project QadFinancials > class BPosting > method CalcAllPostingLineForGLOpenItemRec

query calculated fields procedure

Description

Assign a value to query calculated fields


Parameters


iiCompanyIdinputintegerCompany id
iiGLIDinputinteger
itFromPostingDateinputdate
itToPostingDateinputdate
itPostingDateinputdate
icLayerTypeinputcharacterlayer type
iiJournalIDinputinteger
icJournalCodesinputcharacterList of Journal codes
icDivisionCodeinputcharacter
icCostCentreCodeinputcharacter
icProjectCodeinputcharacter
iiCurrencyIDinputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
query PostingLineForGLOpenItemRec


program code (program1/bposting.p)

/* fill translatable values before the loop, otherwise bad performance */
assign vcAllocationTypeLater = {&ALLOCATIONTYPE-LATER-TR}
       vcAllocationTypeNew   = {&ALLOCATIONTYPE-NEW-TR}
       vcAllocationTypeLink  = {&ALLOCATIONTYPE-LINK-TR}.

create query vhQuery in widget-pool "non-persistent".
vhQuery:forward-only = yes.
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 {&tdPostingLineTC}  = {&tdPostingLineDebitTC} - {&tdPostingLineCreditTC}
           {&tdPostingLineLC}  = {&tdPostingLineDebitLC} - {&tdPostingLineCreditLC}
           {&tdPostingLineCC}  = {&tdPostingLineDebitCC} - {&tdPostingLineCreditCC}
           {&tcAllocationType} = (if {&tcGLOpenItemMovementType} = "":U or
                                     {&tcGLOpenItemMovementType} = ?
                                  then vcAllocationTypeLater
                                  else if {&tcGLOpenItemMovementType} = {&MOVEMENTTYPE-INITIAL}
                                       then vcAllocationTypeNew
                                       else vcAllocationTypeLink).
    vhQuery:get-next().
end.

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