首页 > 代码库 > 生成折扣日记账
生成折扣日记账
有些场景下,供应商开发票时会有折扣,开票金额会小于收货金额,过账发票时,系统根据收货金额过账,自动产生折扣金额对应的日记账,与过账发票产生的供应商交易记录自动核销。
public void createDiscountJournal(ERM_VendStatementTable _statementTable){ LedgerJournalTable journalTable; LedgerJournalTrans journalTrans; Voucher voucher; CustVendOpenTransManager manager; VendTransOpen vendTransOpen; VendTrans vendTrans; LedgerJournalCheckPost journalCheckPost; LedgerJournalName journalName; ERM_PurchInvoice purchInvoice; ; if(!_statementTable.discountAmount()) return; ttsbegin; select purchInvoice where purchInvoice.StatementId == _statementTable.StatementId; journalName = LedgerJournalName::find(VendParameters::find().ERM_DiscountJournalNameId); voucher = NumberSeq::newGetVoucher(LedgerParameters::numRefLedgerTempVoucher()).voucher(); journalTable.initFromLedgerJournalName(journalName.JournalName); journalTable.insert(); journalTrans.JournalNum = journalTable.JournalNum; journalTrans.Voucher = voucher; journalTrans.TransDate = purchInvoice.InvoiceDate? purchInvoice.InvoiceDate:systemDateGet(); journalTrans.AccountType = LedgerJournalACType::Vend; journalTrans.AccountNum = _statementTable.VendAccount; journalTrans.AmountCurDebit = _statementTable.discountAmount(); journalTrans.Approved = NoYes::Yes; journalTrans.OffsetAccountType = journalName.OffsetAccountType; journalTrans.OffsetAccount = journalName.OffsetAccount; journalTrans.CurrencyCode = VendTable::find(_statementTable.VendAccount).Currency; journalTrans.ExchRate = Currency::exchRate(journalTrans.CurrencyCode); journalTrans.SettleVoucher = SettlementType::SelectedTransact; journalTrans.insert(); manager = CustVendOpenTransManager::construct(journalTrans); select vendTransOpen exists join vendTrans where vendTransOpen.RefRecId == vendTrans.RecId && vendTrans.Invoice == _statementTable.StatementId && vendTrans.AccountNum == _statementTable.VendAccount; manager.updateTransMarked(vendTransOpen,NoYes::Yes); journalCheckPost = LedgerJournalCheckPost::newLedgerJournalTable(journalTable,NoYes::Yes); journalCheckPost.run(); _statementTable.Status = ERM_VendStatementStatus::Invoiced; _statementTable.update(); _statementTable.dataSource().reread(); _statementTable.dataSource().refresh(); _statementTable.dataSource().active(); ttscommit;}
AX2009 放在这里做个备份
生成折扣日记账
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。