static void Job649(Args _args) { ItemId ItemId = "000XA00612R1"; InventDimId InventDimId = "K00811600"; InventQty qty = 5; InventQty physicalQty; NumberSeq numberSeq; InventJournalVoucherId voucherId; InventTransId InventTransId; InventUpd_Financial financial; InventMov_Vir_Counting movement; TransactionTxt transactionTxt; LedgerVoucher ledgerVoucher; LedgerVoucherObject ledgerVoucherObject; THK_2ndInventQty THK_2ndqty; CostAmount calcCostAmount() { InventPriceMap inventPriceMap = InventTable::find(ItemId).inventCostPriceMap(InventDimId); ; return PriceDisc::price2Amount(inventPriceMap.price(), inventPriceMap.priceUnit(), 0, qty, qty, inventPriceMap.markup(), 0, '', 0); } ; physicalQty = InventSum::find(ItemId,InventDimId).PhysicalInvent; qty = qty - physicalQty; if (qty != 0) { if (!InventTransId) { InventTransId = NumberSeq::newGetNum(InventParameters::numRefInventTransId()).num(); } numberSeq = NumberSeq::newGetNum(InventParameters::numRefInventJournalVoucherId()); voucherId = numberSeq.num(); transactionTxt = new TransactionTxt(); transactionTxt.setType(LedgerTransTxt::InventJournalCount); transactionTxt.setDate(systemdateget()); transactionTxt.setVoucher(voucherId); ledgerVoucher = LedgerVoucher::newLedgerPost(DetailSummary::Summary, SysModule::Invent, numberSeq.parmVoucherSequenceCode()); ledgerVoucherObject = LedgerVoucherObject::newVoucher(voucherId, systemdateget(), SysModule::Invent, LedgerTransType::Invent); ledgerVoucherObject.lastTransTxt(transactionTxt.txt()); ledgerVoucher.addVoucher(ledgerVoucherObject); movement = InventMov_Vir_Counting::newParameters( InventTransId, ItemId, InventDimId, systemdateget(), qty, THK_2ndqty); financial = InventUpd_Financial::newVirtuelCounting(movement, ledgerVoucher, abs(calcCostAmount()) * movement.transSign()); financial.updateNow(); } }