project QadFinancials > class BCInvoice > method CheckLinkedInvoiceCC
Description
Method to check the linked invoice CC rate.
Parameters
| icInvoiceRowid | input | character | Invoice ID. |
| bdExchangeRate | input-output | decimal | Exchange rate. |
| bdRateScale | input-output | decimal | Rate scale parameter. |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bcinvoice.p)
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
find first t_sCInvoice where
t_sCInvoice.tc_Rowid = icInvoiceRowid
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 t_sCInvoice and
t_sCinvoice.tiLinkedCInvoiceVoucher <> 0 and
t_sCInvoice.tiLinkedPeriodYear <> 0 and
t_sCinvoice.tcLinkedJournalCode <> '':U
then do:
<Q-94 run CInvoiceByInvoiceNumber (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input t_sCInvoice.tiLinkedPeriodYear, (CInvoicePostingYear)
input t_sCInvoice.tiLinkedCInvoiceVoucher, (CInvoiceVoucher)
input t_sCInvoice.tcLinkedJournalCode, (JournalCode)
output dataset tqCInvoiceByInvoiceNumber) in BCInvoice >
find first tqCInvoiceByInvoiceNumber no-lock no-error.
if available tqCInvoiceByInvoiceNumber
then do:
if tqCInvoiceByInvoiceNumber.tdCInvoiceCCRate <> bdExchangeRate or
tqCInvoiceByInvoiceNumber.tdCInvoiceCCScale <> bdRateScale
then assign bdExchangeRate = tqCInvoiceByInvoiceNumber.tdCInvoiceCCRate
bdRateScale = tqCInvoiceByInvoiceNumber.tdCInvoiceRateScale
t_sCinvoice.CInvoiceCCRate = bdExchangeRate
t_sCinvoice.CInvoiceCCScale = bdRateScale.
end. /* if available tqDInvoiceByInvoiceNumber */
end. /* if t_sCInvoice ..... */
/* Only raise an error if the invoice could not be found. */
else if not available t_sCInvoice
then do:
assign vcMessage = trim(#T-43'An internal error occured when finding the supplier invoice':255(47069726)T-43#)
viLocalReturnStatus = -1.
<M-41 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-564768':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
end. /* if not available t_sDInvoice */
assign oiReturnStatus = viLocalReturnStatus.