Skip to main content

Hello!

We created a extension pack for the screen EP305000 - Employee Timecards for the register “details”
We renamed time to “Start” and added “Pause” and “End” as UsrFields which work fine so far.
They are defined as dateandtime fields so that u can select a time from a list like 00:00 - 00:30…

We would now like to add - inside of the grid right next to the “End” field - another field called “Summary” that calculates the actual Work time (UsrEnd - Start - UsrPause) for each added row.

How would that be possible?
I searched for it on Google but couldnt find a way. 
Yet i am a Rookie and don't know much about c# and coding til now. 
So any help would be appreciated that might lead to a solution

Greetings

Hi @jwestermann17 

Below is my understanding….

In the Employee Time Card screen,

-- You have renamed the “Time” field to “Start”

-- Added new customized fields “Pause” and “End” (these are just like “Start” fields)

 

Based on these fields, you want to calculate the “Total Time Spent” on the reach record right?

If yes, can you please review the below example and confirm if this is correct...
​​​Start Time = 9AM

End Time = 6 PM

PauseTime = 1.00

Do you want to display 8 hours in the summary field?


Hi @Naveen B 

Thats correct. 
All three fields follow the format “hh:mm” so the Summary Field should be in the same format.

 

If yes, can you please review the below example and confirm if this is correct...
​​​Start Time = 9AM

End Time = 6 PM

PauseTime = 1.00

Do you want to display 8 hours in the summary field?

 


Correct. Thats what i would like to display in the summary field inside of the Grid.
 


Hey, someone got a hint or a idea?

Greeting


I would use the event FieldSelecting and do the math in there.

the Start End would be a DateDiff command and then I would turn the Pause in to minutes and DateAdd the Minutes * -1

Let me know if you need code samples. If you do it would be helpful to get your current package so I could code to what you have.


I would use the event FieldSelecting and do the math in there.

the Start End would be a DateDiff command and then I would turn the Pause in to minutes and DateAdd the Minutes * -1

Let me know if you need code samples. If you do it would be helpful to get your current package so I could code to what you have.


Hey, i would really appreciate a code sample for this particular case.
I attached our current package, but i don’t know if it is possible to use in Acumatica.
We use the german version of Acumatica called Lexbizz and i never had a chance to test if it does.

So i don’t know if it works with the standard Acumatica. 
You might need to try. 

 

Greetings


can you get the source for TimecardCastCode.dll?

that is the part I would need to tweak for you I would guess

 


There isn’t much in it.
Thats what we got at the moment:

https://pastebin.com/1LWuYv0S

Is that what you needed?


Hey @shawn98 

any progress regarding this topic?


sorry been a crazy couple days will try to get it done today


Hey @shawn98 

Could u find some time yesterday? :)

Greetings


sorry it took so long.

attached files are the Source for the DLL in the package and the package itself.

I do my dev work in Visual Studio, hoping that since you had a dll in there already that its not a problem.

Please let me know how it works for you and if you have any questions.


Hey @shawn98,

thank you very much. Your Customization Project seems to work fine for me.
But I noticed something weird where i dont know if this is a lexbizz / Acumatica bug or something Code based.

Question 1: Bug?
If a user mistakenly sets the End Time before the Start Time a minus gets added to the result.
(Which seems logical)
 

End Time way before Start Time


Upon changing the End Time to a Time after the Start Time the minus stays til i save it.

 

End Time after Start Time

 

Inside of the Field, u don’t see any minus anymore, but it only disappears when i select a value out of the Combobox or save the record. Is that a known bug inside of Acumatica/Lexbizz?


​​​​​​​Question 2: 
​​​​​​​
In the Field “Start” its able to write any value inside of it. 
For example the Start Time can be 08:33.
If i try this in “Pause” and “Ende” (usrEz usrPause) i can only enter values from the dropbox.
Is that a attribute or something else? 
 

Additional Question: 

Is it possible to select Combobox Values of the Field “Ende” based on what is selected in “Start?” 
So that the dropbox only shows times after the selected start time? 


Hey,

I don’t really find a difference between the “Start/Time” field and our user defined Fields. 
I even copied the ASPX Settings from the original Field to the Start field, yet i can only insert values that are in the dropbox and none that aren’t. 

Any Ideas?
 


Sorry I just used what you sent me. The values you selected were not actually time values but values in a PXIntList. (End was Minutes since midnight, pause was similar) So you have to choose one of those. If you wanted you could do true time fields and select accordingly. The BusLogic would have to be tweaked to properly do the math but it is doable.

 


Hey, thank you.
I will take a look on it, but i am pretty sure that End already is PXTimelist, just like the Start field. 
Not sure tho. 


pxtimelist is a combobox attribute. The type of the field is PXDBInt not PXDBDateTime like start is.


Ahh.. My Bad, sorry.
I guess it is “Minutes since midnight” because in the ASPX is used PXTimeSpan which stores “minutes since midnight” in the DAC.

Should i use PXDateTimeEdit instead or is this irrelevant?
Is this why i can’t write like 3 for 3 minutes inside of the field?

 


Reply