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

ASUJOLIB.m

Go to the documentation of this file.
ASUJOLIB ; IHS/ITSC/LMH -SCREENMAN FOR ONLINE ISSUE ENTRY ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;This routine will be used for the online issue book transaction
 ;entry
 D:'$D(ASUK("DT")) DATE^ASUUDATE
 D:'$D(ASUL(1)) ARE^ASULARST($P(^ASUSITE(1,0),U))
 S ASUJ("E#","STA")=$G(ASUL(1,"AR","STA1"))
 K DIR S DIR(0)="PAO^9002039.2:AENQ",DIR("A")="ENTER YOUR REQUISITIONER CODE: "
 D ^DIR Q:$D(DUOUT)  Q:$D(DIROUT)  Q:$D(DTOUT)
 Q:$G(Y)']""
 S ASUJ=+Y
 D CALCVOU
 K DIR S DIR(0)="SA^Y:Yes;N:No",DIR("A")="DO YOU WANT TO LOOK AT ALL ENTRIES IN YOUR ISSUE BOOK? ",DIR("B")="Y"
 D ^DIR Q:$D(DUOUT)  Q:$D(DIROUT)  Q:$D(DTOUT)
 Q:$G(Y)']""
 G:Y["Y" LOOPALL
ANOTHER ;
 K DIC S DIC(0)="AENQ",DIC=9002036.8,D="I",DIC("A")="ENTER THE INDEX NUMBER OF THE ITEM YOU WANT TO ORDER: ",DIC("S")="I $P(^(0),U,15)=ASUJ"
 D IX^DIC Q:$D(DUOUT)  Q:$D(DIROUT)  Q:$D(DTOUT)  Q:$G(Y)']""
 S (ASUJ("E#","RQI"),DA)=+Y,ASUJ("E#","IDX")=$P(^ASUT(8,DA,0),U,5)
 S DDSFILE=9002036.8,DR="[ASUJIB ISSUE]",DDSPARM="CES" D ^DDS
 K DIR S DIR(0)="SA^Y:Yes;N:No",DIR("A")="ORDER ANOTHER ITEM? ",DIR("B")="Y"
 D ^DIR G:$D(DIRUT) EXIT G:X="N" EXIT
 G ANOTHER
LOOPALL ;
 S DA=ASUJ_"000000",X=$O(^ASUT(8,DA)) I $E(X,1,9)'=ASUJ W !!,"No entries in Issue Book for this Requsitioner" Q
 F  S DA=$O(^ASUT(8,DA)) Q:$E(DA,1,9)'=ASUJ  D  G:$G(ASUJ("ANS"))="N" EXIT
 .S ASUJ("E#","RQI")=DA,ASUJ("E#","IDX")=ASUL(1,"AR","AP")_$E(DA,$L(DA)-5,$L(DA))
 .S DDSFILE=9002036.8,DR="[ASUJIB ISSUE]",DDSPARM="CES"
 .D ^DDS
 .K DIR S DIR(0)="SA^Y:Yes;N:No",DIR("A")="CONTINUE WITH NEXT ITEM? ",DIR("B")="Y"
 .D ^DIR
 .I $D(DIRUT) S ASUJ("ANS")="N"
 .S ASUJ("ANS")=$E(X)
EXIT ;
 K DIR,DIC,ASUJ,DA,DDSFILE,DR,DDSPARM
 Q
CALCVOU ;
 S ASUJ("VOU")=$P($G(^ASUSITE(1,1)),U,8)
 I ASUJ("VOU")=4999 W "Sorry, no Voucher Numbers available for Online Issues" H 5 Q
 S $P(^ASUSITE(1,1),U,8)=ASUJ("VOU")+1,ASUP("LSMO")=$P(^ASUSITE(1,0),U,14)
 S ASUJ("VOU")=$E(ASUP("LSMO"),3,4)_$E(ASUP("LSMO"),1,2)+1_$P($FN((ASUJ("VOU")*.0001),"",4),".",2)
 Q
UCST ;EP ;CALCULATE UNIT COST FOR FORM
 S ASUJ("OH","VAL")=$P(^ASUMS(ASUJ("E#","STA"),1,ASUJ("E#","IDX"),0),U,16)
 S ASUJ("OH","QTY")=$P(^ASUMS(ASUJ("E#","STA"),1,ASUJ("E#","IDX"),0),U,17)
 I ASUJ("OH","VAL")>0,ASUJ("OH","QTY")>0 D
 .S (ASUJ("UCST"),Y)=$FN((ASUJ("OH","VAL")/ASUJ("OH","QTY")),"",2)
 E  D
 .S ASUJMSG(1)="This item is not in stock. If you order it, it will be BackOrdered"
 .S ASUJMSG(2)="The Unit Cost displayed is the Last Purchase Price"
 .S ASUJMSG(3)="$$EOP" W *7 D HLP^ASUJHELP(.ASUJMSG) ;DFM P1 9/1/98
 .S (ASUJ("UCST"),Y)=$FN($P(^ASUMS(ASUJ("E#","STA"),1,ASUJ("E#","IDX"),0),U,15),"",2) ;Last Purchase Price
 Q
VAL ;EP ;CALCULATE ORDER VALUE FOR FORM
 I '$D(ASUJ("UCST")) D UCST
 S ASUJ("QTY")=$$GET^DDSVALF("QTY")
 S ASUJ("VAL")=$FN((ASUJ("QTY")*ASUJ("UCST")),",",2)
 D PUT^DDSVALF("VAL","","",ASUJ("VAL"))
 Q
RVAL ;EP ;CALCULATE RECOMMED VALUE FOR FORM
 I '$D(ASUJ("UCST")) D UCST
 S ASUJ("RQTY")=$P(^ASUT(8,ASUJ("E#","RQI"),3),U,6)
 S (ASUJ("RVAL"),Y)=$FN((ASUJ("RQTY")*ASUJ("UCST")),",",2)
 Q
VOU ;EP ;CALCULATE VOUCHER NUMBER FOR FORM
 D:'$D(ASUJ("VOU")) CALCVOU
 S Y=ASUJ("VOU")
 S $P(^ASUT(8,ASUJ("E#","RQI"),0),U,8)=ASUJ("VOU")
 Q
FILE ;EP ;PLACE ORDER INTO ASUTRN ISSUE FILE
 S ASUT="IBK" D DAYTIM^ASUUDATE
 S ASUHDA=$O(^ASUT(3,9999999999),-1)+1
 M ^ASUT(3,ASUHDA)=^ASUT(8,ASUJ("E#","RQI"))
 S $P(^ASUT(3,ASUHDA,0),U)=ASUT(ASUT,"TRKY")
 S $P(^ASUT(3,ASUHDA,3),U,6)="" ;BLANK OUT RECOMMEND QTY
 S $P(^ASUT(8,ASUHDA,0),U,6)="" ;RESET ORDER QTY
 S $P(^ASUT(8,ASUHDA,1),U,8)="" ;RESET VOUCHER NUMBER
 S DA=ASUHDA,DIK="^ASUT(3," D IX^DIK ;Re xref new record
 Q
CRMSTR ;EP ; -CREATE ISSUE BOOK TRANS
 D:$G(ASUK("DT"))']"" DATE^ASUUDATE
 W !!,"CREATE ONLINE ISSUE BOOK TRANS MASTER PROGRAM",!!
 I $G(ASUF("STA"))'["S" D
 .S ASUMK("E#","STA")=0
 .F  S ASUMK("E#","STA")=$O(^ASUMK(ASUMK("E#","STA"))) Q:ASUMK("E#","STA")'?1N.N  D REQS
 E  D
 .K DIR
 .S DIR(0)="PAO^ASUMK(",DIR("A")="ENTER STATION FOR ISSUE BOOK : " D ^DIR
 .Q:Y']""
 .Q:Y<0
 .S ASUMK("E#","STA")=+Y
 .D REQS
 K ASUC,ASUMK,ASUMS,ASUMX,ASUV,ASUT
 Q
REQS ;
 S (ASUL(2,"STA","E#"),ASUMS("E#","STA"))=ASUMK("E#","STA")
 D STA^ASULARST(ASUL(2,"STA","E#"))
 S ASUMK("E#","REQ")=0
 F  S ASUMK("E#","REQ")=$O(^ASUMK(ASUMK("E#","STA"),1,ASUMK("E#","REQ"))) Q:ASUMK("E#","REQ")'?1N.N  D
 .S DA=ASUMK("E#","REQ")_000000,ASUHDA=DA+999999,DIK="ASUT(8,"
 .F  S DA=$O(^ASUT(8,DA)) Q:DA'?1N.N  Q:DA>ASUHDA  D ^DIK
 .F X=19,20,22 K ASUL(X)
 .D REQ^ASULDIRR(ASUMK("E#","REQ"))
 .W !?10,"PROCESSING REQUSITIONER: ",ASUL(20,"REQ","NM")
 .S ASUMK("E#","IDX")=0
 .F  S ASUMK("E#","IDX")=$O(^ASUMK(ASUMK("E#","STA"),1,ASUMK("E#","REQ"),1,ASUMK("E#","IDX"))) Q:ASUMK("E#","IDX")'?1N.N  Q:$E(ASUMK("E#","IDX"),3,9)="999999"  D
 ..S ASUMS("E#","IDX")=ASUMK("E#","IDX")
 ..D ^ASUMSTRD,READ^ASUMKBIO
 ..S ASUMX("E#","IDX")=ASUMK("E#","IDX") D READ^ASUMXDIO
 ..I $G(Y)<0 W !?15,"NO ENTRY IN INDEX MASTER" Q
 ..W !?10,"PROCESSING INDEX: ",ASUMX("IDX")
 ..S ASUMS("E#","IDX")=ASUMX("E#","IDX")
 ..D ^ASUMSTRD
 ..I $G(Y)<0 W !?20,"NO INDEX ON STATION MASTER" Q
 ..S ASUT20=$G(^ASUL(20,ASUL(20,"REQ","E#"),2,1,0))
 ..I ASUT20']"" W !?30,"NO PRIMAR CAN AVAILABLE" Q
 ..S ASUL(20,"CAN")=$P(ASUT20,U)
 ..S ASUL(17,"SSA")=$P(ASUT20,U,2) D SSA^ASULDIRR(ASUL(17,"SSA"))
 ..S ASUHDA=ASUL(20,"REQ","E#")_ASUMX("IDX")
 ..Q:'$D(ASUHDA)
 ..S (ASUT(0),ASUT(1),ASUT(3))="",ASUT="OIB"
 ..S $P(ASUT(0),U)=ASUHDA
 ..S $P(ASUT(0),U,2)=ASUL(1,"AR","E#")
 ..S $P(ASUT(0),U,3)=ASUL(2,"STA","E#")
 ..S $P(ASUT(0),U,4)=ASUMX("ACC")
 ..S $P(ASUT(0),U,5)=ASUMX("E#","IDX")
 ..S $P(ASUT(0),U,6)=DUZ(2)
 ..S $P(ASUT(0),U,10)="Y" ;Status
 ..S $P(ASUT(0),U,11)=ASUL(17,"SSA","E#")
 ..S $P(ASUT(0),U,13)=ASUL(18,"SST","E#")
 ..S $P(ASUT(0),U,14)=ASUL(19,"USR","E#")
 ..S $P(ASUT(0),U,15)=ASUL(20,"REQ","E#")
 ..S $P(ASUT(0),U,16)=ASUMS("EOQ","TB")
 ..S $P(ASUT(1),U)=32
 ..S $P(ASUT(1),U,2)=ASUL(1,"AR","AP")
 ..S $P(ASUT(1),U,3)=ASUL(2,"STA","CD")
 ..S $P(ASUT(1),U,4)=ASUMX("ACC")
 ..S $P(ASUT(1),U,5)=ASUMX("IDX")
 ..S $P(ASUT(1),U,6)="" ;QTY REQ
 ..S $P(ASUT(1),U,7)="" ;VAL
 ..S $P(ASUT(1),U,8)="" ;VOU
 ..S $P(ASUT(1),U,10)="" ;DT REQ
 ..S $P(ASUT(1),U,11)=ASUL(17,"SSA")
 ..S $P(ASUT(1),U,13)=ASUL(18,"SST")
 ..S $P(ASUT(1),U,14)=ASUL(19,"USR")
 ..S $P(ASUT(1),U,15)=ASUL(20,"CAN")
 ..S $P(ASUT(1),U,16)=ASUMS("EOQ","TP")
 ..S $P(ASUT(1),U,18)="" ;F-P-N
 ..S $P(ASUT(3),U)="" ;POST
 ..S $P(ASUT(3),U,2)=3 ;ISSUE TYPE (REGULAR)
 ..S $P(ASUT(3),U,3)="" ;REQ TYP
 ..S $P(ASUT(3),U,4)="" ;REQ #
 ..S $P(ASUT(3),U,5)="" ;C/G
 ..S $P(ASUT(3),U,6)=ASUMK("ULQTY")
 ..I $D(^ASUT(3,ASUHDA,0)) D
 ...S DA=ASUHDA,DIK="^ASUT(8," D ^DIK ;Delete old entry and xrefs
 ..S ^ASUT(8,ASUHDA,0)=ASUT(0)
 ..S ^ASUT(8,ASUHDA,1)=ASUT(1)
 ..S ^ASUT(8,ASUHDA,3)=ASUT(3)
 ..S $P(^ASUT(8,0),U,4)=$P(^ASUT(8,0),U,4)+1,$P(^ASUT(8,0),U,3)=ASUHDA
 ..S DA=ASUHDA,DIK="^ASUT(8," D IX^DIK ;Re xref new record
 .K ASUMK("E#","IDX")
 K ASUT20
 Q
TRANS ;EP ;SCREENMAN FOR ONLINE ISSUE TRANSACTION ENTRY
 W !!,"NOT CURRENTLY AVAILABLE"
 Q