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

ASUV2RN.m

Go to the documentation of this file.
ASUV2RN ; IHS/ITSC/LMH -ENTER RE-COUNTS ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine accepts Physical Inventory 'Re-Count' data input.
 D:'$D(DT) ^XBKVAR
ACCOUNT ;
 F  D  I $D(DUOUT)!($D(DTOUT))!($G(ASUF)>0) Q
 .D ACCT
 .I $D(DUOUT)!($D(DTOUT))!($G(ASUF)>0) Q
 .I ASUMV("E#","ASA")="" S ASUF=1 Q
 .S DIR("A")="ENTER RE-COUNTS FOR ALL STORAGE LOCATIONS? (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 SLCLOOP
 ..K ASUR("RSVP")
 .E  D ASUV2RN3
 K ASUC("TR"),ASUR,ASUSAV,ASUF,ASUMV,ASUV,ASUMX("E#")
 K DTOUT,DUOUT,DIC,DIR,X,Y
 Q
SLCLOOP ;EP;
 D CKIT
 I $D(DUOUT)!($D(DTOUT))!($G(ASUF)>0) Q
 S ASUMV("E#","SLC")=0
 S ASUF("SLC")=1
 F  S ASUMV("E#","SLC")=$O(^ASUMV(ASUMV("E#","ASA"),1,ASUMV("E#","SLC"))) Q:ASUMV("E#","SLC")'?1N.N  D  Q:$D(DTOUT)  Q:$D(DUOUT)
 .D STORLOC^ASUV9IMR
 .S ASUMV("E#","INDX")=0
 .D CLS^ASUUHDG
 .S ASUF("IDX")=0
 .D IDXLOOP
 D
 .I ASUF("SLC") W !,"ALL RE-COUNTS FOR ACCOUNT '",ASUMV("ACC"),"' -",ASUL(9,"ACC","NM")," HAVE BEEN ENTERED",!!! Q
 .I 'ASUF("IDX") D
 ..W !,"ALL RE-COUNTS FOR STORAGE LOCATION '",ASUMV("SLC"),"' -"
 ..I $G(ASUV("SL NM"))']"" D STORLOC^ASUV9IMR
 ..W $G(ASUV("SL NM"))," HAVE BEEN ENTERED",!!!
 S DIR(0)="E" D ^DIR K DIR
 Q
IDXLOOP ;EP;
 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  Q:$D(DTOUT)  Q:$D(DUOUT)
 .D ASUV2RN2
 Q
LOOP ;EP;
 S ASUMV("E#","ASA")=ASUL(2,"STA","E#")
 F  S ASUMV("E#","ASA")=$O(^ASUMV(ASUMV("E#","ASA"))) Q:ASUMV("E#","ASA")'?1N.N  D SLCLOOP Q:$D(DTOUT)  Q:$D(DUOUT)
 Q
ASUV2RN2 ;
 I ASUMV("E#","INDX")'?1N.N G XIT2
 D INDEX^ASUV9IMR
 I ASUMV("IDX")["*" W !,"Master has been deleted",*7 Q
 D READ^ASUMXDIO
 I ASUMV("CNT-ENT")=2,ASUF("IDX")<2 G XIT2
 I ASUMV("QTY","DIF")=0,$G(ASUF)<2 G XIT2
 I 'ASUF("IDX") W !,"NOW PROCESSING ALL'",ASUMV("SLC"),"' STORAGE LOCATION ENTRIES",! S ASUF("IDX")=1
 S ASUF("SLC")=0
 W !!,"INDEX : ",ASUMX("IDX")
 S ASUMS("STA")=$P(^ASUMS(ASUMV("STA"),0),U)
 W ?15,ASUMX("DESC",1),?65,"STATION : ",ASUMS("STA")
 K DIR
 S DIR("B")=$S(ASUMV("CNT","2ND")>0:ASUMV("CNT","2ND"),1:"")
 S DIR("A")="ENTER RE-COUNT QUANTITY"
 S DIR(0)="NO^0:999999:0^K:X[""."" X" D ^DIR K DIR
 I $D(DTOUT)!($D(DUOUT)) G XIT2
 S ASUR("QTY")=X
 I ASUR("QTY")="" G XIT2
 S ASUMV("CNT","2ND")=ASUR("QTY")
 S ASUMV("QTY","DIF")=ASUR("QTY")-ASUMV("QTY","STAM")
 S ASUMV("CNT-ENT")=2
 D INDEX^ASUV9IMW
XIT2 ;
 Q
ASUV2RN3 ;
 S ASUR("ACC")=ASUMV("ACC")
 F  D  I $D(DUOUT)!($D(DTOUT))!($G(ASUF)>0) Q
 .S DIC("A")="ENTER RE-COUNTS FOR WHAT STORAGE LOCATION CODE "
 .S DIC="9002030.1",DIC(0)="AMEZ"
 .D ^DIC K DIC
 .I $D(DUOUT)!($D(DTOUT)) Q
 .S ASUR("SLC")=$P(Y,U,2),ASUMV("E#","SLC")=+Y
 .I ASUR("SLC")="" S ASUF=1 Q
 .S ASUV("SL NM")=$P(Y(0),U,2)
 .I '$D(^ASUMV(ASUMV("E#","ASA"),1,ASUMV("E#","SLC"),0)) D  Q
 ..W !,"NO ITEMS FOR STORAGE LOCATION ",ASUR("SLC")," IN ACCOUNT ",ASUL(9,"ACC","NM")," INVENTORY MASTER"
 ..D PAUSE
 .E  D
 ..S DIR("A")="ENTER RE-COUNTS FOR ALL ITEMS? (Y/N) "
 ..S DIR("B")="Y"
 ..S DIR("?")="Enter 'Y' to enter re-counts for all items or 'N' to select item to enter re-counts on"
 ..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
 ...S ASUF("IDX")=0
 ...D IDXLOOP
 ...I ASUF("IDX")=0 W !,"ALL STORAGE LOCATION ",ASUV("SL NM")," '",ASUR("SLC"),"' RE-RECOUNTS HAVE BEEN ENTERED FOR ACCOUNT ",ASUL(9,"ACC","NM")
 ..E  D
 ...D RDINDX
 .S ASUF=0
 S ASUF=0
 Q
RDINDX ;
 F  D  I $D(DUOUT)!($D(DTOUT))!($G(ASUF)>0) Q
 .W ! D ^ASUV9IDX
 .I $D(DUOUT)!($D(DTOUT)) Q
 .I ASUMX("E#","IDX")']"" S ASUF=1 Q
 .S ASUMV("E#","INDX")="",ASUF("IDX")=2
 .F ASUC("TR")=1:1 S ASUMV("E#","INDX")=$O(^ASUMV(ASUMV("E#","ASA"),1,ASUMV("E#","SLC"),1,"B",ASUMX("E#","IDX"),ASUMV("E#","INDX"))) D  Q:ASUMV("E#","INDX")=""
 ..I ASUMV("E#","INDX")]"" D
 ...D ASUV2RN2
 ..E  I ASUC("TR")=1 D
 ...W !,"INDEX NOT IN INVENTORY MASTER FOR ACCOUNT ",ASUMV("ACC")," ",ASUL(9,"ACC","NM"),!,"STORAGE LOCATION ",ASUR("SLC")
 ...D PAUSE
 .S ASUF=0
 S ASUF=0
 Q
PAUSE ;
 S DIR(0)="E" D ^DIR K DIR
 Q
ASUV2RN0 ;EP ;CHECK RE-COUNTS;
 D CKIT G:($G(ASUF)>0) EXIT
 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 RE-COUNTED -RE-COUNT NOT MARKED AS COMPLETE"""
 .D V^ASUUPLOG
 G EXIT
FLAGIT3 ;EP;
 S ASURX="W !,""ALL ITEMS HAVE BEEN COUNTED -RE-COUNT MARKED AS COMPLETE"",!,""INVENTORY FOR ACCOUNT '"_ASUMV("ACC")_"' -"_$G(ASUL(9,"ACC","NM"))_" IS NOW IN RESEARCH MODE"""
 D V^ASUUPLOG
 S $P(^ASUMV(ASUMV("E#","ASA"),0),U,4)=3
EXIT ;
 Q
ACCT ;EP;ACCOUNT
 I $G(ASUL(2,"STA","E#"))']"" D STA^ASUV0NT I $D(DTOUT)!($D(DUOUT)) G EXIT
 D CLS^ASUUHDG
 S DIC("A")="ENTER RE-COUNTS FOR WHAT ACCOUNT? "
 S DIC="9002039.09",DIC(0)="AMEZQ"
 D ^DIC K DIC
 I $D(DTOUT)!($D(DUOUT)) Q
 Q:'$D(Y)
 I Y>0 D
 .S ASUF=0
 .S ASUMV("ACC")=$P(Y,U),ASUMV("E#","ASA")=ASUL(2,"STA","E#")_ASUMV("ACC")
 .D ACC^ASULDIRF(ASUMV("ACC"))
 E  D  Q
 .S ASUMV("E#","ASA")=ASUL(2,"STA","E#") S ASUF=1
 I $D(^ASUMV(ASUMV("E#","ASA"),0)) D
 .D ACCOUNT^ASUV9IMR,CKIT
 E  D
 .S ASURX="W !,""NO INVENTORY ACTIVE FOR ACCOUNT '"_ASUMV("ACC")_"' -"_$G(ASUMV("E#","ACC","NM"))_"""",ASUF=1
 .D V^ASUUPLOG
 G EXIT
CKIT ;EP;
 I ASUMV("MODE")=2 S ASUF=0 Q
 I ASUMV("MODE")=0 S ASUV("MSG")="INVENTORY NOT BEGUN " D MESSAGE Q
 I ASUMV("MODE")=1 S ASUV("MSG")="FIRST COUNTS NOT COMPLETED " D MESSAGE Q
 S ASUV("MSG")="RE-COUNTS COMPLETED " D MESSAGE
 I ASUF=2 S ASUF=1 Q
 Q:$D(DTOUT)!($D(DUOUT))
 Q:ASUK("PTR-Q")
 S DIR(0)="Y",DIR("A")="DO YOU WANT TO RE-PRINT THE RE-COUNT LISTING? ",DIR("?")="ENTER 'Y' TO RE-PRINT OR 'N' TO CANCEL REQUEST" D ^DIR K DIR
 I Y S ASUF=0,ASUF("RPRN")=1
 Q
MESSAGE ;
 S ASUV("MSG",1)=$G(ASUV("MSG",1))
 S ASURX="W !,"""_ASUV("MSG",1)_""",!,"""_ASUV("MSG")_"FOR ACCOUNT '"_ASUMV("ACC")_"' -"_$G(ASUL(9,"ACC","NM"))_" INVENTORY"""
 S ASURX=ASURX_",!,""WHICH IS IN "_$S(ASUMV("MODE")=0:"INITIALIZED",ASUMV("MODE")=3:"RESEARCH",ASUMV("MODE")=4:"COMPLETED",1:"FIRST COUNT")_" MODE"""
 I ASUV("MSG",1)="" D
 .S ASUF=2
 E  D
 .S ASUF=1
 D V^ASUUPLOG
 K ASUV("MSG")
 Q