project QadFinancials > class BDInvoice > method CheckExternalInvoiceApiCC
Description
Method to Check the statutory rates in tApiDInvoice
Parameters
| icApiInvoiceRowId | input | character | Row Id of the APIInvoice record |
| bdExchangeRate | input-output | decimal | Exchange rate |
| bdRateScale | input-output | decimal | Rate Scale |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bdinvoice.p)
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
find first tApiDInvoice where
tApiDInvoice.tc_Rowid = icApiInvoiceRowId
exclusive-lock no-error.
/* If the invoice is available and it is a credit note or a correction */
/* then check the statutory currency rates match. */
if available tApiDInvoice and
tApiDinvoice.tiLinkedDInvoiceVoucher <> 0 and tApiDinvoice.tiLinkedDInvoiceVoucher <> ? and
tApiDinvoice.tiLinkedPeriodYear <> 0 and tApiDinvoice.tiLinkedPeriodYear <> ? and
tApiDinvoice.tcLinkedJournalCode <> '':U and tApiDinvoice.tcLinkedJournalCode <> ?
then do:
<Q-32 run DInvoiceByInvoiceNumber (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tApiDInvoice.tiLinkedPeriodYear, (DInvoicePostingYear)
input tApiDInvoice.tiLinkedDInvoiceVoucher, (DInvoiceVoucher)
input tApiDInvoice.tcLinkedJournalCode, (JournalCode)
output dataset tqDInvoiceByInvoiceNumber) in BDInvoice >
find first tqDInvoiceByInvoiceNumber no-lock no-error.
if available tqDInvoiceByInvoiceNumber
then do:
if tqDInvoiceByInvoiceNumber.tdDInvoiceCCRate <> bdExchangeRate or
tqDInvoiceByInvoiceNumber.tdDInvoiceCCScale <> bdRateScale
then assign bdExchangeRate = tqDInvoiceByInvoiceNumber.tdDInvoiceCCRate
bdRateScale = tqDInvoiceByInvoiceNumber.tdDInvoiceRateScale
tApiDinvoice.DInvoiceCCRate = bdExchangeRate
tApiDinvoice.DInvoiceCCScale = bdRateScale.
end. /* if available tqDInvoiceByInvoiceNumber */
end. /* if tApiDInvoice ..... */
/* Only raise an error if the invoice could not be found. */
else if not available tApiDInvoice
then do:
assign vcMessage = trim(#T-67'An internal error occured when finding the customer invoice':255(733711355)T-67#)
viLocalReturnStatus = -1.
<M-49 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-399182':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
end. /* if not available tApiDInvoice */
assign oiReturnStatus = viLocalReturnStatus.