source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDBAN1.m@ 1608

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

initial load of WorldVistAEHR

File size: 1.9 KB
Line 
1PSDBAN1 ;BIR/JPW,LTL-Nurse BAL Report ; 8 Aug 94
2 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
3DEV ;ask device and queue info
4 W !!,"You may queue this report to print at a later time.",!!
5 K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")="HOME" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END
6 I $D(IO("Q")) K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDBAN1",ZTDESC="Balance of NAOU drugs, Contingency Report" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
7 U IO
8START ;loops thru DRUGS
9 W !!,"Give me a second or two to alphabetize.",!
10 N PSDRUG,PSDRUGN S PSDRUG=0,PSDRUGN="" K ^TMP("PSDNST",$J)
11 F S PSDRUG=$O(^PSD(58.8,NAOU,1,PSDRUG)) Q:'PSDRUG D:$P($G(^PSD(58.8,NAOU,1,PSDRUG,0)),U,4)
12 .S ^TMP("PSDNST",$J,$P($G(^PSDRUG(+PSDRUG,0)),U))=$P($G(^PSD(58.8,NAOU,1,PSDRUG,0)),U,4)_" "_$S($P($G(^(0)),U,8)]"":$P($G(^(0)),U,8),1:$P($G(^PSDRUG(PSDRUG,660)),U,8))
13PRINT ;prints the report
14 S (PG,PSDOUT)=0,RPDT=$$HTE^XLFDT($H)
15 K LN S $P(LN,"-",80)="" D HDR I '$D(^TMP("PSDNST",$J)) W !!,?10,"**** NO BALANCES TO REPORT ****" G END
16 S PSDR="" F S PSDR=$O(^TMP("PSDNST",$J,PSDR)) Q:PSDR=""!(PSDOUT) D:$Y+16>IOSL HDR Q:$G(PSDOUT) W !,?2,"=> ",PSDR,?62,$G(^TMP("PSDNST",$J,PSDR)),! D ^PSDRPGS3 Q:PSDOUT
17DONE I $E(IOST)'="C" W @IOF
18 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
19END K %,%H,%I,%ZIS,ALL,DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,LN,NODE,OK,ORD
20 K PG,POP,PSDOUT,PSDPN,PSDR,PSDRN,PSDST,PSDT,QTY,REQ,RPDT,STAT,STATN,X,X1,X2,Y,ZTDESC,ZTDTH,ZTRTN,ZTSAVE,ZTSK
21 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
22 Q
23HDR ;header for log
24 I $E(IOST,1,2)="C-",PG W ! K DA,DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
25 S PG=PG+1 W:$Y @IOF W !,?5,"Controlled Substance Balances, Contingency Report",?70,"Page: ",PG,!,?35,NAOUN,!,?25,RPDT,!
26 W !,?2,"=> DRUG",?62,"QUANTITY",!
27 W !,LN,!
28 Q
29SAVE S (ZTSAVE("ALL"),ZTSAVE("NAOU"),ZTSAVE("NAOUN"))="" S:$D(PSDR) ZTSAVE("PSDR")=""
30 Q
Note: See TracBrowser for help on using the repository browser.