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
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program/bcinvoice.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 vlBJEIsStartedFromCI = false.
/* ======================================================================== */
/* When consecutive numbering is enabled, a temporary number should be used */
/* ======================================================================== */
<Q-53 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-30'Could not find a DomainProperty record for domain ID &1.':255(750397887)T-30#, string(viDomainID) ))
oiReturnStatus = -3.
<M-2 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-191377':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
return.
end. /* if not available tqDomainPropertyForNumbering */
assign vlCIDomainIsConsecutNr = tqDomainPropertyForNumbering.tlDomainPropertyIsConsecutNr
vlCIDomainIsPopupInvNr = tqDomainPropertyForNumbering.tlDomainPropertyIsPopupInvNr
vlCIDomainIsChronolNr = tqDomainPropertyForNumbering.tlDomainPropertyIsChronolNr
vcCIDomainNonChronErr = tqDomainPropertyForNumbering.tcDomainPropertyNonChronErr
viTempCInvoiceVoucher = (if vlCIDomainIsConsecutNr = true then 999000000 else 0).
/* =========================================================================== */
/* Hold the flag for WHT on the current company in an inst-dep class-data-item */
/* =========================================================================== */
<Q-70 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-60'Current Company (ID = &1) not found.':150(326479979)T-60#, string(viCompanyId)))
oiReturnStatus = -1.
<M-67 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-633001':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
return.
end. /* if not available tqCompanyPropertyByCompany */
assign
vlIsWHTOnCompany = tqCompanyPropertyByCompany.tlCompanyPropertyIsWHT
vlCompanyPropertyIsAPUseInvDate = tqCompanyPropertyByCompany.tlCompanyPropertyIsAPUseInvDate.
/* ================================================================================================================================ */
/* Store the domain-dependant properties for the daybook-set in inst-dep class-data-items and use them thoughout the complete class */
/* ================================================================================================================================ */
<Q-19 run POAccountingControlByDomain (all) (Read) (NoCache)
(input vcDomainCode, (Domain)
output dataset tqPOAccountingControlByDomain) in BMfgPOAccountingControl>
find first tqPOAccountingControlByDomain where
tqPOAccountingControlByDomain.tcpoc_domain = vcDomainCode no-error.
if available tqPOAccountingControlByDomain
then assign vlPOCUseDaybookSetBySet = tqPOAccountingControlByDomain.tlpoc_dybkset_by_site
vcPOCDefaultDaybookSet = tqPOAccountingControlByDomain.tcpoc_dflt_dybkset
vlPOCAllowUpdateDaybookOnInv = tqPOAccountingControlByDomain.tlpoc_dybk_on_invoice.
/* ================================================================================================================================ */
/* Get version of operational */
/* ================================================================================================================================ */
<M-92 run StartCacher
(output vhFcComponent (ohCacher),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then leave.
<M-9 run GetIntegerValueFromSession
(input viSessionID (iiSessionId),
input 'MfgProMajorVersion':U (icDataItemName),
output viMfgProMajorVersionBCI (oiValue),
output viFcReturnSuper (oiReturnStatus)) in Cacher>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then leave.
<M-90 run GetIntegerValueFromSession
(input viSessionID (iiSessionId),
input 'MfgProMinorVersion':U (icDataItemName),
output viMfgProMinorVersionBCI (oiValue),
output viFcReturnSuper (oiReturnStatus)) in Cacher>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then leave.
/* ==================================================================================================================== */
/* Check, if fiscal receiving is activated */
/* ==================================================================================================================== */
if viMfgProMajorVersionBCI > 3 /* Meaning eB3 */ or
(viMfgProMajorVersionBCI = 3 /* Meaning eB3 */ and
viMfgProMinorVersionBCI >= 7 /* Meaning SP7 */ )
then do:
<Q-74 run POAccountingControlByDomainV01 (all) (Read) (NoCache)
(input vcDomainCode, (Domain)
output dataset tqPOAccountingControlByDomainV01) in BMfgPOAccountingControl>
find first tqPOAccountingControlByDomainV01 where
tqPOAccountingControlByDomainV01.tcpoc_domain = vcDomainCode.
if available tqPOAccountingControlByDomainV01
then assign vlDomainIsFiscalConfirmBCI = tqPOAccountingControlByDomainV01.tlpoc_fiscal_confirm.
else assign vlDomainIsFiscalConfirmBCI = false.
end. /* if viMfgProMajorVersion > 3 /* Meaning eB3 */ or */