project QadFinancials > class BCInvoice > method UpdateCInvoiceIsSelected

Description

UpdateIsSelected


Parameters


tSelectedCInvoiceinputtemp-tableSelectedInvoice
ilClearDatainputlogicalClearData; pass true in case you want BCinvoice to start from scratch
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BExpenseNote.ExpNoteRegister
method BPaymentSelection.GetInvWithCommonPayAttributes


program code (program1/bcinvoice.p)

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

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

    if oiReturnStatus < 0
    then return.
end.

for each tSelectedCInvoice:
    if (ilClearData                                                           or
        not can-find(tCInvoice where
                     tCInvoice.CInvoice_ID = tSelectedCInvoice.tiCInvoiceId)) and
        lookup(string(tSelectedCInvoice.tiCInvoiceId), vcList, chr(4)) = 0
    then do:
        if vcList <> "":U
        then assign vcList = vcList + chr(4).

        assign vcList = vcList + string (tSelectedCInvoice.tiCInvoiceId).
    end.
end.

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

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

    if oiReturnStatus < 0
    then return.
end.

for each tCInvoice:
    find first tSelectedCInvoice where
               tSelectedCInvoice.tiCInvoiceId = tCInvoice.CInvoice_ID
               no-error.

    if available tSelectedCInvoice
    then do:
        assign tCInvoice.CInvoiceIsSelected = tSelectedCInvoice.tlCInvoiceIsSelected.

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