project QadFinancials > class BCInvoice > method AllocateCInvoicesValidate

Description

validate some parameters


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.AllocateCInvoices


program code (program7/bcinvoice.p)

assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.

if not available tCInvoice
then do:
    assign vcMessage      = trim(#T-14'The specified supplier invoice is not defined in the system.':200(69395)t-14#)
           oiReturnStatus = -1.
    <M-13 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-8042':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
    return.
end.

if not available tAllocateCInvoice
then do:
    assign vcMessage      = trim(#T-17'Internal error. The required temp table is not available.':200(69396)t-17#)
           oiReturnStatus = -1.
    <M-16 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-8043':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
    return.

end.

/* ================================================= */
/* Error when Creditor Invoice was already allocated */
/* ================================================= */
if tCInvoice.CInvoiceAllocationStatus = {&ALLOCSTATUS-ALLOC} and
   tCInvoice.tc_Status <> "N":U
then do:
    assign vcMessage      = trim(#T-5'The supplier invoice has already been allocated.':200(1179)T-5#) + chr(10) + 
                            trim(substitute(#T-6'Entity: &1 / Supplier Invoice: &2 / GL Calendar Year: &3 / Daybook: &4 / Pending Invoice: &5':255(1106)t-6#,
                                            trim(string(tAllocateCInvoice.tiCICompanyId)), trim(string(tAllocateCInvoice.tiCInvoiceId)), trim(string(tAllocateCInvoice.tiPeriodYear)), trim(tAllocateCInvoice.tcJournalCode), trim(string(tAllocateCInvoice.tiCInvoiceVoucher)) ))
           oiReturnStatus = -1.
    <M-1 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-8038':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
    return.
end.

/* ====================== */
/* check mandatory fields */
/* ====================== */
if tAllocateCInvoice.tcReasonCode = "":U and tAllocateCInvoice.tiReasonId = 0
then do:
    assign vcMessage      = trim(#T-7'You must enter the invoice status code.':200(1180)T-7#) + chr(10) + 
                            trim(substitute(#T-8'Entity: &1 / Supplier Invoice: &2 / GL Calendar Year: &3 / Daybook: &4 / Pending Invoice: &5':255(1106)t-8#,
                                            trim(string(tAllocateCInvoice.tiCICompanyId)), trim(string(tAllocateCInvoice.tiCInvoiceId)), trim(string(tAllocateCInvoice.tiPeriodYear)), trim(tAllocateCInvoice.tcJournalCode), trim(string(tAllocateCInvoice.tiCInvoiceVoucher)) ))
           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-8039':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
    return.
end.
if tAllocateCInvoice.tiPostingId = 0
then do:
    assign vcMessage      = trim(#T-9'You must enter the posting ID.':200(1181)T-9#) + chr(10) + 
                            trim(substitute(#T-10'Entity: &1 / Supplier Invoice: &2 / GL Calendar Year: &3 / Daybook: &4 / Pending Invoice: &5':255(1106)t-10#,
                                            trim(string(tAllocateCInvoice.tiCICompanyId)), trim(string(tAllocateCInvoice.tiCInvoiceId)), trim(string(tAllocateCInvoice.tiPeriodYear)), trim(tAllocateCInvoice.tcJournalCode), trim(string(tAllocateCInvoice.tiCInvoiceVoucher)) ))
           oiReturnStatus = -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-8040':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
    return.
end.
if tAllocateCInvoice.tiCirecPostingLineId = 0
then do:
    assign vcMessage      = trim(#T-11'You must enter the identification of the Unmatched Invoices posting line.':200(1182)t-11#) + chr(10) + 
                            trim(substitute(#T-12'Entity: &1 / Supplier Invoice: &2 / GL Calendar Year: &3 / Daybook: &4 / Pending Invoice: &5':255(1106)t-12#,
                                            trim(string(tAllocateCInvoice.tiCICompanyId)), trim(string(tAllocateCInvoice.tiCInvoiceId)), trim(string(tAllocateCInvoice.tiPeriodYear)), trim(tAllocateCInvoice.tcJournalCode), trim(string(tAllocateCInvoice.tiCInvoiceVoucher)) ))
           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-8041':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
    return.
end.

assign oiReturnStatus = viLocalReturnStatus.