コード例 #1
0
        //Hiennv
        private void lueIndexSub_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                int indexSub = Convert.ToInt32(lueIndexSub.Text);
                this.LoadListHall_ByIndexSubHall(this.aPaymentHallsEN, indexSub);
                this.LoadListServices_ByIndexSubServices(this.aPaymentHallsEN, indexSub);

                List<IndexSubSplitBillEN> aListIndexSubSplitBillEN = this.aPaymentHallsEN.aListIndexSubSplitBillH.Where(sub => sub.IndexSub == indexSub && sub.SubStatus > 0).ToList();
                if (aListIndexSubSplitBillEN.Count < 1)
                {
                    decimal? totalBill = this.aListServices.Sum(s => s.Total) + this.aListServices.Sum(r => r.Total);

                    decimal? totalBookingMoney = this.aPaymentHallsEN.GetBookingMoney();

                    if ((totalBill - totalBookingMoney) == 0)
                    {
                        this.aPaymentHallsEN.SetSubBookingMoney(indexSub, totalBookingMoney);
                        this.aPaymentHallsEN.SetSubStatus(indexSub, indexSub); //SubStatus dung de phan biet so tien ung truoc cho tung subBookingmoney

                        this.aPaymentHallsEN.SetBookingMoney(0); // set lai so tien ung truoc bang 0;
                    }
                    else if ((totalBill - totalBookingMoney) > 0)
                    {
                        this.aPaymentHallsEN.SetSubBookingMoney(indexSub, totalBookingMoney);
                        this.aPaymentHallsEN.SetSubStatus(indexSub, indexSub);//SubStatus dung de phan biet so tien ung truoc cho tung subBookingmoney

                        this.aPaymentHallsEN.SetBookingMoney(0); // set lai so tien ung truoc bang 0;
                    }
                    else if ((totalBill - totalBookingMoney) < 0)
                    {
                        BookingHallsBO aBookingHallsBO = new BookingHallsBO();
                        List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookingH_ByStatus(this.aPaymentHallsEN.IDBookingH, 8);
                        if (aListBookingHalls.Count < 2)
                        {
                            this.aPaymentHallsEN.SetSubBookingMoney(indexSub, totalBookingMoney);
                            this.aPaymentHallsEN.SetSubStatus(indexSub, indexSub);//SubStatus dung de phan biet so tien ung truoc cho tung subBookingmoney

                            this.aPaymentHallsEN.SetBookingMoney(0); // set lai so tien ung truoc bang 0;
                        }
                        else
                        {
                            this.aPaymentHallsEN.SetSubBookingMoney(indexSub, totalBill);
                            this.aPaymentHallsEN.SetSubStatus(indexSub, indexSub);//SubStatus dung de phan biet so tien ung truoc cho tung subBookingmoney

                            this.aPaymentHallsEN.SetBookingMoney((totalBookingMoney - totalBill));
                        }
                    }

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_SplitBillHalls_Step2_Load.lueIndexSub_EditValueChanged\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        //Hiennv
        private void btnPayment_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(lueIndexSub.Text) == true)
                {
                    lueIndexSub.Focus();
                    MessageBox.Show("Vui lòng chọn phiếu thanh toán!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    BookingHalls_ServicesBO aBookingHalls_ServicesBO = new BookingHalls_ServicesBO();
                    foreach (ServicesHallsEN aServicesHallsEN in this.aListServices)
                    {
                        BookingHalls_Services aBookingHalls_Services = aBookingHalls_ServicesBO.Select_ByID(aServicesHallsEN.IDBookingHallService);
                        if (aBookingHalls_Services != null && aBookingHalls_Services.Status != 8)
                        {
                            aBookingHalls_Services.ID = aServicesHallsEN.IDBookingHallService;
                            aBookingHalls_Services.Quantity = aServicesHallsEN.Quantity;
                            aBookingHalls_Services.PercentTax = aServicesHallsEN.PercentTax;
                            aBookingHalls_Services.Cost = aServicesHallsEN.Cost;
                            aBookingHalls_Services.Status = 8;// da thanh toan
                            aBookingHalls_ServicesBO.Update(aBookingHalls_Services);
                        }
                    }

                    BookingHallsBO aBookingHallsBO = new BookingHallsBO();
                    foreach (HallsEN aHallsEN in this.aListHalls)
                    {
                        BookingHalls aBookingHalls = aBookingHallsBO.Select_ByID(aHallsEN.IDBookingHall);
                        if (aBookingHalls != null && aBookingHalls.Status != 8)
                        {
                            aBookingHalls.ID = aHallsEN.IDBookingHall;
                            aBookingHalls.PercentTax = aHallsEN.PercentTax;
                            aBookingHalls.Cost = aHallsEN.Cost;
                            aBookingHalls.Status = 8;//da thanh toan
                            aBookingHallsBO.Update(aBookingHalls);
                        }
                    }
                    BookingHsBO aBookingHsBO = new BookingHsBO();
                    BookingHs aBookingHs = aBookingHsBO.Select_ByID(this.aPaymentHallsEN.IDBookingH);
                    List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookingH_ByStatus(this.aPaymentHallsEN.IDBookingH,8);
                    if (aListBookingHalls.Count < 1)
                    {
                        aBookingHs.ID = aPaymentHallsEN.IDBookingH;
                        aBookingHs.PayMenthod = this.aPaymentHallsEN.PayMenthod;
                        aBookingHs.StatusPay = 3;
                        aBookingHs.Status = 8;
                        btnPayment.Enabled = false;
                    }
                    aBookingHs.BookingMoney = this.aPaymentHallsEN.GetBookingMoney();
                    aBookingHsBO.Update(aBookingHs);

                    MessageBox.Show("Thanh toán thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_SplitBillHalls_Step2_Load.btnPayment_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        //Hiennv        31/08/2014           Thanh toan le cho hoi truong
        public void SplitPaymentForBookingH(NewPaymentEN aNewPaymentEN, List<BookingHallUsedEN> aListHalls, List<ServiceUsedEN> aListServicesH)
        {
            try
            {
                foreach (ServiceUsedEN aServicesEN in aListServicesH)
                {

                    aServicesEN.StatusPay = 8;
                    aServicesEN.Save(2);
                }

                BookingHallsBO aBookingHallsBO = new BookingHallsBO();
                foreach (BookingHallUsedEN aHallsEN in aListHalls)
                {
                    aHallsEN.Status = 8;
                    aHallsEN.Save();
                }
                BookingHsBO aBookingHsBO = new BookingHsBO();
                BookingHs aBookingHs = aBookingHsBO.Select_ByID(Convert.ToInt32(aNewPaymentEN.IDBookingH));
                List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookingH_ByStatus(Convert.ToInt32(aNewPaymentEN.IDBookingH), 8);
                if (aListBookingHalls.Count < 1)
                {
                    aBookingHs.ID = Convert.ToInt32(aNewPaymentEN.IDBookingH);
                    aBookingHs.PayMenthod = aNewPaymentEN.PayMenthodH;
                    aBookingHs.StatusPay = 3;
                    aBookingHs.Status = 8;
                    aBookingHs.DatePay = DateTime.Now;
                }
                aBookingHs.BookingMoney = aNewPaymentEN.BookingHMoney;
                aBookingHsBO.Update(aBookingHs);
            }
            catch (Exception ex)
            {
                throw new Exception("ReceptionTaskBO.SplitPaymentForBookingH \n" + ex.ToString());
            }
        }