project QadFinancials > class BCInvoice > method CreateCIPostingValidate
Description
Validate the input parameters of the supplier invoice posting
Parameters
| iiPeriodPeriod | input | integer | |
| iiPeriodYear | input | integer | |
| itPostingDate | input | date | |
| icJournalCode | input | character | |
| icCreditorCode | input | character | |
| idExchangeRateCC | input | decimal | |
| idExchangeRateScaleCC | input | decimal | |
| idInvoiceAmountTC | input | decimal | |
| idInvoiceAmountCC | input | decimal | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bcinvoice.p)
/* ================================================================= */
/* Normailize the input parameters */
/* ================================================================= */
if iiPeriodPeriod = ? then assign iiPeriodPeriod = 0.
if iiPeriodYear = ? then assign iiPeriodYear = 0.
if icJournalCode = ? then assign icJournalCode = "":U.
if icCreditorCode = ? then assign icCreditorCode = "":U.
if idInvoiceAmountCC = ? then assign idInvoiceAmountCC = 0.
if idInvoiceAmountTC = ? then assign idInvoiceAmountTC = 0.
if idExchangeRateCC = ? then assign idExchangeRateCC = 0.
if idExchangeRateScaleCC = ? then assign idExchangeRateScaleCC = 0.
/*******************/
/* Validate statutory exchange rate and amount entered on customer opening balance screen */
if idInvoiceAmountCC <> 0 and
idExchangeRateCC <> 0 and
idExchangeRateScaleCC <> 0
then do:
<Q-86 run CurrencyByCurrRoundingMethod (all) (Read) (NoCache)
(input viCompanyCCId, (CurrencyID)
input ?, (CurrencyCode)
input ?, (RoundingMethodCode)
output dataset tqCurrencyByCurrRoundingMethod) in BCurrency>
find tqCurrencyByCurrRoundingMethod where
tqCurrencyByCurrRoundingMethod.tiCurrency_ID = viCompanyCCId
no-error.
if not available tqCurrencyByCurrRoundingMethod
then do:
assign vcMessage = trim(substitute(#T-59'Setup-error: unable to find the rounding-method for the statutory-currency (&1 / &2)':255(909469140)T-59#,vcCompanyLC,viCompanyLCId)).
<M-85 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-274474':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end. /* if not available tqCurrencyByCurrRoundingMethod */
/*This validation is not required if SC Currency is equal to TC Currency and amount is equal & in the calling method currency code is verified that */
/*if currency code of TC = SC then the idInvoiceAmountTC is assigned to idInvoiceAmountCC. hence they both will have equal values if currency code is same */
if idInvoiceAmountTC <> idInvoiceAmountCC
then do:
assign vdActualInvoiceAmountCC = <M-42 RoundAmount
(input idInvoiceAmountTC * idExchangeRateCC * idExchangeRateScaleCC (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input '':U (icCurrencyCode)) in BCInvoice>.
if vdActualInvoiceAmountCC <> 0 and abs(idInvoiceAmountCC - vdActualInvoiceAmountCC) > abs(tqCurrencyByCurrRoundingMethod.tdRoundingMethodUnit)
then do:
assign vcMessage = trim(substitute(#T-81'Statutory Currency Amount :(&1) does not match statutory currency exchange rate :(&2) for Supplier : (&3)':255(908085495)T-81#,idInvoiceAmountCC,idExchangeRateCC,icCreditorCode)).
<M-65 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'Supplier Code':U (icFieldName),
input icCreditorCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-251237':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end. /*if vdActualInvoiceAmountCC <> 0 and abs(idInvoiceAmountCC - vdActualInvoiceAmountCC) > abs(tqCurrencyByCurrRoundingMethod.tdRoundingMethodUnit)*/
end. /*if idInvoiceAmountTC = idInvoiceAmountCC*/
end. /* if idinvoiceamountcc */
/*****************************************/
/* ================================================================= */
/* GL Year Period and Daybook are mandatory */
/* ================================================================= */
if iiPeriodYear = 0 or
iiPeriodPeriod = 0 or
icJournalCode = "":U
then do:
assign vcMessage = trim(#T-1'You must enter the GL calendar year, GL period, and daybook':255(69410)t-1#)
oiReturnStatus = -1.
<M-2 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-8067':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
end.
/* ================================================================= */
/* Supplier is mandatory */
/* ================================================================= */
if icCreditorCode = "":U
then do:
assign vcMessage = trim(#T-3'You must specify the supplier.':255(69412)t-3#)
oiReturnStatus = -1.
<M-4 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-8069':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
end.
/* ================================================================= */
/* Posting date is mandatory */
/* ================================================================= */
if itPostingDate = ?
then do:
assign vcMessage = trim(#T-5'You must enter the posting date.':255(69413)t-5#)
oiReturnStatus = -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-8071':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
end.