Пример #1
0
        private void btnDiscount_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckDiscount() == 1)
                {
                    frmMessager frm = new frmMessager("Discount", "Exitst discount");
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    double      totalDiscount;
                    frmDiscount frm = new frmDiscount(Discount);
                    if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        Discount = frm.Discount;
                        UCDiscount ucDiscount = new UCDiscount();

                        if (Discount.DiscountType == 1)
                        {
                            ucDiscount.lblMethodType.Text = Discount.DiscountName + "%";
                            totalDiscount            = (OrderMain.SubTotal() * (Convert.ToDouble(Discount.Total / 100.0)) / 100);
                            ucDiscount.lblTotal.Text = "$" + money.Format2(totalDiscount);
                        }
                        else
                        {
                            ucDiscount.lblTotal.Text      = "$" + money.Format2(Discount.Total);
                            totalDiscount                 = Discount.Total;
                            ucDiscount.lblMethodType.Text = Discount.DiscountName;
                        }

                        ucDiscount.Click += ucDiscount_Click;

                        OrderMain.DiscountType = Discount.DiscountType;
                        OrderMain.Discount     = Convert.ToInt32(totalDiscount);
                        flpPaymentType.Controls.Add(ucDiscount);
                        CheckTotal();
                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmPayment::::::::::::::::::::::::::btnDiscount_Click:::::::::::::" + ex.Message);
            }
        }
Пример #2
0
        private void btnDiscount_Click(object sender, EventArgs e)
        {
            try
            {

                if (CheckDiscount() == 1)
                {
                    frmMessager frm = new frmMessager("Discount", "Exitst discount");
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    double totalDiscount ;
                    frmDiscount frm = new frmDiscount(Discount);
                    if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        Discount = frm.Discount;
                        UCDiscount ucDiscount = new UCDiscount();

                        if (Discount.DiscountType == 1)
                        {
                            ucDiscount.lblMethodType.Text = Discount.DiscountName + "%";
                            totalDiscount = (OrderMain.SubTotal() * (Convert.ToDouble(Discount.Total / 100.0)) / 100);
                            ucDiscount.lblTotal.Text = "$" + money.Format2(totalDiscount);
                        }
                        else
                        {
                            ucDiscount.lblTotal.Text = "$" + money.Format2(Discount.Total);
                            totalDiscount = Discount.Total;
                            ucDiscount.lblMethodType.Text = Discount.DiscountName;
                        }

                        ucDiscount.Click += ucDiscount_Click;

                        OrderMain.DiscountType = Discount.DiscountType;
                        OrderMain.Discount =Convert.ToInt32(totalDiscount);
                        flpPaymentType.Controls.Add(ucDiscount);
                        CheckTotal();
                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmPayment::::::::::::::::::::::::::btnDiscount_Click:::::::::::::" + ex.Message);
            }
        }