iiCompanyId | input | integer | Company Id |
iiPostingYear | input | integer | PostingYear |
icJournalCode | input | character | |
oiSharedCompanyId | output | integer | Company Id used as parameter to call GetNumber(BNumber) |
oiNumberYear | output | integer | Year used to call GetNumber (BNumber) If "reset number yearyly" is false, it's a fixed number. Otherwise, it's PostingYear. |
olIsAddNbr | output | logical | return whether company uses additional GL Numbering. |
blStartQueryCompPropByIDAllInfo | input-output | logical | is query CompanyPropertyByIDAllInfo already started or not ? |
oiReturnStatus | output | integer | Return status of the method. |
if oiReturnStatus = 0 then oiReturnStatus = -98. /* =============================================================================== */ /* Check if Additional Numbering is enabled. If not, we don't have to do anything */ /* =============================================================================== */ if not can-find (first tqCompanyPropertyByIDAllInfo where tqCompanyPropertyByIDAllInfo.tiCompany_ID = iiCompanyId) then do: <Q-7 run CompanyPropertyByIDAllInfo (all) (Read) (Cache) (input iiCompanyId, (CompanyId) output dataset tqCompanyPropertyByIDAllInfo) in BCompanyProperty > end. find first tqCompanyPropertyByIDAllInfo where tqCompanyPropertyByIDAllInfo.tiCompany_ID = iiCompanyId and tqCompanyPropertyByIDAllInfo.tlCompanyPropertyIsAddGLNbr no-error. if not available tqCompanyPropertyByIDAllInfo then do: assign olIsAddNbr = false. end. else do: assign olIsAddNbr = tqCompanyPropertyByIDAllInfo.tlCompanyPropertyIsAddGLNbr. <Q-3 run JournalByJournalCodeWithLayer (all) (Read) (NoCache) (input viCompanyId, (CompanyId) input icJournalCode, (JournalCode) output dataset tqJournalByJournalCodeWithLayer) in BJournal> /* Check if Additional Numering is enabled for the layer which is used */ find first tqJournalByJournalCodeWithLayer where tqJournalByJournalCodeWithLayer.tcJournalCode = icJournalCode no-error. if available tqJournalByJournalCodeWithLayer then assign olIsAddNbr = tqJournalByJournalCodeWithLayer.tlLayerIsAddGLNbr. else assign olIsAddNbr = false. if olIsAddNbr then do: if tqCompanyPropertyByIDAllInfo.tiSharedAddNrCompany_ID = ? or tqCompanyPropertyByIDAllInfo.tiSharedAddNrCompany_ID = 0 then assign oiSharedCompanyId = iiCompanyId oiNumberYear = if tqCompanyPropertyByIDAllInfo.tlCompanyPropertyIsAddNrYrly then iiPostingYear else 9999. else do: assign oiSharedCompanyId = tqCompanyPropertyByIDAllInfo.tiSharedAddNrCompany_ID. /* get shared company's information for additional GL Numbering */ if not can-find (first tqCompanyPropertyByIDAllInfo where tqCompanyPropertyByIDAllInfo.tiCompany_ID = oiSharedCompanyId) then do: <Q-8 run CompanyPropertyByIDAllInfo (all) (Read) (Cache) (input oiSharedCompanyId, (CompanyId) output dataset tqCompanyPropertyByIDAllInfo) in BCompanyProperty > end. find first tqCompanyPropertyByIDAllInfo no-error. if available tqCompanyPropertyByIDAllInfo then do: if tqCompanyPropertyByIDAllInfo.tlCompanyPropertyIsAddGLNbr then assign oiNumberYear = if tqCompanyPropertyByIDAllInfo.tlCompanyPropertyIsAddNrYrly then iiPostingYear else 9999. else do: assign vcAddGLNbrMsg = Trim(substitute(#T-9'The company setup is invalid. The company &1 points to the company &2 for the additional numbering functionality and the company &2 is not enabled for additional numbering.':200(59065)t-9#, iiCompanyId,tqCompanyPropertyByIDAllInfo.tiCompany_ID,tqCompanyPropertyByIDAllInfo.tiCompany_ID)) oiReturnStatus = -3. <M-6 run SetMessage (input vcAddGLNbrMsg (icMessage), input '' (icArguments), input '' (icFieldName), input '' (icFieldValue), input 'E' (icType), input 3 (iiSeverity), input tPosting.tc_Rowid (icRowid), input 'QadFin-8881':U (icFcMsgNumber), input '' (icFcExplanation), input '' (icFcIdentification), input '' (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BPosting> return. end. end. end. /* share other company's sequence number */ end. /* if olIsAddNbr */ end. /* else */ if oiReturnStatus = -98 then oiReturnStatus = 0.