public frmRpt_PaymentBookingHs(PaymentHallsEN aPaymentHallsEN) { InitializeComponent(); this.aPaymentHallsEN = aPaymentHallsEN; try { //------------------------------- Hoi truong --------------------- lblNumberVote.Text = Convert.ToString(this.aPaymentHallsEN.IDBookingH); lblIDBookingH.Text = Convert.ToString(this.aPaymentHallsEN.IDBookingH); lblNameCustomer.Text = this.aPaymentHallsEN.NameCustomer; lblGroup.Text = this.aPaymentHallsEN.NameCustomerGroup; lblCompany.Text = this.aPaymentHallsEN.NameCompany; lblTaxNumberCode.Text = this.aPaymentHallsEN.TaxNumberCodeCompany; int day = DateTime.Now.Day; int month = DateTime.Now.Month; int year = DateTime.Now.Year; lblDayMonthYear.Text = "Hà nội , ngày " + day.ToString() + " tháng " + month.ToString() + " năm " + year.ToString(); List<HallsEN> aListHallsEN = new List<HallsEN>(); HallsEN aHallsEN; List<ServicesHallsEN> aListServicesHallsEN = new List<ServicesHallsEN>(); ServicesHallsEN aServicesHallsEN; foreach (InfoDetailPaymentHallsEN aInfoDetailPaymentHallsEN in this.aPaymentHallsEN.aListInfoDetailPaymentHallsEN) { aHallsEN = new HallsEN(); aHallsEN.IDBookingHall = aInfoDetailPaymentHallsEN.aBookingHalls.ID; aHallsEN.IDBookingH = aInfoDetailPaymentHallsEN.aBookingHalls.IDBookingH; aHallsEN.CodeHall = aInfoDetailPaymentHallsEN.aBookingHalls.CodeHall; aHallsEN.Sku = aInfoDetailPaymentHallsEN.Sku; aHallsEN.Date = aInfoDetailPaymentHallsEN.aBookingHalls.Date; aHallsEN.Cost = aInfoDetailPaymentHallsEN.aBookingHalls.Cost; aHallsEN.PercentTax = aInfoDetailPaymentHallsEN.aBookingHalls.PercentTax; aHallsEN.CostRef_Halls = aInfoDetailPaymentHallsEN.aBookingHalls.CostRef_Halls; aHallsEN.TotalMoney = aPaymentHallsEN.GetMoneyHall(aInfoDetailPaymentHallsEN.aBookingHalls.ID); aListHallsEN.Add(aHallsEN); foreach (ServicesHallsEN items in aInfoDetailPaymentHallsEN.aListServicesHallsEN) { aServicesHallsEN = new ServicesHallsEN(); aServicesHallsEN.SkuHall = aHallsEN.Sku; aServicesHallsEN.NameService = items.NameService; aServicesHallsEN.Date = items.Date; aServicesHallsEN.Quantity = items.Quantity; aServicesHallsEN.Cost = items.Cost; aServicesHallsEN.PercentTax = items.PercentTax; aListServicesHallsEN.Add(aServicesHallsEN); } } //danh sach hoi truong this.DetailReportHall.DataSource = aListHallsEN; colSkuHall.DataBindings.Add("Text", this.DetailReportHall.DataSource, "Sku"); colCreateDate.DataBindings.Add("Text", this.DetailReportHall.DataSource, "Date", "{0:dd/MM/yyyy}"); colBookingHallCost.DataBindings.Add("Text", this.DetailReportHall.DataSource, "Cost", "{0:0,0}"); colPercentTax.DataBindings.Add("Text", this.DetailReportHall.DataSource, "PercentTax"); colPaymentMoneyHall.DataBindings.Add("Text", this.DetailReportHall.DataSource, "TotalMoney", "{0:0,0}"); //danh sach dich vu su dung this.DetailReportService.DataSource = aListServicesHallsEN; colService_Sku.DataBindings.Add("Text", this.DetailReportService.DataSource, "SkuHall"); colService_Name.DataBindings.Add("Text", this.DetailReportService.DataSource, "NameService"); colService_Date.DataBindings.Add("Text", this.DetailReportService.DataSource, "Date", "{0:dd/MM/yyyy}"); colService_Quantity.DataBindings.Add("Text", this.DetailReportService.DataSource, "Quantity", "{0:0,0}"); colService_Cost.DataBindings.Add("Text", this.DetailReportService.DataSource, "Cost", "{0:0,0}"); colService_PercentTax.DataBindings.Add("Text", this.DetailReportService.DataSource, "PercentTax"); colService_Money.DataBindings.Add("Text", this.DetailReportService.DataSource, "Total", "{0:0,0}"); //tong tien hoi truong truoc thue lblTotalMoneyHallBeforeTax.Text = String.Format("{0:0,0} (VND)", Convert.ToDecimal(this.aPaymentHallsEN.GetTotalMoneyHallBeforeTax())); //tong tien hoi truong sau thue lblTotalMoneyHallBehindTax.Text = String.Format("{0:0,0} (VND)", Convert.ToDecimal(this.aPaymentHallsEN.GetTotalMoneyHallBehindTax())); //tong tien dich vu hoi truong truoc thue lblTotalMoneyService_BookingHBeforeTax.Text = String.Format("{0:0,0} (VND)", Convert.ToDecimal(this.aPaymentHallsEN.GetTotalMoneyServiceHallBeforeTax())); //tong tien dich vu hoi truong sau thue lblTotalMoneyServices_BookingHBehindTax.Text = String.Format("{0:0,0} (VND)", Convert.ToDecimal(this.aPaymentHallsEN.GetTotalMoneyServiceHallBehindTax())); //tong tien bookingh decimal? moneyBookingHBeforeTax = Convert.ToDecimal(this.aPaymentHallsEN.GetTotalMoneyBookingHBeforeTax()); decimal? moneyBookingHBehindTax = Convert.ToDecimal(this.aPaymentHallsEN.GetTotalMoneyBookingHBehindTax()); lblTotalMoneyBookingHBeforeTax.Text = String.Format("{0:0,0} (VND)", moneyBookingHBeforeTax); lblTotalMoneyBookingHBehindTax.Text = String.Format("{0:0,0} (VND)", moneyBookingHBehindTax); lblBookingMoney_BookingH.Text = String.Format("{0:0,0} (VND)", Convert.ToDecimal(this.aPaymentHallsEN.GetBookingMoney())); lblTotalBookingH.Text = String.Format("{0:0,0} (VND)", (moneyBookingHBehindTax - Convert.ToDecimal(this.aPaymentHallsEN.GetBookingMoney()))); } catch (Exception ex) { MessageBox.Show("frmRpt_PaymentBookingHs.frmRpt_PaymentBookingHs\n" + ex.ToString()); } }
//hiennv public decimal? GetTotalMoneyServiceHallAfterTax() { try { decimal? ret = 0; decimal? cost = 0; for (int i = 0; i < this.aListInfoDetailPaymentHallsEN.Count; i++) { ServicesHallsEN aServicesHallsEN; for (int ii = 0; ii < this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN.Count; ii++) { aServicesHallsEN = new ServicesHallsEN(); aServicesHallsEN = this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii]; if (this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii].Cost == null || this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii].Cost == 0) { cost = this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii].CostRef_Services; } else { cost = this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii].Cost; } decimal? NotTax = cost * Convert.ToDecimal(aServicesHallsEN.Quantity); decimal? Tax = NotTax * Convert.ToDecimal(aServicesHallsEN.PercentTax) / 100; ret = ret + NotTax + Tax; } } return ret; } catch (Exception ex) { throw new Exception("PaymentHallsEN:GetTotalMoneyServiceHallAfterTax\n" + ex.ToString()); } }
//hiennv public decimal? GetTotalMoneyServiceHallBeforeTax_ByIDBookingHall(int IDBookingHall) { try { decimal? ret = 0; decimal? cost = 0; for (int i = 0; i < this.aListInfoDetailPaymentHallsEN.Count; i++) { if (this.aListInfoDetailPaymentHallsEN[i].aBookingHalls.ID == IDBookingHall) { ServicesHallsEN aServicesHallsEN; for (int ii = 0; ii < this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN.Count; ii++) { aServicesHallsEN = new ServicesHallsEN(); aServicesHallsEN = this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii]; if (this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii].Cost == null || this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii].Cost == 0) { cost = this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii].CostRef_Services; } else { cost = this.aListInfoDetailPaymentHallsEN[i].aListServicesHallsEN[ii].Cost; } ret = ret + cost * Convert.ToDecimal(aServicesHallsEN.Quantity); } } } return ret; } catch (Exception ex) { throw new Exception("PaymentHallsEN:GetTotalMoneyServiceHallBeforeTax_ByIDBookingHall\n" + ex.ToString()); } }
//Hiennv public List<ServicesHallsEN> GetListServicesHallsEN() { try { List<ServicesHallsEN> aListServices = new List<ServicesHallsEN>(); ServicesHallsEN aServicesHallsEN; foreach (InfoDetailPaymentHallsEN item1 in this.aListInfoDetailPaymentHallsEN) { foreach (ServicesHallsEN item2 in item1.aListServicesHallsEN) { aServicesHallsEN = new ServicesHallsEN(); aServicesHallsEN.IDBookingHallService = item2.IDBookingHallService; aServicesHallsEN.CodeHall = item2.CodeHall; aServicesHallsEN.SkuHall = item2.SkuHall; aServicesHallsEN.NameService = item2.NameService; aServicesHallsEN.Date = item2.Date; aServicesHallsEN.Quantity = item2.Quantity; aServicesHallsEN.Cost = item2.Cost; aServicesHallsEN.PercentTax = item2.PercentTax; aServicesHallsEN.IndexSubServices = this.GetIndexSubServices(item2.IDBookingHallService); aListServices.Add(aServicesHallsEN); } } return aListServices; } catch (Exception ex) { throw new Exception("PaymentHallsEN:GetListServicesHallsEN\n" + ex.ToString()); } }