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

ASUV3AN.m

Go to the documentation of this file.
ASUV3AN ; IHS/ITSC/LMH -ENTER ADJUSTMENTS ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine accepts Physical Inventory 'Adjustments' data input.
 D:'$D(DT) ^XBKVAR
 F  D  I $D(DUOUT)!($D(DTOUT))!($G(ASUF)>0) Q
 .D ACCOUNT
 .I $D(DUOUT)!($D(DTOUT))!($G(ASUF)>0) Q
 .I ASUMV("E#","ASA")="" S ASUF=1 Q
 .S ASUF("IDX")=1
 .S DIR("A")="ENTER RESEARCH ADJUSTMENT FOR ALL ITEMS? (Y/N) "
 .S DIR("B")="Y"
 .S DIR("?")="Enter 'Y' to enter re-counts for all items or 'N' to select items or '^' to exit"
 .S DIR(0)="SA^Y:Yes;N:No"
 .D ^DIR K DIR
 .I $D(DUOUT)!($D(DTOUT)) Q
 .S ASUR("RSVP")=$E(Y)
 .I ASUR("RSVP")="Y" D
 ..D IXLOOP
 ..K ASUR("RSVP")
 .E  D
 ..K ^ASUV("AX",ASUMV("E#","ASA"))
 ..D ASUV3AN4,ASUV3AN1 S ASUF=0
 .I ASUF("IDX") D
 ..W !!!,"ALL RESEARCH ADJUSTMENT QUANTITIES ENTERED FOR ACCOUNT '",ASUMV("ACC"),"' -",ASUL(9,"ACC","NM"),!
 ..S DIR(0)="E" D ^DIR K DIR
 K ASUC("TR"),ASUR,ASUSAV,ASUF,ASUMV,ASUV,ASUMX
 K DTOUT,DUOUT,DIC,DIR,X,Y
 Q
ASUV3AN0 ;EP ; CHECK
 D CKIT
 G:($G(ASUF)>0)!($D(DTOUT))!($D(DUOUT)) XIT1
 S ASUMV("E#","SLC")=0
 F  S ASUMV("E#","SLC")=$O(^ASUMV(ASUMV("E#","ASA"),1,ASUMV("E#","SLC"))) Q:ASUMV("E#","SLC")'?1N.N  D  I $D(DTOUT)!($D(DUOUT))!($G(ASUF)>0) Q
 .D STORLOC^ASUV9IMR
 .S ASUMV("E#","INDX")=0
 .F  S ASUMV("E#","INDX")=$O(^ASUMV(ASUMV("E#","ASA"),1,ASUMV("E#","SLC"),1,ASUMV("E#","INDX"))) Q:ASUMV("E#","INDX")'?1N.N  D  I $D(DTOUT)!($D(DUOUT))!($G(ASUF)>0) Q
 ..D INDEX^ASUV9IMR
 ..Q:ASUMV("IDX")["*"  ;MASTER HAS BEEN DELETED
 ..I ASUMV("QTY","DIF")=0 Q
 ..I ASUMV("CNT-ENT")>2 Q
 ..S ASUF=1
 I ASUF=1 D
 .S ASURX="W !,""AT LEAST ONE ITEM HAS NOT BEEN RESEARCHED -RESEARCH NOT MARKED AS COMPLETE"""
 .D V^ASUUPLOG
 G XIT1
FLAGIT4 ;EP ;SET FLAGS
 S ASURX="W !,""ALL ITEMS HAVE BEEN RESEARCHED -RESEARCH MARKED AS COMPLETE"",!,""INVENTORY FOR ACCOUNT "_ASUMV("ACC")_" "
 D:$G(ASUL(9,"ACC","NM"))="" ACC^ASULDIRF(ASUMV("ACC"))
 S ASURX=ASURX_ASUL(9,"ACC","NM")_" IS NOW IN COMPLETED MODE"""
 D V^ASUUPLOG
 S $P(^ASUMV(ASUMV("E#","ASA"),0),U,4)=4
XIT1 ;
 Q
ACCOUNT ;
 I $G(ASUL(2,"STA","E#"))']"" D STA^ASUV0NT I $D(DTOUT)!($D(DUOUT)) G XIT1
 D CLS^ASUUHDG
 S DIC("A")="ENTER RESEARCH ADJUSTED QUANTITIES FOR WHAT ACCOUNT? "
 S DIC="9002039.09",DIC(0)="AMEZQ"
 D ^DIC K DIC
 I $D(DTOUT)!($D(DUOUT)) Q
 I '$D(Y) S ASUF=1 Q
 I Y>0 D
 .S ASUMV("ACC")=$P(Y,U),ASUMV("E#","ASA")=ASUL(2,"STA","E#")_ASUMV("ACC")
 E  D
 .S ASUMV("E#","ASA")=ASUL(2,"STA","E#"),ASUF=1
 Q:ASUMV("E#","ASA")=""
 I $D(^ASUMV(ASUMV("E#","ASA"),0)) D
 .D ACCOUNT^ASUV9IMR,CKIT
 E  D
 .S ASURX="W !,""NO INVENTORY ACTIVE FOR ACCOUNT '"_ASUMV("ACC")_"' -"_ASUL(9,"ACC","NM")_"""",ASUF=1
 .D V^ASUUPLOG
 G XIT1
CKIT ;
 D
 .I ASUMV("MODE")=3 S ASUF=0 K ^ASUV("AX",ASUMV("E#","ASA")) D ASUV3AN4 Q
 .I ASUMV("MODE")=0 S ASUF=2,ASUV("MSG",2)="""INVENTORY" D MESSAGE Q
 .I ASUMV("MODE")=1 S ASUF=2,ASUV("MSG",2)="""FIRST COUNTS" D MESSAGE Q
 .I ASUMV("MODE")=2 S ASUF=2,ASUV("MSG",2)="""RE-COUNTS" D MESSAGE Q
 .S ASUF=1,ASUV("MSG",2)="!,""RESEARCH COMPLETED FOR ACCOUNT "_ASUMV("ACC")_" "_ASUL(9,"ACC","NM")_" INVENTORY"
 .S ASUV("MSG")="!,""WHICH IS IN COMPLETED MODE"""
 .D MESSAGE2
 I ASUF=0 Q
 I ASUF=2 S ASUF=1 Q
 Q:$D(DTOUT)!($D(DUOUT))
 Q:$G(ASUK("PTR-Q"))
 S DIR(0)="Y",DIR("A")="DO YOU WANT TO RE-PRINT THE ADJUSTMENT DOCUMENT? ",DIR("?")="ENTER 'Y' TO RE-PRINT OR 'N' TO CANCEL REQUEST" D ^DIR K DIR
 I Y D
 .S ASUF=0,ASUF("RPRN")=1
 E  D
 .S ASUF=1
 Q
MESSAGE ;
 S ASUV("MSG")=ASUV("MSG",2)_" NOT "_$S(ASUMV("MODE")=0:"BEGUN",1:"COMPLETED")_" FOR ACCOUNT "_ASUMV("ACC")_" "_ASUL(9,"ACC","NM")_" INVENTORY"",!,""RESEARCH NOT ALLOWED"""
 S ASUV("MSG",1)=$G(ASUV("MSG",1))
 I ASUV("MSG",1)']"" D
 .S ASUV("MSG",1)="W !,"
 E  D
 .S ASUV("MSG",1)="W !,"""_ASUV("MSG",1)_""",!,"
 S ASURX=ASUV("MSG",1)_ASUV("MSG")
 D V^ASUUPLOG
 Q
MESSAGE2 ;
 S ASUV("MSG",1)=$G(ASUV("MSG",1))
 S ASURX="W !,"""_ASUV("MSG",1)_""","_ASUV("MSG",2)_""""
 I ASUV("MSG",1)="" D
 .S ASUF=2
 E  D
 .S ASUF=1
 D V^ASUUPLOG
 Q
ASUV3AN1 ;
 S ASUR("ACC")=ASUMV("ACC")
 F  D  I $D(DTOUT)!($D(DUOUT))!($G(ASUF)>0) Q
 .W ! D ^ASUV9IDX I $D(DTOUT)!($D(DUOUT)) Q
 .I ASUMX("E#","IDX")="" S ASUF=1 Q
 .D READ^ASUMXDIO
 .S ASUMV("E#","IDX")=ASUMX("IDX")
 .I '$D(^ASUV("AX",ASUMV("E#","ASA"),ASUMV("E#","IDX"))) D
 ..W !,"NO ADJUSTMENT NEEDED FOR THIS INDEX"
 .E  D
 ..D STALOOP
 Q
IXLOOP ;EP
 S ASUMV("E#","IDX")=0
 F  S ASUMV("E#","IDX")=$O(^ASUV("AX",ASUMV("E#","ASA"),ASUMV("E#","IDX"))) Q:ASUMV("E#","IDX")']""  D STALOOP Q:$D(DTOUT)  Q:$D(DUOUT)
 Q
STALOOP ;
 S ASUL(2,"STA","E#")=0
 F  S ASUL(2,"STA","E#")=$O(^ASUV("AX",ASUMV("E#","ASA"),ASUMV("E#","IDX"),ASUL(2,"STA","E#"))) Q:ASUL(2,"STA","E#")']""  D ASUV3AN2 Q:$D(DTOUT)  Q:$D(DUOUT)
 Q
ASUV3AN2 ;
 S ASUMV(0,2)=^ASUV("AX",ASUMV("E#","ASA"),ASUMV("E#","IDX"),ASUL(2,"STA","E#"))
 S ASUMV("E#","SLC")=$P(ASUMV(0,2),U)
 S ASUMV("E#","INDX")=$P(ASUMV(0,2),U,2)
 D ^ASUV9IMR
 D READ^ASUMXDIO
 S ASUMV("VAL","DIF")=ASUMV("QTY","DIF")*ASUMV("U/C")
 I +ASUMV("QTY","DIF")>1!(ASUMV("QTY","DIF")<-1) D
 .I ASUMV("VAL","DIF")'<25!(ASUMV("VAL","DIF")<-25) D
 ..S ASUF("IDX")=0
 ..I ASUR("RSVP")="Y" W !!,"INDEX : ",ASUMX("IDX")
 ..S ASUMS("STA")=$P(^ASUMS(ASUMV("STA"),0),U)
 ..W:ASUR("RSVP")="Y" ?15,ASUMX("DESC",1)
 ..W ?65,"STATION : ",ASUMS("STA")
 ..S DIR("B")=ASUMV("ADJQTY")
 ..S DIR("A")="ENTER RSCH/ADJ MASTER QUANTITY"
 ..S DIR(0)="NO^0:999999:0^K:X[""."" X" D ^DIR K DIR
 ..I $D(DTOUT)!($D(DUOUT)) Q
 ..S ASUR("QTY")=X
 ..I ASUR("QTY")="" Q
 ..S ASUMV("ADJQTY")=ASUR("QTY")
 ..S ASUMV("QTY","DIF")=ASUMV("CNT","2ND")-ASUR("QTY")
 ..S ASUMV("CNT-ENT")=3
 E  D
 .S ASUMV("CNT-ENT")=4
 .Q:ASUR("RSVP")="Y"
 .W !,"DIFFERENCE LESS THAN 1 OR VALUE LESS THAN $25.00 -NO RESEARCH COUNTS"
 .S DIR(0)="E" D ^DIR K DIR
 .S ASUMV("IDX")=""
 D ^ASUV9IMW
 Q
ASUV3AN4 ;
 S ASUMV("E#","SLC")=0
 F  S ASUMV("E#","SLC")=$O(^ASUMV(ASUMV("E#","ASA"),1,ASUMV("E#","SLC"))) Q:ASUMV("E#","SLC")'?1N.N  D
 .S ASUMV("E#","INDX")=0
 .F  S ASUMV("E#","INDX")=$O(^ASUMV(ASUMV("E#","ASA"),1,ASUMV("E#","SLC"),1,ASUMV("E#","INDX"))) Q:ASUMV("E#","INDX")'?1N.N  D
 ..S ASUF("QU")=0
 ..D ^ASUV9IMR
 ..I $G(ASUR("RSVP"))="N" D
 ...I ASUMV("QTY","DIF")=0 D  Q:ASUF("QU")
 ....I ASUMV("QTY","STAM")'=0 S ASUF("QU")=1 Q
 ....I ASUMV("ADJQTY")=0 S ASUF("QU")=1 Q
 ....I ASUMV("CNT","2ND")=0 S ASUF("QU")=1 Q
 ....I ASUMV("CNT","1ST")=0 S ASUF("QU")=1 Q
 ..;I ASUMV("CNT-ENT")>2 S ASUF("QU")=1 Q  ;ADJUSTMENT ALREADY ENTERED
 ..I ASUF("QU")=0 D
 ...S ASUF("IDX")=0
 ...S ^ASUV("AX",ASUMV("E#","ASA"),ASUMV("IDX"),ASUMV("STA"))=ASUMV("E#","SLC")_U_ASUMV("E#","INDX")
 Q