source: WorldVistAEHR/trunk/r/AUTO_REPLENISHMENT_WARD_STOCK-PSGW/PSGWBO.m@ 1604

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

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1PSGWBO ;BHAM ISC/MPH,CML-Enter/Edit Actual Dispensed/Backorder Values ; 09 Dec 93 / 3:10 PM
2 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
3 I '$D(PSGWSITE) D ^PSGWSET Q:'$D(PSGWSITE) S PSGWFLG=1
4 I '$D(PSGWIDA) S DIC="^PSI(58.19,",DIC(0)="QEAMNZ",DIC("A")="SELECT DATE/TIME FOR INVENTORY: " D ^DIC K DIC Q:Y<0 S PSGWIDA=+Y,X1=DT,X2=$P($P(Y,"^",2),".") D ^%DTC
5 I '$D(^PSI(58.19,"AINV",PSGWIDA)) W !!,$S(X<101:"INVENTORY SHEET MUST BE PRINTED BEFORE ON-HAND AMOUNTS MAY BE ENTERED",1:"INVENTORY OVER 100 DAYS OLD CANNOT BE EDITED") G END
6 ;
7EN1 ; PSGWIDA = DA of inventory being edited
8 K PSGW("PO") S PSGWV="AMIS COMPILE FLAG"
9 F SK=0:0 S SK=$O(^PSI(58.19,PSGWIDA,1,"C",SK)) Q:'SK F J=0:0 S J=$O(^PSI(58.19,PSGWIDA,1,"C",SK,J)) Q:'J S PSGW("PO",SK,J)=""
10 S (PSGWADT,PSGWIN)=$P(^PSI(58.19,PSGWIDA,0),"^",1),PSGWCAT="A",FLG=0,AMISFL=0
11WLOOP F PSGSORTK=0:0 S PSGSORTK=$O(PSGW("PO",PSGSORTK)) Q:'PSGSORTK Q:FLG F PSGDA=0:0 S PSGDA=$O(PSGW("PO",PSGSORTK,PSGDA)) D:'PSGDA RESET Q:'PSGDA D WENT Q:FLG S AMISFL=0
12END W ! K PSGW("PO"),DLAYGO,I,J,K,K1,PSG1,PSG2,PSG3,PSGWACT,PSGWAOUN,PSGWDA,PSGDDA,PSGWDIN,PSGWDN,PSGDR,PSGWOD,PSGSORTK,PSGWIN,PSGWN,PSGX,PSGDA,PSGTYP,PSGWIDA,SK,X,Y,A,PSGWADT,PSGWCAT,PSGWQD,FLG,AMISFL,PSGWAOU,KEY,PSGWV,DA,%,%Y,LP,PC
13 K TPSG1,TPSG2,TPSG3,TEMPDR,TYP,DIC,DIE,DR K:$D(PSGWFLG) PSGWFLG,PSGWSITE
14 Q
15WENT S PSGWN=$S($D(^PSI(58.1,PSGDA,0)):$P(^(0),"^",1),1:""),DIC("B")=PSGWN,DIC("A")="Select AREA OF USE: ",DIC("S")="I $D(^PSI(58.19,PSGWIDA,1,""B"",+Y,+Y))"
16 W ! S DIC="^PSI(58.1,",DIC(0)="AEQNMZ" D ^DIC K DIC S (PSGWDA,DA,PSGWAOU)=+Y,PSGWAOUN=$P(Y,"^",2) S:Y<0 FLG=1 Q:Y<0 S:($P(^PSI(58.1,PSGWDA,0),"^",3)'=1)&($P(PSGWSITE,"^",25)=1) AMISFL=1
17 S PSG1=""
18PSG1 S PSG1=$O(^PSI(58.19,"AINV",PSGWIDA,PSGWDA,PSG1)) Q:PSG1="" S PSG2=""
19PSG2 S PSG2=$O(^PSI(58.19,"AINV",PSGWIDA,PSGWDA,PSG1,PSG2)) G PSG1:PSG2="" S PSG3=""
20PSG3 S PSG3=$O(^PSI(58.19,"AINV",PSGWIDA,PSGWDA,PSG1,PSG2,PSG3)) G PSG2:PSG3="" S PSGTYP=""
21PSGTYP S PSGTYP=$O(^PSI(58.19,"AINV",PSGWIDA,PSGWDA,PSG1,PSG2,PSG3,PSGTYP)) G PSG3:PSGTYP="" S PSGDR=""
22PSGDR S PSGDR=$O(^PSI(58.19,"AINV",PSGWIDA,PSGWDA,PSG1,PSG2,PSG3,PSGTYP,PSGDR)) G PSGTYP:PSGDR=""
23 I $P(^PSI(58.19,"AINV",PSGWIDA,PSGWDA,PSG1,PSG2,PSG3,PSGTYP,PSGDR),"^",4)'="",$P(^(PSGDR),"^",4)'>-1 G PSGDR
24 S PSGDDA=+^PSI(58.19,"AINV",PSGWIDA,PSGWDA,PSG1,PSG2,PSG3,PSGTYP,PSGDR),PSGWDN=$P(^(PSGDR),"^",2)
25 S TEMPDR=PSGDR W !!,"ITEM: ",PSGDR
26 I '$D(^PSI(58.1,PSGWDA,1,PSGDDA,1,PSGWIDA,0)) G PSGDR
27 S A=^PSI(58.1,PSGWDA,1,PSGDDA,1,PSGWIDA,0) S (PSGX(5),PSGWOD)=$P(A,"^",5)
28DIS W !,"DISPENSE QUANTITY: " W:PSGX(5)'="" PSGX(5),"// " R X:DTIME S:'$T FLG=1 Q:'$T G:X="" EXP Q:X="^" I X["^" D GETVAL^PSGWBO1 G:DA<0 DIS G PSGDR
29 I "?"[$E(X)!(X<0)!(X>9999)!(X'?1N.N) W *7,!,"Enter number between 0 and 9999 which is the quantity dispensed." G DIS
30 I X D CHKQTY^PSGWBO1 I $D(QTYFLG) K QTYFLG W !!,"ITEM: ",PSGDR G DIS
31 S PSGX(5)=$S(X="@":"",1:X),$P(^PSI(58.1,PSGWDA,1,PSGDDA,1,PSGWIDA,0),"^",5)=PSGX(5),PSGWACT=PSGX(5)
32 S PSGWQD=PSGX(5)-PSGWOD I (AMISFL=1)&(PSGWQD'=0) S ^PSI(58.5,"AMIS",$H,PSGWADT,PSGWCAT,PSGWAOU,PSGWDN,PSGWQD)=""
33 S ^(PSGDR)=$P(^PSI(58.19,"AINV",PSGWIDA,PSGWDA,PSG1,PSG2,PSG3,PSGTYP,PSGDR),"^",1,3)_"^"_PSGX(5)
34 I $P(PSGWSITE,"^",5) S DIC(0)=""
35 E S DIC(0)="QL",DLAYGO="^PSI(58.3,"
36 S DIC="^PSI(58.3,",X="`"_PSGWDN D ^DIC I Y'<0 S PSGWDIN=+Y D ^PSGWFLBO
37 ;
38EXP I $P(^PSI(58.1,PSGWDA,0),"^",4) S DA(1)=PSGWDA,DA=PSGDDA,DIE="^PSI(58.1,"_DA(1)_",1,",DR=35 D ^DIE K DIE,DIC
39 G PSGDR
40RESET ; Reset Sort key if AOUs taken out of order
41 I $O(PSGW("PO",PSGSORTK,0))'=PSGWAOU F J=0:0 S J=$O(PSGW("PO",J)) Q:'J I $O(PSGW("PO",J,0))=PSGWAOU S PSGSORTK=J Q
42 Q
Note: See TracBrowser for help on using the repository browser.