project QadFinancials > class BDInvoice > method PreSaveCommitTax

Description

Saves the Tax records to external tax engine - i.e. Avatax


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDInvoice.PreSave


program code (program1/bdinvoice.p)

 /* make sure that there is a tTaxParametersExtended table */
find first tTaxParamExtDInv no-lock no-error.
if not available tTaxParamExtDInv
then do:
     assign 
        oiReturnStatus = -1
        vcMessage = trim(#T-67'Cannot commit records to Avatax':100(894532618)T-67#).
    <M-27 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'qadfin-533208':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
        return.
end.
assign 
    tTaxParamExtDInv.tcDocumentReference = string(tDInvoice.DInvoicePostingYear) + "/" + tDInvoice.tcJournalCode + string(tDInvoice.DInvoiceVoucher, "999999999").
    tTaxParamExtDInv.tlIsAvataxCommit = true.

 <I-61 {bFcStartAndOpenInstance
     &CLASS                = "PGTM"}>

/* Call RecalculateTaxAvataxCommit to commit the tax to Avatax... */
empty temp-table tTaxDetailDInvoice.

 <M-4 run RecalculateTaxAvataxCommit
    (input  tTaxParamExtDInv (tTaxParametersExtended), 
     input-output tTaxDetailDInvoice (tTaxDetailData), 
     output oiReturnStatus (oiReturnStatus)) in PGTM>

<I-46 {bFcCloseAndStopInstance
     &CLASS           = "PGTM"}>