To whom it could be interesting.
Here is completed code to clock out workers, include stop for related activity tasks. There are couple functions, which are working directly with EPICOR data base, to select (GetAllWorkers2ClockOut and GetWorkerRelatedActivitiesDtl). This way is much faster compare with standard (adapter) way.
I did use Windows Schedule service to start everyday at 23:30 the clock out application. Looks like it most easiest way:slightly_smiling_face:
I did try to use EPICOR schedule to trigger some event , and connect to custom code. But limit of time force me to use Windows Scheduler.
here is, you need to change it for your environment accordingly.
private Ice.Core.Session GetEpicorWorkingSession(bool bDevMod )
{
string strServersConnect = (bDevMod)? â\\EPICOR_SERVER_DEV\ERP10.1.600\Client\config\E101.sysconfigâ : â\\EPICOR_SERVER\ERP10.1.600\Client\config\E101.sysconfigâ;
try
{
return new Ice.Core.Session(â123managerâ, â123managerâ, Ice.Core.Session.LicenseType.DataCollection, strServersConnect);
}
catch(Exception ee)
{
Log.LogMessageToFile("\nGetEpicorWorkingSession exception: " + ee.Message);
return null;
}
}
Compile all, and copy all from debug, or release into specific directory at your EPICORSERVER computer.
At EPICORSERVER computer, you need to find TaskScheduler application.
Run it.
Inside opened meny, create new task. Set schedule for this task.
Assign full path to your winApp .exe file.
Another option to consider is, If you have DMT you can write a Powrshell script that can be scheduled.
The script runs a BAQ that identifies all those logged and outputs the data to CSV. The script then runs on and then runs a DMT load in update mode that logs those users that are logged in, out.
Cheers,
Andrew.
<#
.SYNOPSIS
<This script calls a BAQ at
2358 every night to return all employees logged onto the system>
.DESCRIPTION
Two calls via DMT, on generates a list of employees still clocked on
This uses the DSEBAQClockOut BAQ
The file is generated in the c:\temp directory
The file is used as the source file a command line import on the âTE Labor Combinedâ
upload
.PARAMETER <Parameter_Name>
None
.INPUTS
$DMTPath - location of the DMT path
$User - dmt upload user
$Pass - dmt upload password
$Env =- location of the config file
$DMTLoad - name of the DMT load (needs 2 quotes to allow for spaces in the name)
$Config - name of the config file
$Source - file name of the CSV generated by the BAQ
$Log - names of the log file
$completeLog - name of the completed log file
.OUTPUTS
Log file stored in c:\temp\ClockOutEmps.csv.CompleteLog.txt
.NOTES
Version: 1.0
Author: Andrew Clements
Creation Date: 10/07/2017
Purpose/Change: Initial script development
#>
#Extract Data From From BAQ -> CSV File -> Load in with DMT
What are you actually returning with your DSEBAQClockout BAQ to pass to the âTE Labor Combinedâ DMT?
Iâm guessing something as it relates to all LaborDtl records with ActiveTrans=1 , but how are you manipulating that dataset to be a clean DMT to actually end the activity on the labor record? Can you supply this BAQ or the columns youâre pulling?
Weâve managed to end the production activity using the below DMT but itâs not updating the LaborHrs / BurdenHrs dynamically based on ClockInDate/Time (just returns 0) â also not sure if Iâm missing other pieces for this to be a clean close out.
The process runs @ 23.58 every night and runs the following query.
select
[LaborHed].[Company] as [LaborHed_Company],
[LaborHed].[EmployeeNum] as [LaborHed_EmployeeNum],
[LaborHed].[LaborHedSeq] as [LaborHed_LaborHedSeq],
(23.98) as [Calculated_ClockOutTime],
('false') as [Calculated_ActiveTrans]
from Erp.LaborHed as LaborHed
where (LaborHed.ClockOutTime = 0)
Iâm afraid I canât post the BAQ export due to ip issues.
It must be noted that this does not handle open labordtl records and would leave them active.
The scope of this requirement, was that the client is using the clock in / clock out function as a time clock for payroll and also as a way of determining who is on site for a fire safety roll call, so they could not have people remaining clocked on whilst off site, so i didnât need to consider open labordtl records.
If you wanted to do this with all the âbells and whistlesâ , then I would be looking at creating an executable in Visual Studio, that called the Epicor âLabor.EndActivityâ and âEmpBasic.ClockOutâ methods.
You could then schedule this executable to run at a given time, using the Microsoft scheduler.