public void Save() { var purchase = new PurchaseModel { PurchaseID = _view.PurchaseID, Tgl = _view.Tgl, Jam = _view.Jam, SupplierID = _view.SupplierID, SupplierName = _view.SupplierName, Keterangan = _view.Catatan, TotalHarga = _view.Total, Diskon = _view.DiskonLain, BiayaLain = _view.BiayaLain, GrandTotal = _view.GrandTotal, ListBrg = _view.ListBrg, IsClosed = _view.IsClosedPO }; purchase.ListBrg = purchase.ListBrg.Where(x => x.BrgID != "").ToList(); using (var trans = TransHelper.NewScope()) { var result = _purchaseBL.Save(purchase); var result2 = _bpPurchaseBL.Generate(result); trans.Complete(); } }
public void Save() { var receipt = new ReceiptModel { ReceiptID = _view.ReceiptID, Tgl = _view.Tgl, Jam = _view.Jam, PurchaseID = _view.PurchaseID, SupplierID = _view.SupplierID, SupplierName = _view.SupplierName, Keterangan = _view.Catatan, TotalHarga = _view.Total, Diskon = _view.DiskonLain, BiayaLain = _view.BiayaLain, GrandTotal = _view.GrandTotal, ListBrg = _view.ListBrg }; receipt.ListBrg = receipt.ListBrg.Where(x => x.BrgID != "").ToList(); using (var trans = TransHelper.NewScope()) { var result = _receiptBL.Save(receipt); var result1 = _bpPurchaseBL.Generate(result); var result2 = _bpStokBL.Generate(result); // update status ClosePO var po = _purchaseBL.GetData(result.PurchaseID); if (result1.TotHargaPurchase == result1.TotHargaReceipt) { _purchaseBL.ClosePO(po); } else { _purchaseBL.OpenPO(po); } trans.Complete(); } }