30.06.2004, 07:51 | #1 |
Участник
|
Удалить закупку
Хочу удалить закупку. Будет ли такой код правильным?
Период текущий месяц,сопоставлений и списаний нет. ---- static void job123(Args _args) { PurchLine PurchLine; PurchTable PurchTable; Voucher v; TaxTrans TaxTrans; LedgerTrans LedgerTrans; VendTrans VendTrans; InventTrans InventTrans; VendInvoiceTrans VendInvoiceTrans; VendInvoicePurchLink VendInvoicePurchLink; VendInvoiceJour VendInvoiceJour; VendTransOpen VendTransOpen; VendSettlement VendSettlement; InventBatch InventBatch; InventDim InventDim; InventSum InventSum; MarkupTrans MarkupTrans; LedgerBalancesTrans LedgerBalancesTrans; LedgerBalancesDimTrans LedgerBalancesDimTrans; str id; ; ttsbegin; delete_from PurchLine where PurchLine.PurchId=='123456789'; delete_from PurchTable where PurchTable.PurchId=='123456789'; delete_from VendInvoiceTrans where VendInvoiceTrans.PurchId=='123456789'; delete_from VendInvoicePurchLink where VendInvoicePurchLink.PurchId=='123456789'; delete_from VendInvoiceJour where VendInvoiceJour.PurchId=='123456789'; delete_from InventBatch where InventBatch.InventBatchId=='123456789'; while select InventDim where InventDim.InventBatchId=='123456789' delete_from InventSum where InventSum.InventDimId==InventDim.InventDimId; delete_from InventDim where InventDim.InventBatchId=='123456789'; while select InventTrans where InventTrans.TransRefId=='123456789' if (InventTrans) { v=InventTrans.Voucher; delete_from MarkupTrans where MarkupTrans.Voucher==v; delete_from TaxTrans where TaxTrans.Voucher==v; while select VendTrans where VendTrans.Voucher==v delete_from VendTransOpen where VendTransOpen.RefRecId==VendTrans.RecId; //while select VendTrans where VendTrans.Voucher==v // delete_from VendSettlement where VendSettlement.TransRecId==VendTrans.RecId; // while select VendTrans where VendTrans.Voucher==v { delete_from LedgerTrans where LedgerTrans.Voucher==VendSettlement.TaxVoucher_RU; delete_from VendSettlement where VendSettlement.OffsetRecId==VendTrans.OffsetRecId && VendSettlement.TransRecId==VendTrans.RecId; } delete_from VendTrans where VendTrans.Voucher==v; while select LedgerTrans where LedgerTrans.Voucher==v { delete_from LedgerBalancesTrans where LedgerBalancesTrans.TransDate==LedgerTrans.Transdate && LedgerBalancesTrans.AccountNum==LedgerTrans.AccountNum && LedgerBalancesTrans.DebitMST == LedgerTrans.AmountMST; delete_from LedgerBalancesDimTrans where LedgerBalancesDimTrans.TransDate==LedgerTrans.Transdate && LedgerBalancesDimTrans.AccountNum==LedgerTrans.AccountNum && LedgerBalancesDimTrans.DebitMST == LedgerTrans.AmountMST; } delete_from LedgerTrans where LedgerTrans.Voucher==v; } delete_from InventTrans where InventTrans.TransRefId=='123456789'; ttscommit; } |
|