static void Job649(Args _args)
{
ItemId ItemId = "000XA00612R1";
InventDimId InventDimId = "K00811600";
InventQty qty = ;
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(),
,
qty,
qty,
inventPriceMap.markup(),
,
'',
);
}
;
physicalQty = InventSum::find(ItemId,InventDimId).PhysicalInvent;
qty = qty - physicalQty;
if (qty != )
{
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();
}
}