project QadFinancials > class BDInvoice > method ValidateComponentAllBill


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDInvoice.ValidateComponentAll


program code (program1/bdinvoice.p)

for each t_sDInvoice where t_sDInvoice.tc_Status = 'C' and
                           t_sDInvoice.Bill_ID <> 0:
    /* if DInvoice is reopened, there will be no warning message */
    find first t_iDInvoice where t_iDInvoice.DInvoice_ID = t_sDInvoice.DInvoice_ID no-error.
    if available t_iDInvoice then
    do: 
        /* if a invoice status is not changed to closed, the validation will not execute */   
        if not (t_iDInvoice.DInvoiceIsOpen and not t_sDInvoice.DInvoiceIsOpen) then return.
    end.
end.

for each t_sDInvoice where t_sDInvoice.tc_Status = 'C' and
                           t_sDInvoice.Bill_ID <> 0
                     break by t_sDInvoice.Bill_ID:
    if first-of (t_sDInvoice.Bill_ID) then
    do:
        <Q-21 run BillById (all) (Read) (NoCache)
           (input ?, (CompanyId)
            input t_sDInvoice.Bill_ID, (Bill_ID)
            output dataset tqBillById) in BBill>
        find first tqBillById no-error.
        if available tqBillById then
        do:
            if tqBillById.tcBillStatus = {&BILLSTATUS-INITIAL} then
            do:
                <M-95 run SetMessage
                   (input  trim(substitute(#T-51'The bill &1 status is initial. Payments are only expected for confirmed bills.':255(185493189)T-51#, tqBillById.tiBillNumber)) (icMessage), 
                    input  '':U (icArguments), 
                    input  '':U (icFieldName), 
                    input  '':U (icFieldValue), 
                    input  'W':U (icType), 
                    input  3 (iiSeverity), 
                    input  '':U (icRowid), 
                    input  'qadfin-452588':U (icFcMsgNumber), 
                    input  '':U (icFcExplanation), 
                    input  '':U (icFcIdentification), 
                    input  '':U (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
                 oiReturnStatus = 1.
             end.
        end.
    end.
end.