Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSGWPAW

PSGWPAW.m

Go to the documentation of this file.
PSGWPAW ;BHAM ISC/PTD,CML-Print AMIS Data Worksheet for All Drugs in All AOUs ; 19 Mar 93 / 8:32 AM
 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
 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.",!!
 I '$O(^PSI(58.1,0)) W !,"You MUST create AOUs before running this report!" G END^PSGWPAW1
DEV K %ZIS,IOP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END^PSGWPAW1
 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")=""
 I  D ^%ZTLOAD,HOME^%ZIS K ZTSK G END^PSGWPAW1
 U IO
 ;
ENQ ;ENTRY POINT WHEN QUEUED
AOU 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
 ;
XREF 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
 Q
 ;
BUILD I $P(^PSI(58.1,PSGWAOU,1,PSGWITM,0),"^",10)="Y",$P(^(0),"^",3)="" S $P(^(0),"^",10)=""
 I $P(^PSI(58.1,PSGWAOU,1,PSGWITM,0),"^",3)'="" Q:$P(^(0),"^",3)'>PSGWDT
 I '$O(^PSI(58.1,PSGWAOU,1,PSGWITM,2,0)) S K=9999 D SETGL Q
 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)=""
 Q
 ;
SETGL I '$O(^PSDRUG(PSGWDR,0)) S DIK="^PSI(58.1,"_PSGWAOU_",1,",DA=PSGWITM,DA(1)=PSGWAOU D ^DIK K DIK,DA Q
 I $O(^PSDRUG(PSGWDR,0)) S PSGWNM=$S($P(^PSDRUG(PSGWDR,0),"^")'="":$P(^(0),"^"),1:"ZZNAME MISSING") S ^TMP("PSGWPAW",$J,K,PSGWNM,PSGWDR)=""
 Q
 ;
PRTQUE ;AFTER DATA IS COMPILED, QUEUE THE PRINT
 K ZTSAVE,ZTIO S ZTIO=PSGWIO,ZTRTN="PRINT^PSGWPAW1",ZTDESC="Print AMIS Worksheet",ZTDTH=$H,ZTSAVE("^TMP(""PSGWPAW"",$J,")=""
 D ^%ZTLOAD K ^TMP("PSGWPAW",$J) G END^PSGWPAW1
 ;