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

PSSDOSLZ.m

Go to the documentation of this file.
PSSDOSLZ ;BIR/RTR-Dosage edit ;10/24/01
 ;;1.0;PHARMACY DATA MANAGEMENT;**49**;9/30/97
 ;
 ;Reference to ^PS(50.607 supported by DBIA 2221
 ;
SET ;x-ref on Dispense Unit per Dose to set Dose field
 N PSSUNIT,PSSUNITV,PSSDOSEV,PSS2,PSS1,PSS3,PSSU1,PSSUNITA,PSSUNITB,PSSUSL,PSSUST,PSSU50,PSSUSL2,PSSUSL3,PSSUSL4,PSSUSL5
 N PSSUZ,PSSUZ1,PSSUZD
 S PSSDOSEV=+$G(X)*+$P($G(^PSDRUG(PSSIEN,"DOS")),"^")
 S PSSUNIT=$P($G(^PS(50.607,+$P($G(^PSDRUG(PSSIEN,"DOS")),"^",2),0)),"^")
 S PSSUSL=0 I PSSUNIT["/" S PSSUST=$$PSJST^PSNAPIS(+$P($G(^PSDRUG(PSSIEN,"ND")),"^"),+$P($G(^PSDRUG(PSSIEN,"ND")),"^",3)) D  S PSSUST=+$P($G(PSSUST),"^",2) I $G(PSSUST),$G(PSSU50),+$G(PSSUST)'=+$G(PSSU50) S PSSUSL=1
 .S PSSU50=$P($G(^PSDRUG(PSSIEN,"DOS")),"^")
 I PSSUNIT["/" S PSSUNITA=$P(PSSUNIT,"/"),PSSUNITB=$P(PSSUNIT,"/",2),PSS1=+$G(PSSUNITA),PSSU1=+$G(PSSUNITB)
 I PSSUNIT["/",$G(PSSUSL) S PSSUSL2=PSSU50/PSSUST,PSSUSL3=PSSUSL2*X S PSSUSL4=PSSUSL3*$S($G(PSSU1):PSSU1,1:1) S PSSUSL5=$S('$G(PSSU1):PSSUSL4_$G(PSSUNITB),1:PSSUSL4_$P(PSSUNITB,PSSU1,2))
 I PSSUNIT["/" S PSSUNITV=$S('$G(PSS1):PSSDOSEV,1:($G(PSS1)*PSSDOSEV))_$S($G(PSS1):$P(PSSUNITA,PSS1,2),1:PSSUNITA)_"/"_$S($G(PSSUSL):$G(PSSUSL5),'$G(PSSU1):X_PSSUNITB,1:(X*+PSSU1)_$P(PSSUNITB,PSSU1,2))
 I PSSUNIT'["/" S PSSUNITV=PSSDOSEV_PSSUNIT
 I $G(PSSUNITV)["/." S PSSUZD=$G(PSSUNITV) D
 .S PSSUZ=$P(PSSUZD,"/."),PSSUZ1=$P(PSSUZD,"/.",2)
 .S PSSUNITV=$G(PSSUZ)_"/0."_$G(PSSUZ1)
 S X=$S($E($G(PSSUNITV),1)=".":"0",1:"")_$G(PSSUNITV)
 Q