VistA-FOIAVistA/r/PHARMACY_DATA_MANAGEMENT-PSS/PSSJSPU0.m

15 lines
859 B
Mathematica
Raw Permalink Normal View History

PSSJSPU0 ;BIR/CML3,WRT-SCHEDULE PROCESSOR UTILITY CONT. ; 06/24/96 9:22
;;1.0;PHARMACY DATA MANAGEMENT;;9/30/97
;
ENDSD ; calculate default start date
N %,%H,%I,ET,FT,LT,NT,X,X1,X2,Y D NOW^%DTC
I $S(PSJTS="O":1,'PSJAT:1,PSJSCH="NOW":1,PSJSCH="STAT":1,PSJSCH="ONCE":1,PSJSCH="ONE-TIME":1,PSJSCH="ONE TIME":1,1:PSJSCH="ON CALL") S PSJX=$E(%,1,10)+($E(%,11,12)>30/100) Q:$P(PSJX,".",2) S X1=PSJX_.24,X2=-1 D C^%DTC S PSJX=X Q
S NT=%#1,FT="."_$P(PSJAT,"-"),LT="."_$P(PSJAT,"-",$L(PSJAT,"-"))
I FT=LT S ET=FT,X2=$S(NT>FT:FT+.24-NT<(NT-FT),1:$S(NT+.24-FT<(FT-NT):-1,1:0)) G SADD
I NT>LT S ET=$S(FT+.24-NT<(NT-LT):FT,1:LT),X2=ET=FT G SADD
I NT<FT S ET=$S(NT+.24-LT<(FT-NT):LT,1:FT),X2=$S(ET=LT:-1,1:0)
E S LT=1,X2=0 F F=1:1 S FT="."_$P(PSJAT,"-",F) Q:'FT S TT=FT-NT S:TT<0 TT=-TT S:TT<LT ET=FT,LT=TT
SADD ;
S (X,X1)=$P(%,".") D:X2 C^%DTC S PSJX=X_ET
Q