project QadFinancials > class BPaymentSelection > method CalcAllSelectPaySel

query calculated fields procedure

Description

Assign a value to query calculated fields


Parameters


iiCompanyIdinputintegerCompany id
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
query SelectPaySel


program code (program1/bpaymentselection.p)

assign vcPaymentSelectionStatuses = {&PAYMENTSELECTIONSTATUSS}.

create query vhQuery in widget-pool "non-persistent".
vhQuery:set-buffers(ih_Buffer).
vhQuery:query-prepare("for each ":U + ih_Buffer:table).
vhQuery:query-open().
vhQuery:get-first().

do while not vhQuery:query-off-end:

    assign viCounter           = lookup({&tcPaySelStatus}, vcPaymentSelectionStatuses, chr(2))
           {&tcPaySelStatusTr} = entry(viCounter - (if viCounter mod 2 = 0 then 1 else 0),
                                       vcPaymentSelectionStatuses, chr(2)) no-error.

    /* Count the number of Invoices */
    <I-20 {READDIRECTDBACCESS
         &READTABLENAMES = "PaySelLine"}>
         
    for each PaySelLine fields (PaySelLineIsConfirmed) where
             PaySelLine.PaySel_ID = {&tiPaySel_ID}
             no-lock :

        assign {&tiNumberOfLines} = {&tiNumberOfLines} + 1.

        if PaySelLine.PaySelLineIsConfirmed
        then assign {&tiNumberOfConfirmedLines} = {&tiNumberOfConfirmedLines} + 1.

    end. /* for each PaySelLine */

    vhQuery:get-next().

end. /* do while */

vhQuery:query-close().
delete object vhQuery.