project QadFinancials > class BPosting > method InitInstance

Description

Assign temporary voucher for consecutive numbering and retrieve consecutive and chronological numbering settings.

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/bposting.p)

<ANCESTOR-CODE>

    /* necesarry to check the validatebcandadditionalupdates     */
    /* it must only be executed when instance is started here to */
    assign vlBGLOpenItemIsStartedFromPost = false
           vlTaxPostingSCExRateModified   = false.

/* ======================================================================== */
/* When consecutive numbering is enabled, a temporary number should be used */
/* ======================================================================== */
<Q-19 run DomainPropertyForNumbering (all) (Read) (NoCache)
   (input viDomainID, (DomainId)
    output dataset tqDomainPropertyForNumbering) in BDomainProperty >
find tqDomainPropertyForNumbering where
     tqDomainPropertyForNumbering.tiDomain_ID = viDomainID
     no-lock no-error.
if not available tqDomainPropertyForNumbering
then do:
    assign vcMessage      = trim(substitute(#T-70'Could not find a DomainProperty record for domain ID &1.':255(750397887)T-70#, string(viDomainID) ))
           oiReturnStatus = -3.
    <M-32 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'S':U (icType), 
        input  2 (iiSeverity), 
        input  '':U (icRowid), 
        input  'qadfin-704830':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BPosting>
    return.
end. /* if not available tqDomainPropertyForNumbering */
    
assign vlPostingDomainIsConsecutNr     = tqDomainPropertyForNumbering.tlDomainPropertyIsConsecutNr
       vlPostingDomainIsPopupInvNr     = tqDomainPropertyForNumbering.tlDomainPropertyIsPopupInvNr
       vlPostingDomainIsChronolNr      = tqDomainPropertyForNumbering.tlDomainPropertyIsChronolNr
       vcPostingDomainNonChronError    = tqDomainPropertyForNumbering.tcDomainPropertyNonChronErr
       vlBPostingIsStartedFromBYrClose = false
       viTempPostingVoucher            = (if vlPostingDomainIsConsecutNr = true then 999000000 else 0).

/* ======================================================================================================== */
/* Set the dataitem which indicates if the banking/cash transactions should be updated by the daemon or not */
/* Note there is no maintenance program for this, so you need to use NI Customization to have this changed  */
/* The default value is ByDaemon which is new from Febr 2012                                                */
/* ======================================================================================================== */
assign vlBankCashTrxInRealTime = false.