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

ASUV1PN.m

Go to the documentation of this file.
ASUV1PN ; IHS/ITSC/LMH -ENTER 1ST COUNTS ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine accepts Physical Inventory 'First Count' data input.
 D:'$D(DT) ^XBKVAR
ACCOUNT ;
 F  D  Q:$D(DUOUT)  Q:$D(DTOUT)  Q:$G(ASUF)>0
 .D ACCT
 .I $D(DUOUT)!($D(DTOUT)) Q
 .Q:$G(ASUF)>0
 .I ASUMV("E#","ASA")="" S ASUF=1 Q
 .S DIR("A")="ENTER COUNTS FOR ALL STORAGE LOCATIONS? (Y/N) "
 .S DIR("B")="Y"
 .S DIR("?")="Enter 'Y' to enter 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
 ..D ASUV1PN3
 K ASUC("TR"),ASUR,ASUSAV,ASUF,ASUMV,ASUV,ASUMX
 K DTOUT,DUOUT,DIC,DIR,X,Y
 Q
ASUV1PN0 ;EP ;
 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)]"" Q
 ..D INDEX^ASUV9IMR
 ..Q:ASUMV("IDX")["*"  ;MASTER HAS BEEN DELETED
 ..I ASUMV("CNT-ENT")=1 Q
 ..S ASUF=1
 I ASUF=1 D
 .S ASURX="W !,""AT LEAST ONE ITEM HAS NOT BEEN COUNTED -FIRST COUNT NOT MARKED AS COMPLETE"""
 .D V^ASUUPLOG
 G XIT1
FLAGIT1 ;EP;
 S ASURX="W !,""INVENTORY FOR ACCOUNT '"_ASUMV("ACC")_"' -"_ASUL(9,"ACC","NM")_" IS NOW IN FIRST COUNT MODE"""
 D V^ASUUPLOG
 S $P(^ASUMV(ASUMV("E#","ASA"),0),U,4)=1
 G XIT1
FLAGIT2 ;EP;
 S ASURX="W !,""ALL ITEMS HAVE BEEN COUNTED ONCE -FIRST COUNT MARKED AS COMPLETE"",!,""INVENTORY FOR ACCOUNT '"_ASUMV("ACC")_"' -"_ASUL(9,"ACC","NM")_" IS NOW IN RE-COUNT MODE"""
 D V^ASUUPLOG
 S $P(^ASUMV(ASUMV("E#","ASA"),0),U,4)=2
XIT1 ;
 Q
ACCT ;EP;ACCOUNT
 D CLS^ASUUHDG
 S DIC("A")="ENTER 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")_"' -"_ASUL(9,"ACC","NM")_"""",ASUF=1
 .D V^ASUUPLOG
 G XIT1
CKIT ;EP;
 I ASUMV("MODE")=1 S ASUF=0 Q
 I ASUMV("MODE")=0 S ASUV("MSG")="INITIAL INVENTORY LIST HAS NOT YET BEEN CREATED " D MESSAGE Q
 S ASUV("MSG")="FIRST COUNTS ARE ALREADY COMPLETED " D MESSAGE
 D REPRINT
 Q
CKINIT ;EP;
 I ASUMV("MODE")=0 S ASUF=0 Q
 S ASUV("MSG")="INVENTORY HAS ALREADY BEGUN " D MESSAGE
REPRINT ;
 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")_"' -"_ASUL(9,"ACC","NM")_" INVENTORY"""
 S ASURX=ASURX_",!,""WHICH IS IN "_$S(ASUMV("MODE")=1:"FIRST COUNT",ASUMV("MODE")=2:"RECOUNT",ASUMV("MODE")=3:"RESEARCH",1:"COMPLETED")_" MODE"""
 I ASUV("MSG",1)="" D
 .S ASUF=2
 E  D
 .S ASUF=1
 K ASUV("MSG")
 D V^ASUUPLOG
 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
 .D CLS^ASUUHDG
 .S ASUF("IDX")=0
 .D IDXLOOP
 D
 .I ASUF("SLC") W !,"ALL COUNTS FOR ACCOUNT '",ASUMV("ACC"),"' -",ASUL(9,"ACC","NM")," HAVE BEEN ENTERED",!!! Q
 .I 'ASUF("IDX") W !,"ALL RECOUNTS FOR STORAGE LOCATION '",ASUMV("SLC"),"' -",ASUMV("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 ASUV1PN2
 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
ASUV1PN2 ;
 I ASUMV("E#","INDX")'?1N.N G XIT2
 D INDEX^ASUV9IMR
 Q:ASUMV("IDX")["*"  ;MASTER HAS BEEN DELETED
 D READ^ASUMXDIO
 I ASUMV("CNT-ENT")=1,ASUF("IDX")<2 G XIT2
 D:$G(ASUMV("SLC"))']"" STORLOC^ASUV9IMR
 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")
 S DIR("B")=$S(ASUMV("CNT","1ST")>0:ASUMV("CNT","1ST"),1:"")
 S DIR("A")="ENTER INVENTORY QUANTITY COUNT"
 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","1ST")=ASUR("QTY")
 S ASUMV("QTY","DIF")=ASUR("QTY")-ASUMV("QTY","STAM")
 S ASUMV("CNT-ENT")=1
 D INDEX^ASUV9IMW
XIT2 ;
 Q
ASUV1PN3 ;
 S ASUR("ACC")=ASUMV("ACC")
 F  D  I $D(DUOUT)!($D(DTOUT))!$G(ASUF)]"" Q
 .S DIC("A")="ENTER 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 ",ASUV("SL NM")," '",ASUR("SLC"),"' IN ACCOUNT ",ASUL(9,"ACC","NM")," INVENTORY MASTER"
 ..D PAUSE
 .E  D
 ..S DIR("A")="ENTER COUNTS FOR ALL ITEMS? (Y/N) "
 ..S DIR("B")="Y"
 ..S DIR("?")="Enter 'Y' to enter counts for all items or 'N' to select item to enter 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  Q
 ...S ASUF("IDX")=0
 ...D IDXLOOP
 ...I ASUF("IDX")=0 W !,"ALL ",ASUV("SL NM")," '",ASUR("SLC"),"' ITEM COUNTS HAVE BEEN ENTERED FOR ACCOUNT ",ASUL(9,"ACC","NM") D PAUSE
 ..E  D
 ...D RDINDX
 .S ASUF=0
 S ASUF=0
 Q
RDINDX ;
 F  D  I $D(DUOUT)!($D(DTOUT))!$G(ASUF)]"" 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 ASUV1PN2
 ..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