source: WorldVistAEHR/trunk/r/PAID-PRS/PRSAOTTR.m@ 1710

Last change on this file since 1710 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1PRSAOTTR ;WCIOFO/JAH-LIST OVERTIME REQUESTS-8/18/98
2 ;;4.0;PAID;**43**;Sep 21, 1995
3HDR ;
4 S VALMHDR(1)="PP "_PRSRPPE_" Week "_PRSRWK_" Overtime Requests for "_PRSRNM
5 Q
6 ;
7 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
8 ;
9OTRQVW ;OVERTIME REQUESTS VIEW
10 ; -- main entry point for PRSA VIEW OT REQ which is called by
11 ; the PRSA VIEW OT REQ protocol on the PRSA OVERTIME WARNINGS
12 ; List Template protocol menu.
13 S PRSOUT=0
14 ;
15 K ^TMP("PRSAOTR",$J)
16 N PRSRREC,PRSRIEN
17 ;
18 ;ask user to select an overtime warning. The requests on file
19 ;associated with that warning will be displayed
20 ;
21 D PICKWARN
22 ;
23 Q:PRSOUT
24 ;
25 ; Call to List Manager to run PRSA OT VIEW REQ template
26 D EN^VALM("PRSA VIEW OT REQ")
27 S VALMBCK="R"
28 Q
29 ;
30 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
31 ;
32PICKWARN ;procedure asks for one entry on ot warnings list
33 ; and gets the warnings data from the ot warnings file.
34 ;
35 ;allow selection of only one (1) of the items on the list.
36 ;call returns VALMY() array subscripted by list item number.
37 D EN^VALM2("","S")
38 ;
39 S PRSRREC="",PRSRREC=$O(VALMY(0))
40 I $G(PRSRREC) D
41 . ;Get ien for 458.6 that matches the list item.
42 . S PRSRIEN=$G(^TMP("PRSAOTW",$J,PRSRREC)) ; Selected ot warn list num
43 . S PRSRREC=$G(^PRST(458.6,PRSRIEN,0)) ; Data on ot warnings list item
44 . S PRSRPPI=$P(PRSRREC,U,3) ; Pay period ien
45 . S PRSRPPE=$P($G(^PRST(458,PRSRPPI,0)),U) ; External pp format
46 . S PRSREMP=$P(PRSRREC,U,2) ; Employee 450 ien
47 . S PRSRWK=$P(PRSRREC,U,4) ; Week 1 or 2 of pp
48 . S PRSRNM=$P($G(^PRSPC(PRSREMP,0)),U) ; External emp name
49 E S PRSOUT=1
50 Q
51 ;
52 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
53 ;
54INIT(PPI,PPE,WK,EMP) ;BUILD LIST OF OT REQUESTS FOR EMPLOYEE
55 ;Input: PPI,PPE - pay period of concern. internal and external YY-PP
56 ; WK - week (1) or week (2) of pay period
57 ; EMP - employees internal entry number in file 450.
58 ;
59 ;local vars: D1 - 1st day of payperiod-returned by NX^PRSAPPU
60 ; OTREC - a record containing 1 overtime request.
61 ; START,STOP - 1st & last FM days of week (Sun,Sat)
62 ;
63 ; quit returning 0 if anything is missing.
64 Q:$G(PPE)=""!$G(WK)=""!$G(EMP)="" 0
65 ;
66 ; Loop thru OT/CT requests file x-ref on requested work date &
67 ; add employees OT requests within week to the list array.
68 ;
69 N D1,TOTALOT,START,STOP,OTREC,REQCNT
70 ;
71 ;get start and stop FM days for one week of the pay period.
72 D WEEKRNG^PRSAOTT(PPE,WK,.START,.STOP)
73 S (REQCNT,TOTALOT,VALMCNT)=0
74 S D1=START-.1
75 F S D1=$O(^PRST(458.2,"AD",EMP,D1)) Q:D1>STOP!(D1="") D
76 . S OTREC=""
77 . F S OTREC=$O(^PRST(458.2,"AD",EMP,D1,OTREC)) Q:OTREC="" D
78 .. I $$OTREQ^PRSAOTT(OTREC) D
79 ... S REQCNT=REQCNT+1
80 ... D LISITEM(OTREC,REQCNT,.TOTALOT)
81 I REQCNT=0 D
82 . D SET^VALM10(1," NO REQUESTS FOUND")
83 . S VALMCNT=1
84 D SET^VALM10(REQCNT+VALMCNT+1,"----------------------------------------------")
85 D SET^VALM10(REQCNT+VALMCNT+2,"Current requested overtime total: "_TOTALOT_" hrs.")
86 ;
87 ; set list manager counter of number of items in list including
88 ; lines containing requests, total, and ----'s
89 ;
90 S VALMCNT=REQCNT+2+VALMCNT
91 Q
92 ;
93 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
94 ;
95LISITEM(IEN,COUNT,OTTOTAL) ;ADD A SINGLE ITEM TO VIEW OT REQ LIST
96 N PRSSTAT,PRSHRS,PRSRQDT,OTREC,X
97 ;
98 ;Get data from OT requests file to build one (1) line in the
99 ;list of one employee's ot requests for the week.
100 ;
101 S OTREC=$G(^PRST(458.2,IEN,0)) ; Ot/ct/ch requests file rec
102 S PRSRQDT=$P(OTREC,U,3) ; Requested work date
103 S PRSRQDT=$E($$FDATE^VALM1(PRSRQDT),1,12) ; External date
104 S PRSHRS=$P(OTREC,U,6) ; # of hours requested
105 ; Status of requests
106 S PRSSTAT=$$EXTERNAL^DILFD(458.2,10,,$P(OTREC,U,8),)
107 ;S PRSTL=$P(OTREC,U,9)
108 ;
109 ;Build one line (X) for list manager with an ot request.
110 ; 3rd parameter is name of field on List Template
111 ;
112 S X=$$SETFLD^VALM1(COUNT,"","NUMBER")
113 S X=$$SETFLD^VALM1(PRSHRS,X,"HRSREQ")
114 S X=$$SETFLD^VALM1(PRSSTAT,X,"STATUS")
115 S X=$$SETFLD^VALM1(PRSRQDT,X,"WORKDATE")
116 ;
117 ;add line built in X to the list
118 ;
119 D SET^VALM10(COUNT,X,COUNT)
120 ;
121 ;add OT hrs from this line to total OT requests for this list
122 ;
123 S OTTOTAL=PRSHRS+OTTOTAL
124 ;
125 ; save the ien of the record in the list global for easier
126 ; reference to the acutal data.
127 ;
128 S ^TMP("PRSAOTR",$J,COUNT)=OTREC
129 Q
130 ;
131 ;= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
132 ;
Note: See TracBrowser for help on using the repository browser.