Раздел: [[Программирование | ]] > [[БизнесЛогика]] ---- {{toc}} как формировать проводки [[ГлавнаяКнига]] описано в материалах курса MorphXIntergationMaster. [[http://www.axforum.info/forums/attachment.php?s=&postid=26507]], описывающий проводки в Axapta, опубликованный Иваном Мищенко в [[http://www.axforum.info/forums/showthread.php?postid=26507]] При сторнировании надо выставлять флаг parmCorrection в [[Класс/LedgerVoucherObject]] иначе при отрицательной сумме получится реверсирование _ledgerVoucher.findLedgerVoucherObject().parmCorrection( _isCancellation); === Пример === в качестве примера использования можно западной функциональности можно посмотреть Класс/TutorialLedgerVoucher [[РоссийскаяФункциональность]], судя по всему, требует дополнительных действий для обеспечения корреспонденции. Пример можно посмотреть [[http://www.axforum.info/forums/showthread.php?postid=67347#post67347]]: // EVGL, Correspondence II --> if (ledgerBondClient && AmountTrans) { ledgerBondClient.bondVRef2VRef(ledgerBondClient.lastVrefId(), ledgerBondClient.lastVrefId(-1)); } // EVGL, Correspondence II --> еще один пример: // \Data Dictionary\Tables\CustTrans\Methods\postClosing void postClosing(TransDate _postingDate, ledgerVoucher _ledgerVoucher = _ledgerVoucher) { // Номерная серия NumberSeq numberSeq; // Движок корреспонденции // EGLA, Correspondence II, --> LedgerBondClient_RU ledgerBondClient; // EGLA, Correspondence II, <-- // LedgerVoucher - объект инкапсулирующий всю операцию проводки ledgerVoucher ledgerVoucher = _ledgerVoucher; // LedgerVoucherObject - объект инкапсулирующий документ ГК LedgerVoucherObject ledgerVoucherObject; // Признак того, что создается собственный объект разноску boolean ledgerVoucherInit = false; // Профиль разноски CustPostingProfile postingProfileClose = CustLedger::loadPostingClose(this.postingProfile); // Со счета LedgerAccount fromAccount; // На счет LedgerAccount toAccount; // Если найден профиль разноски закрытия, отличабщийся от текущего if (postingProfileClose && postingProfileClose != this.postingProfile) { // Получение счетов для разноски fromAccount = CustLedgerAccounts::sumAccount(this.accountNum, this.postingProfile); toAccount = CustLedgerAccounts::sumAccount(this.accountNum, postingProfileClose); // Запоминания профиля разноски закрытия this.postingProfileClose = postingProfileClose; // Если счета отличаются if (fromAccount != toAccount) { // Если нам не передали объект-разноску создаем свой: if (! ledgerVoucher) //ledgerVouchertrans) { // Получаем номерную серию numberSeq = NumberSeq::newGetVoucher(CustParameters::numRefCustCloseVoucher()); // Создаем объект- разноску ledgerVoucher = ledgerVoucher::newLedgerPost(DetailSummary::Detail, SysModule::Cust, numberSeq.parmVoucherSequenceCode()); // Создаем объект - voucher ledgerVoucherObject = LedgerVoucherObject::newVoucher(numberSeq.voucher(), _postingDate, SysModule::Cust, LedgerTransType::Cust); // ссылка на платеж, которая попадет в проводки ledgerVoucherObject.parmPaymentReference(this.paymReference); // Добавляем документ ГК в разноску ledgerVoucher.AddVoucher(ledgerVoucherObject); ledgerVoucherInit= true; } // Добавляем кредитовую проводку ledgerVoucher.addTrans( LedgerVoucherTransObject::newCreateTrans( ledgerVoucher.findLedgerVoucherObject(), LedgerPostingType::CustBalance, fromAccount, this.dimension, this.currencyCode, -this.amountCur, this.recId)); // Добавляем дебетовую проводку ledgerVoucher.addTrans( LedgerVoucherTransObject::newCreateTrans( ledgerVoucher.findLedgerVoucherObject(), LedgerPostingType::CustBalance, toAccount, this.dimension, this.currencyCode, this.amountCur, this.recId)); // EGLA, Correspondence II --> // Получаем объект для корреспонденции ledgerBondClient = ledgerVoucher.findLedgerVoucherObject().ledgerBondClient_RU(); if (ledgerBondClient && this.amountCur) { // Устанавливаем корреспонденцию ledgerBondClient.bondVRef2VRef(ledgerBondClient.lastVrefId(), ledgerBondClient.lastVrefId(-1)); } // EGLA, Correspondence II <-- // Устанавливаем дату закрытия this.closed = this.maxSettlementDate(_postingDate); // если нам пришлось создать собственный объект-разноску: if (ledgerVoucherInit) { // завершаем её ledgerVoucher.end(); } } } } === см. также == [[:AxForum]]: *[[http://www.axforum.info/forums/showthread.php?s=&threadid=9187]] *Класс/LedgerVoucher *[[http://www.ms-dynamics.ru/blog/2007/08/28/nemnogo-ob-arxitekture-raznoski-v-gk-i-probleme-korrespondencii-schetov/]] -- см. раздел "Немного о программном API создания постингов"