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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSUOP5 5292 printed Oct 16, 2024@18:28:54 Page 2
PSUOP5 ;BIR/CFL,TJH;PSU PBM Outpatient Pharmacy summary statistical data; 08/25/1998
+1 ;;4.0;PHARMACY BENEFITS MANAGEMENT;;MARCH, 2005
+2 ;
RECLOOP ; loop through 'by-drug' totals to get grand totals
+1 ;
+2 ;
+3 SET PSUSITE=""
+4 FOR
SET PSUSITE=$ORDER(^XTMP(PSUOPSUB,"DRUG",PSUSITE))
if PSUSITE=""
QUIT
Begin DoDot:1
+5 FOR I=1:1:9
SET PSUSUMT(I)=0
+6 SET PSUDNM=""
+7 FOR
SET PSUDNM=$ORDER(^XTMP(PSUOPSUB,"DRUG",PSUSITE,PSUDNM))
if PSUDNM=""
QUIT
Begin DoDot:2
+8 SET PSUNR=$GET(^XTMP(PSUOPSUB,"DRUG",PSUSITE,PSUDNM,"N"))
+9 SET PSUYR=$GET(^XTMP(PSUOPSUB,"DRUG",PSUSITE,PSUDNM,"Y"))
+10 FOR I=1:1:4
SET PSUSUMT(I)=PSUSUMT(I)+$PIECE(PSUNR,U,I)
+11 FOR I=5:1:7
SET PSUSUMT(I)=PSUSUMT(I)+$PIECE(PSUYR,U,I-3)
End DoDot:2
+12 SET PSUDVD=(PSUSUMT(1)+PSUSUMT(2)+PSUSUMT(3))
+13 IF PSUDVD
SET PSUSUMT(8)=PSUSUMT(4)/PSUDVD
+14 SET PSUDVD=(PSUSUMT(5)+PSUSUMT(6))
+15 IF PSUDVD
SET PSUSUMT(9)=PSUSUMT(7)/PSUDVD
+16 FOR I=1:1:9
SET $PIECE(PSUREC,U,I)=PSUSUMT(I)
+17 SET ^XTMP(PSUOPSUB,"SUMMARY",PSUSITE)=PSUREC
End DoDot:1
+18 QUIT
+19 ;
RECSUM ;Set up statistical summary data to be printed
+1 IF PSUNOREC
QUIT
+2 KILL PSULINE,J
+3 SET Y=PSUSDT
XECUTE ^DD("DD")
SET PSUDTS=Y
+4 SET Y=PSUEDT
XECUTE ^DD("DD")
SET PSUDTE=Y
+5 FOR I=1:1:9
SET J(I)=$PIECE(^XTMP(PSUOPSUB,"SUMMARY",PSUDIV),"^",I)
+6 SET PSULINE(1)="Outpatient Statistical Data Summary for "_PSUDTS_" through "_PSUDTE
+7 SET PSULINE(2)=" "
+8 SET X=""
SET X=$$SETSTR^VALM1("Consolidated Mail Out Pharmacy (CMOP)",X,43,37)
+9 SET PSULINE(3)=X
+10 SET PSULINE(4)=" "
+11 SET X=""
SET X=$$SETSTR^VALM1("Total",X,34,5)
SET X=$$SETSTR^VALM1("Total",X,69,5)
+12 SET PSULINE(5)=X
+13 SET X=""
SET X="Partials"
SET X=$$SETSTR^VALM1("Fills",X,13,5)
+14 SET X=$$SETSTR^VALM1("Refills",X,22,7)
SET X=$$SETSTR^VALM1("Cost",X,35,4)
+15 SET X=$$SETSTR^VALM1("Fills",X,48,5)
SET X=$$SETSTR^VALM1("Refills",X,57,7)
+16 SET X=$$SETSTR^VALM1("Cost",X,70,4)
+17 SET PSULINE(6)=X
+18 SET PSULINE(7)=$EXTRACT(PSUDASH,1,79)
+19 SET X=$JUSTIFY(J(1),6)_$JUSTIFY(J(2),10)_$JUSTIFY(J(3),11)_$JUSTIFY(J(4),12,2)_$JUSTIFY(J(5),12)_$JUSTIFY(J(6),11)_$JUSTIFY(J(7),12,2)
+20 SET PSULINE(8)=X
+21 SET PSULINE(9)=" "
+22 SET X=$EXTRACT("Avg. Cost/Fill = $"_$JUSTIFY(J(8),0,2)_PSUFILL,1,47)_"Avg. Cost/Fill = $"_$JUSTIFY(J(9),0,2)
+23 SET PSULINE(10)=X
+24 SET XMCHAN=1
+25 SET XMSUB="V. 4.0 PBMOP "_$GET(PSUMON)_" "_PSUDIV_" "_PSUDIVNM
+26 SET XMTEXT="PSULINE("
+27 MERGE XMY=PSUXMYS1
+28 DO ^XMD
+29 MERGE ^XTMP(PSUOPSUB,"STATSUM",PSUDIV)=PSULINE
+30 QUIT
+31 ;
DRUGSUM ; create the Drug Summary
+1 ;VMP OIFO BAY PINES;ELR;PSU*3.0*32
+2 KILL ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV)
+3 SET PSUHDR0="Outpatient Statistical Data for "_PSUDTS_" through "_PSUDTE
+4 SET PSUHDR1=$JUSTIFY("Total Total Qty",96)
+5 SET PSUHDR2="Drug Name"_$JUSTIFY("Partials Fills Refills Cost Dispensed",87)
+6 SET PSUHDR3="Drug Name"_$JUSTIFY("Fills Refills Cost Dispensed",87)
+7 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,1)=PSUHDR0
+8 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,2)=$JUSTIFY("Page: 1",89)
+9 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,3)=" "
+10 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,4)=PSUHDR1
+11 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,5)=PSUHDR2
+12 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,6)=$EXTRACT(PSUDASH,1,96)
+13 SET PSUDN=""
SET PSULN=6
+14 FOR I=1:1:4
SET PSUTOT(I)=0
+15 FOR
SET PSUDN=$ORDER(^XTMP(PSUOPSUB,"DRUG",PSUDIV,PSUDN))
if PSUDN=""
QUIT
Begin DoDot:1
+16 SET PSUR=$GET(^XTMP(PSUOPSUB,"DRUG",PSUDIV,PSUDN,"N"))
+17 if PSUR=""
QUIT
+18 FOR I=1:1:7
SET PSUF(I)=$PIECE(PSUR,U,I)
if I<5
SET PSUTOT(I)=PSUTOT(I)+PSUF(I)
+19 SET PSULINE=$EXTRACT(PSUDN_" "_PSUF(6)_PSUF(7)_PSUFILL,1,43)_$JUSTIFY(PSUF(1),9)
+20 SET PSULINE=PSULINE_$JUSTIFY(PSUF(2),9)_$JUSTIFY(PSUF(3),9)_$JUSTIFY(PSUF(4),13,2)_$JUSTIFY(PSUF(5),13,2)
+21 SET PSULN=PSULN+1
+22 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSULINE
End DoDot:1
+23 SET PSULN=PSULN+1
+24 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=$EXTRACT(PSUDASH,1,96)
+25 SET PSULN=PSULN+1
+26 SET PSULINE=$EXTRACT("Totals:"_PSUFILL,1,43)_$JUSTIFY(PSUTOT(1),9)_$JUSTIFY(PSUTOT(2),9)_$JUSTIFY(PSUTOT(3),9)_$JUSTIFY(PSUTOT(4),13,2)
+27 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSULINE
+28 SET PSULN=PSULN+1
+29 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=" "
+30 SET PSULN=PSULN+1
+31 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)="* Non-Formulary"
+32 SET PSULN=PSULN+1
+33 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)="# Not on National Formulary"
+34 SET PSULN=PSULN+1
+35 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=" "
+36 SET PSULN=PSULN+1
+37 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=$JUSTIFY("Consolidated Mail Out Pharmacy (CMOP)",66)
+38 SET PSULN=PSULN+1
+39 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=" "
+40 SET PSULN=PSULN+1
+41 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSUHDR1
+42 SET PSULN=PSULN+1
+43 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSUHDR3
+44 SET PSULN=PSULN+1
+45 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=$EXTRACT(PSUDASH,1,96)
+46 SET PSUDN=""
+47 FOR I=1:1:4
SET PSUTOT(I)=0
+48 FOR
SET PSUDN=$ORDER(^XTMP(PSUOPSUB,"DRUG",PSUDIV,PSUDN))
if PSUDN=""
QUIT
Begin DoDot:1
+49 SET PSUR=$GET(^XTMP(PSUOPSUB,"DRUG",PSUDIV,PSUDN,"Y"))
+50 if PSUR=""
QUIT
+51 FOR I=1:1:7
SET PSUF(I)=$PIECE(PSUR,U,I)
if I<5
SET PSUTOT(I)=PSUTOT(I)+PSUF(I)
+52 SET PSULINE=$EXTRACT(PSUDN_" "_PSUF(6)_PSUF(7)_PSUFILL,1,43)_$JUSTIFY("",9)
+53 SET PSULINE=PSULINE_$JUSTIFY(PSUF(2),9)_$JUSTIFY(PSUF(3),9)_$JUSTIFY(PSUF(4),13,2)_$JUSTIFY(PSUF(5),13,2)
+54 SET PSULN=PSULN+1
+55 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSULINE
End DoDot:1
+56 SET PSULN=PSULN+1
+57 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=$EXTRACT(PSUDASH,1,96)
+58 SET PSULN=PSULN+1
+59 SET PSULINE=$EXTRACT("Totals:"_PSUFILL,1,43)_$JUSTIFY("",9)_$JUSTIFY(PSUTOT(2),9)_$JUSTIFY(PSUTOT(3),9)_$JUSTIFY(PSUTOT(4),13,2)
+60 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=PSULINE
+61 SET PSULN=PSULN+1
+62 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)=" "
+63 SET PSULN=PSULN+1
+64 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)="* Non-Formulary"
+65 SET PSULN=PSULN+1
+66 SET ^XTMP(PSUOPSUB,"DRUGSUM",PSUDIV,PSULN)="# Not on National Formulary"
+67 SET XMSUB="V. 4.0 PBMOP "_PSUMON_" "_PSUDIV_" "_PSUDIVNM
+68 SET XMTEXT="^XTMP(PSUOPSUB,""DRUGSUM"",PSUDIV,"
+69 SET XMCHAN=1
+70 MERGE XMY=PSUXMYS2
+71 DO ^XMD
+72 QUIT