Esempio n. 1
0
        public void CheckOut()
        {
            double  totalamount = 0;
            Receipt or          = new Receipt();

            or.InitializePrinter();
            or.OpenDrawer();


            frmInput payment = new frmInput();

            payment.Title         = "Actual Cash on Hand";
            payment.Caption       = "Amount";
            payment.IsNumericOnly = true;
            payment.Value         = "0";
            if (payment.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (payment.Value != "" && Convert.ToDouble(payment.Value) > 0)
                {
                    CashCount cc = new CashCount();
                    if (cc.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        return;
                    }
                    else
                    {
                        totalamount = cc.TotalAmount;
                    }
                    if (Convert.ToDouble(payment.Value) != totalamount)
                    {
                        MessageBox.Show("Cash count doesn't match with your total Amount", "Cash Count", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    //btnSearch.PerformClick();
                    UpdateCheckout();

                    clsCheckOut ckout = new clsCheckOut();
                    ckout.ActualAmount   = double.Parse(payment.Value);
                    ckout.ExpectedAmount = expectedCOH;
                    ckout.Timestamp      = dtPickStart.Value;
                    ckout.UserId         = lstUsers[cboCashier.SelectedIndex].UserId;
                    ckout.UserName       = lstUsers[cboCashier.SelectedIndex].UserName;
                    lstCheckOutItems[lstCheckOutItems.Count - 1].ActualAmount = ckout.ActualAmount;
                    ckout.LstItems = this.lstCheckOutItems;

                    ckout.Save();
                    isCheckout = false;
                    UpdateCheckout();
                    btnPrint.PerformClick();
                }
            }
        }
Esempio n. 2
0
        private void btnCheckOut_Click(object sender, EventArgs e)
        {
            //frmChkOutLight chkout = new frmChkOutLight();
            //chkout.ShowDialog();
            btnSearch.PerformClick();
            if (cboCashier.SelectedIndex == 0)
            {
                MessageBox.Show("Please select cashier.", "Checkout", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            double totalamount = 0;

            if (MessageBox.Show("Would you like to perform Cash Count?", "Cash Count", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                CashCount cc = new CashCount();
                if (cc.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }
                else
                {
                    totalamount = cc.TotalAmount;
                }
            }
            frmInput payment = new frmInput();

            payment.Title         = "Actual Cash on Hand";
            payment.Caption       = "Amount";
            payment.IsNumericOnly = true;
            payment.Value         = totalamount.ToString();
            if (payment.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (payment.Value != "")
                {
                    clsCheckOut ckout = new clsCheckOut();
                    ckout.ActualAmount   = double.Parse(payment.Value);
                    ckout.ExpectedAmount = expectedCOH;
                    ckout.Timestamp      = dtPickStart.Value;
                    ckout.UserId         = lstUsers[cboCashier.SelectedIndex - 1].UserId;
                    ckout.UserName       = lstUsers[cboCashier.SelectedIndex - 1].UserName;
                    ckout.Save();
                    btnSearch.PerformClick();
                }
            }
        }