project QadFinancials > class BCInvoice > method CalcAllSelectCInvoicePayments

query calculated fields procedure

Description

Assign a value to query calculated fields


Parameters


iiCompanyIdinputintegerCompany id
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
query SelectCInvoicePayments


program code (program1/bcinvoice.p)

assign vcInvoiceTypes         = {&INVOICETYPES}
    vcPaymentSelectionStatuss = {&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:
    /* CalcCInvoiceTypePayments */
    assign {&tcCInvoiceTypePayments} = "?":U.
    do viCounter = num-entries(vcInvoiceTypes,chr(2)) to 1 by -2 :
        if entry(viCounter,vcInvoiceTypes,chr(2)) = {&tcCInvoiceType}
        then do :
            assign {&tcCInvoiceTypePayments} = entry(viCounter - 1,vcInvoiceTypes,chr(2)) no-error.
            leave.
        end. /* if entry */
    end.
    
    /* CalcPaySelStatusPayments */
    assign {&tcPaySelStatusPayments} = "?":U.
    do viCounter = num-entries(vcPaymentSelectionStatuss,chr(2)) to 1 by -2 :
        if entry(viCounter,vcPaymentSelectionStatuss,chr(2)) = {&tcPaySelStatus}
        then do :
            assign {&tcPaySelStatusPayments} = entry(viCounter - 1,vcPaymentSelectionStatuss,chr(2)) no-error.
            leave.
        end. /* if entry */
    end.

    vhQuery:get-next().
end.
vhQuery:query-close().
delete object vhQuery.