protected LedgerJournalTable createLedgerJournalTable(Currency _currency) { LedgerJournalTable ledgerJournalTable; ledgerJournalTable.clear(); ledgerJournalTable.initValue(); ledgerJournalTable.JournalNum = JournalTableData::newTable(ledgerJournalTable).nextJournalId(); ledgerJournalTable.initFromLedgerJournalName(_currency.VKDiscrepancyJournalName); // journal description, should be after initFromLedgerJournalName ledgerJournalTable.Name = strFmt('%1: %2', _currency.CurrencyCode, ledgerJournalTable.Name); ledgerJournalTable.CurrencyCode = _currency.CurrencyCode; ledgerJournalTable.insert(); return ledgerJournalTable; }
protected DimensionDefault getDimensionDefaultValue(DimensionDefault _account, DimensionDefault _defaultDimensions = 0) { container accPattern; MainAccountNum mainAccountNum; DimensionDefault dimensionDefault; Map dimSpecifiers; MapEnumerator enumerator; DimensionValue dimValue; // accPattern = ["420100", "420100", 0]; // ['acount display value', 'mainAccountId', count of dimensions pairs, dimension name, dimension value, ...] // [“131100”,”131100″, 1, “COUNTRY”,”USA”]; mainAccountNum = DimensionAttributeValueCombination::getMainAccountFromLedgerDimension(_account); accPattern = [MainAccountNum, MainAccountNum]; if (_defaultDimensions) { dimSpecifiers = DimensionDefaultingEngine::getDefaultDimensionSpecifiers(_defaultDimensions); accPattern += dimSpecifiers.elements(); if (dimSpecifiers.elements()) { enumerator = dimSpecifiers.getEnumerator(); while (enumerator.moveNext()) { dimValue = enumerator.currentValue(); accPattern += dimensionAttribute::find(enumerator.currentKey()).Name; accPattern += dimValue; } } } else { accPattern += 0; } dimensionDefault = AxdDimensionUtil::getLedgerAccountId(accPattern); return dimensionDefault; }
protected void createLedgerJournalTrans( Currency _currency, LedgerJournalTable _ledgerJournalTable, VKDiscrepancyContainer _discrepancyContainer) { AxLedgerJournalTrans axLedgerJournalTrans; RetailStoreTenderTypeTable retailStoreTenderTypeTable = this.getRetailStoreTenderTypeTable(_discrepancyContainer.parmChannel()); RetailStoreTable retailStoreTable = this.getRetailStoreTable(_discrepancyContainer.parmChannel()); ; axLedgerJournalTrans = new AxLedgerJournalTrans(); axLedgerJournalTrans.parmJournalNum(_ledgerJournalTable.JournalNum); axLedgerJournalTrans.parmTransDate(systemDateGet()); axLedgerJournalTrans.parmAccountType(LedgerJournalACType::Ledger); //ledgerDimension = DimensionDefaultingService::serviceMergeDefaultDimensions(_currency.VKDiscrepancyLedgerDimension, retailStoreTable.DefaultDimension); axLedgerJournalTrans.parmLedgerDimension(this.getDimensionDefaultValue(_currency.VKDiscrepancyLedgerDimension, retailStoreTable.DefaultDimension)); // axLedgerJournalTrans.parmOffsetAccountType(LedgerJournalACType::Ledger); // if called then parmOffsetLedgerDimension will not set the value axLedgerJournalTrans.parmOffsetLedgerDimension(this.getDimensionDefaultValue(retailStoreTenderTypeTable.LedgerDimension, retailStoreTable.DefaultDimension)); if (_discrepancyContainer.parmAmount() > 0) { axLedgerJournalTrans.parmAmountCurDebit(_discrepancyContainer.parmAmount()); } else { axLedgerJournalTrans.parmAmountCurCredit(-_discrepancyContainer.parmAmount()); } axLedgerJournalTrans.parmTxt(_discrepancyContainer.parmStore()); axLedgerJournalTrans.save(); }
static void VKPostGeenralJournal(Args _args) { LedgerJournalTable ledgerJournalTable = LedgerJournalTable::find('VK-000178'); LedgerJournalCheckPost ledgerJournalCheckPost; ttsBegin; ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable, NoYes::Yes); ledgerJournalCheckPost.run(); ttsCommit; info('done'); }
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.
Authors are allowed to set their own AdSense units and "buy me a coffee" link.
Join us.