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

PSUOP5.m

Go to the documentation of this file.
PSUOP5 ;BIR/CFL,TJH;PSU PBM Outpatient Pharmacy summary statistical data; 08/25/1998
 ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
 ;
RECLOOP ; loop through 'by-drug' totals to get grand totals
 ;
 ;
 S PSUSITE=""
 F  S PSUSITE=$O(^XTMP(PSUOPSUB,"DRUG",PSUSITE)) Q:PSUSITE=""  D
 .F I=1:1:9 S PSUSUMT(I)=0
 .S PSUDNM=""
 .F  S PSUDNM=$O(^XTMP(PSUOPSUB,"DRUG",PSUSITE,PSUDNM)) Q:PSUDNM=""  D
 ..S PSUNR=$G(^XTMP(PSUOPSUB,"DRUG",PSUSITE,PSUDNM,"N"))
 ..S PSUYR=$G(^XTMP(PSUOPSUB,"DRUG",PSUSITE,PSUDNM,"Y"))
 ..F I=1:1:4 S PSUSUMT(I)=PSUSUMT(I)+$P(PSUNR,U,I)
 ..F I=5:1:7 S PSUSUMT(I)=PSUSUMT(I)+$P(PSUYR,U,I-3)
 .S PSUDVD=(PSUSUMT(1)+PSUSUMT(2)+PSUSUMT(3))
 .I PSUDVD S PSUSUMT(8)=PSUSUMT(4)/PSUDVD
 .S PSUDVD=(PSUSUMT(5)+PSUSUMT(6))
 .I PSUDVD S PSUSUMT(9)=PSUSUMT(7)/PSUDVD
 .F I=1:1:9 S $P(PSUREC,U,I)=PSUSUMT(I)
 .S ^XTMP(PSUOPSUB,"SUMMARY",PSUSITE)=PSUREC
 Q
 ;
RECSUM ;Set up statistical summary data to be printed
 I PSUNOREC Q
 K PSULINE,J
 S Y=PSUSDT X ^DD("DD") S PSUDTS=Y
 S Y=PSUEDT X ^DD("DD") S PSUDTE=Y
 F I=1:1:9 S J(I)=$P(^XTMP(PSUOPSUB,"SUMMARY",PSUDIV),"^",I)
 S PSULINE(1)="Outpatient Statistical Data Summary for "_PSUDTS_" through "_PSUDTE
 S PSULINE(2)=" "
 S X="",X=$$SETSTR^VALM1("Consolidated Mail Out Pharmacy (CMOP)",X,43,37)
 S PSULINE(3)=X
 S PSULINE(4)=" "
 S X="",X=$$SETSTR^VALM1("Total",X,34,5),X=$$SETSTR^VALM1("Total",X,69,5)
 S PSULINE(5)=X
 S X="",X="Partials",X=$$SETSTR^VALM1("Fills",X,13,5)
 S X=$$SETSTR^VALM1("Refills",X,22,7),X=$$SETSTR^VALM1("Cost",X,35,4)
 S X=$$SETSTR^VALM1("Fills",X,48,5),X=$$SETSTR^VALM1("Refills",X,57,7)
 S X=$$SETSTR^VALM1("Cost",X,70,4)
 S PSULINE(6)=X
 S PSULINE(7)=$E(PSUDASH,1,79)
 S X=$J(J(1),6)_$J(J(2),10)_$J(J(3),11)_$J(J(4),12,2)_$J(J(5),12)_$J(J(6),11)_$J(J(7),12,2)
 S PSULINE(8)=X
 S PSULINE(9)=" "
 S X=$E("Avg. Cost/Fill = $"_$J(J(8),0,2)_PSUFILL,1,47)_"Avg. Cost/Fill = $"_$J(J(9),0,2)
 S PSULINE(10)=X
 S XMCHAN=1
 S XMSUB="V. 4.0 PBMOP "_$G(PSUMON)_" "_PSUDIV_" "_PSUDIVNM
 S XMTEXT="PSULINE("
 M XMY=PSUXMYS1
 D ^XMD
 M ^XTMP(PSUOPSUB,"STATSUM",PSUDIV)=PSULINE
 Q
 ;
DRUGSUM ; create the Drug Summary
 ;VMP OIFO BAY PINES;ELR;PSU*3.0*32
 K ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV)
 S PSUHDR0="Outpatient Statistical Data for "_PSUDTS_" through "_PSUDTE
 S PSUHDR1=$J("Total     Total Qty",96)
 S PSUHDR2="Drug Name"_$J("Partials    Fills  Refills     Cost     Dispensed",87)
 S PSUHDR3="Drug Name"_$J("Fills  Refills     Cost     Dispensed",87)
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,1)=PSUHDR0
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,2)=$J("Page: 1",89)
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,3)=" "
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,4)=PSUHDR1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,5)=PSUHDR2
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,6)=$E(PSUDASH,1,96)
 S PSUDN="",PSULN=6
 F I=1:1:4 S PSUTOT(I)=0
 F  S PSUDN=$O(^XTMP(PSUOPSUB,"DRUG",PSUDIV,PSUDN)) Q:PSUDN=""  D
 .S PSUR=$G(^XTMP(PSUOPSUB,"DRUG",PSUDIV,PSUDN,"N"))
 .Q:PSUR=""
 .F I=1:1:7 S PSUF(I)=$P(PSUR,U,I) S:I<5 PSUTOT(I)=PSUTOT(I)+PSUF(I)
 .S PSULINE=$E(PSUDN_" "_PSUF(6)_PSUF(7)_PSUFILL,1,43)_$J(PSUF(1),9)
 .S PSULINE=PSULINE_$J(PSUF(2),9)_$J(PSUF(3),9)_$J(PSUF(4),13,2)_$J(PSUF(5),13,2)
 .S PSULN=PSULN+1
 .S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSULINE
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=$E(PSUDASH,1,96)
 S PSULN=PSULN+1
 S PSULINE=$E("Totals:"_PSUFILL,1,43)_$J(PSUTOT(1),9)_$J(PSUTOT(2),9)_$J(PSUTOT(3),9)_$J(PSUTOT(4),13,2)
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSULINE
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=" "
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)="* Non-Formulary"
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)="# Not on National Formulary"
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=" "
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=$J("Consolidated Mail Out Pharmacy (CMOP)",66)
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=" "
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSUHDR1
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSUHDR3
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=$E(PSUDASH,1,96)
 S PSUDN=""
 F I=1:1:4 S PSUTOT(I)=0
 F  S PSUDN=$O(^XTMP(PSUOPSUB,"DRUG",PSUDIV,PSUDN)) Q:PSUDN=""  D
 .S PSUR=$G(^XTMP(PSUOPSUB,"DRUG",PSUDIV,PSUDN,"Y"))
 .Q:PSUR=""
 .F I=1:1:7 S PSUF(I)=$P(PSUR,U,I) S:I<5 PSUTOT(I)=PSUTOT(I)+PSUF(I)
 .S PSULINE=$E(PSUDN_" "_PSUF(6)_PSUF(7)_PSUFILL,1,43)_$J("",9)
 .S PSULINE=PSULINE_$J(PSUF(2),9)_$J(PSUF(3),9)_$J(PSUF(4),13,2)_$J(PSUF(5),13,2)
 .S PSULN=PSULN+1
 .S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSULINE
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=$E(PSUDASH,1,96)
 S PSULN=PSULN+1
 S PSULINE=$E("Totals:"_PSUFILL,1,43)_$J("",9)_$J(PSUTOT(2),9)_$J(PSUTOT(3),9)_$J(PSUTOT(4),13,2)
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSULINE
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=" "
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)="* Non-Formulary"
 S PSULN=PSULN+1
 S ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)="# Not on National Formulary"
 S XMSUB="V. 4.0 PBMOP "_PSUMON_" "_PSUDIV_" "_PSUDIVNM
 S XMTEXT="^XTMP(PSUOPSUB,""DRUGSUM"",PSUDIV,"
 S XMCHAN=1
 M XMY=PSUXMYS2
 D ^XMD
 Q