- ASUJHIST ; IHS/ITSC/LMH -MARK TRANSACTION AS UPDATED ;
- ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
- ;This routine updates a successfully processed transaction's status
- ;flag to 'Updated', stores the date processed, and the balance on
- ;the master updated for both quantity and value after the transaction
- ;was posted. For transaction code '3J' the account code from the
- ;master is also stored in the transaction.
- S ASUT(ASUT,"STATUS")="U",ASUT(ASUT,"DTP")=ASUK("DT","FM"),ASUTDA=ASUHDA
- S ASUT(ASUT,"MST","QTY")=$G(ASUMS("QTY","O/H")),ASUT(ASUT,"MST","VAL")=$G(ASUMS("VAL","O/H"))
- S ASUT(ASUT,"MST","D/I")=$G(ASUMS("D/I","QTY-TOT")),ASUT(ASUT,"DTE")=$P(ASUT(ASUT,"TRKY"),".") S:ASUT(ASUT,"TRKY")["." ASUT(ASUT,"DTE")=ASUT(ASUT,"DTE")_"."_$P(ASUT(ASUT,"TRKY"),".",2)
- S ASUJV=$S(ASUT="BOR":3,1:ASUJ)
- L +^ASUH(0):DTIME I '$T W !,"History file in use by another user try later!" S DA="" Q
- D HISTKEY L -^ASUH(0)
- D WRITE^ASU0TRWR(DA,"H") ;Write History transaction from variables
- S DA=ASUTDA,DIK="^ASUT("_ASUJV_","
- ;I ASUT("TRCD")'="4A" D ^DIK ;Delete old transaction
- K ASUJV
- I $G(ASUF("SV")) K ASUF("SV") Q
- D PSTKL^ASUCOKIL
- Q
- HISTKEY ;EP ;GET HISTORY IEN
- N V,X,Y,Z S Z=ASUL(2,"STA","E#")_"-"_ASUK("DT","FM")_"-"_"9999999"
- S Y=($O(^ASUH("AA"),-1))+1,X=$O(^ASUH("B",Z),-1)
- I $E(X,1,14)=$E(Z,1,14) D
- .S V=($P(X,"-",3))+1
- .S V=(V*.000001)
- .S V=$P(V,".",2) S:$L(V)<6 V=V_$E("000000",1,(6-$L(V))) S $P(X,"-",3)=V
- E D
- .S V="000001" S X=Z,$P(X,"-",3)=V
- S (ASUT(ASUT,"TRKY"),ASUH("KEY"))=X,DA=Y
- Q
- ACCT ;EP ;UPDATE ACCOUNT
- S:ASUT(ASUT,"ACC")']"" ASUT(ASUT,"ACC")=$G(ASUMX("ACC"))
- S DR=DR_";.04///"_ASUT(ASUT,"ACC")_";4///"_ASUT(ASUT,"ACC")
- Q
- ASUJHIST ; IHS/ITSC/LMH -MARK TRANSACTION AS UPDATED ;
- +1 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
- +2 ;This routine updates a successfully processed transaction's status
- +3 ;flag to 'Updated', stores the date processed, and the balance on
- +4 ;the master updated for both quantity and value after the transaction
- +5 ;was posted. For transaction code '3J' the account code from the
- +6 ;master is also stored in the transaction.
- +7 SET ASUT(ASUT,"STATUS")="U"
- SET ASUT(ASUT,"DTP")=ASUK("DT","FM")
- SET ASUTDA=ASUHDA
- +8 SET ASUT(ASUT,"MST","QTY")=$GET(ASUMS("QTY","O/H"))
- SET ASUT(ASUT,"MST","VAL")=$GET(ASUMS("VAL","O/H"))
- +9 SET ASUT(ASUT,"MST","D/I")=$GET(ASUMS("D/I","QTY-TOT"))
- SET ASUT(ASUT,"DTE")=$PIECE(ASUT(ASUT,"TRKY"),".")
- IF ASUT(ASUT,"TRKY")["."
- SET ASUT(ASUT,"DTE")=ASUT(ASUT,"DTE")_"."_$PIECE(ASUT(ASUT,"TRKY"),".",2)
- +10 SET ASUJV=$SELECT(ASUT="BOR":3,1:ASUJ)
- +11 LOCK +^ASUH(0):DTIME
- IF '$TEST
- WRITE !,"History file in use by another user try later!"
- SET DA=""
- QUIT
- +12 DO HISTKEY
- LOCK -^ASUH(0)
- +13 ;Write History transaction from variables
- DO WRITE^ASU0TRWR(DA,"H")
- +14 SET DA=ASUTDA
- SET DIK="^ASUT("_ASUJV_","
- +15 ;I ASUT("TRCD")'="4A" D ^DIK ;Delete old transaction
- +16 KILL ASUJV
- +17 IF $GET(ASUF("SV"))
- KILL ASUF("SV")
- QUIT
- +18 DO PSTKL^ASUCOKIL
- +19 QUIT
- HISTKEY ;EP ;GET HISTORY IEN
- +1 NEW V,X,Y,Z
- SET Z=ASUL(2,"STA","E#")_"-"_ASUK("DT","FM")_"-"_"9999999"
- +2 SET Y=($ORDER(^ASUH("AA"),-1))+1
- SET X=$ORDER(^ASUH("B",Z),-1)
- +3 IF $EXTRACT(X,1,14)=$EXTRACT(Z,1,14)
- Begin DoDot:1
- +4 SET V=($PIECE(X,"-",3))+1
- +5 SET V=(V*.000001)
- +6 SET V=$PIECE(V,".",2)
- IF $LENGTH(V)<6
- SET V=V_$EXTRACT("000000",1,(6-$LENGTH(V)))
- SET $PIECE(X,"-",3)=V
- End DoDot:1
- +7 IF '$TEST
- Begin DoDot:1
- +8 SET V="000001"
- SET X=Z
- SET $PIECE(X,"-",3)=V
- End DoDot:1
- +9 SET (ASUT(ASUT,"TRKY"),ASUH("KEY"))=X
- SET DA=Y
- +10 QUIT
- ACCT ;EP ;UPDATE ACCOUNT
- +1 IF ASUT(ASUT,"ACC")']""
- SET ASUT(ASUT,"ACC")=$GET(ASUMX("ACC"))
- +2 SET DR=DR_";.04///"_ASUT(ASUT,"ACC")_";4///"_ASUT(ASUT,"ACC")
- +3 QUIT