project QadFinancials > class BAPMatching > method CalcAllSelectAPMatching

query calculated fields procedure

Description

Assign a value to query calculated fields


Parameters


iiCompanyIdinputintegerCompany id
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
query SelectAPMatching


program code (program1/bapmatching.p)

assign vcAPMATCHINGSTATUSES ={&APMATCHINGSTATUSES}.
    assign vcINVOICETYPES ={&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:
        assign {&tcAPMatchingStatusCalc} =  entry(lookup({&tcAPMatchingStatus}, vcAPMATCHINGSTATUSES, chr(2)) 
                                                  - (if lookup({&tcAPMatchingStatus},vcAPMATCHINGSTATUSES,chr(2)) modulo 2 = 0 then 1 else 0), 
                                                  vcAPMATCHINGSTATUSES, chr(2)) 
               {&tcCInvoiceTypeCalc}     =  entry(lookup({&tcCInvoiceType}, vcINVOICETYPES, chr(2)) 
                                                  - (if lookup({&tcCInvoiceType},vcINVOICETYPES,chr(2)) modulo 2 = 0 then 1 else 0), 
                                                  vcINVOICETYPES, chr(2)) 
                                            no-error.
        vhQuery:get-next().
    end.
    vhQuery:query-close().
    delete object vhQuery.