AR_InvoiceTaxSummary_bus is updated only Taxable Amount in A/R Invoice Data Entry Totals

Hello everyone!

I have script that should be updating the value of TaxAmount field in Account Receivable ->Invoice Data Entry...

strInvoiceNumerAndSchedule = strInvoiceNumber & "IN" & "000001EX"

Set oTS = oSession.AsObject(oSession.GetObject("AR_InvoiceTaxSummary_bus"))
retVal = oTS.SetKey(strInvoiceNumerAndSchedule)
retVal = oTS.SetValue("SalesTaxAmt", CDbl(TotalTaxAmount.text))
retVal = oTS.Write()

He is updating the value only at A/R Invoice Data Entry Totals(Taxable Amount field) tab but not in ->TaxDetail ->Tax Amount.

Is it a Sage bug or i have to modify my script?

  • 0
    The total is calculated from the tax table, not the other way around. Beware, there are events that will cause the taxes to be recalculated, so any value you set is not safe from being automatically changed by the system.
  • 0 in reply to Kevin M
    Tnx from reply,
    My script which is changing the value is on Accept (Postwrite event of the table).So when i check again the same AR Invoice number the value is only changed in (Taxable Amount field) tab but not in ->TaxDetail ->Tax Amount.
  • 0 in reply to ndym1
    And I explained why that happens. You need to create an object for the tax table and update the value there, not the total on the header.
    But really, the system should calculate taxes correctly. Fix that properly not via script.
  • 0 in reply to Kevin M
    Excuse me for the stupid question but when you says you need to create an object for the tax table and update the value there which Bus or table do you mean to use to achieve it ?
  • 0 in reply to ndym1
    Look in the help files for File Layouts. The table names (and associated business objects) are listed in there.
  • 0 in reply to Kevin M
    C:\Sage\Sage 100 Standard\MAS90\Home\Lib\_repository\mas5.30.01.00\env\any\CommonProgramFiles\Sage\Common Components\Help\5.30\FileLayouts.chm
  • 0 in reply to Kent Rhodes
    Tnx for the replays Kevin and Kent u are helping me alot and i`m rly appreciate your help!

    A little more info- we have custom tax schedule in which i`m trying to make a change on SalesTaxAmt
    As documentation says AR_InvoceTaxSummery to get access you need :
    KPRIMARY:InvoiceNo+InvoiceType+ScheduleSeqNo+TaxCode
    KTAXCODE:TaxCode+InvoiceNo+InvoiceType+ScheduleSeqNo

    Set oInvoiceTaxSummary = oSession.AsObject(oSession.GetObject("AR_InvoiceTaxSummary_bus"))
    retVal = oInvoiceTaxSummary.SetKeyValue("InvoiceNo", strInvoiceNumber)
    retVal = oInvoiceTaxSummary.SetKeyValue("InvoiceType$", strInvoiceType)
    retVal = oInvoiceTaxSummary.SetKeyValue("ScheduleSeqNo", strScheduleSeqNo)
    retVal = oInvoiceTaxSummary.SetKeyValue("TaxCode$", strTaxCode)
    retVal = oInvoiceTaxSummary.SetKey()

    retVal = oInvoiceTaxSummary.SetValue("SalesTaxAmt", 1234.02)

    'I tried with or without .Write() method
    retVal = oInvoiceTaxSummary.Write()

    I know this functionality is working because Sage has default Tax schedule and it work fine.I think Sage get little confuse because there are 2 fields SalesTaxAmt - AR_InvoiceHeader which is my default bus in this example and AR_InvoiceTaxSummary which also has SalesTaxAmt field and the value i`m trying to change.
  • 0 in reply to Kent Rhodes
    Txn for the replays Kevin and Kent u are helping me alot guys and Im rly appreciate your help!

    A little more info - we have custom tax schedule in which im trying to make a change on SalesTaxAmt
    As documentation says AR_InvoiceTaxSummary to get access you need :
    KPRIMARY: InvoiceNo+InvoiceType+ScheduleSeqNo+TaxCode
    KTAXCODE: TaxCode+InvoiceNo+InvoiceType+ScheduleSeqNo

    Set oInvoiceTaxSummary = oSession.AsObject(oSession.GetObject("AR_InvoiceTaxSummary_bus"))
    retVal = oInvoiceTaxSummary.SetKeyValue("InvoiceNo$", "0100084")
    retVal = oInvoiceTaxSummary.SetKeyValue("InvoiceType$", "IN")
    retVal = oInvoiceTaxSummary.SetKeyValue("ScheduleSeqNo$", "000001")
    retVal = oInvoiceTaxSummary.SetKeyValue("TaxCode$", "EX")
    retVal = oInvoiceTaxSummary.SetKey()

    retVal = oInvoiceTaxSummary.SetValue("SalesTaxAmt", 1234.02)
    retVal = oInvoiceTaxSummary.Write()
    I know that this functionality is working because Sage has default Tax schedule and it work fine.I think Sage get little confuse because there is 2 fields SalesTaxAmt - AR_InvoiceHeader which is my default bus and AR_InvoiceTaxSummary which also has SalesTaxAmt field and the value im trying to change
  • 0 in reply to Kevin M
    You are totally right about the part that system override the value of the field after me. I accidentally saw that code is work when i was added a last line of code which rise Sage exception...Does anyone knows a way to tell Sage not to do this..I tried with SetToReadOnly(SalesTaxAmt) after Write() method but no luck.My code start with entering fields in edit mode -

    If oBusObj.EditState>0 Then

    'code over here

    End If
  • 0 in reply to ndym1
    Why are you trying to override the tax amount?