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

PSUUD3.m

Go to the documentation of this file.
PSUUD3 ;BIR/TJH/,PDW - PBM UNIT DOSE OUTPUT ;25 AUG 1998
 ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
EN ;
 ;
NONE ; send "no data" message if nothing collected
 I '$D(^XTMP(PSUUDSUB,"DETAIL")) D  Q
 .S ^XTMP("PSU_"_PSUJOB,"PSUNONE","UD")=""
 .S NONE=1
 .K PSUXMY,^XTMP(PSUUDSUB,"RECORDS")
 .M PSUXMY=PSUXMYS1
 .I PSUMASF!PSUPBMG M PSUXMY=PSUXMYH
 .S ^XTMP(PSUUDSUB,"RECORDS",PSUSNDR,1)="No data to report"
 .D EN^PSUUD4(.PSUMSGT)
 .S ^XTMP("PSU_"_PSUJOB,"CONFIRM",PSUSNDR,PSUOPTN,"L")=0
 .S ^XTMP("PSU_"_PSUJOB,"CONFIRM",PSUSNDR,PSUOPTN,"M")=1
NONEQ ; routine does not pass this point if "no data" due to Quit at NONE+1
 ;
MMFULL ; send full detail to Hines if Master File update was selected
 K PSUXMY,^XTMP(PSUUDSUB,"RECORDS")
 M PSUXMY=PSUXMYH
 M ^XTMP(PSUUDSUB,"RECORDS")=^XTMP(PSUUDSUB,"DETAIL")
 D EN^PSUUD6    ;AMIS Summary report
 I 'PSUSMRY D
 .D EN^PSUUD4(.PSUMSGT)
 .M ^XTMP("PSU_"_PSUJOB,"CONFIRM")=PSUMSGT
 ;
 ;
MMSSUM ; statistical summary
 N PSUUDFLG S PSUUDFLG=1         ;Flag for summary reports
 S $P(SPACES," ",81)="",$P(DASH,"-",81)=""
 K PSUXMY,^XTMP(PSUUDSUB,"RECORDS"),^XTMP(PSUUDSUB,"STATSUM")
 M PSUXMY=PSUXMYS1
 S PSUFACN=""
 F  S PSUFACN=$O(^XTMP(PSUUDSUB,"DIS",PSUFACN)) Q:PSUFACN=""  D
 .S PSUF2=$G(^XTMP(PSUUDSUB,"SSN",PSUFACN)) ; Total patients
 .S PSUDIV=PSUFACN D GETDIV^PSUV3 I PSUDIVNM'="" D
 ..S ^XTMP("PSU_"_PSUJOB,"PSUCT",PSUDIVNM)=PSUF2
 .I PSUDIVNM="" S ^XTMP("PSU_"_PSUJOB,"PSUCT",PSUDIV)=PSUF2
 ;
MMDRUG ; summary by drug
 K ^XTMP(PSUUDSUB,"RECORDS"),^XTMP(PSUUDSUB,"DRUGSUM")
 Q:PSUSMRY        ;Don't print if user wants summary only
 ;
 K PSUXMY
 M PSUXMY=PSUXMYS2
 S PSUFACN=""
 F  S PSUFACN=$O(^XTMP(PSUUDSUB,"DRUG",PSUFACN)) Q:PSUFACN=""  D
 .S X="Unit Dose Statistical Data for "_PSURP("START")_" through "_PSURP("END")
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,1)=X
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,2)=" "
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,3)=" "
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,4)=$E(SPACES,1,50)_"Total"_$E(SPACES,1,11)_"Total"
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,5)=$E(SPACES,1,50)_"Dispensed"_$E(SPACES,1,7)_"Dispensed"
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,6)="Drug Name"_$E(SPACES,1,41)_"Units"_$E(SPACES,1,11)_"Cost"
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,7)=$E(DASH,1,75)
 .S PSUX="",PSULN=7,PSUGTC=0,PSUGTU=0
 .F  S PSUX=$O(^XTMP(PSUUDSUB,"DRUG",PSUFACN,PSUX)) Q:PSUX=""  D
 ..S PSUR=^XTMP(PSUUDSUB,"DRUG",PSUFACN,PSUX)
 ..S PSUTU=$P(PSUR,U,1),PSUPPU=$P(PSUR,U,2),PSUNON=$P(PSUR,U,3),PSUNFI=$P(PSUR,U,4)
 ..S PSUTC=PSUTU*PSUPPU,PSUGTC=PSUGTC+PSUTC,PSUGTU=PSUGTU+PSUTU
 ..S PSUDN=$E(PSUX,1,40)_" "_$S(PSUNON="N/F":"*",1:"")_$S(PSUNFI=0:"#",1:"")
 ..S PSULN=PSULN+1
 ..S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,PSULN)=$E(PSUDN_SPACES,1,45)_$J(PSUTU,12,2)_"    "_$J(PSUTC,12,2)
 .S PSULN=PSULN+1
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,PSULN)=$E(DASH,1,75)
 .S PSULN=PSULN+1
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,PSULN)="Totals:"_$E(SPACES,1,38)_$J(PSUGTU,12,2)_"    "_$J(PSUGTC,12,2)
 .S PSULN=PSULN+1
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,PSULN)=" "
 .S PSULN=PSULN+1
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,PSULN)="* Non-Formulary"
 .S PSULN=PSULN+1
 .S ^XTMP(PSUUDSUB,"DRUGSUM",PSUFACN,PSULN)="# Not on National Formulary"
 M ^XTMP(PSUUDSUB,"RECORDS")=^XTMP(PSUUDSUB,"DRUGSUM")
 D EN^PSUUD4(.PSUMSGT)
 K ^XTMP(PSUUDSUB,"RECORDS")
 ;
 Q