project QadFinancials > class BDInvoice > method CalcAllSelectDInvoice

query calculated fields procedure

Description

Assign a value to query calculated fields


Parameters


iiCompanyIdinputintegerCompany id
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
query SelectDInvoice


program code (program1/bdinvoice.p)

assign vcListInvTypes = {&INVOICETYPES}.

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:
    /* work with a do because the translated and untranslated values can be the same */
    assign {&tcDInvoiceTypeCalc} = "?":U.
    do viCounter = num-entries(vcListInvTypes,chr(2)) to 1 by -2 :
        if entry(viCounter,vcListInvTypes,chr(2)) = {&tcDInvoiceType}
        then do :
            assign {&tcDInvoiceTypeCalc} = entry(viCounter - 1,vcListInvTypes,chr(2)) no-error.
            leave.
        end. /* if entry */
    end.    
    
    vhQuery:get-next().

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