PRSRL11 ;HISC/JH,WIRMFO/JAH,SAB-ALL EMPLOYEE LEAVE USED REPORT ;8/27/01
;;4.0;PAID;**2,17,39,34,69**;Sep 21, 1995
; prints leave used report when All employees in T&L Unit selected
S (PAGE,POUT)=0,DAT2=$$FMTE^XLFDT(DT)
D HDR1
N MLINHRS
; loop thru pay periods (external value)
S PP=""
F S PP=$O(^TMP($J,"USE",PP)) Q:PP="" D Q:POUT
. S DATE(1)="" ; previous leave date, used to control printing of date
. ; loop thru leave dates (fileman)
. S DATE=0 F S DATE=$O(^TMP($J,"USE",PP,DATE)) Q:DATE'>0 D Q:POUT
.. S DATE(2)=$E(DATE,4,5)_"/"_$E(DATE,6,7)_"/"_$E(DATE,2,3)
.. ; loop thru employee names
.. S NAM="" F S NAM=$O(^TMP($J,"USE",PP,DATE,NAM)) Q:NAM="" D Q:POUT
... ; loop thru employee ssn's
... S SSN=""
... F S SSN=$O(^TMP($J,"USE",PP,DATE,NAM,SSN)) Q:SSN="" D Q:POUT
.... ; loop thru employee ien's (file #450)
.... S D0=0
.... F S D0=$O(^TMP($J,"USE",PP,DATE,NAM,SSN,D0)) Q:D0'>0 D Q:POUT
..... ; loop thru instances of wrk nodes that contained leave
..... S NUM=0
..... F S NUM=$O(^TMP($J,"USE",PP,DATE,NAM,SSN,D0,NUM)) Q:NUM'>0 D Q:POUT
...... S TOUR=$G(^TMP($J,"USE",PP,DATE,NAM,SSN,D0,NUM))
...... Q:TOUR=""!($P(TOUR,U,3)="") ; no start time or type of time
...... Q:$E($P(TOUR,U,3),1)="H" ; holiday worked or excused
...... S PRSRSSN=$E(SSN,1,3)_$E(SSN,5,6)_$E(SSN,8,11)
...... D TYPSTF^PRSRUT0 ; returns SW(2), = 77 for daily tour, else = 73
...... S MLINHRS=$$MLINHRS^PRSAENT(DFN)
...... D:$Y+5>IOSL HDR Q:POUT
...... W !,"|"
...... I DATE'=DATE(1) W DATE(2) S DATE(1)=DATE ; print date if changed
...... W ?10,"|",$E(NAM,1,20),?32,"|"
...... S SW(3)=0 ; flag, set false to suppress new line when 1st segment
...... ; loop thru leave segments in node - data source and format from
...... ; node 2 for day, empl. in #458 but ONLY contains leave
...... ; Break out CU posting to comp or credit based on time remarks.
...... ;
...... F K=1:4 Q:$P(TOUR,"^",K+2)="" D
....... N COMPCRED S LEV=$P(TOUR,"^",K+2),%=$F(LVT,";"_LEV_":")
....... W:SW(3) !,"|",?10,"|",?32,"|" ; new line for subsequent segments
.......; W:%>0 $P($E(LVT,%,999),";")
....... S:LEV="CU" COMPCRED=$S($P(TOUR,"^",K+3)=16:"Credit Hours",1:"Compensatory")
....... W:%>0 $S(LEV="CU":COMPCRED,1:$P($E(LVT,%,999),";"))
....... W ?53,"|",$P(TOUR,"^",K),?61,"|",$P(TOUR,"^",K+1),?69,"|"
....... ; call PRSRLL to set TIM (elasped time) and TYL (D day, H hour)
....... S Z="^^"_DATE_"^"_$P(TOUR,"^",K)_"^"_DATE_"^"_$P(TOUR,"^",K+1)
....... I LEV="ML" D
........ I MLINHRS D H^PRSRLL Q
........ D D^PRSRLL
....... D D^PRSRLL:LEV'="ML"&(SW(2)=77) ; daily tour
....... D H^PRSRLL:LEV'="ML"&(SW(2)=73) ; else hour
....... W $S(SW(2)=77:$J(TIM,7),1:$J(TIM,7,2))
....... W ?($X+1),TYL,?79,"|"
....... S SW(3)=1 ; set flag true so next segment (if any) on new line
.. Q:POUT
.. D VLIN1
;
I 'CNT D
. D VLIN1
. W !,"|",?10,"No Leave Usage on File within this Date Range.",?79,"|"
;
; report footer
I 'POUT D
. I $Y+5<IOSL,IOSL<66 F I=$Y:1:IOSL-5 D VLIN1
. D VLIDSH1
. S CODE="L004",FOOT="VA TIME & ATTENDANCE SYSTEM" D FOOT2^PRSRUT0
. I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
Q
;
HDR ; page break
I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,POUT=1 Q
D VLIDSH1
S CODE="L004",FOOT="VA TIME & ATTENDANCE SYSTEM" D FOOT2^PRSRUT0
I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR I 'Y S POUT=1 Q
HDR1 ; page header
W:$E(IOST,1,2)="C-"!(PAGE) @IOF
S PAGE=PAGE+1
W !?31,^TMP($J,"USE"),?60,"DATE: ",DAT2
W !?22,"from: ",XX," to: ",YY
W !?36,"T&L: ",$P(TLE(1),"^"),!
D VLIDSH1
W !,"|","DATE",?10,"|","EMPLOYEE",?32,"|","TYPE",?53,"|","FROM",?61,"|","TO",?69,"|","LENGTH",?79,"|"
D VLIDSH1
S DATE(1)="" ; forces leave date to print on new page
Q
;
VLIDSH1 ;dashed line (with columns)
W !,"|---------|---------------------|--------------------|-------|-------|---------|"
Q
;
VLIN1 ; blank line (with columns)
W !,"|",?10,"|",?32,"|",?53,"|",?61,"|",?69,"|",?79,"|"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRSRL11 4023 printed Nov 22, 2024@17:38:31 Page 2
PRSRL11 ;HISC/JH,WIRMFO/JAH,SAB-ALL EMPLOYEE LEAVE USED REPORT ;8/27/01
+1 ;;4.0;PAID;**2,17,39,34,69**;Sep 21, 1995
+2 ; prints leave used report when All employees in T&L Unit selected
+3 SET (PAGE,POUT)=0
SET DAT2=$$FMTE^XLFDT(DT)
+4 DO HDR1
+5 NEW MLINHRS
+6 ; loop thru pay periods (external value)
+7 SET PP=""
+8 FOR
SET PP=$ORDER(^TMP($JOB,"USE",PP))
if PP=""
QUIT
Begin DoDot:1
+9 ; previous leave date, used to control printing of date
SET DATE(1)=""
+10 ; loop thru leave dates (fileman)
+11 SET DATE=0
FOR
SET DATE=$ORDER(^TMP($JOB,"USE",PP,DATE))
if DATE'>0
QUIT
Begin DoDot:2
+12 SET DATE(2)=$EXTRACT(DATE,4,5)_"/"_$EXTRACT(DATE,6,7)_"/"_$EXTRACT(DATE,2,3)
+13 ; loop thru employee names
+14 SET NAM=""
FOR
SET NAM=$ORDER(^TMP($JOB,"USE",PP,DATE,NAM))
if NAM=""
QUIT
Begin DoDot:3
+15 ; loop thru employee ssn's
+16 SET SSN=""
+17 FOR
SET SSN=$ORDER(^TMP($JOB,"USE",PP,DATE,NAM,SSN))
if SSN=""
QUIT
Begin DoDot:4
+18 ; loop thru employee ien's (file #450)
+19 SET D0=0
+20 FOR
SET D0=$ORDER(^TMP($JOB,"USE",PP,DATE,NAM,SSN,D0))
if D0'>0
QUIT
Begin DoDot:5
+21 ; loop thru instances of wrk nodes that contained leave
+22 SET NUM=0
+23 FOR
SET NUM=$ORDER(^TMP($JOB,"USE",PP,DATE,NAM,SSN,D0,NUM))
if NUM'>0
QUIT
Begin DoDot:6
+24 SET TOUR=$GET(^TMP($JOB,"USE",PP,DATE,NAM,SSN,D0,NUM))
+25 ; no start time or type of time
if TOUR=""!($PIECE(TOUR,U,3)="")
QUIT
+26 ; holiday worked or excused
if $EXTRACT($PIECE(TOUR,U,3),1)="H"
QUIT
+27 SET PRSRSSN=$EXTRACT(SSN,1,3)_$EXTRACT(SSN,5,6)_$EXTRACT(SSN,8,11)
+28 ; returns SW(2), = 77 for daily tour, else = 73
DO TYPSTF^PRSRUT0
+29 SET MLINHRS=$$MLINHRS^PRSAENT(DFN)
+30 if $Y+5>IOSL
DO HDR
if POUT
QUIT
+31 WRITE !,"|"
+32 ; print date if changed
IF DATE'=DATE(1)
WRITE DATE(2)
SET DATE(1)=DATE
+33 WRITE ?10,"|",$EXTRACT(NAM,1,20),?32,"|"
+34 ; flag, set false to suppress new line when 1st segment
SET SW(3)=0
+35 ; loop thru leave segments in node - data source and format from
+36 ; node 2 for day, empl. in #458 but ONLY contains leave
+37 ; Break out CU posting to comp or credit based on time remarks.
+38 ;
+39 FOR K=1:4
if $PIECE(TOUR,"^",K+2)=""
QUIT
Begin DoDot:7
+40 NEW COMPCRED
SET LEV=$PIECE(TOUR,"^",K+2)
SET %=$FIND(LVT,";"_LEV_":")
+41 ; new line for subsequent segments
if SW(3)
WRITE !,"|",?10,"|",?32,"|"
+42 ; W:%>0 $P($E(LVT,%,999),";")
+43 if LEV="CU"
SET COMPCRED=$SELECT($PIECE(TOUR,"^",K+3)=16:"Credit Hours",1:"Compensatory")
+44 if %>0
WRITE $SELECT(LEV="CU":COMPCRED,1:$PIECE($EXTRACT(LVT,%,999),";"))
+45 WRITE ?53,"|",$PIECE(TOUR,"^",K),?61,"|",$PIECE(TOUR,"^",K+1),?69,"|"
+46 ; call PRSRLL to set TIM (elasped time) and TYL (D day, H hour)
+47 SET Z="^^"_DATE_"^"_$PIECE(TOUR,"^",K)_"^"_DATE_"^"_$PIECE(TOUR,"^",K+1)
+48 IF LEV="ML"
Begin DoDot:8
+49 IF MLINHRS
DO H^PRSRLL
QUIT
+50 DO D^PRSRLL
End DoDot:8
+51 ; daily tour
if LEV'="ML"&(SW(2)=77)
DO D^PRSRLL
+52 ; else hour
if LEV'="ML"&(SW(2)=73)
DO H^PRSRLL
+53 WRITE $SELECT(SW(2)=77:$JUSTIFY(TIM,7),1:$JUSTIFY(TIM,7,2))
+54 WRITE ?($X+1),TYL,?79,"|"
+55 ; set flag true so next segment (if any) on new line
SET SW(3)=1
End DoDot:7
End DoDot:6
if POUT
QUIT
End DoDot:5
if POUT
QUIT
End DoDot:4
if POUT
QUIT
End DoDot:3
if POUT
QUIT
+56 if POUT
QUIT
+57 DO VLIN1
End DoDot:2
if POUT
QUIT
End DoDot:1
if POUT
QUIT
+58 ;
+59 IF 'CNT
Begin DoDot:1
+60 DO VLIN1
+61 WRITE !,"|",?10,"No Leave Usage on File within this Date Range.",?79,"|"
End DoDot:1
+62 ;
+63 ; report footer
+64 IF 'POUT
Begin DoDot:1
+65 IF $Y+5<IOSL
IF IOSL<66
FOR I=$Y:1:IOSL-5
DO VLIN1
+66 DO VLIDSH1
+67 SET CODE="L004"
SET FOOT="VA TIME & ATTENDANCE SYSTEM"
DO FOOT2^PRSRUT0
+68 IF $EXTRACT(IOST,1,2)="C-"
SET DIR(0)="E"
DO ^DIR
KILL DIR
End DoDot:1
+69 QUIT
+70 ;
HDR ; page break
+1 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
SET POUT=1
QUIT
+2 DO VLIDSH1
+3 SET CODE="L004"
SET FOOT="VA TIME & ATTENDANCE SYSTEM"
DO FOOT2^PRSRUT0
+4 IF $EXTRACT(IOST,1,2)="C-"
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET POUT=1
QUIT
HDR1 ; page header
+1 if $EXTRACT(IOST,1,2)="C-"!(PAGE)
WRITE @IOF
+2 SET PAGE=PAGE+1
+3 WRITE !?31,^TMP($JOB,"USE"),?60,"DATE: ",DAT2
+4 WRITE !?22,"from: ",XX," to: ",YY
+5 WRITE !?36,"T&L: ",$PIECE(TLE(1),"^"),!
+6 DO VLIDSH1
+7 WRITE !,"|","DATE",?10,"|","EMPLOYEE",?32,"|","TYPE",?53,"|","FROM",?61,"|","TO",?69,"|","LENGTH",?79,"|"
+8 DO VLIDSH1
+9 ; forces leave date to print on new page
SET DATE(1)=""
+10 QUIT
+11 ;
VLIDSH1 ;dashed line (with columns)
+1 WRITE !,"|---------|---------------------|--------------------|-------|-------|---------|"
+2 QUIT
+3 ;
VLIN1 ; blank line (with columns)
+1 WRITE !,"|",?10,"|",?32,"|",?53,"|",?61,"|",?69,"|",?79,"|"
+2 QUIT