source: WorldVistAEHR/trunk/r/PAID-PRS/PRSRLSOR.m@ 1800

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

initial load of WorldVistAEHR

File size: 2.2 KB
RevLine 
[613]1PRSRLSOR ;HISC/JH,WIRMFO/JAH-LEAVE REPORT SORTS ;7/8/97
2 ;;4.0;PAID;**16,17,26**;Sep 21, 1995
3REQ ; find employee leave requests within specified period
4 ; input
5 ; D0 - employee ien (file 450)
6 ; NAM - employee name
7 ; FR - specified FR date
8 ; TO - specified TO date
9 ; CNT
10 ; output
11 ; ^TMP($J,"REQ",request from date, employee name, request ien)=data
12 ; CNT
13 ; get cost center/org code (ccoc) from employee record
14 S ORG=$$CCORG^PRSRUTL(PRSRY1)
15 ; send bulletin to G.PAD if ORG description missing, but continue.
16 I +ORG>0 D CCORGBUL^PRSRUTL(ORG,PRSRDUZ,1,$P(PRSRY,"^",2))
17 ; loop thru employee requests in reverse chrono by request's TO DATE
18 ; quit loop when earlier than specified FROM DATE
19 S DTI("Q")=9999999-FR
20 S DTI=0 F S DTI=$O(^PRST(458.1,"AD",D0,DTI)) Q:DTI>DTI("Q")!(DTI="") D
21 . S DA=0 F S DA=$O(^PRST(458.1,"AD",D0,DTI,DA)) Q:'DA D
22 . . S Z=$G(^PRST(458.1,DA,0)) Q:Z=""
23 . . Q:$P(Z,U,3)>TO!($P(Z,U,3)="") ; exclude: after specified date range
24 . . Q:"DX"[$P(Z,U,9) ; exclude: status disapproved or canceled
25 . . S X=$P(Z,U,7),%=$F(LVT,";"_X_":"),X(1)=$S(%>0:$P($E(LVT,%,999),";"),1:"")
26 . . S X=$P(Z,U,9),%=$F(LVS,";"_X_":"),X(2)=$S(%>0:$P($E(LVS,%,999),";"),1:"")
27 . . S ^TMP($J,"REQ",$P(Z,U,3),NAM,DA)=$P(Z,U,4)_U_$P(Z,U,6)_U_$P(Z,U,5)_U_X(1)_U_X(2)_U_$P(Z,U,11)_U_$P(Z,U,13)_U_$P(Z,U,12)_U_$P(Z,U,15,16)
28 . . S CNT=CNT+1 I '(CNT#30),$E(IOST,1,2)="C-",'$D(ZTQUEUED) W "."
29 Q
30 ;
31USE I SW S DA(4)=0 F I=0:0 S DA(4)=$O(TLE(DA(4))) Q:DA(4)'>0 S DA(3)=0 F S DA(3)=$O(TLE(DA(4),DA(3))) Q:DA(3)'>0 S D0=$P(TLE(DA(4),DA(3)),U) D
32 . Q:$G(^PRST(458,DA(1),"E",D0,"D",DA,2))="" S TOUR=$G(^PRST(458,DA(1),"E",D0,"D",DA,2)) Q:TOUR="" D CKTOUR^PRSRUT0(.TOUR) Q:TOUR=""
33 . S SSN=$P($G(^PRSPC(D0,0)),U,9),SSN=$E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,9),CNT=CNT+1,^TMP($J,"USE",DA(2),$P(DATES,"^",DA),$P(TLE(DA(4),DA(3)),U,2),SSN,D0,CNT)=TOUR W:'$D(ZTSK)&($E(IOST)'="P")&($R(30)) "."
34 . Q
35 I 'SW S DAY=$P($G(^PRST(458,DA(1),2)),"^",DA) Q:DAY="" D
36 . Q:$G(^PRST(458,DA(1),"E",D0,"D",DA,2))=""!(($P(DATES,"^",DA)<FR)!($P(DATES,"^",DA)>TO)) S TOUR=$G(^PRST(458,DA(1),"E",D0,"D",DA,2)) Q:TOUR="" D CKTOUR^PRSRUT0(.TOUR) Q:TOUR=""
37 . S CNT=CNT+1,^TMP($J,"USE",CNT,$P(DA(2),"-",2),$P(DATES,"^",DA),DAY)=TOUR W:'$D(ZTSK)&($E(IOST)'="P")&($R(30)) "."
38 . Q
39 Q
Note: See TracBrowser for help on using the repository browser.