project QadFinancials > class BDInvoice > method AdditionalUpdatesAllCreateDAVal
Description
submethod of AdditionalUpdatesAllCreateDA : this method will check if the exchange rates of the original invoice and linked invoice are the same
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program8/bdinvoice.p)
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
VALBLOCK: DO:
for each tDInvoice where
(tDInvoice.tc_Status = "N":U or
tDInvoice.tc_Status = "C":U) and
tDInvoice.LinkedDInvoice_ID <> 0 and
tDInvoice.LinkedDInvoice_ID <> ? and
(tDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTE} or
tDInvoice.DInvoiceType = {&INVOICETYPE-INVOICECORRECTION} or
tDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION}):
if not vlStartDInvoiceByID
then do:
<Q-9 run DInvoiceByID (Start) in BDInvoice >
assign vlStartDInvoiceByID = true.
end.
<Q-8 run DInvoiceByID (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tDInvoice.LinkedDInvoice_ID, (DInvoice_ID)
output dataset tqDInvoiceByID) in BDInvoice >
find first tqDInvoiceByID where
tqDInvoiceByID.tiDinvoice_ID = tDInvoice.LinkedDInvoice_ID
no-error.
if not available tqDInvoiceByID
then do:
assign vcMessage = trim(#T-4'The system encountered an error when retrieving the linked invoice.':255(65735)T-4#)
viLocalReturnStatus = -1.
<M-3 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-9759':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
leave VALBLOCK.
end.
if tDInvoice.DInvoiceExchangeRate <> tqDInvoiceByID.tdDInvoiceExchangeRate or
tDInvoice.DInvoiceRateScale <> tqDInvoiceByID.tdDInvoiceRateScale or
tDInvoice.DInvoiceCCRate <> tqDInvoiceByID.tdDInvoiceCCRate or
tDInvoice.DInvoiceCCScale <> tqDInvoiceByID.tdDInvoiceCCScale
then do:
/* to make sure that the translatable value of the invoice type is shown */
do viCounter = num-entries({&INVOICETYPES},chr(2)) to 1 by -2 :
if entry(viCounter,{&INVOICETYPES},chr(2)) = tDInvoice.DInvoiceType
then assign vcDInvoiceTypeTrans = entry(viCounter - 1,{&INVOICETYPES},chr(2)) no-error.
if entry(viCounter,{&INVOICETYPES},chr(2)) = tqDInvoiceByID.tcDInvoiceType
then do :
assign vctqDInvoiceTypeTrans = entry(viCounter - 1,{&INVOICETYPES},chr(2)) no-error.
leave.
end. /* if entry */
end.
assign vcMessage = trim(#T-7'The exchange-rates on the &1 (&2) should match the exchange-rates on the linked &3 (&4).':255(733752384)T-7#)
vcMessage = substitute(vcMessage, vcDInvoiceTypeTrans, string(tDInvoice.DInvoicePostingYear) + "/":U + tDInvoice.tcJournalCode + "/":U + string(tDInvoice.DInvoiceVoucher), vctqDInvoiceTypeTrans, string(tqDInvoiceByID.tiDInvoicePostingYear) + "/":U + tqDInvoiceByID.tcJournalCode + "/":U + string(tqDInvoiceByID.tiDInvoiceVoucher))
vcMessage = vcMessage + chr(10) + substitute(trim(#T-11'Base-Currency rate of the &1 : &2, &3':255(413957962)T-11#), vcDInvoiceTypeTrans, tDInvoice.DInvoiceExchangeRate, tDInvoice.DInvoiceRateScale)
vcMessage = vcMessage + chr(10) + substitute(trim(#T-12'Base-Currency rate of the &1 : &2, &3':255(413957962)T-12#), vctqDInvoiceTypeTrans, tqDInvoiceByID.tdDInvoiceExchangeRate, tqDInvoiceByID.tdDInvoiceRateScale)
vcMessage = vcMessage + chr(10) + substitute(trim(#T-13'Statutory-Currency rate of the &1 : &2, &3':255(591281008)T-13#), vcDInvoiceTypeTrans, tDInvoice.DInvoiceCCRate, tDInvoice.DInvoiceCCScale)
vcMessage = vcMessage + chr(10) + substitute(trim(#T-14'Statutory-Currency rate of the &1 : &2, &3':255(591281008)T-14#), vctqDInvoiceTypeTrans, tqDInvoiceByID.tdDInvoiceCCRate, tqDInvoiceByID.tdDInvoiceCCScale)
viLocalReturnStatus = -1.
<M-6 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-9760':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
leave VALBLOCK.
end.
end. /* for each tDInvoice */
END. /* VALBLOCK */
if vlStartDInvoiceByID
then do:
<Q-10 run DInvoiceByID (Stop) in BDInvoice >
end.
assign oiReturnStatus = viLocalReturnStatus.