public void submitOrCancelBill(BillDTO bill, DoanhThu doanhThu) { double discount = 0; string sql; if (bill.Status == 1) { if (customerBUS.CheckCustomer(bill.Customer)) { bill.Customer = customerBUS.getDiscount(bill.Customer); if (bill.Customer.Type == 1) { discount = 20; } bill.TotalPrice = bill.TotalPrice - (bill.TotalPrice * discount / 100); } sql = "UPDATE BILL_OUT SET TOTALPRICE = " + bill.TotalPrice.ToString() + " , STATUS = 1 , ID_CUSTOMER = " + bill.Customer.ID + " WHERE ID = " + bill.ID; DataProvider.Instance.ExecuteNonQuery(sql); //Them doanh thu DoanhThuBUS doanhThuBUS = new DoanhThuBUS(); double tg = bill.TotalPrice; tg -= doanhThu.Value; doanhThu.Value = tg; doanhThuBUS.UpdateDoanhThu(doanhThu); if (customerBUS.CheckCustomer(bill.Customer)) { customerBUS.UpdatePayCount(bill.Customer, bill); } } else { sql = "DELETE FROM BILL_INFO WHERE ID_BILL = " + bill.ID; DataProvider.Instance.ExecuteNonQuery(sql); sql = "DELETE FROM BILL_OUT WHERE ID = " + bill.ID; DataProvider.Instance.ExecuteNonQuery(sql); } }