|
База знаний ERP: Axapta/ФормированиеПроводокГК |
|
Раздел: Программирование > Бизнес Логика
как формировать проводки ГК описано в материалах курса Morph X Intergation Master?.
При сторнировании надо выставлять флаг parmCorrection в LedgerVoucherObject иначе при отрицательной сумме получится реверсирование _ledgerVoucher.findLedgerVoucherObject().parmCorrection(
_isCancellation);Примерв качестве примера использования можно западной функциональности можно посмотреть Класс / Tutorial Ledger Voucher
Российская Функциональность, судя по всему, требует дополнительных действий для обеспечения корреспонденции. Пример можно посмотреть // 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();
}
}
}
}см. также
Файлов нет.
[Показать файлы/форму]
Комментариев нет.
[Показать комментарии/форму]
|
| Powered by WackoWiki R4.2 |