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

PSSP134.m

Go to the documentation of this file.
PSSP134 ;REPORT OF REFORMATTED LOCAL POSSIBLE DOSES
 ;;1.0;PHARMACY DATA MANAGEMENT;**134**;9/30/97;Build 8
 ;
LOOP ;LOOP THROUGH DRUG FILE FOR ALL LOCAL POSSIBLE DOSES
 N PSSDRUG,PSSLPD2,PSSNLPD,PSSLPDX,PSSXDT,X1,X2,X,PSSDRUGN
 K ^XTMP("PSSP134")
 S X1=DT,X2=90 D C^%DTC S PSSXDT=$G(X)
 S ^XTMP("PSSP134",0)=PSSXDT_"^"_DT
 S PSSDRUG=0 F  S PSSDRUG=$O(^PSDRUG(PSSDRUG)) Q:'PSSDRUG  D
 .S PSSLPDX=0 F  S PSSLPDX=$O(^PSDRUG(PSSDRUG,"DOS2",PSSLPDX)) Q:'PSSLPDX  D
 ..S PSSLPD2=$P($G(^PSDRUG(PSSDRUG,"DOS2",PSSLPDX,0)),"^",1)
 ..I PSSLPD2="" Q
 ..S PSSNLPD=$$DOSE(PSSLPD2)
 ..S PSSDRUGN=$P($G(^PSDRUG(PSSDRUG,0)),"^")
 ..S ^XTMP("PSSP134",PSSDRUGN,PSSDRUG,PSSLPDX)=PSSLPD2_"^"_PSSNLPD
 D REPORT
 Q
 ;
DOSE(PSSDOSE) ;
 N PSSCHAR,PSSXX,PSSDOSR
 S (PSSXX,PSSDOSR)=""
 F PSSXX=1:1:$L(PSSDOSE) D
 .S PSSCHAR=$E(PSSDOSE,PSSXX)
 .I PSSCHAR=".",$E(PSSDOSE,PSSXX+1),$E(PSSDOSR,$L(PSSDOSR))'?1N S PSSCHAR=0_PSSCHAR
 .I PSSDOSR]"",$E(PSSDOSR,$L(PSSDOSR))?1N,PSSCHAR'?1N,"() -./%,"'[PSSCHAR S PSSDOSR=PSSDOSR_" "_PSSCHAR Q
 .I PSSDOSR]"",$E(PSSDOSR,$L(PSSDOSR))'?1N,"() -./%,"'[$E(PSSDOSR,$L(PSSDOSR)),PSSCHAR?1N S PSSDOSR=PSSDOSR_" "_PSSCHAR Q
 .I PSSDOSR]"",$E(PSSDOSR,$L(PSSDOSR))?1N,PSSCHAR'?1N S PSSDOSR=PSSDOSR_PSSCHAR Q
 .I PSSDOSR]"",$E(PSSDOSR,$L(PSSDOSR))'?1N,PSSCHAR'?1N S PSSDOSR=PSSDOSR_PSSCHAR Q
 .S PSSDOSR=PSSDOSR_PSSCHAR
 .Q
 Q PSSDOSR
 ;
REPORT ;REPORT OF LOCAL POSSIBLE DOSES BEFORE AND AFTER
 N XMDUZ,XMSUB,XMTEXT,XMY,Y,PSSDT,PSSXDT,DIFROM,PSSI
 K ^XTMP("PSSP134R")
 S X1=DT,X2=90 D C^%DTC S PSSXDT=$G(X)
 S ^XTMP("PSSP134R",0)=PSSXDT_"^"_DT
 S XMDUZ="REFORMATTED LOCAL POSSIBLE DOSES",XMSUB="REFORMATTED LOCAL POSSIBLE DOSES",XMTEXT="^XTMP(""PSSP134R"","
 I $D(^XUSEC("PSNMGR")) F PSSI=0:0 S PSSI=$O(^XUSEC("PSNMGR",PSSI)) Q:'PSSI  S XMY(PSSI)=""
 D NOW^%DTC S Y=% X ^DD("DD") S PSSDT=Y
 S ^XTMP("PSSP134R",1)="REFORMATTED LOCAL POSSIBLE DOSES USING API ASSOCIATED WITH PSS*1.0*78"
 S ^XTMP("PSSP134R",2)=PSSDT
 S ^XTMP("PSSP134R",3)=""
 N PSSLPD,PSSNLPD,PSSDRUG,PSSLPDX,PSSLPDD,PSSLINE,PSSXX,PSSDRUGN,PSSSPC,PSSX
 ;
 S PSSXX=4,PSSLINE="",PSSSPC=""
 F PSSX=1:1:50 S $E(PSSLINE,PSSXX)="-",$E(PSSSPC,PSSXX)=" "
 S PSSDRUGN="" F  S PSSDRUGN=$O(^XTMP("PSSP134",PSSDRUGN)) Q:PSSDRUGN=""  D
 .S PSSDRUG=0 F  S PSSDRUG=$O(^XTMP("PSSP134",PSSDRUGN,PSSDRUG)) Q:'PSSDRUG  D
 ..S ^XTMP("PSSP134R",PSSXX)=$P($G(^PSDRUG(PSSDRUG,0)),"^",1)_" (#"_PSSDRUG_")"
 ..S PSSXX=PSSXX+1
 ..S PSSLPDX=0 F  S PSSLPDX=$O(^XTMP("PSSP134",PSSDRUGN,PSSDRUG,PSSLPDX)) Q:'PSSLPDX  D
 ...S PSSLPDD=^XTMP("PSSP134",PSSDRUGN,PSSDRUG,PSSLPDX)
 ...S PSSLPD=$P(PSSLPDD,"^"),PSSNLPD=$P(PSSLPDD,"^",2)
 ...S ^XTMP("PSSP134R",PSSXX)=$E(PSSSPC,1,10)_PSSLPD
 ...S ^XTMP("PSSP134R",PSSXX+1)=$E(PSSSPC,1,10)_PSSNLPD
 ...S ^XTMP("PSSP134R",PSSXX+2)=""
 ...S PSSXX=PSSXX+3
 D ^XMD
 Q