source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOCST10.m@ 1046

Last change on this file since 1046 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.0 KB
RevLine 
[613]1PSOCST10 ;BHAM ISC/SAB - high cost report ; 12/11/96 13:47
2 ;;7.0;OUTPATIENT PHARMACY;**31,56**;DEC 1997
3 ;this routine list rxs that cost over a specified $ amount for a specified date range
4 ;External Ref. ^PSDRUG( is supp. by DBIA# 221
5BEG W ! S %DT(0)=-DT,%DT("A")="Beginning Date: ",%DT="APE" D ^%DT G:Y<0!($D(DTOUT)) EXIT S (%DT(0),BEGDATE)=Y
6 W ! S %DT("A")="Ending Date: " D ^%DT G:Y<0!($D(DTOUT)) EXIT S ENDDATE=Y D:+$E(Y,6,7)=0 DTC
7MAX K DIR S DIR("A")="Dollar Limit ",DIR("B")=30,DIR(0)="N^0:9999:2",DIR("?")="Enter a dollar amount between 0-9999 with no more than two decimals or ^ quit"
8 D ^DIR K DIR G:$D(DIRUT) EXIT S MAX=Y
9DEV K %ZIS,IOP,POP,ZTSK S PSOION=ION,%ZIS="QM" D ^%ZIS K %ZIS I POP S IOP=PSOION D ^%ZIS K IOP,PSOION W !,"Please try later!" G EXIT
10 K PSOION I $D(IO("Q")) D G EXIT
11 .S ZTDESC="Outpatient High Cost Report",ZTRTN="START^PSOCST10" F G="BEGDATE","ENDDATE","MAX" S:$D(@G) ZTSAVE(G)=""
12 .K IO("Q") D ^%ZTLOAD W:$D(ZTSK) !,"Report is Queued to print !!" K ZTSK
13START U IO S PAGE=1,(CNT,TCOST)=0 D HD
14 F NDT=BEGDATE:1:ENDDATE F TY="AL","AM" S PSDT=NDT D ST1 Q:$D(DIRUT)
15 Q:$D(DIRUT) D HD:($Y+4)>IOSL
16 D:'$D(DIRUT) FT
17EXIT W ! D ^%ZISC K XTYPE,DIR,DTOUT,DUOUT,DIROUT,DIRUT,^TMP($J),NDT,TY,BEGDATE,CNT,COST,TCOST,DR0,DRCST,ENDDATE,MAX,PAGE,PGM,POP,PSDT,PSFILL,PSRXN,QTY,RX0,RX1,VAR,X,Y,%DT
18 S:$D(ZTQUEUED) ZTREQ="@" Q
19ST1 F S PSDT=$O(^PSRX(TY,PSDT)) Q:'PSDT!(PSDT>(NDT_".999999")) D ST2 Q:$D(DIRUT)
20 Q
21ST2 S PSRXN=0 F S PSRXN=$O(^PSRX(TY,PSDT,PSRXN)) Q:'PSRXN D ST3 Q:$D(DIRUT)
22 Q
23ST3 S PSFILL=""
24 F S PSFILL=$O(^PSRX(TY,PSDT,PSRXN,PSFILL)) Q:PSFILL="" D CHK Q:$D(DIRUT)
25 Q
26CHK Q:'$D(^PSRX(PSRXN,0))!(+$P(^PSRX(PSRXN,"STA"),"^")=13) S RX0=^(0) Q:'$D(^PSDRUG(+$P(RX0,"^",6),0)) S DR0=^(0)
27 I TY="AL" S:PSFILL RX1=$G(^PSRX(PSRXN,1,PSFILL,0)) Q:PSFILL&($G(RX1)="")
28 I TY="AM" Q:'$P($G(^PSRX(PSRXN,"P",PSFILL,0)),"^",19) S RX1=^(0)
29 S DRCST=$S('PSFILL&(+$P(RX0,"^",17)):$P(RX0,"^",17),PSFILL&(+$P($G(RX1),"^",11)):$P($G(RX1),"^",11),1:0)
30 S QTY=$S('PSFILL:+$P(RX0,"^",7),1:+$P(RX1,"^",4))
31 I 'DRCST S DRCST=$S($P($G(^PSDRUG(+$P(RX0,"^",6),660)),"^",6):+$P(^(660),"^",6),1:0)
32 S COST=QTY*DRCST Q:COST<MAX
33 D HD:($Y+4)>IOSL Q:$D(DIRUT)
34 W !,$S(PSFILL&(TY="AL"):"*",TY="AM":"%",1:" ")_$P(RX0,"^"),?11,$E($P(DR0,"^"),"^",40),?51,$J(QTY,6),?60,$J(DRCST,6,3),?68,$J(COST,12,2) S CNT=CNT+1,TCOST=TCOST+COST
35 Q
36HD I PAGE>1,$E(IOST)="C" S DIR(0)="E",DIR("A")=" Press Return to Continue or ^ to Exit" D ^DIR K DIR
37 Q:$D(DIRUT) W @IOF,!,"Fills That Cost at Least $"_MAX_" for the Period: " S Y=BEGDATE D DT^DIO2 W " to " S Y=ENDDATE D DT^DIO2 W ?72,"Page "_PAGE,!,"Run Date: " S Y=DT D DT^DIO2 S PAGE=PAGE+1
38 W !!,"Rx #",?11,"Drug",?54,"QTY",?59,"Un.Cost",?70,"Total Cost"
39 W ! F I=1:1:80 W "-"
40 Q
41FT W ! F I=1:1:80 W "-"
42 S TCOST="Total Cost = "_$FN(TCOST,",",2)
43 W !,"No. of Fills = "_CNT,?50,$J(TCOST,30)
44 W ! F I=1:1:80 W "-"
45 W !,"(* indicates a refill, % indicates a partial) "
46 Q
47DTC N DD,MM S DD=31,MM=+$E(Y,4,5) I MM'=12 S MM=MM+1,MM=$S(MM<10:"0",1:"")_MM,X2=Y,X1=$E(Y,1,3)_MM_"00" D ^%DTC S DD=X
48 S ENDDATE=Y+DD
49 Q
Note: See TracBrowser for help on using the repository browser.