You shouldn’t need DMT at all.
So there are two things that need to be corrected:
The Labor Detail (the Job they are clocked into)
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:
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.
@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.
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)
@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.
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”.
I clocked in 2 employees with two different timings.
1st employee reached 7hrs clock in time
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)
{
}
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.
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.
Am I using the “double time InLimitHrs” correctly?
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.
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!