project QadFinancials > class BDInvoice > 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/bdinvoice.p)

<ANCESTOR-CODE>

/* necesarry to check the validatebcandadditionalupdates     */
/* it must only be executed when instance is started here to */
/* if you are changing a draft, don't set it on false, it will be automatically set correctly */
if not vlDraftsActive
then assign vlBJEIsStartedFromDI = false.

/* Initialize the temporary voucher number variable. */
assign viCCNTempDInvNbr = 999000000.

/* Set the class data items that hold the consecutive and chronological numbering settings for the working domain */

<Q-79 run DomainPropertyForNumbering (all) (Read) (NoCache)
   (input viDomainID, (DomainId)
    output dataset tqDomainPropertyForNumbering) in BDomainProperty >
    
find first tqDomainPropertyForNumbering where
           tqDomainPropertyForNumbering.tiDomain_ID = viDomainID
no-lock no-error.

if available tqDomainPropertyForNumbering
then do:
    assign vlCCNIsConsecutNr  = tqDomainPropertyForNumbering.tlDomainPropertyIsConsecutNr
           vlCCNIsChronolNr   = tqDomainPropertyForNumbering.tlDomainPropertyIsChronolNr
           vlCCNIsPopupInvNr  = tqDomainPropertyForNumbering.tlDomainPropertyIsPopupInvNr.
           
           if tqDomainPropertyForNumbering.tcDomainPropertyNonChronErr = {&NONCHRONOLOGICAL-ERROR}
           then assign vlCCNNonChronError = TRUE.
           else assign vlCCNNonChronError = FALSE.

end. /* if available tqDomainPropertyForNumbering */
else do:
    assign vlCCNIsConsecutNr  = false
           vlCCNIsChronolNr   = false
           vlCCNIsPopupInvNr  = false
           vlCCNNonChronError = false.
end. /* NOT if available tqDomainPropertyForNumbering */

<I-63 {bFcOpenInstance
     &CLASS           = "Session"}>
       
<M-86 run GetLogicalValue
   (input  'ARInvoiceExchangeRateDate':U (icName), 
    output vlCompanyPropertyIsARUseTaxDate (olValue), 
    output viFcReturnSuper (oiReturnStatus)) in Session>
    
<M-46 run GetLogicalValue
   (input  'AvataxIsActive':U (icName), 
    output vlAvataxIsActive (olValue), 
    output viFcReturnSuper (oiReturnStatus)) in Session>

<I-84 {bFcCloseInstance
     &CLASS           = "Session"}>