tldm-universe/CMS/BP.CLOCK/AL.SPC
2024-09-10 15:25:06 -04:00

247 lines
6.4 KiB
Plaintext
Executable File

* AL.CLOCK
*
OPEN "USER" TO USER ELSE ABORT 201,"USER"
OPEN "CLOCKFILE" TO CFILE ELSE ABORT 201,"CLOCKFILE"
OPEN "HP.CONTROL" TO HPC ELSE ABORT 201,"HP.CONTROL"
*
$INCLUDE GEN.COM2
STR=STR("=",177)
CURR.DT=OCONV(DATE(),"D2")
CRT @(0,0):CS
*
EXECUTE "EX PRINTER"
*
CRT @(0,0):CS
*
*----------*
10 * Promt for department to do report for
CRT @(4,4):CR:"Please input DEPARTMENT CODES that will be used seperated by"
CRT @(4,5):"a comma (EX: 506,507) :":
INPUT DEPT.CODES
IF DEPT.CODES="" OR DEPT.CODES=PF3 THEN STOP
*--------*
20 * Prompt for name of department
CRT @(4,7):CR:"Please enter NAME of department for which the report is to"
CRT @(4,8):"processed for (EX: FULFILLMENT CENTER) :":
INPUT DEPT.NAME
IF DEPT.NAME="" THEN GO 20
IF DEPT.NAME=PF3 OR DEPT.NAME=PF1 THEN GO 10
DEPT.NAME=TRIM(OCONV(DEPT.NAME,"MCU"))
*--------*
30 * Begin date prompt
CRT @(4,10):CR:"Please input BEGINNING date range (EX: 01/01/95) :":
INPUT BDATE
IF BDATE="" OR BDATE=PF3 THEN GO 10
IF BDATE=PF1 THEN GO 20
BEGIN.DATE=ICONV(BDATE,"D")
IF BEGIN.DATE="" OR BEGIN.DATE=0 THEN
CRT @(0,22):"INVALID DATE FORMAT":CL
RQM ; GO 30
END
OBDATE=OCONV(BEGIN.DATE,"D2/")
*------*
40 * Ending date prompt
CRT @(4,12):CR:"Please input ENDING date range (EX: 01/31/95) :":
INPUT EDATE
IF EDATE="" OR EDATE=PF3 THEN GO 10
IF EDATE=PF1 THEN GO 30
END.DATE=ICONV(EDATE,"D")
IF END.DATE="" OR END.DATE=0 THEN
CRT @(0,22):"INVALID DATE FORMAT":CL
RQM ; GO 40
END
OEDATE=OCONV(END.DATE,"D2/")
*-----*
DC.LEN=LEN(DEPT.CODES)
DC.CD=DEPT.CODES
FOR B=1 TO DC.LEN
IF DC.CD[B,1]="," THEN DC.CD=DC.CD[1,B-1]:VM:DC.CD[B+1,DC.LEN]
NEXT B
D.CODES=""
DC.CNT=DCOUNT(DC.CD,VM)
FOR B=1 TO DC.CNT
D.CODES=D.CODES:'"':DC.CD<1,B>:'"'
NEXT B
D.CODES=TRIM(D.CODES)
*-----*
*
ACCT.ARRAY=''
ACCT.ARRAY<1>="001":VM:"002"
ACCT.ARRAY<2>="0000":VM:"0"
*
EOF=0 ; REC.READ=0 ; REC.SEL=0
*
CMND=\SSELECT CLOCKFILE WITH IDATE GE "\:BEGIN.DATE:\" \
CMND=CMND:\AND WITH IDATE LE "\:END.DATE:\" BY LNAME BY FNAME BY IDATE \
*
EXECUTE CMND
*
CRT @(0,0):CS
LOOP
READNEXT ID ELSE EOF=1
UNTIL EOF DO
USER.ID=OCONV(ID,"G0|1") ; REC.READ=REC.READ+1
READ REC FROM CFILE,ID THEN
READ USER.REC FROM USER,USER.ID THEN
DC=USER.REC<5>
LOCATE(DC,DC.CD,1;FND) THEN
FND.USER=0
FOR Z=6 TO 100
IF ACCT.ARRAY<Z,1>=USER.ID THEN
FND.USER=Z ; Z=999
END
NEXT Z
IF FND.USER=0 THEN
CHK.CT=DCOUNT(ACCT.ARRAY,AM)
IF CHK.CT LE 5 THEN CHK.CT=6 ELSE CHK.CT=CHK.CT+1
FND.USER=CHK.CT
ACCT.ARRAY<FND.USER,1>=USER.ID
END
LG.CNT=DCOUNT(REC<1>,VM)
FOR B=1 TO LG.CNT STEP 2
CLT=OCONV(REC<2,B>,"G0-1")
ST.TM=REC<1,B> ; END.TM=REC<1,B+1>
TM=END.TM-ST.TM
100 *
LOCATE(CLT,ACCT.ARRAY,1;FND.CL;'AL') THEN
ACCT.ARRAY<FND.USER,FND.CL>=ACCT.ARRAY<FND.USER,FND.CL>+TM ; * user/client time
ACCT.ARRAY<FND.USER,2>=ACCT.ARRAY<FND.USER,2>+TM ; * user total time
ACCT.ARRAY<2,2>=ACCT.ARRAY<2,2>+TM ; * total time
ACCT.ARRAY<2,FND.CL>=ACCT.ARRAY<2,FND.CL>+TM ; * total for client
END ELSE
DN.CT=DCOUNT(ACCT.ARRAY,AM)
ACCT.ARRAY=INSERT(ACCT.ARRAY,1,FND.CL;CLT)
FOR Z=2 TO DN.CT
ACCT.ARRAY=INSERT(ACCT.ARRAY,Z,FND.CL;'')
NEXT Z
GO 100
END
REC.SEL=REC.SEL+1
NEXT B
END
END
END
*
IF REM(REC.READ,200)=0 THEN
CRT @(0,10):"RECORDS READ: ":REC.READ
CRT @(0,12):"RECORDS QUAL: ":REC.SEL
END
REPEAT
*
CHK.DATA=TRIM(ACCT.ARRAY<6,1>)
IF CHK.DATA='' THEN STOP
*
HD="LABOR REPORT FOR ":DEPT.NAME
HD.LEN=LEN(HD)
XLNG=INT((160-HD.LEN)/2)
YLNG=XLNG
LEN.TEST=XLNG+YLNG+HD.LEN
IF LEN.TEST GT 160 THEN YLNG=YLNG-1
HDLN1=CURR.DT:SPACE(XLNG):HD:SPACE(YLNG)
HDLN2=SPACE(68):"REPORT DATE RANGE - (":OBDATE:" - ":OEDATE:")"
ACCT.CT=DCOUNT(ACCT.ARRAY<1>,VM)
USER.CT=DCOUNT(ACCT.ARRAY,AM)
ACROSS.CT=INT(((ACCT.CT-2)/19)+1)
DOWN.CT=INT(((USER.CT-5)/13)+1)
CLT.CT=ACCT.CT
HDLN3='' ; DATA.ARRAY='' ; DA.CNT=1
FOR B=3 TO ACCT.CT
HDLN3=HDLN3:ACCT.ARRAY<1,B>'L#8'
NEXT B
HDLN3="Employees(Hrs)":SPACE(11):HDLN3
FOR B=6 TO USER.CT
LN=''
TTL.HRS=((ACCT.ARRAY<B,2>/60)/60)*100
TTL.HRS=OCONV(TTL.HRS,"MR2")
USER.ID=ACCT.ARRAY<B,1>
READ REC FROM USER,USER.ID ELSE REC=''
LN<1>=REC<1>[1,1]:". ":REC<2>:" (":TTL.HRS:")"
LN<1>=LN<1>'L#25' ; LN<2>=LN<2>'L#25'
FOR X=3 TO CLT.CT
LN.HR=((ACCT.ARRAY<B,X>/60)/60)*100
LN.HR=OCONV(LN.HR,"MR2")
LN.PC=(ACCT.ARRAY<B,X>/ACCT.ARRAY<B,2>)*10000
LN.PC=OCONV(LN.PC,"MR2"):"%"
LN<1>=LN<1>:LN.HR'L#8'
LN<2>=LN<2>:LN.PC'L#8'
NEXT X
DATA.ARRAY<DA.CNT>=LN<1> ; DA.CNT=DA.CNT+1
DATA.ARRAY<DA.CNT>=LN<2> ; DA.CNT=DA.CNT+1
DATA.ARRAY<DA.CNT>='' ; DA.CNT=DA.CNT+1
NEXT B
LN=''
LN.HR=((ACCT.ARRAY<2,2>/60)/60)*100
LN.HR=OCONV(LN.HR,"MR2")
LN.PC=(ACCT.ARRAY<2,2>/ACCT.ARRAY<2,2>)*10000
LN.PC=OCONV(LN.PC,"MR2"):"%"
LN<1>="TOTAL HOURS (":LN.HR:")"
LN<1>=LN<1>'L#25'
LN<2>=SPACE(13):LN.PC'L#12'
FOR B=3 TO CLT.CT
LN.HR=((ACCT.ARRAY<2,B>/60)/60)*100
LN.HR=OCONV(LN.HR,"MR2")
LN.PC=(ACCT.ARRAY<2,B>/ACCT.ARRAY<2,2>)*10000
LN.PC=OCONV(LN.PC,"MR2"):"%"
LN<1>=LN<1>:LN.HR'L#8'
LN<2>=LN<2>:LN.PC'L#8'
NEXT B
DATA.ARRAY<DA.CNT>=LN<1> ; DA.CNT=DA.CNT+1
DATA.ARRAY<DA.CNT>=LN<2> ; DA.CNT=DA.CNT+1
*
PRINTER ON
READ SXTN.PITCH FROM HPC,"16.PITCH" ELSE SXTN.PITCH=''
READ LN.SCP FROM HPC,"LANDSCAPE" ELSE LN.SCP=''
READ RESET.PRT FROM HPC,"RESET" ELSE RESET.PRT=''
*
PRINT SXTN.PITCH
PRINT LN.SCP
*
HDLN3.HOLD=HDLN3
DATA.ARRAY.HOLD=DATA.ARRAY
PG.CNT=0
PG.CNT.ACROSS="A":VM:"B":VM:"C":VM:"D":VM:"E":VM:"F"
ACROSS.VL=0
HDLN3.VL=1
DA.CNT=DCOUNT(DATA.ARRAY,AM)
GR.TTL.LN=DA.CNT-2
*
FOR B=1 TO ACROSS.CT
FOR X=1 TO DA.CNT
IF REM(X,39)=0 OR X=1 THEN
PRINT CHAR(12)
PG.CNT=PG.CNT+1
IF HDLN3.VL LE 1 THEN
HDLN1.PT=HDLN1:"PAGE ":PG.CNT
END ELSE
HDLN1.PT=HDLN1:"PAGE ":PG.CNT:PG.CNT.ACROSS<1,ACROSS.VL>
END
HDLN3.PT=HDLN3[HDLN3.VL,177]
PRINT HDLN1.PT
PRINT HDLN2
PRINT
PRINT HDLN3.PT
PRINT STR
PRINT
END
LN=DATA.ARRAY<X>[1,177]
PRINT LN
DATA.ARRAY<X>=DATA.ARRAY<X>[178,10000]
IF X=GR.TTL.LN THEN
PRINT STR
LN=DATA.ARRAY<X+1>[1,177]
PRINT LN
DATA.ARRAY<X+1>=DATA.ARRAY<X+1>[178,10000]
LN=DATA.ARRAY<X+2>[1,177]
PRINT LN
DATA.ARRAY<X+2>=DATA.ARRAY<X+2>[178,10000]
X=DA.CNT
END
NEXT X
PG.CNT=0
ACROSS.VL=ACROSS.VL+1
HDLN3.VL=HDLN3.VL+177
NEXT B
PRINT RESET.PRT
STOP
*