project QadFinancials > class BDInvoice > method UpdateDInvoiceIsSelected

Description

UpdateDInvoiceIsSelected


Parameters


tSelectedDInvoiceinputtemp-tableSelecteddInvoice
ilClearDatainputlogical
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentSelection.AdditionalUpdatesDInvoice


program code (program1/bdinvoice.p)

if ilClearData
then do:
    <M-1 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BDInvoice>

    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.

    if oiReturnStatus < 0
    then return.
end.

for each tSelectedDInvoice:
    if (ilClearData                                                           or
        not can-find(tDInvoice where
                     tDInvoice.DInvoice_ID = tSelectedDInvoice.tiDInvoiceId)) and
        lookup(string(tSelectedDInvoice.tiDInvoiceId), vcList, chr(4)) = 0
    then do:
        if vcList <> "":U
        then assign vcList = vcList + chr(4).

        assign vcList = vcList + string (tSelectedDInvoice.tiDInvoiceId).
    end.
end.

if vcList <> "":U
then do:
    <M-2 run DataLoad (input  '':U (icRowids), 
                   input  vcList (icPkeys), 
                   input  '':U (icObjectIds), 
                   input  '':U (icFreeform), 
                   input  not ilClearData (ilKeepPrevious), 
                   output viFcReturnSuper (oiReturnStatus)) in BDInvoice>

    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.

    if oiReturnStatus < 0
    then return.
end.

for each tDInvoice:
    find first tSelectedDInvoice where
               tSelectedDInvoice.tiDInvoiceId = tDInvoice.DInvoice_ID
               no-error.

    if available tSelectedDInvoice
    then do:
        assign tDInvoice.DInvoiceIsSelected = tSelectedDInvoice.tlDInvoiceIsSelected.

        if tDInvoice.tc_Status = "":U
        then assign tDInvoice.tc_Status = "C":U.
    end.
end.