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

ACRFSTOK.m

Go to the documentation of this file.
ACRFSTOK ;IHS/OIRM/DSD/THL,AEF - ADD/EDIT STOCK ITEMS; [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;ROUTINE TO ADD OR EDIT STANDARD ITEMS
ITEM F  D ITEM1 Q:$D(ACRQUIT)!$D(ACROUT)
 K ACRQUIT,ACR,ACRSEQ,ACRDA,ACRSET,ACRSTOCK
 Q
ITEM1 W @IOF
 K ACRQUIT,ACR,ACRSEQ,ACRDA,ACRSET,ACRSTOCK
 W !?22,"ADD/EDIT STANDARD ITEMS"
 W !?21,"|==============================|"
 S DIR(0)="FO^1:30"
 S DIR("A")="STANDARD ITEM......."
 S DIR("?")="^ S DIC=""^ACRITEM("",DIC(0)=""EMZ"" D DIC^ACRFDIC K DIC"
 D DIR^ACRFDIC
 Q:$D(ACRQUIT)!$D(ACROUT)!(X="")!($E(X)=U)!($E(X)="?")
 S ACRX=X
 S DIC="^ACRITEM("
 S DIC(0)="EMZ"
 S DIC("S")="Q:'$D(^ACRITEM(+Y,""DT1""))  I $P(^(""DT1""),U,3)=1!($P(^(""DT1""),U,3)="""")"
 D DIC^ACRFDIC
 I $D(ACRQUIT)!$D(ACROUT)!('$L(X)) K ACRQUIT Q
 S ACRDA=Y
 I +ACRDA<1,$L(X)>2 D  I $D(ACRQUIT) K ACRQUIT Q
 .S DIR(0)="YOA"
 .S DIR("A")="   ADD "_X_" AS A NEW ARMS STANDARD ITEM? "
 .D DIR^ACRFDIC
 .I Y'=1 S ACRQUIT="" Q
 .S DIC("DR")="1////"_ACRX
 .D NEW^ACRFSTK1
ITEM11 ;EDIT A STANDARD ITEM
 Q:+ACRDA<1
 I $P($G(^ACRITEM(+ACRDA,"DT1")),U,3)'=1,$P($G(^ACRITEM(+ACRDA,"DT")),U)]"" D
 .S ACRPDA=$P(^ACRITEM(+ACRDA,"DT"),U,15)
 .Q:'ACRPDA
 .S ACRYY=0
 .F  S ACRYY=$O(^ACRITEM("G",ACRPDA,ACRYY)) Q:'ACRYY  I $D(^ACRITEM(ACRYY,"DT1")),$P(^("DT1"),U,3)=1 S ACRDA=ACRYY Q
 S (ACRD0,ACRITMDA)=+ACRDA
 S ACRSEQ=1
 N ACRY
 S ACRY=$P(ACRDA,U,3)
 F  D ITEM2 Q:$D(ACRQUIT)!$D(ACROUT)
 K ACRQUIT
 I ACRSEQ<3,$G(ACR(1)),'$D(ACRDEL),$P($G(^ACRITEM(+ACR(1),"DT1")),U) D
 .F  D ITEM5 Q:$D(ACRQUIT)!$D(ACROUT)!(ACRSEQ>2)
 K ACRQUIT,ACRDEL
 Q
ITEM2 I ACRY=1 S ACRSEQ=1 D ITEM3 Q:$D(ACRQUIT)!$D(ACROUT)
 D DISP^ACRFSTK1
 I ACRSEQ>1 D
 .S DIR(0)="YO"
 .S DIR("A")="Change Vendor priority"
 .S DIR("B")="NO"
 .D DIR^ACRFDIC
 .I Y=1 D
 ..I ACRSEQ=2 D
 ...S ACRX=ACR(2)
 ...S ACR(2)=ACR(1)
 ...S ACR(1)=ACRX
 ...F ACRX=1,2 D
 ....S DA=+ACR(ACRX)
 ....S DIE="^ACRITEM("
 ....S DR="15////"_+ACR(1)_";26////"_ACRX
 ....D DIE^ACRFDIC
 ..I ACRSEQ=3 D
 ...F ACRX=1:1:3 S ACRX(ACRX)=$G(ACR(ACRX))
 ...S ACRPRI=0
 ...W !
 ...F  S ACRPRI=$O(ACR(ACRPRI)) Q:'ACRPRI
 ...S DIR(0)="SOB^2:"_$P(ACR(2),U,3)_";3:"_$P(ACR(3),U,3)
 ...S DIR("A")="New Primary Vendor"
 ...D DIR^ACRFDIC
 ...I Y D
 ....S ACRX=Y
 ....S ACRX(Y)=ACR(1)
 ....S ACRX(1)=ACR(Y)
 ....S ACRSET="1:"_$P(ACR(1),U,3)_";"
 ....S ACRSET=$S(Y=2:ACRSET_"3:"_$P(ACR(3),U,3),1:ACRSET_"2:"_$P(ACR(2),U,3))
 ...Q:'Y
 ...S DIR(0)="SOB^"_ACRSET
 ...S DIR("A")="New Secondary Vendor"
 ...D DIR^ACRFDIC
 ...I Y=1 D
 ....S ACRX(2)=ACR(Y)
 ....S ACRX(3)=ACR($S(ACRX+Y=3:3,ACRX+Y=4:2,1:1))
 ...F ACRX=1:1:3 D
 ....S ACR(ACRX)=ACRX(ACRX)
 ....S DA=+ACR(ACRX)
 ....S DIE="^ACRITEM("
 ....S DR="15////"_+ACR(1)_";26////"_ACRX
 ....D DIE^ACRFDIC
 K ACRQUIT
 S DIR(0)="YO"
 S DIR("A")="Edit Item Data........"
 S DIR("B")="NO"
 D DIR^ACRFDIC
 I Y'=1 S ACRQUIT="" Q
 D ITEM3
 Q
ITEM3 S ACRY=""
 D:'$D(ACRADD) ITEM4
ITEM31 Q:$D(ACRQUIT)!$D(ACROUT)
 S:'$D(Y) Y="G"
 S:"123G"'[Y Y="G"
 S:Y="G" ACRG=""
 S DA=+ACRDA
 S DR=$S(Y:"[ACR DI VENDOR]",1:"[ACR ADD DIRECT ISSUE]")
 K ACRSSITM
ITEM311 S DIE="^ACRITEM("
 S ACRITEM=""
 S:$D(^ACRITEM(ACRDA,"DT1")) ACRMESS=$S(DR["SEC":"VENDOR - "_$S($P(^("DT1"),U)]"":$P(^AUTTVNDR($P(^ACRITEM(ACRDA,"DT1"),U),0),U),1:""),1:"STANDARD ITEM GENERAL INFO")
 D DIE^ACRFDIC
 K ACRITEM
 I $D(ACRG) F ACR=2,3 D:$D(ACR(ACR))
 .S ^ACRITEM(+ACR(ACR),"DT")=^ACRITEM(ACRDA,"DT")
 .S:$D(^ACRITEM(ACRDA,"DT2")) ^ACRITEM(+ACR(ACR),"DT2")=^ACRITEM(ACRDA,"DT2")
 .K ACRG
 I $D(ACRDEL) D DELETE^ACRFSTK1
 Q
ITEM4 K ACRADD
 S ACRSET="G:GENERAL INFORMATION;"_$S(ACRSEQ=1:"1:PRIMARY VENDOR",ACRSEQ=2:"1:PRIMARY VENDOR;2:SECONDARY VENDOR",1:"1:PRIMARY VENDOR;2:SECONDARY VENDOR;3:TERTIARY VENDOR")
 S DIR(0)="SO^"_ACRSET
 S DIR("A")="Which OPTION"
 D DIR^ACRFDIC
 Q:$D(ACRQUIT)!$D(ACROUT)
 Q:Y=""
 Q:'$D(ACR(Y))&'$D(ACR(1))
 S ACRDA=$S(Y&$D(ACR(Y)):+ACR(Y),1:+ACR(1))
 S:Y>1 ACRDEL=+ACR(Y)_U_Y
 Q
ITEM5 S DIR(0)="YO"
 S DIR("A")="Add a "_$S(ACRSEQ=1:"Secondary",1:"Tertiary ")_" Vendor"
 S DIR("B")="NO"
 D DIR^ACRFDIC
 I Y'=1 S ACRQUIT="" Q
 S DIC="^AUTTVNDR("
 S DIC(0)="AEMQZ"
 S DIC("A")="VENDOR..............: "
 D DIC^ACRFDIC
 Q:+Y<1!$D(ACRQUIT)!$D(ACROUT)
 S ACRVDA=+Y,ACR=0
 S ACRSEQ=ACRSEQ+1
 S X=ACRINDEX
 S DIC(0)="L"
 S DIC="^ACRITEM("
 S DIC("DR")="24////"_ACRVDA_";26////"_ACRSEQ
 D FILE^ACRFDIC
 Q:+Y<1
 S (DA,ACRDA)=+Y
 S $P(^ACRITEM(+Y,0),U,2)=$P(^ACRITEM(ACRDA(1),0),U,2)
 S ^ACRITEM(+Y,"DT")=^ACRITEM(+ACRDA(1),"DT")
 S DIK="^ACRITEM("
 D IX1^ACRFDIC
 S DA=+ACRDA
 S DIE="^ACRITEM("
 S DR=".03////"_ACRSEQ_";15////"_+ACRDA(1)_";26////"_ACRSEQ
 D DIE^ACRFDIC
 S (DA,ACRDA(ACRSEQ))=ACRDA
 S DR="[ACR DI VENDOR]"
 D ITEM311
 Q
ADD ;EP;TO ADD ITEM TO SI FILE DURING PO PROCESSING
 S ACRADD=""
 S ACRSSITM=""
 S X=^ACRSS(ACRSSDA,0)
 S ACRDT=$G(^ACRSS(ACRSSDA,"DT"))
 S ACRKW=$G(^ACRSS(ACRSSDA,"NMS"))
 S ACRVND=$G(^ACRSS(ACRSSDA,"VND"))
 S ACRDSC=$G(^ACRSS(ACRSSDA,"DESC"))
 S:ACRDSC[";" ACRDSC=$TR(ACRDSC,";",",")
 S DIC="^ACRITEM("
 S DIC(0)="LZ"
 S DIC("DR")=".02////"_$E($P(ACRKW,U,5),1,16)_";1////"_$P(ACRDSC,U)_";2////"_$P(ACRDSC,U,2)_";4////"_$P(ACRDT,U,4)_";29////"_$P(ACRDT,U,2)_";12////"_$P(ACRDT,U,2)_";13////"_$P(ACRDT,U,3)_";8////"_DT_";6////"_$P(X,U,4)
 S DIC("DR")=DIC("DR")_";24////"_+ACRVND_";50////"_$P(ACRDSC,U,3)_";51////"_$P(ACRDSC,U,4)_";52////"_$P(ACRDSC,U,5)
 D NEW^ACRFSTK1
 D ITEM11
 K ACRSSITM
 Q