Beispiel #1
0
        private void btnLock_Click(object sender, EventArgs e)
        {
            //locks register and clears any user entry
            if (btnLock.Text == "Lock")
            {
                LockForm();
                txtInput.Clear();
                TxtCashOut.Clear();
                label12.Text     = "Lock";
                txtInput.Enabled = false;

                return;
            }

            //enables the form to be ulocked
            if (btnLock.Text == "Unlock")
            {
                groupBoxLock.Visible   = false;
                groupBoxUnlock.Visible = true;
                groupBoxUnlock.BringToFront();
                BtnLogOff.Visible = false;
                label12.Text      = "Unlock";
                TxtUnlock.Focus();
            }
        }
Beispiel #2
0
        private void btnClear_Click(object sender, EventArgs e)
        {
            //Clears everything back into the default view
            if (BtnCash.Visible == true || TxtCashOut.Visible == true)
            {
                BtnCash.Visible = false;
                BtnEFT.Visible  = false;

                TxtCashOut.Visible = false;
                TxtCashOut.Clear();
                TxtUnlock.Clear();
                txtInput.Focus();

                BtnCoupon.Visible      = true;
                btnLock.Visible        = true;
                btnVoid.Visible        = true;
                btnRegOptions.Visible  = true;
                btnTender.Visible      = true;
                BtnPay.Visible         = false;
                BtnEnterCoupon.Visible = false;

                groupBoxTenderTotal.Visible = false;
            }
            //clear user entry
            txtInput.Clear();
            qty            = 1;
            lblQty.Visible = false;
        }
Beispiel #3
0
        private void BtnCash_Click(object sender, EventArgs e)
        {
            //hide cash and tender buttons and displays the cashout textbox
            BtnCash.Visible    = false;
            BtnEFT.Visible     = false;
            TxtCashOut.Visible = true;
            BtnPay.Visible     = true;
            TxtCashOut.Focus();

            TxtCashOut.Text = "0.00";
        }
Beispiel #4
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            //enables and disables the visibility option based on what needs to be displayed
            //Prioritizing the default view
            if (BtnCash.Visible == true || BtnLogOff.Visible == true)
            {
                BtnCash.Visible       = false;
                BtnEFT.Visible        = false;
                BtnPay.Visible        = false;
                BtnLogOff.Visible     = false;
                btnTillReport.Visible = false;

                BtnCoupon.Visible     = true;
                btnLock.Visible       = true;
                btnVoid.Visible       = true;
                btnRegOptions.Visible = true;
                btnTender.Visible     = true;
                btnLock.Enabled       = true;
                btnRegOptions.Enabled = true;

                groupBoxTenderTotal.Visible = false;
            }

            if (BtnPay.Visible == true)
            {
                BtnCash.Visible    = true;
                BtnEFT.Visible     = true;
                TxtCashOut.Visible = false;
                BtnPay.Visible     = false;
                TxtCashOut.Clear();
            }

            if (BtnEnterCoupon.Visible == true)
            {
                BtnEnterCoupon.Visible = false;
                TxtCashOut.Visible     = false;
                TxtCashOut.Text        = "";

                BtnCoupon.Visible     = true;
                btnLock.Visible       = true;
                btnVoid.Visible       = true;
                btnRegOptions.Visible = true;
                btnTender.Visible     = true;
            }

            if (groupBoxUnlock.Visible == true)
            {
                groupBoxUnlock.Visible = false;
                LockForm();
            }
            txtInput.Focus();
        }
Beispiel #5
0
        private void BtnCoupon_Click(object sender, EventArgs e)
        {
            //enables and disables the cupon visibility options based on what needs to be displayed
            //won't allow coupon entry if there is not an order in progress
            if (listViewGrocery.Items.Count is 0)
            {
                MessageBox.Show("Start A New Order To Tender");
            }
            else
            {
                BtnCoupon.Visible     = false;
                btnLock.Visible       = false;
                btnVoid.Visible       = false;
                btnRegOptions.Visible = false;
                btnTender.Visible     = false;
                BtnEFT.Visible        = false;

                BtnEnterCoupon.Visible = true;
                TxtCashOut.Visible     = true;
                TxtCashOut.Focus();
            }
        }
Beispiel #6
0
        private void BtnPay_Click(object sender, EventArgs e)
        {
            //if payment field is empty, will stop execution
            if (TxtCashOut.Text == "")
            {
                return;
            }

            //string builder that allows me to insert decimal points into certain parts of the textfiled based on how many characters are inside
            StringBuilder myCashBuilder = new StringBuilder(TxtCashOut.Text);

            //Allows insertion of a decimal point based on how many characters are inside the string
            string cashStr = TxtCashOut.Text;

            if (cashStr.Contains(".") == false)
            {
                if (TxtCashOut.TextLength < 3)
                {
                    if (TxtCashOut.TextLength == 2)
                    {
                        myCashBuilder.Insert((TxtCashOut.TextLength - TxtCashOut.TextLength), "0.");
                        TxtCashOut.Text = myCashBuilder.ToString();
                    }
                    else
                    {
                        myCashBuilder.Insert((TxtCashOut.TextLength - TxtCashOut.TextLength), "0.0");
                        TxtCashOut.Text = myCashBuilder.ToString();
                    }
                }
                else
                {
                    myCashBuilder.Insert((TxtCashOut.TextLength - 2), ".");
                    TxtCashOut.Text = myCashBuilder.ToString();
                }
                return;
            }

            //string builder for my richtextbox
            StringBuilder rtfTable = new StringBuilder();

            //array set up to input a cash entry into the ListView if the amount entered is less than the total amount
            string[]     arr = new string[5];
            ListViewItem itm;

            //header for my receipt
            string header = "Mitch's Grocery & Mercantile Supply" + Environment.NewLine
                            + "1234 Best Damn Groceries Rd" + Environment.NewLine + "Vieques, PR 00765"
                            + Environment.NewLine + "407-555-5555" + Environment.NewLine + Environment.NewLine;
            string footer = Environment.NewLine + "Thank You Very Much For Shopping With Us" + Environment.NewLine +
                            "Your Cashier was: " + Global.Cashier + Environment.NewLine +
                            "We Hope To See You Again!" + Environment.NewLine + Environment.NewLine + "Mitch's Grocery & Mercantile Supply";
            string tenderTime = Environment.NewLine + lblDate.Text + Environment.NewLine;

            if (decimal.Parse(TxtCashOut.Text) < total)
            {
                if (TxtCashOut.Text == "0.00")
                {
                    return;
                }

                arr[0] = "Cash";
                arr[1] = "";
                arr[2] = "";
                arr[3] = "-" + TxtCashOut.Text;
                arr[4] = "";


                itm = new ListViewItem(arr);
                listViewGrocery.Items.Add(itm);

                TotalCount();

                btnClear_Click(sender, e);
                TxtCashOut.Clear();

                return;
            }
            else
            {
                //runs if the amount entered is greater than the total
                //renders everything back into the default view and reveals the richtextbox receipt
                BtnCash.Visible    = false;
                BtnEFT.Visible     = false;
                BtnPay.Visible     = false;
                TxtCashOut.Visible = false;


                BtnCoupon.Visible     = true;
                btnLock.Visible       = true;
                btnVoid.Visible       = true;
                btnRegOptions.Visible = true;
                btnTender.Visible     = true;

                groupBoxTenderTotal.Visible = false;

                richTextBoxPrintCtrl1.Visible = true;


                //THIS VVVVVVVVV custom fontstyle and text alignment
                richTextBoxPrintCtrl1.SelectionFont      = new Font(richTextBoxPrintCtrl1.Font, FontStyle.Bold);
                richTextBoxPrintCtrl1.SelectionAlignment = HorizontalAlignment.Center;
                //   VVVVVV Goes To VVVVVVV
                richTextBoxPrintCtrl1.SelectedText = header;

                //Appends each item inside the ListView into my table string builder
                rtfTable.Append(@"{\rtf1 ");
                for (int i = 0; i < listViewGrocery.Items.Count; i++)
                {
                    rtfTable.Append(@"\trowd");
                    rtfTable.Append(@"\cellx1500" + listViewGrocery.Items[i].SubItems[0].Text);
                    rtfTable.Append(@"\intbl\cell");
                    rtfTable.Append(@"\cellx3000" + "");
                    rtfTable.Append(@"\intbl\cell");
                    rtfTable.Append(@"\cellx4500" + "x" + listViewGrocery.Items[i].SubItems[2].Text);
                    rtfTable.Append(@"\intbl\cell");
                    rtfTable.Append(@"\cellx6000" + "$" + listViewGrocery.Items[i].SubItems[3].Text);
                    rtfTable.Append(@"\intbl\cell");
                    rtfTable.Append(@"\cellx7500" + listViewGrocery.Items[i].SubItems[4].Text);
                    rtfTable.Append(@"\intbl\cell\row");
                }
                //Appends the order total, Sales Tax, Grand Total, Cash Payment, Change, and savings into the table
                rtfTable.Append(@"\trowd");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell\row");

                rtfTable.Append(@"\trowd");
                rtfTable.Append(@"\cellx1500" + "Order Total");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "$" + (total - taxTotal).ToString("#.##"));
                rtfTable.Append(@"\intbl\cell\row");

                rtfTable.Append(@"\trowd");
                rtfTable.Append(@"\cellx1500" + "Sales Tax");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + lblTax.Text);
                rtfTable.Append(@"\intbl\cell\row");

                rtfTable.Append(@"\trowd");
                rtfTable.Append(@"\cellx1500" + "Grand Total");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "$" + total.ToString("#.##"));
                rtfTable.Append(@"\intbl\cell\row");

                rtfTable.Append(@"\trowd");
                rtfTable.Append(@"\cellx1500" + "Cash");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "Payment");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "$" + TxtCashOut.Text);
                rtfTable.Append(@"\intbl\cell\row");

                rtfTable.Append(@"\trowd");
                rtfTable.Append(@"\cellx1500" + "Change");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "$" + (total - decimal.Parse(TxtCashOut.Text)).ToString("#.##"));
                rtfTable.Append(@"\intbl\cell\row");

                rtfTable.Append(@"\trowd");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell\row");

                rtfTable.Append(@"\trowd");
                rtfTable.Append(@"\cellx1500" + "Savings");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + "");
                rtfTable.Append(@"\intbl\cell");
                rtfTable.Append(@"\cellx1500" + lblSavings.Text);
                rtfTable.Append(@"\intbl\cell\row");

                rtfTable.Append(@"\pard");
                rtfTable.Append(@"}");

                //trims any trailing occurance of the specified character
                string rtf1 = richTextBoxPrintCtrl1.Rtf.Trim().TrimEnd('}');
                string rtf2 = rtfTable.ToString();

                //Place all text entries in a specified order into the rich text box
                richTextBoxPrintCtrl1.Select(header.ToString().Count(), 0);
                richTextBoxPrintCtrl1.SelectedRtf = rtf2;

                richTextBoxPrintCtrl1.Text += tenderTime + footer;

                richTextBoxPrintCtrl1.BringToFront();

                label1.Text   = "Change";
                TxtTotal.Text = (total - decimal.Parse(TxtCashOut.Text)).ToString("#.##");

                Global.CashInTill += subTotal;
                //Global.CashInTill += total;
                Global.CouponsInTill += coupon * -1;

                tmrReceipt.Enabled = true;
            }
        }