28.07.2011, 16:37 | #1 |
Участник
|
Программное создание заказа на покупку
День добрый!
Пытаюсь программно создать строку заказа, как и сам заказ. Столкнулся с проблемой, что строки заказа не создаются. Вот код: X++: static void NewPurch(Args _args) { PurchTable _pTable; PurchLine _pLine; str _purchId, _PurchName, _OrderAccount, _InvoiceAccount, _payment, _vendGroup, _paymentSched, _itemBuyerGroup; PurchStatus _purchStatus; PurchaseType _PurchaseType; SettlementType _SettleVoucher; Date _DeliveryDate; ; _purchId = '00000223_106'; _PurchName = 'ООО форд'; _OrderAccount = '000223_053'; _InvoiceAccount = '000223_053'; _DeliveryDate = today()+1; _payment = '25е число'; _vendGroup = 'поставщики'; _paymentSched = 'оплата за месяц'; _itemBuyerGroup = '1'; _purchStatus = PurchStatus::Backorder ; _PurchaseType = PurchaseType::Journal ; _SettleVoucher = SettlementType::None ; ttsbegin; select forupdate _pTable; _pTable.initValue(); _pTable.PurchId = _purchId; _pTable.PurchName = _purchName; _pTable.OrderAccount = _OrderAccount; _pTable.InvoiceAccount = _InvoiceAccount; _pTable.DeliveryDate = _DeliveryDate; _pTable.Payment = _payment; _pTable.VendGroup = _vendGroup; _pTable.PaymentSched = _paymentSched; _pTable.ItemBuyerGroupId = _itemBuyerGroup; _pTable.PurchStatus = _purchStatus; _pTable.PurchaseType = _purchaseType; _ptable.SettleVoucher = _SettleVoucher; _pTable.CurrencyCode = 'руб'; _pTable.LanguageId = 'ru'; _pTable.insert() ; ttscommit; } X++: static void NewPurchLine(Args _args) { PurchLine _pLine; str _purchId, _ItemId, _purchUnit; real _QtyOrdered, _RemainPurchPhysical, _purchPrice, _purchQty, _RemainInventPhysical; PurchStatus _purchStatus; PurchaseType _PurchaseType; Date _DeliveryDate; ; _purchId = '00000223_106'; _itemId = '001'; _purchStatus = PurchStatus::Backorder ; _DeliveryDate = today()+1; _QtyOrdered = 999; _RemainPurchPhysical = 999; _PurchPrice = 10; _PurchUnit = 'шт'; _PurchQty = 999; _PurchaseType = PurchaseType::Journal ; _RemainInventPhysical = 999; ttsbegin; select forupdate _pLine; _pLine.initValue(); _pLine.PurchId = _purchId; _pLine.ItemId = _itemId; _pLine.PurchStatus = _purchStatus; _pLine.DeliveryDate = _DeliveryDate; _pLine.QtyOrdered = _QtyOrdered; _pLine.RemainPurchPhysical = _RemainPurchPhysical; _pLine.PurchPrice = _PurchPrice; _pLine.PurchUnit = _PurchUnit; _pLine.PurchQty = _purchQty; _pLine.PurchaseType = _PurchaseType; _pLine.RemainInventPhysical = _RemainInventPhysical; _pLine.insert() ; ttscommit; } Вроде все связи в таблицах посмотрел и всё равно не пойму, где ошибся... |
|