| 1 | PRSA8BNI        ;WOIFO/JAH - Tour Hours vs 8B Norm Hrs Report ;3/5/08
 | 
|---|
| 2 |         ;;4.0;PAID;**116**;Sep 21, 1995;Build 23
 | 
|---|
| 3 |         ;;Per VHA Directive 2004-038, this routine should not be modified.
 | 
|---|
| 4 |         Q
 | 
|---|
| 5 |         ;
 | 
|---|
| 6 | GETPP() ;prompt for pay period
 | 
|---|
| 7 |         N DIC,X,Y,PPI,DTOUT
 | 
|---|
| 8 |         S DIC="^PRST(458,",DIC(0)="AEQM",DIC("A")="Select PAY PERIOD: "
 | 
|---|
| 9 |         W !
 | 
|---|
| 10 |         D ^DIC
 | 
|---|
| 11 |         S PPI=+Y
 | 
|---|
| 12 |         I $D(DTOUT)!(+Y'>0) S PPI=0
 | 
|---|
| 13 |         Q PPI
 | 
|---|
| 14 | NOTOURS()       ;return true if user wants to see data from employees with
 | 
|---|
| 15 |         ;        no tour of duty set up yet
 | 
|---|
| 16 |         ;        otherwise return 0 or -1 for abort
 | 
|---|
| 17 |         ;
 | 
|---|
| 18 |         N DIR,DIRUT,Y
 | 
|---|
| 19 |         S DIR(0)="Y"
 | 
|---|
| 20 |         S DIR("B")="N"
 | 
|---|
| 21 |         S DIR("A")="Include employees with no tour of duty entered"
 | 
|---|
| 22 |         D ^DIR
 | 
|---|
| 23 |         Q:$D(DIRUT) -1
 | 
|---|
| 24 |         Q +Y
 | 
|---|
| 25 |         ;
 | 
|---|
| 26 | NOTCARD()       ;return true if user wants to see data from employees with
 | 
|---|
| 27 |         ;  no timecard on file, ie no entry for pp in 458
 | 
|---|
| 28 |         ;  otherwise return 0 or -1 for abort
 | 
|---|
| 29 |         ;
 | 
|---|
| 30 |         N DIR,DIRUT,Y
 | 
|---|
| 31 |         S DIR(0)="Y"
 | 
|---|
| 32 |         S DIR("B")="N"
 | 
|---|
| 33 |         S DIR("A")="Include employees with no timecard on file"
 | 
|---|
| 34 |         D ^DIR
 | 
|---|
| 35 |         Q:$D(DIRUT) -1
 | 
|---|
| 36 |         Q +Y
 | 
|---|
| 37 | DAILYHRS()      ;return true if user wants to see tour hours for each day
 | 
|---|
| 38 |         ;  otherwise return 0 or -1 for abort
 | 
|---|
| 39 |         ;
 | 
|---|
| 40 |         N DIR,DIRUT,Y
 | 
|---|
| 41 |         S DIR(0)="Y"
 | 
|---|
| 42 |         S DIR("B")="N"
 | 
|---|
| 43 |         S DIR("A")="Include employees daily tour hours"
 | 
|---|
| 44 |         D ^DIR
 | 
|---|
| 45 |         Q:$D(DIRUT) -1
 | 
|---|
| 46 |         Q +Y
 | 
|---|
| 47 |         ;
 | 
|---|
| 48 | TRHDR   ;
 | 
|---|
| 49 |         W !!,?7,"Day",?12,"ToD #*",?19,"Tour Week 1",?34,"Hours*",?47,"ToD #*",?54,"Tour Week 2",?69,"Hours*"
 | 
|---|
| 50 |         W !,?7,"---",?12,"-----",?19,"-----------",?34,"-----",?47,"-----",?54,"-----------",?69,"-----"
 | 
|---|
| 51 |         Q
 | 
|---|
| 52 | EMPINFO(PRSENAME,PRSSN,HRS)     ;
 | 
|---|
| 53 |         W !!?2,PRSENAME,?26,PRSSN,?44,$P(HRS,U),?55,$P(HRS,U,2)
 | 
|---|
| 54 |         I $G(DUZ(0))="@" W ?63,PRSIEN
 | 
|---|
| 55 |         Q
 | 
|---|
| 56 | HDR(PG,TSTAMP,END,FORWHO,PPE,PPRANGE)   ;
 | 
|---|
| 57 |         S PG=PG+1
 | 
|---|
| 58 |         W @IOF
 | 
|---|
| 59 |         N H1,H2,B
 | 
|---|
| 60 |         S H1="VA TIME & ATTENDANCE REPORT "_FORWHO_"--"_TSTAMP
 | 
|---|
| 61 |         S B=$E("               ",1,(IOM-$L(H1))\2-3-$L(PG))
 | 
|---|
| 62 |         S H2="Tour Hrs Don't Match 8B Normal Hrs:  PP "_PPE_" ("_PPRANGE_")"
 | 
|---|
| 63 |         W !,?(IOM-$L(H1)\2),H1,B,"p",PG,!,?(IOM-$L(H2)\2),H2
 | 
|---|
| 64 |         Q:END
 | 
|---|
| 65 |         W !!,?2,"EMPLOYEE NAME",?26,"    SSN",?40,"8B NRM HRS   ToD HRS*"
 | 
|---|
| 66 |         I $G(DUZ(0))="@" W ?63,"IEN 450"
 | 
|---|
| 67 |         W !?2,"======================",?26,"===========",?40,"==========   ======="
 | 
|---|
| 68 |         I $G(DUZ(0))="@" W "   ======="
 | 
|---|
| 69 |         Q
 | 
|---|
| 70 |         ;
 | 
|---|
| 71 | RET(TSTAMP)     ;
 | 
|---|
| 72 |         I ($E(IOST,1,2)'="C-")!($D(ZTQUEUED)) D HDR(.PG,TSTAMP,0,FORWHO,PPE,PPRANGE) Q 0
 | 
|---|
| 73 |         ;
 | 
|---|
| 74 |         N OUT
 | 
|---|
| 75 |         S OUT=$$ASK^PRSLIB00(1)
 | 
|---|
| 76 |         I 'OUT D HDR(.PG,TSTAMP,0,FORWHO,PPE,PPRANGE)
 | 
|---|
| 77 |         Q OUT
 | 
|---|
| 78 | GETHOURS(PPI,PRSIEN)    ; Return TOUR HOURS AND NORMAL HOURS
 | 
|---|
| 79 |         N MATCH,HRS,NH,ENT,ENTPTR,DFN,TH
 | 
|---|
| 80 |         I $G(PPI)'>0!($G(PRSIEN)'>0) Q 1
 | 
|---|
| 81 |         S MATCH=1
 | 
|---|
| 82 |         S NH=-1
 | 
|---|
| 83 |         S ENTPTR=$P($G(^PRST(458,PPI,"E",PRSIEN,0)),U,5)
 | 
|---|
| 84 |         I ENTPTR'="" D
 | 
|---|
| 85 |         .  S ENT=$P($G(^PRST(457.5,ENTPTR,1)),U)
 | 
|---|
| 86 |         .  S NH=$E($G(^PRST(458,PPI,"E",PRSIEN,5)),26,27)
 | 
|---|
| 87 |         .  Q:NH="00"
 | 
|---|
| 88 |         .  I +NH'>0 S NH=$P($G(^PRSPC(PRSIEN,0)),U,50)
 | 
|---|
| 89 |         I $G(ENT)="" S DFN=PRSIEN D ^PRSAENT
 | 
|---|
| 90 |         I $G(ENT)'="",$E(ENT)'="D",($E(ENT,1,2)'="0D") D
 | 
|---|
| 91 |         .  D TOURHRS^PRSARC07(.HRS,PPI,PRSIEN)
 | 
|---|
| 92 |         .  S TH=($G(HRS("W1"))+$G(HRS("W2")))
 | 
|---|
| 93 |         Q NH_U_TH
 | 
|---|
| 94 |         ;
 | 
|---|
| 95 | REPDONE(OUT,TLECNT,TSTAMP,DAILYHRS,GRANDTOT)    ; report done display page
 | 
|---|
| 96 |         ;
 | 
|---|
| 97 |         I TLECNT=0 D HDR(.PG,TSTAMP,1,FORWHO,PPE,PPRANGE) W !,"NO T&L UNITS WERE FOUND ASSIGNED TO YOU THAT COULD BE CHECKED." Q
 | 
|---|
| 98 |         I 'OUT,$Y>(IOSL-24) S OUT=$$ASK^PRSLIB00(1) D HDR(.PG,TSTAMP,1,FORWHO,PPE,PPRANGE)
 | 
|---|
| 99 |         I OUT W !!,"********REPORT ABORTED*********"
 | 
|---|
| 100 |         E  W !!,"REPORT COMPLETED.  TOTAL MISMATCHES FOUND:  ",GRANDTOT
 | 
|---|
| 101 |         W !,"================================================================="
 | 
|---|
| 102 |         N TXT,I
 | 
|---|
| 103 |         W !
 | 
|---|
| 104 |         F I=1:1 S TXT=$P($T(ALLFT+I),";",3) Q:TXT=""  W !,TXT
 | 
|---|
| 105 |         I DAILYHRS D
 | 
|---|
| 106 |         .  F I=1:1 S TXT=$P($T(DAILYFT+I),";",3) Q:TXT=""  W !,TXT
 | 
|---|
| 107 |         S OUT=$$ASK^PRSLIB00(1)
 | 
|---|
| 108 |         Q
 | 
|---|
| 109 | ALLFT   ;;
 | 
|---|
| 110 |         ;;                   FOOTNOTES TO REPORT HEADINGS
 | 
|---|
| 111 |         ;;                   ============================
 | 
|---|
| 112 |         ;;*ToD HRS (Tour of Duty Hours) The total Tour of Duty hours that fall within the
 | 
|---|
| 113 |         ;;--------  two week pay period, beginning midnight Saturday.  Hours that cross 
 | 
|---|
| 114 |         ;;          midnight from a tour that starts on the last day of a pay period will
 | 
|---|
| 115 |         ;;          appear on the following pay period.
 | 
|---|
| 116 |         ;;.....................................................................
 | 
|---|
| 117 | DAILYFT ;;
 | 
|---|
| 118 |         ;;*Hours   (DAILY TOUR HOURS) This column contains actual tour hours that fall
 | 
|---|
| 119 |         ;;------    on that day from the 24 hour period beginning at midnight.  A two day
 | 
|---|
| 120 |         ;;          tour will contribute hours to each day the tour falls on.  Hours 
 | 
|---|
| 121 |         ;;          that cross midnight from a tour that starts on the last day of a pay
 | 
|---|
| 122 |         ;;          period will appear on the following pay period.
 | 
|---|
| 123 |         ;;.....................................................................
 | 
|---|
| 124 |         ;;*ToD #   (Tour of Duty Number)
 | 
|---|
| 125 |         ;;------
 | 
|---|
| 126 |         ;;.....................................................................
 | 
|---|