project QadFinancials > class BDDocument > method GetCompanyCodeByDInvoiceId

Description

Get company code by the given DInvoice_ID. This method currently using by the Deduction Review program.


Parameters


iiDInvoiceIdinputinteger
ocCompanyCodeoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program1/bddocument.p)

assign oiReturnStatus = -98.

/* Get company code by the given DInvoice_ID. This method using by the deduction review program. */
assign ocCompanyCode = '':U.

if iiDInvoiceId = ? or iiDInvoiceId <= 0
then do:
    assign oiReturnStatus = 0.
    return.
end.

<Q-11 run GetCompanyCodeByDInvoiceId (all) (Read) (NoCache)
   (input ?, (CompanyId)
    input iiDInvoiceId, (DInvoiceId)
    output dataset tqGetCompanyCodeByDInvoiceId) in BDInvoice>

find first tqGetCompanyCodeByDInvoiceId no-error.
if available tqGetCompanyCodeByDInvoiceId
then do:
    assign ocCompanyCode = tqGetCompanyCodeByDInvoiceId.tcCompanyCode.
end.                                                               

assign oiReturnStatus = 0.