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

ASU6JUPD.m

Go to the documentation of this file.
ASU6JUPD ; IHS/ITSC/LMH -PROCESS CREDIT ADJUSTMENTS -37 ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;;This routine provides logic to post (process) ADJUSTMENT
 ;;transactions to the database.
 S:$G(DDSREFT)']"" DDSREFT=$G(ASUV("DDSREFT"))
 I ASUT("TRCD")="37" D
 .S ASUS("CLCD")=0 ;Value entered in transaction flag
 .S:ASUT(ASUT,"VAL")="" ASUS("CLCD")=1 ;Value to be set by program
 .D CAJRSET Q:$D(DDSERROR)  ;Update Station master from transaction variables
 .S ASUT(ASUT,"ACC")=ASUMX("ACC"),ASUT(ASUT,"CALCED")=ASUS("CLCD")
 I ASUT("TRCD")="3P" D
 .D QVINCRE ;Update Station master from transaction variables
 I ASUT("TRCD")="2P" D
 .D CAJRSET ;Update station master from transaction variables
 I ASUT("TRCD")="27" D
 .D DAJRSET ;Update Station master from transaction variables
 Q:$D(DDSERROR)
 D ^ASUJHIST ;Move transaction to History file
 Q
DAJRSET ;EP; -RESETS TOTAL VALUE & TOTAL QUANTITY ON DEBIT ADJUSTMENTS
 I ASUT(ASUT,"QTY")=""&(ASUT(ASUT,"VAL")]"") G CALCMST
 I ASUT(ASUT,"VAL")=""&(ASUT(ASUT,"QTY")]"") N X S X="" D MSUNCST(.X)
 I ASUT(ASUT,"VAL")']"" S ASUT(ASUT,"VAL")=X*ASUT(ASUT,"QTY")
CALCMST ;CALCULATE MASTER TOTAL
 D QVINCRE
 Q
CAJRSET ;EP; RESETS TOTAL VALUE & TOTAL QUANTITY ON CREDIT ADJUSTMENTS
 I ASUT(ASUT,"QTY")']"" G CACKCS
 I ASUT(ASUT,"VAL")']"" G CACKQT
 G CACKCB
CACKQT ;CHECK QTY
 I ASUT(ASUT,"QTY")>ASUMS("QTY","O/H") G RJCRBAL
 I ASUT(ASUT,"QTY")=ASUMS("QTY","O/H") S ASUT(ASUT,"VAL")=ASUMS("VAL","O/H") G CACKAL
 N X S X="" D MSUNCST(.X)
 S ASUT(ASUT,"VAL")=X*ASUT(ASUT,"QTY")
 I ASUT(ASUT,"VAL")>ASUMS("VAL","O/H") S ASUT(ASUT,"VAL")=ASUMS("VAL","O/H")
 G CACKAL
CACKCS ;CHECK IF ONLY COST ENTERED
 I ASUT(ASUT,"VAL")']"" G RJNOENTR
CACKCB ;CHECK IF CREDIT BALANCE
 I ASUT(ASUT,"VAL")>ASUMS("VAL","O/H") G RJCRBAL
CACKAL ;CHECK BALANCES
 S ASUMS("QTY","O/H")=ASUMS("QTY","O/H")-ASUT(ASUT,"QTY")
 S ASUMS("VAL","O/H")=ASUMS("VAL","O/H")-ASUT(ASUT,"VAL")
 I ASUMS("QTY","O/H")=0 G CACKV0
 I ASUMS("QTY","O/H")<0 G RJCRBAL
 I ASUMS("VAL","O/H")=0!(ASUMS("VAL","O/H")<0) G REJBOH
 G STAUPDT
CACKV0 ;CHECK VALUE ZERO
 I ASUMS("VAL","O/H")=0 G STAUPDT
 G REJBOH
MSUNCST(X) ;EP ;COMPUTE UNIT COST FROM MASTER
 I 0=+ASUMS("VAL","O/H")!(0=+ASUMS("QTY","O/H")) D
 .S X=0
 E  D
 .S X=$FN(ASUMS("VAL","O/H")/ASUMS("QTY","O/H"),"-",2)
 I ASUT("TRCD")=27 S:X=0 X=ASUMS("LPP")
 Q
QVDECRE ;EP;.
 S ASUMS("VAL","O/H")=ASUMS("VAL","O/H")-ASUT(ASUT,"VAL")
 S ASUMS("QTY","O/H")=ASUMS("QTY","O/H")-ASUT(ASUT,"QTY")
 I ASUT("TRCD")="2P" G QVDCK0
 G STAUPDT
QVDCK0 ;
 I ASUMS("VAL","O/H")<0 G RJCRBAL
 I ASUMS("QTY","O/H")<0 G RJCRBAL
 I ASUMS("VAL","O/H")=0&(ASUMS("QTY","O/H")>0) G REJBOH
 I ASUMS("QTY","O/H")=0&(ASUMS("VAL","O/H")>0) G REJBOH
 G STAUPDT
QVINCRE ;EP;.
 S ASUMS("VAL","O/H")=ASUMS("VAL","O/H")+ASUT(ASUT,"VAL")
 S ASUMS("QTY","O/H")=ASUMS("QTY","O/H")+ASUT(ASUT,"QTY")
STAUPDT ;
 D MIX^ASUMSTWR
 Q
REJBOH ;REJECT BALANCE ON HAND
 N Z S Z="Master Balance on Hand" D MSG^ASUJHELP(.Z) S DDSERROR=1 ;DFM P1 9/1/98
 G REJECT
RJCRBAL ;REJECT CREDIT BALANCE
 N Z S Z="Would create Master Credit Balance" D MSG^ASUJHELP(.Z) S DDSERROR=2 ;DFM P1 9/1/98
 G REJECT
RJNOENTR ;REJECT NO ENTRY
 N Z S Z="NO QTY OR VAL" D MSG^ASUJHELP(.Z) S DDSERROR=3 ;DFM P1 9/1/98
REJECT ;REJECT REPORT
 Q