Calculate Values inside of a Grid (Timefields)


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


17 replies

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?

 

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

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. 

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,

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?
 

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? 

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 

Could u find some time yesterday? :)

Greetings

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

Hey @shawn98 

any progress regarding this topic?

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

https://pastebin.com/1LWuYv0S

Is that what you needed?

can you get the source for TimecardCastCode.dll?

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

 

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

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, someone got a hint or a idea?

Greeting

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.
 

Userlevel 6
Badge +8

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?

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved