project QadFinancials > class BCInvoiceJournalEntry > method InitInstance

Description

This method can be extended with code to execute when an instance of a business class is started.

PreCondition

This method is executed when a new instance of the business class is started, or when a draft instance is opened (in that case a new instance is started which is a copy of the draft instance).


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program/bcinvoicejournalentry.p)

<ANCESTOR-CODE>

    /* ============================================================================================================= */
    /* Hold the flag for which date to use for exchange rates  on the current company in an inst-dep class-data-item */
    /* ============================================================================================================= */
    <Q-22 run CompanyPropertyByCompany (all) (Read) (NoCache)
       (input viCompanyId, (CompanyId)
        input ?, (CompanyCode)
        input ?, (CurrencyCode)
        output dataset tqCompanyPropertyByCompany) in BCompanyProperty>    
    find first tqCompanyPropertyByCompany where
               tqCompanyPropertyByCompany.tiCompany_ID = viCompanyId
               no-lock no-error.
    if not available tqCompanyPropertyByCompany 
    then do:
        assign vcMessage      = trim(substitute(#T-58'Current Company (ID = &1) not found.':150(326479979)T-58#, string(viCompanyId)))
               oiReturnStatus = -1.
        <M-41 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'qadfin-320771':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BCInvoiceJournalEntry>
        return.
    end. /* if not available tqCompanyPropertyByCompany  */
    assign 
        vlCompPropIsAPUseInvDate = tqCompanyPropertyByCompany.tlCompanyPropertyIsAPUseInvDate.