Description
This method updates the tax recorde of the supplier invoice
Parameters
Internal usage
unused
program code (program6/bcinvoice.p)
/* =================================================================================================== */
/* Method : UpdateCInvoiceVat */
/* Desc : This method updates the tax recorde of the supplier invoice */
/* */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) tUpdateCInvoiceVat temp table filled with CInvoiceVat ID and delayd tax amount */
/* =================================================================================================== */
assign oiReturnStatus = -98.
for each tUpdateCInvoiceVat:
if not can-find (first tCInvoice where
tCInvoice.CInvoice_ID = tUpdateCInvoiceVat.tiCInvoiceId)
then assign vcListCInvoiceIds = if vcListCInvoiceIds = "":U
then string(tUpdateCInvoiceVat.tiCInvoiceId)
else
if lookup(string(tUpdateCInvoiceVat.tiCInvoiceId), vcListCInvoiceIds, chr(4)) = 0
then vcListCInvoiceIds + chr(4) + string (tUpdateCInvoiceVat.tiCInvoiceId)
else vcListCInvoiceIds.
end.
if vcListCInvoiceIds <> "":U
then do:
<M-1 run DataLoad
(input '':U (icRowids),
input vcListCInvoiceIds (icPkeys),
input '':U (icObjectIds),
input '':U (icFreeform),
input false (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then do :
assign vcMessage = trim(substitute(#T-2'Data could not be loaded: unable to load the list of supplier invoices (&1).':100(1107)T-2#, replace(vcListCInvoiceIds, chr(4), ",":U))).
<M-3 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-8290':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
return.
end. /* if oiReturnStatus < 0 */
end.
end.
for each tUpdateCInvoiceVat:
find first tCInvoice where
tCInvoice.CInvoice_ID = tUpdateCInvoiceVat.tiCInvoiceId no-error.
if not available tCInvoice
then do:
assign vcMessage = trim(#T-4'The invoice was not found. The system cannot update it.':100(65684)t-4#).
<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-8292':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
next.
end.
find first tCInvoiceVat where
tCInvoiceVat.CInvoiceVat_ID = tUpdateCInvoiceVat.tiCInvoiceVatId and
tCInvoiceVat.tc_ParentRowid = tCInvoice.tc_Rowid no-error.
if available tCInvoiceVat
then do:
assign tCInvoiceVat.CInvoiceVatSuspDelTaxAmtTC = tCInvoiceVat.CInvoiceVatSuspDelTaxAmtTC - tUpdateCInvoiceVat.tdDelTaxAmountTC
tCInvoiceVat.tc_Status = "C":U.
end.
end.
if oiReturnStatus = -98 then assign oiReturnStatus = 0.