PRSRL12 ;HISC/JH,WCIOFO/SAB-INDIVIDUAL EMPLOYEE LEAVE USED REPORT ;08/27/01
;;4.0;PAID;**2,5,19,39,34,69**;Sep 21, 1995
; prints leave used report when specific employee selected
N MLINHRS
S (PAGE,POUT)=0,DAT2=$$FMTE^XLFDT(DT)
D HDR3
D TYPSTF^PRSRUT0 ; returns SW(2): = 77 for daily tour, else = 73
S MLINHRS=$$MLINHRS^PRSAENT(DFN)
; init totals for all leave types
F I=1:1 S X=$P($P(LVT,";",I+1),":") Q:X="" S TLEV(X)=""
;
; Add 2 types of leave to hold break out totals of
; comp/credit--credit hours & compensatory.
;
S (TLEV("CUCOMP"),TLEV("CUCRED"))=""
; loop thru instances of wrk nodes containing leave
S INX=0 F S INX=$O(^TMP($J,"USE",INX)) Q:INX'>0 D Q:POUT
. ; loop thru pay periods (nn)
. S PP="" F S PP=$O(^TMP($J,"USE",INX,PP)) Q:PP="" D Q:POUT
.. ; loop thru leave date (fileman)
.. S DATE=0
.. F S DATE=$O(^TMP($J,"USE",INX,PP,DATE)) Q:DATE'>0 D Q:POUT
... ; loop thru leave date (external)
... S DAY=""
... F S DAY=$O(^TMP($J,"USE",INX,PP,DATE,DAY)) Q:DAY="" D Q:POUT
.... S TOUR=$G(^TMP($J,"USE",INX,PP,DATE,DAY)) Q:TOUR=""
.... D:$Y+5>IOSL HDR Q:POUT
.... ; start detail line - only print pp and date when changed
.... W !,"|"
.... I PP'=PP(1) W PP S PP(1)=PP
.... W ?4,"|"
.... I DAY'=DAY(1) W DAY S DAY(1)=DAY
.... W ?19,"|"
.... S SW(3)=0 ; flag, set false to suppress new line when 1st segment
.... ; loop thru segments in node - data source and format from
.... ; node 2 for day, empl. in #458 but ONLY contains leave
.... F K=1:4 Q:$P(TOUR,"^",K+2)="" D
..... N COMPCRED S LEV=$P(TOUR,"^",K+2) ; leave type (internal code)
..... W:SW(3) !,"|",?4,"|",?19,"|" ; new line for subsequent segments
..... S %=$F(LVT,";"_LEV_":")
..... ;comp/credit (CU) is distinguishable by time remarks code (K+3)
..... S:LEV="CU" COMPCRED=$S($P(TOUR,"^",K+3)=16:"Credit Hours",1:"Compensatory")
..... ;display leave type
..... W:%>0 $S(LEV="CU":COMPCRED,1:$P($E(LVT,%,999),";"))
..... W:LEV="LWOP" " - AWOL"
..... W ?41,"|",$P(TOUR,"^",K),?49,"|",$P(TOUR,"^",K+1),?57,"|"
..... ; 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 ; For Military Leave - PRS*4.0*69
...... 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 ?57,$S(SW(2)=77:$J(TIM,4),1:$J(TIM,7,2))
..... W " ",$S(TYL="H":"Hour",1:"Day")_$S(TIM="":"",TIM'=1:"s",1:"")
..... W ?79,"|"
..... S TLEV(LEV)=TLEV(LEV)+TIM ; add to total for type of leave
..... I LEV="CU" S TLEV($S($P(TOUR,"^",K+3)=16:"CUCRED",1:"CUCOMP"))=TLEV($S($P(TOUR,"^",K+3)=16:"CUCRED",1:"CUCOMP"))+TIM
..... S SW(3)=1 ; set flag true so next segment (if any) on new line
;
I 'CNT D
. D VLIN0
. W !,"|",?10,"No Leave Usage on File within this Date Range.",?79,"|"
;
; report totals
I CNT,'POUT D
. D HDR:$Y+7>IOSL
. D VLIN0
. W !,"|",?4,"|",?19,"|",?27,"TOTALS:"
. S SW(3)=0 ; set false so 1st type of leave printed on same line
. ; loop thru leave type totals
. S LEV="" F S LEV=$O(TLEV(LEV)) Q:LEV="" D Q:POUT
.. Q:TLEV(LEV)="" ; none of this type of leave found
.. D:$Y+5>IOSL HDR Q:POUT
.. W:SW(3) !,"|",?4,"|",?19,"|",?39 ; new line when not first leave type
.. S %=$F(LVT,";"_LEV_":") W:%>0 ?39,$P($E(LVT,%,999),";") ; leave type
.. ;write out subtotals for comp/credit
.. I LEV="CUCOMP" W ?42,"Compensatory"
.. I LEV="CUCRED" W ?42,"Credit Hours"
.. W ?58,$S(SW(2)=77:$J($G(TLEV(LEV)),4),1:$J($G(TLEV(LEV)),7,2))
.. W " "
.. I LEV="ML" W $S(MLINHRS:"Hour",1:"Day")
.. I LEV'="ML" W $S(SW(2)=77:"Day",1:"Hour")
.. W $S(TLEV(LEV)'=1:"s",1:""),?79,"|"
.. S:'SW(3) SW(3)=1 ; set true so next leave type on new line
;
; report footer
I 'POUT D
. I IOSL<66 F I=$Y:1:IOSL-6 D VLIN0
. D VLIDSH0
. S CODE="L003",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 VLIDSH0
S CODE="L003",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
HDR3 ; page header
I $E(IOST,1,2)="C-"!PAGE W @IOF
S PAGE=PAGE+1
W !?31,^TMP($J,"USE"),?60,"DATE: ",DAT2
W !?22,"from: ",XX," to: ",YY
W !?24,"for: ",NAM," - T&L: ",TLE,!
D VLIDSH0
W !,"|","PP",?4,"|","DATE",?19,"|","TYPE",?41,"|","FROM",?49,"|","TO",?57,"|","LENGTH",?79,"|"
D VLIDSH0
S (PP(1),DAY(1))="" ; forces pp and leave date to print on new page
Q
;
VLIDSH0 ; dashed line (with columns)
W !,"|---|--------------|---------------------|-------|-------|---------------------|"
Q
;
VLIN0 ; blank line (with columns)
W !,"|",?4,"|",?19,"|",?41,"|",?49,"|",?57,"|",?79,"|"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRSRL12 4883 printed Nov 22, 2024@17:38:32 Page 2
PRSRL12 ;HISC/JH,WCIOFO/SAB-INDIVIDUAL EMPLOYEE LEAVE USED REPORT ;08/27/01
+1 ;;4.0;PAID;**2,5,19,39,34,69**;Sep 21, 1995
+2 ; prints leave used report when specific employee selected
+3 NEW MLINHRS
+4 SET (PAGE,POUT)=0
SET DAT2=$$FMTE^XLFDT(DT)
+5 DO HDR3
+6 ; returns SW(2): = 77 for daily tour, else = 73
DO TYPSTF^PRSRUT0
+7 SET MLINHRS=$$MLINHRS^PRSAENT(DFN)
+8 ; init totals for all leave types
+9 FOR I=1:1
SET X=$PIECE($PIECE(LVT,";",I+1),":")
if X=""
QUIT
SET TLEV(X)=""
+10 ;
+11 ; Add 2 types of leave to hold break out totals of
+12 ; comp/credit--credit hours & compensatory.
+13 ;
+14 SET (TLEV("CUCOMP"),TLEV("CUCRED"))=""
+15 ; loop thru instances of wrk nodes containing leave
+16 SET INX=0
FOR
SET INX=$ORDER(^TMP($JOB,"USE",INX))
if INX'>0
QUIT
Begin DoDot:1
+17 ; loop thru pay periods (nn)
+18 SET PP=""
FOR
SET PP=$ORDER(^TMP($JOB,"USE",INX,PP))
if PP=""
QUIT
Begin DoDot:2
+19 ; loop thru leave date (fileman)
+20 SET DATE=0
+21 FOR
SET DATE=$ORDER(^TMP($JOB,"USE",INX,PP,DATE))
if DATE'>0
QUIT
Begin DoDot:3
+22 ; loop thru leave date (external)
+23 SET DAY=""
+24 FOR
SET DAY=$ORDER(^TMP($JOB,"USE",INX,PP,DATE,DAY))
if DAY=""
QUIT
Begin DoDot:4
+25 SET TOUR=$GET(^TMP($JOB,"USE",INX,PP,DATE,DAY))
if TOUR=""
QUIT
+26 if $Y+5>IOSL
DO HDR
if POUT
QUIT
+27 ; start detail line - only print pp and date when changed
+28 WRITE !,"|"
+29 IF PP'=PP(1)
WRITE PP
SET PP(1)=PP
+30 WRITE ?4,"|"
+31 IF DAY'=DAY(1)
WRITE DAY
SET DAY(1)=DAY
+32 WRITE ?19,"|"
+33 ; flag, set false to suppress new line when 1st segment
SET SW(3)=0
+34 ; loop thru segments in node - data source and format from
+35 ; node 2 for day, empl. in #458 but ONLY contains leave
+36 FOR K=1:4
if $PIECE(TOUR,"^",K+2)=""
QUIT
Begin DoDot:5
+37 ; leave type (internal code)
NEW COMPCRED
SET LEV=$PIECE(TOUR,"^",K+2)
+38 ; new line for subsequent segments
if SW(3)
WRITE !,"|",?4,"|",?19,"|"
+39 SET %=$FIND(LVT,";"_LEV_":")
+40 ;comp/credit (CU) is distinguishable by time remarks code (K+3)
+41 if LEV="CU"
SET COMPCRED=$SELECT($PIECE(TOUR,"^",K+3)=16:"Credit Hours",1:"Compensatory")
+42 ;display leave type
+43 if %>0
WRITE $SELECT(LEV="CU":COMPCRED,1:$PIECE($EXTRACT(LVT,%,999),";"))
+44 if LEV="LWOP"
WRITE " - AWOL"
+45 WRITE ?41,"|",$PIECE(TOUR,"^",K),?49,"|",$PIECE(TOUR,"^",K+1),?57,"|"
+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 ; For Military Leave - PRS*4.0*69
IF LEV="ML"
Begin DoDot:6
+49 IF MLINHRS
DO H^PRSRLL
QUIT
+50 DO D^PRSRLL
End DoDot:6
+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 ?57,$SELECT(SW(2)=77:$JUSTIFY(TIM,4),1:$JUSTIFY(TIM,7,2))
+54 WRITE " ",$SELECT(TYL="H":"Hour",1:"Day")_$SELECT(TIM="":"",TIM'=1:"s",1:"")
+55 WRITE ?79,"|"
+56 ; add to total for type of leave
SET TLEV(LEV)=TLEV(LEV)+TIM
+57 IF LEV="CU"
SET TLEV($SELECT($PIECE(TOUR,"^",K+3)=16:"CUCRED",1:"CUCOMP"))=TLEV($SELECT($PIECE(TOUR,"^",K+3)=16:"CUCRED",1:"CUCOMP"))+TIM
+58 ; set flag true so next segment (if any) on new line
SET SW(3)=1
End DoDot:5
End DoDot:4
if POUT
QUIT
End DoDot:3
if POUT
QUIT
End DoDot:2
if POUT
QUIT
End DoDot:1
if POUT
QUIT
+59 ;
+60 IF 'CNT
Begin DoDot:1
+61 DO VLIN0
+62 WRITE !,"|",?10,"No Leave Usage on File within this Date Range.",?79,"|"
End DoDot:1
+63 ;
+64 ; report totals
+65 IF CNT
IF 'POUT
Begin DoDot:1
+66 if $Y+7>IOSL
DO HDR
+67 DO VLIN0
+68 WRITE !,"|",?4,"|",?19,"|",?27,"TOTALS:"
+69 ; set false so 1st type of leave printed on same line
SET SW(3)=0
+70 ; loop thru leave type totals
+71 SET LEV=""
FOR
SET LEV=$ORDER(TLEV(LEV))
if LEV=""
QUIT
Begin DoDot:2
+72 ; none of this type of leave found
if TLEV(LEV)=""
QUIT
+73 if $Y+5>IOSL
DO HDR
if POUT
QUIT
+74 ; new line when not first leave type
if SW(3)
WRITE !,"|",?4,"|",?19,"|",?39
+75 ; leave type
SET %=$FIND(LVT,";"_LEV_":")
if %>0
WRITE ?39,$PIECE($EXTRACT(LVT,%,999),";")
+76 ;write out subtotals for comp/credit
+77 IF LEV="CUCOMP"
WRITE ?42,"Compensatory"
+78 IF LEV="CUCRED"
WRITE ?42,"Credit Hours"
+79 WRITE ?58,$SELECT(SW(2)=77:$JUSTIFY($GET(TLEV(LEV)),4),1:$JUSTIFY($GET(TLEV(LEV)),7,2))
+80 WRITE " "
+81 IF LEV="ML"
WRITE $SELECT(MLINHRS:"Hour",1:"Day")
+82 IF LEV'="ML"
WRITE $SELECT(SW(2)=77:"Day",1:"Hour")
+83 WRITE $SELECT(TLEV(LEV)'=1:"s",1:""),?79,"|"
+84 ; set true so next leave type on new line
if 'SW(3)
SET SW(3)=1
End DoDot:2
if POUT
QUIT
End DoDot:1
+85 ;
+86 ; report footer
+87 IF 'POUT
Begin DoDot:1
+88 IF IOSL<66
FOR I=$Y:1:IOSL-6
DO VLIN0
+89 DO VLIDSH0
+90 SET CODE="L003"
SET FOOT="VA TIME & ATTENDANCE SYSTEM"
DO FOOT2^PRSRUT0
+91 IF $EXTRACT(IOST,1,2)="C-"
SET DIR(0)="E"
DO ^DIR
KILL DIR
End DoDot:1
+92 ;
+93 QUIT
+94 ;
HDR ; page break
+1 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
SET POUT=1
QUIT
+2 DO VLIDSH0
+3 SET CODE="L003"
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
HDR3 ; 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 !?24,"for: ",NAM," - T&L: ",TLE,!
+6 DO VLIDSH0
+7 WRITE !,"|","PP",?4,"|","DATE",?19,"|","TYPE",?41,"|","FROM",?49,"|","TO",?57,"|","LENGTH",?79,"|"
+8 DO VLIDSH0
+9 ; forces pp and leave date to print on new page
SET (PP(1),DAY(1))=""
+10 QUIT
+11 ;
VLIDSH0 ; dashed line (with columns)
+1 WRITE !,"|---|--------------|---------------------|-------|-------|---------------------|"
+2 QUIT
+3 ;
VLIN0 ; blank line (with columns)
+1 WRITE !,"|",?4,"|",?19,"|",?41,"|",?49,"|",?57,"|",?79,"|"
+2 QUIT