source: FOIAVistA/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDAMIS4.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 2.2 KB
Line 
1PSDAMIS4 ;BIR/JPW-Print NAOU AMIS Summary Totals ; 1 Sept 94
2 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
3PRINT ;prints data for stock drugs
4 K LN S $P(LN,"-",80)="",(PG,PSDOUT)=0,%DT="",X="T" D ^%DT X ^DD("DD") S RPDT=Y
5 I '$D(^TMP("PSDAMIS",$J)) D HDR W !!,?10,"***** NO DATA AVAILABLE FOR THIS REPORT *****" Q
6 S JJ="" F S JJ=$O(^TMP("PSDAMISS",$J,JJ)) D:JJ="" GTOT Q:JJ=""!(PSDOUT) D HDR Q:PSDOUT S KK="" F S KK=$O(^TMP("PSDAMISS",$J,JJ,KK)) D:KK="" NTOT Q:KK=""!(PSDOUT) D TOT
7 Q
8HDR ;lists header information
9 Q:PSDOUT
10 I $E(IOST,1,2)="C-",PG K DA,DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
11 W:$Y @IOF S PG=PG+1 W !,"SUMMARY NAOU/DRUG USAGE REPORT - DATE: "_RPDT,?70,"PAGE: ",PG,!
12 I ANS="N",$D(JJ) W "NAOU: ",JJ,!
13 I ANS="D",$D(JJ) W "DRUG: ",JJ,!
14 W "From ",$P(PSDATE,"^")," to ",$P(PSDATE,"^",2),!!
15 W !,?2,"=> ",$S(ANS="D":"NAOU",1:"DRUG"),!,"TOTAL # OF ORDERS",?30,"TOTAL QUANTITY",?60,"TOTAL COST",!,LN,!
16 Q
17TOT Q:PSDOUT I $Y+8>IOSL D HDR Q:PSDOUT
18 W !!,?2,"=> ",KK,!,$J(^TMP("PSDAMISS",$J,JJ,KK),8),?30,$J(^TMP("PSDAMISQ",$J,JJ,KK),8),?60,$J(^TMP("PSDAMISC",$J,JJ,KK),8,2)
19 Q
20NTOT Q:PSDOUT I $Y+8>IOSL D HDR Q:PSDOUT
21 W !!,?2,"=> ",KK
22 W !!,$S(ANS="D":"DRUG",1:"NAOU")," Subtotals: ",!,"Number of Orders: ",?30,$J(^TMP("PSDAMIST",$J,JJ),8),! W:ANS="D" "Total Quantity: ",?30,$J(^TMP("PSDAMISQT",$J,JJ),8),!
23 W "Total Cost of Orders: ",?60,$J(^TMP("PSDAMISCN",$J,JJ),8,2)
24 W !,"Average Cost of Orders: ",?60,$S(+^TMP("PSDAMIST",$J,JJ):$J((^TMP("PSDAMISCN",$J,JJ)/^TMP("PSDAMIST",$J,JJ)),8,2),1:$J("0.00",8,2)),!
25 Q
26GTOT ;grand totals
27 Q:PSDOUT D HDR Q:PSDOUT
28 W !,"Grand Totals by Dispensing Site: ",PSDSN,!
29 S PSDSN="" F S PSDSN=$O(^TMP("PSDAMISVG",$J,PSDSN)) Q:PSDSN=""!PSDOUT D Q:PSDOUT
30 .I $Y+6>IOSL D HDR Q:PSDOUT
31 .W !,"Number of Orders: ",?30,$J(^TMP("PSDAMISVG",$J,PSDSN),6),!,"Cost of Orders: ",?60,$J(^TMP("PSDAMISCVG",$J,PSDSN),8,2),!
32 .W "Average Cost Per Order: ",?60,$S(+^TMP("PSDAMISVG",$J,PSDSN):$J((^TMP("PSDAMISCVG",$J,PSDSN)/^TMP("PSDAMISVG",$J,PSDSN)),8,2),1:$J("0.00",8,2)),!
33 D HDR Q:PSDOUT
34 W !!,"Grand Totals: ",!,"Number of Orders: ",?30,$J(^TMP("PSDAMISG",$J),8),!,"Cost of Orders: ",?60,$J(^TMP("PSDAMISCG",$J),8,2),!
35 W "Average Cost Per Order: ",?60,$J((^TMP("PSDAMISCG",$J)/^TMP("PSDAMISG",$J)),8,2),!
36 Q
Note: See TracBrowser for help on using the repository browser.