source: WorldVistAEHR/trunk/r/AUTO_REPLENISHMENT_WARD_STOCK-PSGW/PSGWBOI.m@ 929

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1PSGWBOI ;BHAM ISC/CML-Print Backorder Report by Specific Item (Single or Multiple) ; 19 Mar 93 / 8:24 AM
2 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
3SINGLE ;ENTRY POINT FOR SINGLE ITEM
4 W ! K DIC,^TMP("PSGWQ",$J) S DIC="^PSI(58.3,",DIC(0)="QEAOM" D ^DIC K DIC G:Y<0 QUIT S BODA=+Y,DRGDA=$P(Y,"^",2) G START
5MULTI ;ENTRY POINT FOR MULTIPLE ITEMS
6 W ! K DIC,^TMP("PSGWQ",$J) S DIC="^PSI(58.3,",DIC(0)="QEAOM" F JJ=0:0 D ^DIC Q:Y<0 S ^TMP("PSGWQ",$J,+Y)=$P(Y,"^",2)
7 I X="^"!('$D(^TMP("PSGWQ",$J))) G QUIT
8START W !!,"Right margin for this report is 80 columns.",!,"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
10 I $D(IO("Q")) K IO("Q") S PSGWIO=ION,ZTIO="" K ZTSAVE,ZTDTH,ZTSK S ZTRTN="ENQ^PSGWBOI",ZTDESC="Compile data for ITEM Backorder report",ZTSAVE("PSGWIO")=""
11 I S:$D(^TMP("PSGWQ",$J)) ZTSAVE("^TMP(""PSGWQ"",$J,")="" S:$D(BODA) ZTSAVE("BODA")="" S:$D(DRGDA) ZTSAVE("DRGDA")="" D ^%ZTLOAD,HOME^%ZIS K ZTSK G QUIT
12 U IO
13 ;
14ENQ ;ENTRY POINT WHEN QUEUED
15 K ^TMP("PSGWBOI",$J) I $D(BODA),$D(DRGDA) S HDRFLG="S" D BUILD G:$D(ZTQUEUED) PRTQUE G PRT1^PSGWBOIP
16 I $D(^TMP("PSGWQ",$J)) S HDRFLG="M" F BODA=0:0 S BODA=$O(^TMP("PSGWQ",$J,BODA)) G:'BODA&($D(ZTQUEUED)) PRTQUE G:'BODA PRT1^PSGWBOIP S DRGDA=$P(^(BODA),"^") D BUILD
17 ;
18BUILD ;
19 Q:'$D(^PSDRUG(DRGDA,0)) S DNM=$S($P(^(0),"^")]"":$P(^(0),"^"),1:"UNKNOWN")
20 I '$O(^PSI(58.3,BODA,0)) S ^TMP("PSGWBOI",$J,DNM,"ZZZ","ZZZ")="" Q
21 F AOU=0:0 S AOU=$O(^PSI(58.3,BODA,1,AOU)) Q:'AOU I $D(^(AOU,0)) D AOUCHK F BO=0:0 S BO=$O(^PSI(58.3,BODA,1,AOU,1,BO)) Q:'BO I $D(^(BO,0)) S QQ=^(0) D SETGL
22 Q
23AOUCHK ;
24 I '$O(^PSI(58.3,BODA,1,AOU,1,0)) S ^TMP("PSGWBOI",$J,DNM,"ZZZ","ZZZ")=""
25 Q
26SETGL ;
27 S BODT=$P(QQ,"^"),CURBO=$S($P(QQ,"^",5)="":$P(QQ,"^",2),1:0)
28 S ANM=$S($D(^PSI(58.1,AOU,0)):$P(^(0),"^"),1:"AOU NAME MISSING") I CURBO>0,$D(^PSI(58.1,AOU,"I")),^("I"),^("I")'>DT S ANM=ANM_" **"
29 S LOC="" I $O(^PSI(58.1,AOU,1,"B",DRGDA,0)) S ITMDA=$O(^(0)) I $D(^PSI(58.1,AOU,1,ITMDA,0)) S LOC=$P(^(0),"^",8)
30 S:LOC="" LOC="UNKNOWN" S ^TMP("PSGWBOI",$J,DNM,ANM,BODT)=LOC_"^"_CURBO
31 Q
32 ;
33PRTQUE ;
34 K ZTSAVE,ZTIO S ZTIO=PSGWIO,ZTRTN="PRT1^PSGWBOIP",ZTDESC="Print Data for Backorder Item List",ZTDTH=$H,ZTSAVE("^TMP(""PSGWBOI"",$J,")="",ZTSAVE("HDRFLG")=""
35 D ^%ZTLOAD K ^TMP("PSGWQ",$J)
36QUIT ;
37 K %DT,%,%H,%I,BO,BODA,BODT,CURBO,DIC,DNM,DRGDA,ITMDA,JJ,LOC,TOT,AOU,ANM,HDT,INACT,LL,LN,LNS,QQ,PG,X,Y
38 K ^TMP("PSGWBOI",$J),^TMP("PSGWQ",$J),PSGWIO,ZTSK,ZTIO,DA,HDRFLG,IO("Q") D ^%ZISC
39 S:$D(ZTQUEUED) ZTREQ="@" Q
Note: See TracBrowser for help on using the repository browser.