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

PSJSPU0.m

Go to the documentation of this file.
PSJSPU0 ;BIR/CML3-SCHEDULE PROCESSOR UTILITY CONT. ;16 DEC 97 / 1:43 PM 
 ;;5.0; INPATIENT MEDICATIONS ;;16 DEC 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