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

ACRFSHI1.m

Go to the documentation of this file.
ACRFSHI1 ;IHS/OIRM/DSD/THL,AEF - SHIPPING INSTRUCTIONS - CON'T; [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;TO REVIEW AND EDIT SHIPPING INSTRUCTIONS
ITEMS ;EP - LIST BY ITEM NUMBER ITEMS TO BE SHIPPED
 F  D IC Q:$D(ACRQUIT)
 K ACRQUIT,ACRQUAN,ACRSSI,ACRSS
 Q
IDISP ;EP;DISPLAY ITEMS FOR EACH SHIPPING LOCATION
 W !
 D IARRAY
 S ACRSSIDA=0
 F  S ACRSSIDA=$O(^ACRSI(ACRSIDA,1,ACRSSIDA)) Q:'ACRSSIDA  I $D(^ACRSI(ACRSIDA,1,ACRSSIDA,0)) S ACRSSI=^(0) D
 .S ACRI=0
 .F  S ACRI=$O(ACRSS(ACRI)) Q:'ACRI  I +ACRSS(ACRI)=+ACRSSI D
 ..S ACRSSI(ACRI)=ACRSSIDA
 ..S ACRIMAX=ACRI
 ..S ACRQUAN(+ACRSSI)=$G(ACRQUAN(+ACRSSI))+$P(ACRSSI,U,2)
 ..S ACRQUAN(+ACRSSI,ACRSIDA)=$G(ACRQUAN(+ACRSSI,ACRSIDA))+$P(ACRSSI,U,2)
 ..W !?9,"Item: ",$J(ACRI,6)
 ..W ?25,"Quantity: ",$J($P(ACRSSI,U,2),6)
 ..D P
 Q
IARRAY ;EP - SET DOCUMENT ITEM ARRAY
 K ACRSS
 S (ACRJ,ACRSSDA)=0
 F  S ACRSSDA=$O(^ACRSS("J",ACRDOCDA,ACRSSDA)) Q:'ACRSSDA  D
 .S ACRSSDT=$G(^ACRSS(ACRSSDA,"DT"))
 .S ACRJ=ACRJ+1
 .S ACRSS(ACRJ)=ACRSSDA_U_+ACRSSDT
 .S ACRSS("ACRSS",ACRSSDA)=ACRJ_U_+ACRSSDT
 Q
IC ;EP;TO CHOOSE ITEM(S) TO ADD OR EDIT CTION
 S DIR(0)="SO^1:ADD ITEM for this SHIPPING location"_$S($D(^ACRSI(ACRSIDA,1)):";2:EDIT ITEM for this SHIPPPING location;3:DELETE ITEM from this SHIPPING location",1:"")
 W !
 D DIR^ACRFDIC
 Q:$D(ACRQUIT)!$D(ACROUT)!'$G(Y)
 I Y=1 D IADD Q
 I Y=2 D IEDIT Q
 I Y=3 D IDELETE Q
 Q
IADD D ITEM^ACRFSHIP
 Q:$D(ACRQUIT)!$D(ACROUT)
 Q:'+$G(ACRITEMS)
 F ACRJ=1:1 S ACRX=$P(ACRITEMS,",",ACRJ) Q:ACRX=""  I '$D(^ACRSI(ACRSIDA,1,"B",ACRSS(ACRX))) D I1
 Q
I1 S:'$D(^ACRSI(ACRSIDA,1,0)) ^ACRSI(ACRSIDA,1,0)="^9003010.01P"
 S DA(1)=ACRSIDA
 S DIC="^ACRSI("_ACRSIDA_",1,"
 S DIC(0)="L"
 S X=+ACRSS(ACRX)
 D FILE^ACRFDIC
 S ACRSSIDA=+Y
 S:'$D(ACRIMAX) ACRIMAX=1
 S ACRSSI=^ACRSI(ACRSIDA,1,ACRSSIDA,0)
 D IQUAN
 Q
IEDIT ;EDIT EXISTING SHIPPING INSTRUTIONS
 S:'$D(ACRIMAX) ACRIMAX=1
 I ACRIMAX=1 S ACRX=1
 E  D ICHOOSE
 Q:$D(ACRQUIT)!$D(ACROUT)
 F ACRI=1:1 S Y=$P(ACRX,",",ACRI) Q:'Y!'$D(ACRSSI(+Y))!$D(ACRQUIT)!$D(ACROUT)  D IE
 Q
IDELETE ;
 S DA(1)=ACRSIDA
 S DA=ACRSSIDA
 S DIK="^ACRSI("_ACRSIDA_","
 D DIK^ACRFDIC
 Q
ICHOOSE ;CHOOSE ITEM TO BE EDITED
 I ACRIMAX=1 S ACRX=1 Q
 S DIR(0)="LO^1:"_ACRIMAX
 S DIR("A")="Which Item(s)"
 W !
 D DIR^ACRFDIC
 I +Y<1 S ACRQUIT="" Q
 S ACRX=Y
 Q
IE ;LOOP THROUGH ITEMS
 S (ACRSSIDA,DA)=ACRSSI(+Y)
 S ACRSSI=^ACRSI(ACRSIDA,1,ACRSSIDA,0)
 S X=$P(ACRSS("ACRSS",+ACRSSI),U,2)
 S Y=ACRQUAN(+ACRSSI)
 I X-Y<0 D
 .W !!,X," of this item ",$S(X>1:"were",1:"was")," ordered."
 .W !,Y,$S(+Y>1:" is",1:" are")," already marked for shipment."
 .W !!,"Make sure you do not request shipment for more than you ordered."
 .D PAUSE^ACRFWARN
 D IQUAN
 Q
IQUAN ;SET QUANTITIY TO BE SHIPPED
 W !!,"TOTAL QUANTITY ORDRD..: ",$P(ACRSS("ACRSS",+ACRSSI),U,2)
 W !,"TOTAL MARKED SHIPPED..: ",+$G(ACRQUAN(+ACRSSI))
 W !,"TOTAL TO THIS LOCATION: ",+$G(ACRQUAN(+ACRSSI,ACRSIDA))
 S DA(1)=ACRSIDA
 S DA=ACRSSIDA
 S DR="1T"
 S DIE="^ACRSI("_ACRSIDA_",1,"
 D DIE^ACRFDIC
 Q
P ;SCREEN CONTROL
 Q:IOSL-6>$Y
 I $E(IOST,1,2)="P-" D HEAD^ACRFSHIP,DISP^ACRFSHIP
 I $E(IOST,1,2)="C-" D PAUSE^ACRFWARN
 Q
QUAN ;CALCULATE QUANTITY MARKED AS SHIP
 N ACRSIDA
 S ACRSIDA=0
 F  S ACRSIDA=$O(^ACRSI("B",ACRDOCDA,ACRSIDA)) Q:'ACRSIDA  D
 .N ACRSSIDA
 .S ACRSSIDA=0
 .F  S ACRSSIDA=$O(^ACRSI(ACRSIDA,1,ACRSSIDA)) Q:'ACRSSIDA  D
 ..I $D(^ACRSI(ACRSIDA,1,ACRSSIDA,0)) S ACRSSDA=+^(0),ACRQUAN=$P(^(0),U,2) D:ACRSSDA
 ...S ACRQUAN(ACRSSDA)=$G(ACRQUAN(ACRSSDA))+ACRQUAN
 Q