project QadFinancials > class BDInvoice > method GetInvoiceNumber

Description

Retrieve the invoice number based on the invoice ID


Parameters


iiDInvoiceIDinputintegerInput parameter: integer, DInvoice ID number.
oiDInvoiceVoucheroutputintegerOutput parameter: integer, voucher number of the invoice.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program6/bdinvoice.p)

assign oiReturnStatus      = -98
       viLocalReturnStatus = 0
       oiDInvoiceVoucher   = 0.
       
if iiDInvoiceId <> ? and iiDInvoiceId <> 0
then do:
    find tDInvoice where
         tDInvoice.DInvoice_ID = iiDInvoiceId
         no-lock no-error.
    if available tDInvoice
    then assign oiDInvoiceVoucher = tDInvoice.DInvoiceVoucher.
    else do:
        <Q-60 run DInvoiceByIDAllInfo (all) (Read) (NoCache)
           (input viCompanyId, (CompanyId)
            input iiDInvoiceID, (DInvoiceID)
            output dataset tqDInvoiceByIDAllInfo) in BDInvoice >
            
        find tqDInvoiceByIDAllInfo where
             tqDInvoiceByIDAllInfo.tiDInvoice_ID = iiDInvoiceID
             no-lock no-error.
        if available tqDInvoiceByIDAllInfo
        then assign oiDInvoiceVoucher = tqDInvoiceByIDAllInfo.tiDInvoiceVoucher.    
    end. /* else do:                                   */
end.     /* if iiDInvoiceId <> ? and iiDInvoiceId <> 0 */

assign oiReturnStatus = viLocalReturnStatus.