source: WorldVistAEHR/trunk/r/PAID-PRS/PRSU1B2.m@ 1147

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

initial load of WorldVistAEHR

File size: 5.0 KB
Line 
1PRSU1B2 ;WOIFO/PLT-UTILITY ; 24-Aug-2005 10:34 AM
2 ;;4.0;PAID;**112**;Sep 21, 1995;Build 54
3 ;;Per VHA Directive 2004-038, this routine should not be modified
4 QUIT ; invalid entry
5 ;
6 ;prsa date ~1=[label]^routine, ~2=task description
7 ;prsb data ~1=variable name/global root, ~2...
8 ;prsc data ~1=1 if ask start time, ~2=start time (fm time/$h-time), ~3=keep until time (fm/$h)
9 ; ~4=i/o device name, ~5=priority(1-10),
10 ; ~6=task uci, ~7=volume set,
11TASK(PRSA,PRSB,PRSC) ;ef value ^1 task number, ^2=start time(fm/$h)
12 ;task set-up
13 N ZTRN,ZTDESC,ZTDTH,ZTIO,ZTUCI,ZTCPU,ZTPRI,ZTSAVE,ZTKIL,ZTSK
14 N A,B
15 S ZTRTN=$P(PRSA,"~"),ZTDESC=$P(PRSA,"~",2)
16 I $G(PRSB)]"" F A=1:1 Q:$P(PRSB,"~",A,999)="" S B=$P(PRSB,"~",A) S:B]"" @("ZTSAVE("""_B_""")=""""")
17 S ZTIO=""
18 S PRSC=$G(PRSC) S:'PRSC ZTDTH=$S($P(PRSC,"~",2)="":$H,1:$P(PRSC,"~",2))
19 I $P(PRSC,"~",3,999)]"" D
20 . S:$P(PRSC,"~",3)]"" ZTKILL=$P(PRSC,"~",3)
21 . S:$P(PRSC,"~",4)]"" ZTIO=$P(PRSC,"~",4)
22 . S:$P(PRSC,"~",5)]"" ZTPRI=$P(PRSC,"~",5)
23 . S:$P(PRSC,"~",6)]"" ZTUCI=$P(PRSC,"~",6)
24 . S:$P(PRSC,"~",7)]"" ZTCPU=$P(PRSC,"~",7)
25 . QUIT
26 D ^%ZTLOAD
27 QUIT $G(ZTSK)_"^"_$G(ZTSK("D"))
28 ;
29 ;PRSA data ^1=message subject, ^2=message sender's name (option)
30 ;xmtext text array name with left parenthesis
31 ;.xmy recipients ri/name, group array, return value ien of 3.9
32 ;.xmrou routine name array
33 ;.xmstrip striped character array
34MM(PRSA,XMTEXT,XMY,XMROU,XMSTRIP) ;mail message sending
35 N XMSUB,XMDUZ
36 S XMSUB=$P(PRSA,"^") S:$P(PRSA,"^",2)]"" XMDUZ=$P(PRSA,"^",2)
37 D ^XMD K XMY S XMY=XMZ K XMZ
38 QUIT
39 ;
40 ;
41 ;PRSA=package name (.01) in file 9.4
42PKGVER(PRSA) ;ef - ^1=ri of file 9.4, ^2=version number from node version if defined
43 ; ^3=version number from node 22, ^4=version install date from node 22
44 N A,B,C
45 S (A,B)=""
46 Q:$D(PRSPKVER(PRSA)) PRSPKVER(PRSA)
47 S A=$O(^DIC(9.4,"B",PRSA,""))
48 I A S PRSPKVER(PRSA)=A,$P(PRSPKVER(PRSA),"^",2)=$P($G(^DIC(9.4,A,"VERSION")),"^"),$P(PRSPKVER(PRSA),"^",3)=$P(PRSPKVER(PRSA),"^",2) D:$P(PRSPKVER(PRSA),"^",2)=""
49 . D EN^DDIOL("Package is defined, but has not current version data.")
50 . D EN^DDIOL("Please call IRM!")
51 S:'A PRSPKVER(PRSA)=""
52 QUIT PRSPKVER(PRSA)
53 ;
54 ;A=date/time, B='I' if fileman date/time, 'H' if $H date/time, 'E' if external date
55 ;C="S" if second required
56DT(A,B,C) ;ef value: -1 if wrong format, ^1=fileman.time, ^2=$h date,time
57 ; ^3-week day, ^4=mm/dd/yy@time, ^5=alpha date@time
58 N %DT,X,Y,Z,%H,%,%T,%Y
59 S:'$D(C) C="" S Z=""
60 I B="E" D QUIT:Z=-1 Z
61 . S %DT="T" S:C="S" %DT=%DT_"S"
62 . S X=A D ^%DT S Z=Y
63 I B="H" D
64 . S %H=+A D YMD^%DTC S Z=X,%=$P(A,",",2) D S^%DTC S Z=Z_$S(%=0:".0000",C="S":%,1:$E(%,1,5))
65 S:Z="" Z=A
66 S X=Z D H^%DTC S $P(Z,"^",2)=%H_","_%T,$P(Z,"^",3)=%Y
67 S Y=$P(Z,"^") S:C="S" %DT="S" D DD^%DT S $P(Z,"^",5)=Y,A=$P(Y,"@",2)
68 S $P(Z,"^",4)=$E(Z,4,5)_"/"_$E(Z,6,7)_"/"_$E(Z,2,3)
69 S:$P(Z,"^")["." $P(Z,"^",4)=$P(Z,"^",4)_"@"_$TR(A,":",""),$P(Z,"^")=+Z
70 QUIT Z
71 ;
72 ;a - the date, b - date format:E - external, I - internal, H - $h
73DTPP(A,B) ;ef - -1 if date in wrong format, day #^pay period yy-pp^pp start date cyymmdd^pp ending date cyymmdd^pp start $h date
74 ;assume the pp '06-01' starting 1/8/2006 with $h=60273 and fm date 3060108
75 N C,D,E,F,G
76 S E="60273^3060108^06-01"
77 S D=$$DT(A,B),F=+$P(D,U,2) I D=-1 QUIT D
78 ;find the first pay period date of the year
79 S D=$E(D,1,3)_"0101",B=$$DT(D,"I"),D=+$P(B,U,2) F G=D:1:D+14 QUIT:G-E#14=0
80 I G'>F S $P(C,U,2)=$E(B,2,3)_"-"_$E(F-G\14+101,2,3)
81 E S D=$E(B,1,3)-1_"0101",B=$$DT(D,"I"),D=+$P(B,U,2) F G=D:1:D+14 I E-G#14=0 S $P(C,U,2)=$E(B,2,3)_"-"_$E(F-G\14+101,2,3) QUIT
82 S $P(C,U)=F-G#14+1,$P(C,U,3)=$E($$DT(F-C+1,"H"),1,7),$P(C,U,4)=$E($$DT(F-C+14,"H"),1,7),$P(C,U,5)=F-C+1
83 QUIT C
84 ;
85 ;a - pay period yyyy-nn or yy-nn, b - day #
86PPDT(A,B) ;ef- -1 if a,b invalid, date of day # cyymmdd^pp start date cyymmdd^pp ending date^pp start $h date
87 ;assume 19yy if yy>70 and 20yy if yy'>70
88 ;assume the pp '06-01' starting 1/8/2006 with $h=60273 and fm date 3060108
89 N C,D,E,F,G
90 S E="60273^3060108^06-01"
91 I A'?1(2N1"-"2N,4N1"-"2N)!(B'?1.2N)!(B>14)!(B<1) QUIT -1
92 I $P(A,"-",2)<1!($P(A,"-",2)>27) QUIT -1
93 S D=$P(A,"-") I D?2N S D=$S(D>70:1900,1:2000)+D
94 ;find the first pay period date of the year
95 S C=$$DT("1/1/"_D,"E"),F=$P(C,U,2) F G=F:1:F+14 QUIT:G-E#14=0
96 S C=$P(A,"-",2)-1*14+G,C=$E($$DT(C+B-1,"H"),1,7)_U_$E($$DT(C,"H"),1,7)_U_$E($$DT(C+13,"H"),1,7)_U_C
97 I $P(A,"-",2)>24 S F=$$DT("1/1/"_(D+1),"E"),F=$P(F,U,2) F B=F:1:F+14 I B-E#14=0 S:B-G/14<$P(A,"-",2) C="-1^"_(B-G/14) QUIT
98 QUIT C
99 ;
100 ; a= ien of 450, b=pay period yyyy-pp or yy-pp or ien of file #458
101RSHR(A,B) ;ef - ^1-first week recess hrs in file 458.8, ^2 - second week recess hrs
102 N C
103 S:B?1.N B=$P(^PRST(458,B,0),U) S:B?2N1"-".E B=$S(B<70:20,1:19)_B
104 D RSPP^PRSARC05(.C,A,B)
105 QUIT +$G(C(+$$PPDT(B,1)))_"^"_+$G(C(+$$PPDT(B,8)))
106 ;
107 ;a=8b string, b=week1 code^value length^week2 code^value length, c=1 if 3-digit hr
108CD8B(A,B,C) ;ef - ^1=week 1 value (hours if c=1), ^2=week 2 value (hours if c=1)
109 N D,E
110 S D=$E(A,33,999),E=$P(D,$P(B,U),2),D=$P(D,$P(B,U,3),2)
111 S:E]"" E=$E(E,1,$P(B,U,2)),E=$S(C=1:E/10+(E#10*.15),1:E) S:D]"" D=$E(D,1,$P(B,U,4)),D=$S(C=1:D/10+(D#10*.15),1:D)
112 QUIT $G(E)_U_$G(D)
Note: See TracBrowser for help on using the repository browser.