Clocking out employees automatically

,

What’s your code look like now. It sounds like it worked the first time at 5 hours and clocked them out as it should have. Now at 2 hours it’s not?

No Joshua. May be my first example is wrong. The code remains the same as I posted above. I am just adjusting the “double timeinlimithours” for testing purpose. Hence I tested with 2hours. I ran the BAQ when the clocked in time hours >2hrs but it did not clockout.

Again I ran the BAQ when the clocked in time is 3.5hrs, it clocked out.

image

Put a bunch of message boxes in your BAQ/BPM that tells you where in the code you are.

Infomessage.Publish(“some message here”);

Then you can see what’s going on in your logic and where your if statements are going. You can even put your variables in there so that you can see what they are.

@jgiese.wci I downloaded your BAQ but it didn’t work for me when I uploaded it due to version issues. Would you be able to share a newer version or at least a screenshot of the tables involved so I could replicate it on my end? Thank you, much appreciated!

image

I’m not in 700. Try opening it in a text editor and changing the versions and importing into a test db. If that works then export from your test and import into your production proper.

Change .baq to .zip and open it up

Strange, the version says “3.2.200.0” , should I replace the 200 with 700?

Thanks,

image

verify what ice version you are on but i assume it’s .700 yes.

Help > About > System Info > Framework Base Version

The following post demonstrates using Powershell to generate a list of employees that need clocking and then fires DMT to clock off the users in the list

1 Like

Thank you! This is a great idea, I’ll give it a try and see if I could get it working.

@jgiese.wci I know this is an old topic, but do you mind helping out a complete novice?

I imported your BAQ (after fixing version compatibility - I’m on 10.2.700.24) and when I check the syntax of the BPM code, I get the following error:

The name ‘BetterLog’ does not exist in the current context

Is that something I need to create or reference? I did notice a UD field as well (MissedPunch_c) that I could create later, but for now I’ve simply commented that line out to test.

Thank you, or anyone else for that matter, in advance for any help provided!

That’s an external dll for creating log files. You can comment those out if you want to skip the logging part of it.

1 Like

Or replace those lines with Ice.Diagnostics.Log.WriteEntry()

1 Like

Thank you! This is working great for me. I have it set up on the Post-Processing of GetList so that I can run it every night at 6:00 PM.

Do you know how I might modify the code so that, as a last step, the LaborDtl.TimeStatus is set to ‘E’ ? This will make it easier to Fix those ClockOutTimes on a UBAQ Dashboard I’m creating for the supervisors.

Here’s what I tried so far:

 foreach (var dtl in laborData.LaborDtl)
          {
            try
            {
              if (dtl.ActiveTrans)
              {
                  dtl.RowMod = "U";
                  labor.EndActivity(ref laborData);
                  dtl["TimeStatus"] = "E";
                  labor.Update(ref laborData);
                  Ice.Diagnostics.Log.WriteEntry($"Type = {dtl.LaborType}, Resource = {dtl.ResourceDesc}, JobNum = {dtl.JobNum}, LaborHedSeq = {dtl.LaborHedSeq}, LaborDtlSeq = {dtl.LaborDtlSeq}, LaborDtlTimeStatus = {dtl.TimeStatus}", "BAQ Auto - Clock Out");
              }
            }
            catch (Exception ex)
            {
              Ice.Diagnostics.Log.WriteEntry($"ERROR ENDING ACTIVITY: JobNum = {dtl.JobNum}, LaborHedSeq = {dtl.LaborHedSeq}, LaborDtlSeq = {dtl.LaborDtlSeq}--Error: {ex.Message}", "BAQ Auto - Clock Out");
            }

The log file showed the Time Status as ‘E’ but then when I open the record in Time and Expense Entry, it is ‘Approved’ instead of ‘Entered.’ Can anyone tell me what I did wrong?

Looks like you ran an action on the row with EndActivity, and then an Update.
EndActivity probably changed the RowMod.

Check and see. You will probably need to change the RowMod before Update.

There is a checkbox called ‘Automatically Approve time’ - believe it’s on the Employee record. Is that set?

@MikeGross is this what you’re referring too?

image

It looks like it is unchecked by default for our employees, which makes it all the more curious why the activities are automatically marked as approved when they are ended.

Yes - and there is also one in Site Configuration.

1 Like

The option to automatically approve is unchecked for Employees and in Site Config, so I’m not sure what is forcing the approval immediately. I’ll look for a BPM that might be handling that.

Regardless, I don’t want Supervisors to have to approve all labor. I just want them to correct labor entries when needed, preferably from an Updateable Dashboard.

And coordinate that with finance/accounting as once labor is posted, it’s so much more difficult to correct.

1 Like

Are you backflushing labor? It will be approved automatically.

Otherwise, you may need to open a ticket to get help, or do a client (or server) trace to see if you can see what is being called when you enter time that gets automatically approved.