project QadFinancials > class BDInvoice > method GetTSMNumber

Description

Returns the payment reference based on the customer invoice ID


Parameters


iiDInvoiceIDinputintegerInput parameter: integer, DInvoice ID number.
ocDInvoiceTSMNumberoutputcharacterHolds the returnvalue for TSMNumber
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program6/bdinvoice.p)

assign ocDInvoiceTSMNumber = "".
       
/* Gets the payment reference if the customer invoice ID is used */
if iiDInvoiceId <> ? and iiDInvoiceId <> 0
then do:
    find tDInvoice where
         tDInvoice.DInvoice_ID = iiDInvoiceId
         no-lock no-error.
    if available tDInvoice
    then assign ocDInvoiceTSMNumber = tDInvoice.DInvoiceTSMNumber.
    else do:
        <Q-59 run DInvoiceByIDAllInfo (all) (Read) (NoCache)
           (input ?, (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 ocDInvoiceTSMNumber = tqDInvoiceByIDAllInfo.tcDInvoiceTSMNumber.    
    end. /* else do:                                   */
end.  /* if iiDInvoiceId <> ? and iiDInvoiceId <> 0 */