source: FOIAVistA/trunk/r/AUTO_REPLENISHMENT_WARD_STOCK-PSGW/PSGWATR.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1PSGWATR ;BHAM ISC/CML-Item Activity Inquiry ; 19 Mar 93 / 8:21 AM
2 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
3 W !!,"This option will list all activity for a specified item, in a specified,",!,"area of use, for a specified date range.",!
4BDT S %DT="AEX",%DT("A")="BEGINNING date for report: " D ^%DT K %DT G:Y<0 QUIT^PSGWATR1 S BDT=Y
5EDT S %DT="AEX",%DT(0)=BDT,%DT("A")="ENDING date for report: " D ^%DT K %DT G:Y<0 QUIT^PSGWATR1 S EDT=Y
6ASKAOU W ! S DIC="^PSI(58.1,",DIC(0)="QEAM",DIC("A")="Select AOU: " D ^DIC K DIC G:Y<0 QUIT^PSGWATR1 S AOU=+Y
7ASKITEM W ! S DIC="^PSI(58.1,"_AOU_",1,",DIC(0)="QEAM",DIC("A")="Select ITEM: " D ^DIC K DIC G:Y<0 QUIT^PSGWATR1 S ITEM=+Y
8 W !!,"The right margin for this report is 80.",!,"You may queue the report to print at a later time.",!!
9DEV K %ZIS,IOP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G QUIT^PSGWATR1
10 I $D(IO("Q")) K IO("Q") S PSGWIO=ION,ZTIO="" K ZTSAVE,ZTDTH,ZTSK S ZTRTN="ENQ^PSGWATR",ZTDESC="Compile Item Activity Inquiry" F G="BDT","EDT","AOU","ITEM","PSGWIO" S:$D(@G) ZTSAVE(G)=""
11 I D ^%ZTLOAD,HOME^%ZIS K ZTSK G QUIT^PSGWATR1
12 U IO
13 ;
14ENQ ;ENTRY POINT WHEN QUEUED
15 K ^TMP("PSGWATR",$J) D AR,OD,RET G:$D(ZTQUEUED) PRTQUE G ^PSGWATR1
16AR ;AUTOMATIC REPLENISHMENT INVENTORIES
17 S TYPE="AR"
18 F INVDA=0:0 S INVDA=$O(^PSI(58.1,AOU,1,ITEM,1,INVDA)) Q:'INVDA I $D(^PSI(58.19,INVDA,0)) S ARDT=$P(^(0),"^") I ARDT'<BDT&(ARDT'>(EDT+.999999)) S QD=$P(^PSI(58.1,AOU,1,ITEM,1,INVDA,0),"^",5) I +QD D SETGL
19 Q
20 ;
21OD ;ON DEMAND REQUESTS
22 S TYPE="OD"
23 F ODDA=0:0 S ODDA=$O(^PSI(58.1,AOU,1,ITEM,5,ODDA)) Q:'ODDA I $D(^PSI(58.1,AOU,1,ITEM,5,ODDA,0)) S ODDT=$P(^(0),"^") I ODDT'<BDT&(ODDT'>(EDT+.999999)) S QD=$P(^(0),"^",2) I +QD D SETGL
24 Q
25RET ;RETURNS
26 S TYPE="RET"
27 F RETDT=0:0 S RETDT=$O(^PSI(58.1,AOU,1,ITEM,3,RETDT)) Q:'RETDT I $D(^PSI(58.1,AOU,1,ITEM,3,RETDT,0)) I RETDT'<BDT&(RETDT'>(EDT+.999999)) S QD=$P(^(0),"^",2) I +QD D SETGL
28 Q
29SETGL ;
30 I TYPE="AR" S ^TMP("PSGWATR",$J,"AR",ARDT)=INVDA_"^"_QD Q
31 I TYPE="OD" S ^TMP("PSGWATR",$J,"OD",ODDT)=QD Q
32 I TYPE="RET" S ^TMP("PSGWATR",$J,"RET",RETDT)=QD Q
33 Q
34 ;
35PRTQUE ;AFTER DATA IS COMPILED, QUEUE THE PRINT
36 K ZTSAVE,ZTIO S ZTIO=PSGWIO,ZTRTN="^PSGWATR1",ZTDESC="Print Item Activity Inquiry",ZTDTH=$H,ZTSAVE("^TMP(""PSGWATR"",$J,")="" F G="BDT","EDT","AOU","ITEM" S:$D(@G) ZTSAVE(G)=""
37 D ^%ZTLOAD K ^TMP("PSGWATR",$J) G QUIT^PSGWATR1
38 ;
Note: See TracBrowser for help on using the repository browser.