source: WorldVistAEHR/trunk/r/AUTO_REPLENISHMENT_WARD_STOCK-PSGW/PSGWPAW.m@ 660

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

initial load of WorldVistAEHR

File size: 1.8 KB
Line 
1PSGWPAW ;BHAM ISC/PTD,CML-Print AMIS Data Worksheet for All Drugs in All AOUs ; 19 Mar 93 / 8:32 AM
2 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
3 D NOW^%DTC S PSGWDT=X W !!!,"Right margin for this report is 80 columns.",!,"You may queue the report to print at a later time.",!!
4 I '$O(^PSI(58.1,0)) W !,"You MUST create AOUs before running this report!" G END^PSGWPAW1
5DEV K %ZIS,IOP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END^PSGWPAW1
6 I $D(IO("Q")) K IO("Q") S PSGWIO=ION,ZTIO="" K ZTSAVE,ZTDTH,ZTSK S ZTRTN="ENQ^PSGWPAW",ZTDESC="Compile AMIS Worksheet",ZTSAVE("PSGWIO")="",ZTSAVE("PSGWDT")=""
7 I D ^%ZTLOAD,HOME^%ZIS K ZTSK G END^PSGWPAW1
8 U IO
9 ;
10ENQ ;ENTRY POINT WHEN QUEUED
11AOU K ^TMP("PSGWPAW",$J) F PSGWAOU=0:0 S PSGWAOU=$O(^PSI(58.1,PSGWAOU)) G:('PSGWAOU)&($D(ZTQUEUED)) PRTQUE G:'PSGWAOU PRINT^PSGWPAW1 D XREF
12 ;
13XREF F PSGWDR=0:0 S PSGWDR=$O(^PSI(58.1,PSGWAOU,1,"B",PSGWDR)) Q:'PSGWDR F PSGWITM=0:0 S PSGWITM=$O(^PSI(58.1,PSGWAOU,1,"B",PSGWDR,PSGWITM)) Q:'PSGWITM D BUILD
14 Q
15 ;
16BUILD I $P(^PSI(58.1,PSGWAOU,1,PSGWITM,0),"^",10)="Y",$P(^(0),"^",3)="" S $P(^(0),"^",10)=""
17 I $P(^PSI(58.1,PSGWAOU,1,PSGWITM,0),"^",3)'="" Q:$P(^(0),"^",3)'>PSGWDT
18 I '$O(^PSI(58.1,PSGWAOU,1,PSGWITM,2,0)) S K=9999 D SETGL Q
19 F PSGWTY=0:0 S PSGWTY=$O(^PSI(58.1,PSGWAOU,1,PSGWITM,2,PSGWTY)) Q:'PSGWTY S K=PSGWTY D SETGL S ^TMP("PSGWPAW",$J,"DN",PSGWNM)=""
20 Q
21 ;
22SETGL I '$O(^PSDRUG(PSGWDR,0)) S DIK="^PSI(58.1,"_PSGWAOU_",1,",DA=PSGWITM,DA(1)=PSGWAOU D ^DIK K DIK,DA Q
23 I $O(^PSDRUG(PSGWDR,0)) S PSGWNM=$S($P(^PSDRUG(PSGWDR,0),"^")'="":$P(^(0),"^"),1:"ZZNAME MISSING") S ^TMP("PSGWPAW",$J,K,PSGWNM,PSGWDR)=""
24 Q
25 ;
26PRTQUE ;AFTER DATA IS COMPILED, QUEUE THE PRINT
27 K ZTSAVE,ZTIO S ZTIO=PSGWIO,ZTRTN="PRINT^PSGWPAW1",ZTDESC="Print AMIS Worksheet",ZTDTH=$H,ZTSAVE("^TMP(""PSGWPAW"",$J,")=""
28 D ^%ZTLOAD K ^TMP("PSGWPAW",$J) G END^PSGWPAW1
29 ;
Note: See TracBrowser for help on using the repository browser.