Description
Validate the input reocrds of the input ttemp-tables of the calling method
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bwithholdingtax.p)
/* ===================================== */
/* Exception Handling - Initialisation */
/* ===================================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
VALIDATEINPUTBLOCK: DO :
/* ====================================================== */
/* Make sure a tInvoiceWHTPayment record is available */
/* ====================================================== */
if not available tInvoiceWHTPayment
then do:
assign vcMessage = trim(substitute(#T-82'Internal Error: No &1 record available for method &2.':255(405458570)T-82#, "tInvoiceWHTPayment":U, "BWithholdingTax:CreateAndOrUpdateWHTValidate":U))
viLocalReturnStatus = -3.
<M-7 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-474892':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BWithholdingTax>
Leave VALIDATEINPUTBLOCK.
end. /* if not available tInvoiceWHTPayment */
/* ================================================================================================= */
/* if tlUpdateAllAmounts is not filled when tlCreateWHT is true, then give it false as initial value */
/* ================================================================================================= */
if tInvoiceWHTPayment.tlCreateWHT = true and
tInvoiceWHTPayment.tlUpdateAllAmounts = ?
then assign tInvoiceWHTPayment.tlUpdateAllAmounts = false.
/* =========================== */
/* Validate the record content */
/* =========================== */
assign vcMessage = "":U.
RECORDVALIDATIONBLOCK: DO :
if tInvoiceWHTPayment.tiCInvoiceID = 0 or tInvoiceWHTPayment.tiCInvoiceID = ?
then assign vcMessage = trim(substitute(#T-63'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1.':255(940249308)T-63#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tiCInvoiceID":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tdAllocatedAmountTC = 0 or tInvoiceWHTPayment.tdAllocatedAmountTC = ?
then assign vcMessage = trim(substitute(#T-21'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(955085692)T-21#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tdAllocatedAmountTC":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tlCreateWHT = ?
then assign vcMessage = trim(substitute(#T-57'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(955085692)T-57#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tlCreateWHT":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if (tInvoiceWHTPayment.tiWHTNumber = 0 or tInvoiceWHTPayment.tiWHTNumber = ?) and tInvoiceWHTPayment.tlCreateWHT = true
then assign vcMessage = trim(substitute(#T-34'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(625666778)T-34#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tiWHTNumber":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tcPaymentReference = "":U or tInvoiceWHTPayment.tcPaymentReference = ?
then assign vcMessage = trim(substitute(#T-81'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(955085692)T-81#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tcPaymentReference":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tcCurrencyCode = "":U or tInvoiceWHTPayment.tcCurrencyCode = ?
then assign vcMessage = trim(substitute(#T-42'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1.':255(925173054)T-42#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tcCurrencyCode":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.ttPostingDate = ?
then assign vcMessage = trim(substitute(#T-16'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(151590311)T-16#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.ttPostingDate":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tcWHTStatus = "":U or tInvoiceWHTPayment.tcWHTStatus = ?
then assign vcMessage = trim(substitute(#T-49'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(227636095)T-49#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tcWHTStatus":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tlUpdateAllAmounts = ?
then assign vcMessage = trim(substitute(#T-94'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(576256983)T-94#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tlUpdateAllAmounts":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tdPaymentAccRateTCLC = 0 or tInvoiceWHTPayment.tdPaymentAccRateTCLC = ?
then assign vcMessage = trim(substitute(#T-9'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(512114940)T-9#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tdPaymentAccRateTCLC":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tdPaymentAccScaleTCLC = 0 or tInvoiceWHTPayment.tdPaymentAccScaleTCLC = ?
then assign vcMessage = trim(substitute(#T-25'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(737030882)T-25#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tdPaymentAccScaleTCLC":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tdPaymentAccRateTCCC = 0 or tInvoiceWHTPayment.tdPaymentAccRateTCCC = ?
then assign vcMessage = trim(substitute(#T-59'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(300123418)T-59#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tdPaymentAccRateTCCC":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tdPaymentAccScaleTCCC = 0 or tInvoiceWHTPayment.tdPaymentAccScaleTCCC = ?
then assign vcMessage = trim(substitute(#T-98'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(998986332)T-98#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tdPaymentAccScaleTCCC":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tdPaymentWHTRateTCLC = 0 or tInvoiceWHTPayment.tdPaymentWHTRateTCLC = ?
then assign vcMessage = trim(substitute(#T-33'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(577331897)T-33#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tdPaymentWHTRateTCLC":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tdPaymentWHTScaleTCLC = 0 or tInvoiceWHTPayment.tdPaymentWHTScaleTCLC = ?
then assign vcMessage = trim(substitute(#T-79'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(246709687)T-79#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tdPaymentWHTScaleTCLC":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tdPaymentWHTRateTCCC = 0 or tInvoiceWHTPayment.tdPaymentWHTRateTCCC = ?
then assign vcMessage = trim(substitute(#T-11'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(730859783)T-11#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tdPaymentWHTRateTCCC":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if tInvoiceWHTPayment.tdPaymentWHTScaleTCCC = 0 or tInvoiceWHTPayment.tdPaymentWHTScaleTCCC = ?
then assign vcMessage = trim(substitute(#T-43'Internal Error: The mandatory field &2 is missing in the input temp-table of method &1':255(282391764)T-43#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U,"tInvoiceWHTPayment.tdPaymentWHTScaleTCCC":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
if (tInvoiceWHTPayment.tiCDocumentInvoiceXrefID = 0 or tInvoiceWHTPayment.tiCDocumentInvoiceXrefID = ?) and
(tInvoiceWHTPayment.tiBankStateAllocID = 0 or tInvoiceWHTPayment.tiBankStateAllocID = ?) and
(tInvoiceWHTPayment.tiOIAjustLnID = 0 or tInvoiceWHTPayment.tiOIAjustLnID = ?) and
(tInvoiceWHTPayment.tiCACInvoiceID = 0 or tInvoiceWHTPayment.tiCACInvoiceID = ?)
then assign vcMessage = trim(substitute(#T-5'Internal Error: Either the link to the Payment, either the link to the Banking-Entry, either the link to the Open Item Adjustment, either the link to the supplier-adjustment is missing in the input temp-table of method &1.':255(234872867)T-5#,"BWithholdingTax:CreateAndOrUpdateWHT":U)).
if vcMessage <> "":U then Leave RECORDVALIDATIONBLOCK.
END. /* RECORDVALIDATIONBLOCK */
if vcMessage <> "":U
then do :
Assign viLocalReturnStatus = -3.
<M-62 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-746260':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BWithholdingTax>
Leave VALIDATEINPUTBLOCK.
end. /* if vcMessage <> "":U */
/* ========================== */
/* Check for valid wht status */
/* ========================== */
if tInvoiceWHTPayment.tcWHTStatus <> {&WHTSTATUS-INIT} and
tInvoiceWHTPayment.tcWHTStatus <> {&WHTSTATUS-DUE} and
tInvoiceWHTPayment.tcWHTStatus <> {&WHTSTATUS-VOID}
then do:
assign vcMessage = trim(substitute(#T-70'Internal error: The WHT-status (&2) of the input record on method &1 is not valid.':255(431473328)T-70#,"BWithholdingTax:CreateAndOrUpdateWHTValidate":U, tInvoiceWHTPayment.tcWHTStatus))
viLocalReturnStatus = -3.
<M-32 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-299787':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BWithholdingTax>
leave VALIDATEINPUTBLOCK.
end. /* if tInvoiceWHTPayment.tcWHTStatus <> {&WHTSTATUS-INIT} and */
END. /* VALIDATEINPUTBLOCK */
/* ================== */
/* Exception Handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.