Description
This method updates the tax recorde of the customer invoice
Parameters
Internal usage
QadFinancials
program code (program6/bdinvoice.p)
/* =================================================================================================== */
/* Method : UpdateDInvoiceVat */
/* Desc : This method updates the tax recorde of the customer invoice */
/* */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) tUpdateDInvoiceVat temp table filled with DInvoiceVat ID and delayd tax amount */
/* =================================================================================================== */
assign oiReturnStatus = -98.
for each tUpdateDInvoiceVat:
if not can-find (first tDInvoice where
tDInvoice.DInvoice_ID = tUpdateDInvoiceVat.tiDInvoiceId)
then assign vcListDInvoiceIds = if vcListDInvoiceIds = "":U
then string(tUpdateDInvoiceVat.tiDInvoiceId)
else
if lookup(string(tUpdateDInvoiceVat.tiDInvoiceId), vcListDInvoiceIds, chr(4)) = 0
then vcListDInvoiceIds + chr(4) + string (tUpdateDInvoiceVat.tiDInvoiceId)
else vcListDInvoiceIds.
end.
if vcListDInvoiceIds <> "":U
then do:
<M-3 run DataLoad
(input '':U (icRowids),
input vcListDInvoiceIds (icPkeys),
input '':U (icObjectIds),
input '':U (icFreeform),
input false (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then do :
assign vcMessage = trim(substitute(#T-1'Data could not be loaded: unable to load the list of customer invoices (&1).':100(1795)T-1#, replace(vcListDInvoiceIds, chr(4), ",":U))).
<M-4 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8303':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
return.
end. /* if oiReturnStatus < 0 */
end.
end.
for each tUpdateDInvoiceVat:
find first tDInvoice where
tDInvoice.DInvoice_ID = tUpdateDInvoiceVat.tiDInvoiceId no-error.
if not available tDInvoice
then do:
assign vcMessage = trim(#T-6'The invoice was not found. The system cannot update it.':100(65684)t-6#).
<M-5 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8304':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
next.
end.
find first tDInvoiceVat where
tDInvoiceVat.DInvoiceVat_ID = tUpdateDInvoiceVat.tiDInvoiceVatId and
tDInvoiceVat.tc_ParentRowid = tDInvoice.tc_Rowid no-error.
if available tDInvoiceVat
then assign tDInvoiceVat.DInvoiceVatSuspDelTaxAmtTC = tDInvoiceVat.DInvoiceVatSuspDelTaxAmtTC - tUpdateDInvoiceVat.tdSuspTaxAmountTC
tDInvoiceVat.tc_Status = 'C':U.
end.
if oiReturnStatus = -98 then assign oiReturnStatus = 0.