Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PRSU1B2

PRSU1B2.m

Go to the documentation of this file.
  1. PRSU1B2 ;WOIFO/PLT-UTILITY ; 24-Aug-2005 10:34 AM
  1. ;;4.0;PAID;**112**;Sep 21, 1995;Build 54
  1. ;;Per VHA Directive 2004-038, this routine should not be modified
  1. QUIT ; invalid entry
  1. ;
  1. ;prsa date ~1=[label]^routine, ~2=task description
  1. ;prsb data ~1=variable name/global root, ~2...
  1. ;prsc data ~1=1 if ask start time, ~2=start time (fm time/$h-time), ~3=keep until time (fm/$h)
  1. ; ~4=i/o device name, ~5=priority(1-10),
  1. ; ~6=task uci, ~7=volume set,
  1. TASK(PRSA,PRSB,PRSC) ;ef value ^1 task number, ^2=start time(fm/$h)
  1. ;task set-up
  1. N ZTRN,ZTDESC,ZTDTH,ZTIO,ZTUCI,ZTCPU,ZTPRI,ZTSAVE,ZTKIL,ZTSK
  1. N A,B
  1. S ZTRTN=$P(PRSA,"~"),ZTDESC=$P(PRSA,"~",2)
  1. I $G(PRSB)]"" F A=1:1 Q:$P(PRSB,"~",A,999)="" S B=$P(PRSB,"~",A) S:B]"" @("ZTSAVE("""_B_""")=""""")
  1. S ZTIO=""
  1. S PRSC=$G(PRSC) S:'PRSC ZTDTH=$S($P(PRSC,"~",2)="":$H,1:$P(PRSC,"~",2))
  1. I $P(PRSC,"~",3,999)]"" D
  1. . S:$P(PRSC,"~",3)]"" ZTKILL=$P(PRSC,"~",3)
  1. . S:$P(PRSC,"~",4)]"" ZTIO=$P(PRSC,"~",4)
  1. . S:$P(PRSC,"~",5)]"" ZTPRI=$P(PRSC,"~",5)
  1. . S:$P(PRSC,"~",6)]"" ZTUCI=$P(PRSC,"~",6)
  1. . S:$P(PRSC,"~",7)]"" ZTCPU=$P(PRSC,"~",7)
  1. . QUIT
  1. D ^%ZTLOAD
  1. QUIT $G(ZTSK)_"^"_$G(ZTSK("D"))
  1. ;
  1. ;PRSA data ^1=message subject, ^2=message sender's name (option)
  1. ;xmtext text array name with left parenthesis
  1. ;.xmy recipients ri/name, group array, return value ien of 3.9
  1. ;.xmrou routine name array
  1. ;.xmstrip striped character array
  1. MM(PRSA,XMTEXT,XMY,XMROU,XMSTRIP) ;mail message sending
  1. N XMSUB,XMDUZ
  1. S XMSUB=$P(PRSA,"^") S:$P(PRSA,"^",2)]"" XMDUZ=$P(PRSA,"^",2)
  1. D ^XMD K XMY S XMY=XMZ K XMZ
  1. QUIT
  1. ;
  1. ;
  1. ;PRSA=package name (.01) in file 9.4
  1. PKGVER(PRSA) ;ef - ^1=ri of file 9.4, ^2=version number from node version if defined
  1. ; ^3=version number from node 22, ^4=version install date from node 22
  1. N A,B,C
  1. S (A,B)=""
  1. Q:$D(PRSPKVER(PRSA)) PRSPKVER(PRSA)
  1. S A=$O(^DIC(9.4,"B",PRSA,""))
  1. 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)=""
  1. . D EN^DDIOL("Package is defined, but has not current version data.")
  1. . D EN^DDIOL("Please call IRM!")
  1. S:'A PRSPKVER(PRSA)=""
  1. QUIT PRSPKVER(PRSA)
  1. ;
  1. ;A=date/time, B='I' if fileman date/time, 'H' if $H date/time, 'E' if external date
  1. ;C="S" if second required
  1. DT(A,B,C) ;ef value: -1 if wrong format, ^1=fileman.time, ^2=$h date,time
  1. ; ^3-week day, ^4=mm/dd/yy@time, ^5=alpha date@time
  1. N %DT,X,Y,Z,%H,%,%T,%Y
  1. S:'$D(C) C="" S Z=""
  1. I B="E" D QUIT:Z=-1 Z
  1. . S %DT="T" S:C="S" %DT=%DT_"S"
  1. . S X=A D ^%DT S Z=Y
  1. I B="H" D
  1. . 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))
  1. S:Z="" Z=A
  1. S X=Z D H^%DTC S $P(Z,"^",2)=%H_","_%T,$P(Z,"^",3)=%Y
  1. S Y=$P(Z,"^") S:C="S" %DT="S" D DD^%DT S $P(Z,"^",5)=Y,A=$P(Y,"@",2)
  1. S $P(Z,"^",4)=$E(Z,4,5)_"/"_$E(Z,6,7)_"/"_$E(Z,2,3)
  1. S:$P(Z,"^")["." $P(Z,"^",4)=$P(Z,"^",4)_"@"_$TR(A,":",""),$P(Z,"^")=+Z
  1. QUIT Z
  1. ;
  1. ;a - the date, b - date format:E - external, I - internal, H - $h
  1. DTPP(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
  1. ;assume the pp '06-01' starting 1/8/2006 with $h=60273 and fm date 3060108
  1. N C,D,E,F,G
  1. S E="60273^3060108^06-01"
  1. S D=$$DT(A,B),F=+$P(D,U,2) I D=-1 QUIT D
  1. ;find the first pay period date of the year
  1. 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
  1. I G'>F S $P(C,U,2)=$E(B,2,3)_"-"_$E(F-G\14+101,2,3)
  1. 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
  1. 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
  1. QUIT C
  1. ;
  1. ;a - pay period yyyy-nn or yy-nn, b - day #
  1. PPDT(A,B) ;ef- -1 if a,b invalid, date of day # cyymmdd^pp start date cyymmdd^pp ending date^pp start $h date
  1. ;assume 19yy if yy>70 and 20yy if yy'>70
  1. ;assume the pp '06-01' starting 1/8/2006 with $h=60273 and fm date 3060108
  1. N C,D,E,F,G
  1. S E="60273^3060108^06-01"
  1. I A'?1(2N1"-"2N,4N1"-"2N)!(B'?1.2N)!(B>14)!(B<1) QUIT -1
  1. I $P(A,"-",2)<1!($P(A,"-",2)>27) QUIT -1
  1. S D=$P(A,"-") I D?2N S D=$S(D>70:1900,1:2000)+D
  1. ;find the first pay period date of the year
  1. S C=$$DT("1/1/"_D,"E"),F=$P(C,U,2) F G=F:1:F+14 QUIT:G-E#14=0
  1. 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
  1. 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
  1. QUIT C
  1. ;
  1. ; a= ien of 450, b=pay period yyyy-pp or yy-pp or ien of file #458
  1. RSHR(A,B) ;ef - ^1-first week recess hrs in file 458.8, ^2 - second week recess hrs
  1. N C
  1. S:B?1.N B=$P(^PRST(458,B,0),U) S:B?2N1"-".E B=$S(B<70:20,1:19)_B
  1. D RSPP^PRSARC05(.C,A,B)
  1. QUIT +$G(C(+$$PPDT(B,1)))_"^"_+$G(C(+$$PPDT(B,8)))
  1. ;
  1. ;a=8b string, b=week1 code^value length^week2 code^value length, c=1 if 3-digit hr
  1. CD8B(A,B,C) ;ef - ^1=week 1 value (hours if c=1), ^2=week 2 value (hours if c=1)
  1. N D,E
  1. S D=$E(A,33,999),E=$P(D,$P(B,U),2),D=$P(D,$P(B,U,3),2)
  1. 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)
  1. QUIT $G(E)_U_$G(D)