Clocking out employees automatically

,

Hi All

If I have someone still clocked on a job what is the data I have to change on DMT to not only end the job but clock them out?

Looking to do this via DMT.

Just trying to reduce the amount of clockings they are doing so they don’t get too close to each other.

Regards

Richard

You shouldn’t need DMT at all.
So there are two things that need to be corrected:

  1. The Labor Detail (the Job they are clocked into)
  2. Clocking out the Employee

There is a built in conversion program to correct this under System Mgmt > Upgrade/Mass Regeneration > End Active Labor Transactions.
You enter the Employee ID and click on Get Details, select the Labor Transactions that need to be Ended and then the ‘Submit’ icon in the toolbar:


After doing this you can make adjustments to the Labor Transaction via Time & Expense Entry.

Rich, Did you manually add that screen to the path? I can’t seen to find it on my version of Epicor 10.2500.

image

It is under Conversion Workbench, then User Run Conversions

1 Like

Yes, it’s available in the User Run Conversions too.
I don’t recall, but I may have added it to the menu.

we built a BAQ to automatically clock folks out of detail then jobs. run the query filtered as desired and post get list do the logic.
For mid day sort of stuff we have a fix stuck labor records dashboard to force folks out of activity.
UBAQ can fix this too. We didn’t want supervisors using anything from conversion workbench understandably.

Hi All

Thanks all for your suggestions I want to use DMT as will use our T& A clocking to amend clock out time.

Also want to automate it all.

Regards

Richard

@jgiese.wci Would you be willing to share the baq? I want to do this for going to lunch by team, but the supervisors want a granular approach rather than systematic in case someone is working on a hot must ship today build.

Thanks
Greg

Here is the BAQ. It’s basically an empty shell. All of the logic occurs in the BPM. I use the BAQ simply as a means of firing off the code.WCI-BAQ-AutoClockOut.baq (43.1 KB)

1 Like

@jgiese.wci Thank you. The update has what I needed to know. I was concerned that it was not as simple as a call to end activity and clockout, but it seems like it is that cut and dried.

Depending on what modules you use and what your process is, yeah it’s that simple!

@rwhalebelly were you able to automate this with DMT? We have a similar need.

Hi Aaron

No never got it working in the end as was only needed for a short perioad and they did it manually but I’m sure it’s possible.

Regards

Richard

Hi Joshua,

Thanks for attaching the BAQ. I tried your BAQ and its working great but facing a small issue in it. Our requirement is to clockout the Employees clocked in >14hrs.

I tested for 10hrs by updating the “double timeInLimitHrs - 05.00”.

  1. I clocked in 2 employees with two different timings.
  2. 1st employee reached 7hrs clock in time
  3. 2nd employee reached 11hrs clock in time

When I ran the BAQ, it clocked out both the employees. But it supposed to clockout only the 2nd employee. What is the mistake I am doing? kindly help

Thanks
Subha

double timeInLimitHrs = 05.00;
try
{
  using(var labor = Ice.Assemblies.ServiceRenderer.GetService<LaborSvcContract>(Db, true))
  {
    // Get active labor heads
    bool outBool = false;
    var clockedInRecords = labor.GetRows("LaborHed.ClockOutTime = 0 AND ActiveTrans = true", "", "", "", "", "", "", "", "", "", "", "", 0, 0, out outBool);
    
    // Review each labor head record
    foreach (var hed in clockedInRecords.LaborHed)
    {
      try
      {
        var clockInTime = ((DateTime)hed.ClockInDate).AddHours((double)hed.ClockInTime);
        var clockInLength = DateTime.Now - clockInTime;
    
        // Clock out anyone logged in over X hours.
        if (clockInLength.TotalHours > timeInLimitHrs)
        {          
                   
          // Retrieve labor details
          var laborData = labor.GetByID(hed.LaborHedSeq);
          
          // End Activities
          foreach (var dtl in laborData.LaborDtl)
          {
            try
            {
              if (dtl.ActiveTrans)
              {
                  dtl.RowMod = "U";    
                  labor.EndActivity(ref laborData);
                  labor.Update(ref laborData);
                  
              }
            }
            catch (Exception ex)
            {
              
            }
          }
  
          // Tag record as 'Missed Punch' this is used for reporting on when Emps forget to clock out.
          hed.RowMod = "U";
          hed["MissedPunch_c"] = true;
          labor.Update(ref laborData);
  
          // Clock out employee
          using(var emp = Ice.Assemblies.ServiceRenderer.GetService<EmpBasicSvcContract>(Db, true))
          {
            var EmployeeNum = hed.EmployeeNum;
            
            emp.ClockOut(ref EmployeeNum);
          }
        }  
      }
      catch (Exception ex)
      {
          
      }
    }
  }
}
catch(Exception ex)
{
  
}

If you set the limit at 5 hours it would make sense that it clocked out someone at 7 and 11 hours. This condition is true in both of your scenarios.

if (clockInLength.TotalHours > timeInLimitHrs)

True. Let me try it and one more scenario

I made the “double timeInLimitHrs = 02.00”.

I tried running the BAQ in two different timings.

  1. First time I ran the BAQ and expected the employee number 1609 to be clocked out because the clocked in hrs > 2hrs. But it did not clock out.
    image

  2. Second time I ran the BAQ and expected both the employees should be clocked out because the clocked in hrs > 2hrs for 1609 and testemp. But it did not clock out.
    image

Am I using the “double time InLimitHrs” correctly?

Thanks
Subha

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