source: WorldVistAEHR/trunk/r/PAID-PRS/PRSDUTIL.m@ 1769

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

initial load of WorldVistAEHR

File size: 7.4 KB
RevLine 
[613]1PRSDUTIL ;HISC/MGD-PAID DOWNLOAD UTILITY SUB-ROUTINES ;09/10/2003
2 ;;4.0;PAID;**32,82,99**;Sep 21, 1995
3PIC9 ;Replace 0s
4 S DIF=LTH-$L(GRPVAL) I DIF>0 F FF=1:1:DIF S GRPVAL="0"_GRPVAL
5 K DIF,FF Q
6SIGN ;Sign conversion
7 S L=$L(DATA),S=$E(DATA,L)
8 S LC=$S(S="{":0,S="A":1,S="B":2,S="C":3,S="D":4,S="E":5,S="F":6,S="G":7,S="H":8,S="I":9,S="}":0,S="J":1,S="K":2,S="L":3,S="M":4,S="N":5,S="O":6,S="P":7,S="Q":8,S="R":9,1:S)
9 S DATA=$E(DATA,1,L-1)_LC
10 S:(S="}")!(S="J")!(S="K")!(S="L")!(S="M")!(S="N")!(S="O")!(S="P")!(S="Q")!(S="R") DATA="-"_DATA
11 K L,LC,S Q
12D ;.0
13 S L=$L(DATA),DATA=$E(DATA,1,L-1)_"."_$E(DATA,L) K L G RZ
14DD ;.00
15 S L=$L(DATA),DATA=$E(DATA,1,L-2)_"."_$E(DATA,L-1,L) K L G RZ
16DDD ;.000
17 S L=$L(DATA),DATA=$E(DATA,1,L-3)_"."_$E(DATA,L-2,L) K L G RZ
18DDDD ;.0000
19 S L=$L(DATA),DATA=$E(DATA,1,L-4)_"."_$E(DATA,L-3,L) K L G RZ
20DDDDD ;.00000
21 S L=$L(DATA),DATA=$E(DATA,1,L-5)_"."_$E(DATA,L-4,L) K L G RZ
22AHRS ;Acct hrs
23 S L=$L(DATA),LD=$E(DATA,L),FD=$E(DATA,1,L-1)
24 S LD=$S(LD=0:"00",LD=1:25,LD=2:50,LD=3:75,1:LD)
25 S DATA=FD_"."_LD,DATA=+DATA
26 K FD,L,LD G RZ
27PCT ;%
28 S:+$P(DATA,".",2)=0 DATA=DATA\1
29 S DATA=DATA_"%" Q
30RZ ;Remove leading 0s
31 I +DATA=0 S DATA="" Q
32 S FC=$E(DATA,1)
33 S $P(DATA,".")=+$P(DATA,".")
34 I FC="-",$E(DATA,1)'="-" S DATA="-"_DATA
35 K FC Q
36DATE ;Convert Austin Date to Fileman Date
37 ;Austin's date has form xxYYMMDD or YYYYMMDD
38 Q:DATA=""
39 I $E(DATA,5,8)="0000" S DATA="" Q
40 N X,Y,%DT,DTOUT
41 S X=$E(DATA,5,8)_$S(+$E(DATA)'=$E(DATA):$E(DATA,3,4),1:$E(DATA,1,4))
42 S %DT="" D ^%DT
43 S DATA=$S(Y>0:Y,1:"")
44 Q
45LZ ;Insert leading 0s
46 F UUU=1:1:L-$L(DATA) S DATA=0_DATA
47 K L,UUU Q
48RTS ;Remove trailing spaces
49 Q:$E(DATA,$L(DATA))'=" "
50 F SLOOP=$L(DATA):-1 Q:$E(DATA,SLOOP)'=" " S DATA=$E(DATA,1,SLOOP-1)
51 K SLOOP Q
52OT ;Output trans
53 Q:Y="" S IEN454=0,IEN454=$O(^PRSP(454,1,SUB454,"B",Y,IEN454))
54 I IEN454>0,$P(^PRSP(454,1,SUB454,IEN454,0),U,2)'="" S Y=$P(^PRSP(454,1,SUB454,IEN454,0),U,2) I SUB454="ORG",$D(^PRSP(454.1,Y,0)) S Y=$P(^PRSP(454.1,Y,0),U,1)
55 K IEN454,SUB454 Q
56SOT ;State
57 Q:Y=""
58 S IEN5=0,IEN5=$O(^DIC(5,"C",Y,IEN5))
59 S Y=$S(IEN5>0:$P(^DIC(5,IEN5,0),U,1),1:Y)
60 K IEN5 Q
61AC ;Asgmnt code
62 Q:Y=""
63 S AC="",AC1="",OSC=$E($P(^PRSPC(D0,0),U,17),1,4)
64 F LLL=0:0 S LLL=$O(^PRSP(454,1,"ASS","B",Y,LLL)) Q:LLL="" D Q:AC'=""
65 .S OCCS=$P(^PRSP(454,1,"ASS",LLL,0),U,3)
66 .I OCCS="" S AC1=$P(^PRSP(454,1,"ASS",LLL,0),"^",2)
67 .I OCCS[OSC S AC=$P(^PRSP(454,1,"ASS",LLL,0),"^",2)
68 S Y=$S(AC'="":AC,1:AC1)
69 K AC,AC1,LLL,OCCS,OSC Q
70TITLE ;Title
71 I DATA=" " S DATA="" Q
72 S LD=$E(DATA,6) S:LD'?1N $P(^PRSPC(IEN,0),U,42)=LD
73 I $P(^PRSPC(IEN,0),U,42)?1U&(LD?1N) S $P(^PRSPC(IEN,0),U,42)=""
74 K LD Q
75NH ;Norm Hrs
76 S DATA=+DATA,DB=$P(^PRSPC(IEN,0),U,10)
77 S NH=$S(DATA>0:DATA,DB=1:80,DB=2:DATA,DB=3:0,1:0)
78 S $P(^PRSPC(IEN,0),U,50)=NH
79 K DB,NH Q
80STEP ;Step
81 I DATA=" " S DATA="" Q
82 S:$E(DATA,1)=" " DATA=$E(DATA,2) Q
83ORGCC ;Org/Cost Cntr
84 I DBNAME="MXORGCOD" S COST=$E(DATA,1,4),$P(^PRSPC(IEN,0),U,18)=COST
85 S CCORG=$E(DATA,1,4)_":"_$E(DATA,5,8)
86 I '$D(^PRSP(454,1,"ORG","B",CCORG)) K DD,DO S DIC="^PRSP(454,1,""ORG"",",DIC(0)="L",DLAYGO=454,X=CCORG D FILE^DICN S ^TMP($J,"ORG",CCORG)=""
87 K COST,CCORG,DIC,DLAYGO,X Q
88PVAE ;Prior VA Exp
89 F ABC=1:1:$L(DATA) S PV=$E(DATA,ABC),PIECE=$S(PV="A":1,PV="B":2,PV="C":3,PV="D":4,PV="E":5,PV="F":6,PV="G":7,PV="H":8,PV="I":9,PV="J":10,PV="K":11,PV="L":12,PV="M":13,PV=0:ABC,1:"") S:PIECE'="" $P(^PRSPC(IEN,NODE),U,PIECE)=PV
90 K ABC,PV Q
91ZIP ;Zip
92 I +DATA=0 S DATA="" Q
93 I $E(DATA,6,9)="0000" S DATA=$E(DATA,1,5) Q
94 S DATA=$E(DATA,1,5)_"-"_$E(DATA,6,9) Q
95NPLWOP ;Nonpay & LWOP Hrs
96 S LVGRP=$P(^PRSPC(IEN,0),U,15)
97 S NPLWOP=$S((LVGRP=4)!(LVGRP=5):$J((DATA/14)*80,1,0),1:DATA)
98 I DBNAME="ANONPATIME" S $P(^PRSPC(IEN,1),U,43)=NPLWOP S:TYPE="P" $P(^PRST(459,PPIEN,"P",IEN,6),U,5)=NPLWOP
99 I DBNAME="ALWOPUSED" S $P(^PRSPC(IEN,"LWOP"),U,11)=NPLWOP S:TYPE="P" $P(^PRST(459,PPIEN,"P",IEN,4),U,9)=NPLWOP
100 K LVGRP,NPLWOP Q
101NEWSSN ;New SSN
102 I $L(DATA)<9 S L=9 D LZ
103 Q
104COMP ;0 out comp time bal
105 I DATA="",$E(^PRSPC(IEN,"COMP"),1,7)="^^^^^^^",$P(^PRSPC(IEN,"COMP"),U,9)'="" F ABC=9:1:17 S $P(^PRSPC(IEN,"COMP"),U,ABC)=""
106 Q
107OST ;Occupation Series & Title Output Transform
108 S OSC=Y,OSC14=$E(Y,1,4),OSC15=$E(Y,1,5),LD=$E(Y,6)
109 G:LD?1N OSTOT
110 I OSC14<2200 S NLD=$S((LD="A")!(LD="J"):1,(LD="B")!(LD="K"):2,(LD="C")!(LD="L"):3,(LD="D")!(LD="M"):4,(LD="E")!(LD="N"):5,(LD="F")!(LD="O"):6,(LD="G")!(LD="P"):7,(LD="H")!(LD="Q"):8,(LD="I")!(LD="R"):9,1:LD) S Y=OSC15_NLD
111 I OSC14>2600,LD'?1N S Y=OSC15_"0"
112OSTOT S SUB454="OCC" D OT^PRSDUTIL K SUB454
113 I OSC14<2200,(LD="A")!(LD="B")!(LD="C")!(LD="D")!(LD="E")!(LD="F")!(LD="G")!(LD="H")!(LD="I") S:(Y'["OFFICER")!(Y="POLICE OFFICER") Y="SUPERVISORY "_Y G OSTEX
114 I OSC14<2200,(LD="J")!(LD="K")!(LD="L")!(LD="M")!(LD="N")!(LD="O")!(LD="P")!(LD="Q")!(LD="R") S Y="LEAD "_Y G OSTEX
115 I OSC14>2600,(LD="F")!(LD="G")!(LD="H")!(LD="L")!(LD="S") S SUF=$S(LD="H":" HELPER",LD="L":" LEADER",LD="F":" FOREMAN",LD="G":" GENERAL FOREMAN",LD="S":" SUPERVISOR",1:LD),Y=Y_SUF
116OSTEX K OSC,OSC14,OSC15,LD,NLD,SUF
117 Q
118 ;
119LD ; Set Labor Distribution fields into Multiple.
120 N PRSTMP
121 S PRSTMP=DATA,DATA=$E(DATA,1,4)
122 D LD^PRSDSET
123 S DATA=PRSTMP
124 Q
125 ;==============================================================
126PATCH32 ;Subprograms LOOP450 and DTCMP are post-installation routines
127 ;for patch PRS*4*32. They have no other intended use.
128 ;Convert fields that have received year 2000 dates from Austin.
129 ;Loop thru all employee records. Within employee records loop thru
130 ;the 9 nodes (see ND variable) in each record that contain potential
131 ;problem dates. Traverse the up arrow delimited data in each node,
132 ;but only check the pieces defined in the CHECK array nodes.
133 ;Convert dates in those fields that fall between jan 01, 1900 and
134 ;DEC 31, 1910 inclusively. The conversion will only change the
135 ;century to the 21st.
136 ;
137 ;
138 Q
139 ;==============================================================
140LOOP450 ;
141 ;
142 ;****Keep post-installation from running on subsequent patch installs
143 I $$PATCH^XPDUTL("PRS*4.0*32") D MSSG(0) Q
144 ;
145 D MSSG(1)
146 N CHECK,ND,REC,PIECES,XPDIDTOT,DIV,%
147 S CHECK(0)="51^"
148 S CHECK(1)="30^"
149 S CHECK(2)="2^3^4^5^6^7^8^9^10^11^12^13^14^15^16^17^18^20^22^23^24^25^26^27^28^29^30^31^32^"
150 S CHECK(3)="1^2^3^4^5^6^7^8^9^10^11^12^13^14^15^16^19^20^21^22^"
151 S CHECK(4)="1^2^3^4^5^6^7^8^9^10^11^12^13^14^15^16^17^18^19^20^"
152 S CHECK("PCD")="4^"
153 S CHECK("MSD2")="9^"
154 S CHECK("BOND1")="12^"
155 S CHECK("BOND2")="11^"
156 S CHECK("TSP1")="5^12^14^"
157 ;
158 S XPDIDTOT=$P($G(^PRSPC(0)),"^",4)
159 S DIV=XPDIDTOT\20
160 S %=0
161 S REC=0 F S REC=$O(^PRSPC(REC)) Q:REC'>0 D
162 . S %=%+1
163 . I '(%#DIV) D UPDATE^XPDID(%)
164 . S ND=""
165 . F S ND=$O(CHECK(ND)) Q:ND="" D
166 .. I $G(^PRSPC(REC,ND))'="" D
167 ... S PIECES=CHECK(ND)
168 ... D DTCMP(REC,ND,$G(^PRSPC(REC,ND)),PIECES)
169 Q
170 ;==============================================================
171DTCMP(IEN,NODE,DATANODE,PIECES) ;
172 ;Look at all PEICES in a single DATANODE of an employee's record
173 ;and convert dates from 1900-1910 to respective dates in 2000-2010.
174 N PIECE,NEXT,NEWDATE,DATA
175 F NEXT=1:1 S PIECE=$P(PIECES,"^",NEXT) Q:PIECE="" D
176 . S DATA=$P(DATANODE,"^",PIECE)
177 . I (DATA<2110101),(DATA>1991231) D
178 .. S NEWDATE="3"_$E(DATA,2,7)
179 .. S $P(^PRSPC(IEN,NODE),"^",PIECE)=NEWDATE
180 Q
181 ;==============================================================
182MSSG(FLAG) ;OUT PUT POST INSTALLATION MESSAGE.
183 N MSSG
184 I FLAG S MSSG="Checking date fields in File 450."
185 E S MSSG="Date fields not checked. Checked during previous install of PRS*4*32"
186 D MES^XPDUTL(MSSG)
187 Q
188 ;==============================================================
Note: See TracBrowser for help on using the repository browser.