source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDAMIS0.m@ 1406

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1PSDAMIS0 ;BIR/JPW-Print NAOU AMIS Report by Drug ; 1 Sept 94
2 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
3EN ;entry to print report
4 I SUM D ^PSDAMIS4 G DONE
5PRINT ;prints data for stock drugs
6 K LN S $P(LN,"-",80)="",(PG,PSDOUT)=0,%DT="",X="T" D ^%DT X ^DD("DD") S RPDT=Y
7 I '$D(^TMP("PSDAMIS",$J)) D HDR W !!,?10,"***** NO DATA AVAILABLE FOR THIS REPORT *****" G DONE
8 S PSDR="" F S PSDR=$O(^TMP("PSDAMIS",$J,PSDR)) D:PSDR="" GTOT Q:PSDR=""!(PSDOUT) D HDR S NAOU="" F S NAOU=$O(^TMP("PSDAMIS",$J,PSDR,NAOU)) D:NAOU="" NTOT Q:NAOU=""!(PSDOUT) W !,?2,"=> ",NAOU,! D G:PSDOUT DONE
9 .S NUM="" F S NUM=$O(^TMP("PSDAMIS",$J,PSDR,NAOU,NUM)) D:NUM="" TOT Q:NUM=""!(PSDOUT) F JJ=0:0 S JJ=$O(^TMP("PSDAMIS",$J,PSDR,NAOU,NUM,JJ)) Q:'JJ!(PSDOUT) D Q:PSDOUT
10 ..S NODE=^TMP("PSDAMIS",$J,PSDR,NAOU,NUM,JJ),DATE=$E(JJ,4,5)_"/"_$E(JJ,6,7)_"/"_$E(JJ,2,3)
11 ..I $Y+8>IOSL D HDR Q:PSDOUT W !,?2,"=> ",NAOU,!
12 ..W !,NUM,?16,DATE,?25,$J($P(NODE,"^"),6),?44,$J($P(NODE,"^",2),8,2)
13DONE I $E(IOST)'="C" W @IOF
14 I $E(IOST,1,2)="C-",'PSDOUT W ! K DIR,DIRUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu" D ^DIR K DIR
15END ;
16 K %,%DT,%H,%I,%ZIS,ALL,ANS,COST,DA,DATE,DIR,DIROUT,DIRUT,DTOUT,DUOUT,FLAG,IO("Q"),JJ,JJ1,KK,LOC,LN
17 K NAOU,NAOUN,NODE,NUM,QTY,PG,POP,PSD,PSDATE,PSDED,PSDOUT,PSDPN,PSDR,PSDRN,PSDS,PSDSD,PSDSN,PSDT,RPDT,SUM,X,Y
18 K ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
19 K ^TMP("PSDAMIS",$J),^TMP("PSDAMIST",$J),^TMP("PSDAMISG",$J),^TMP("PSDAMISQ",$J),^TMP("PSDAMISS",$J),^TMP("PSDAMISQT",$J),^TMP("PSDAMISC",$J),^TMP("PSDAMISCN",$J),^TMP("PSDAMISCG",$J)
20 K ^TMP("PSDAMISVG",$J),^TMP("PSDAMISCVG",$J)
21 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
22 Q
23HDR ;lists header information
24 Q:PSDOUT
25 I $E(IOST,1,2)="C-",PG K DA,DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
26 W:$Y @IOF S PG=PG+1 W !,"DRUG/NAOU AMIS REPORT - DATE: "_RPDT,?70,"PAGE: ",PG,!
27 W:$G(PSDR)]"" "DRUG: ",PSDR,!
28 W "From ",$P(PSDATE,"^")," to ",$P(PSDATE,"^",2),!!
29 W !,?2,"=> NAOU",!,?16,"DATE",!,"DISP #",?15,"FILLED",?25,"QUANTITY",?40,"COST PER ORDER",!,LN,!
30 Q
31TOT Q:PSDOUT W !,"---------",?25,"----------",!,?3,^TMP("PSDAMISS",$J,PSDR,NAOU),?25,$J(^TMP("PSDAMISQ",$J,PSDR,NAOU),6),?44,$J(^TMP("PSDAMISC",$J,PSDR,NAOU),8,2),?60,"** NAOU Totals **",!
32 W "=========",?25,"=========",?40,"=============",!
33 Q
34NTOT ;print drug subtotals
35 Q:PSDOUT I $Y+8>IOSL D HDR Q:PSDOUT
36 W:$D(FLAG) !,?5,"** ",PSDR," **",!
37 W:'$D(FLAG) !,"Drug Subtotals: " W !,"Number of Orders: ",?25,$J(^TMP("PSDAMIST",$J,PSDR),7)
38 W !,"Total Quantity of Orders: ",?25,$J(^TMP("PSDAMISQT",$J,PSDR),6)
39 W !,"Total Cost of Orders: ",?44,$J(^TMP("PSDAMISCN",$J,PSDR),8,2)
40 W !,"Average Cost Per Order: ",?44,$S(+^TMP("PSDAMIST",$J,PSDR):$J((^TMP("PSDAMISCN",$J,PSDR)/^TMP("PSDAMIST",$J,PSDR)),8,2),1:$J("0.00",8,2)),!
41 Q
42GTOT ;grand total
43 Q:PSDOUT
44 D HDR Q:PSDOUT S FLAG=1 W !!,?35,"Drug Subtotals Summary",!!
45 S PSDR="" F S PSDR=$O(^TMP("PSDAMIST",$J,PSDR)) Q:PSDR="" D NTOT Q:PSDOUT
46 D HDR Q:PSDOUT
47 W !,"Grand Totals by Dispensing Site: ",PSDSN,!
48 S PSDSN="" F S PSDSN=$O(^TMP("PSDAMISVG",$J,PSDSN)) Q:PSDSN=""!PSDOUT D Q:PSDOUT
49 .I $Y+6>IOSL D HDR Q:PSDOUT
50 .W !,"Number of Orders: ",?25,$J(^TMP("PSDAMISVG",$J,PSDSN),6),!,"Cost of Orders: ",?44,$J(^TMP("PSDAMISCVG",$J,PSDSN),8,2),!
51 .W "Average Cost Per Order: ",?44,$S(+^TMP("PSDAMISVG",$J,PSDSN):$J((^TMP("PSDAMISCVG",$J,PSDSN)/^TMP("PSDAMISVG",$J,PSDSN)),8,2),1:$J("0.00",8,2)),!
52 D HDR
53 W !,"Grand Totals: ",!,"Number of Orders: ",?25,$J(^TMP("PSDAMISG",$J),6),!,"Cost of Orders: ",?44,$J(^TMP("PSDAMISCG",$J),8,2),!
54 W "Average Cost Per Order: ",?44,$S(+^TMP("PSDAMISG",$J):$J((^TMP("PSDAMISCG",$J)/^TMP("PSDAMISG",$J)),8,2),1:$J("0.00",8,2)),!
55 Q
Note: See TracBrowser for help on using the repository browser.