Esempio n. 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (cashDrawer == null)
            {
                MessageBox.Show("You must have a total for your drawer before you can remove from your drawer");
            }
            else
            {
                double amountToRemove = 0;

                if (double.TryParse(txtRemoveMoney.Text, out amountToRemove))
                {
                    if (amountToRemove < cashDrawer.Amount)
                    {
                        CashDrawerChangeReason reasonForm = new CashDrawerChangeReason();
                        reasonForm.ShowDialog();

                        cashDrawer.ReasonForChange = reasonForm.ReasonForChange;

                        cashDrawer.Amount = cashDrawer.Amount - amountToRemove;
                        xmlData.Update(cashDrawer, XmlData.Tables.CashRegisterDrawer);

                        cashDrawer.Description = amountToRemove.ToString("C") + " Removed from drawer";
                    }
                    else
                    {
                        MessageBox.Show("You can not remove more than what is in the drawer");
                    }
                }
                else
                {
                    MessageBox.Show("You must enter a valid amount to remove");
                }
            }

            Common common = new Common(Application.StartupPath);

            common.WriteToLog("CashDrawerHistory", cashDrawer);

            this.Close();
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cashDrawer == null)
            {
                cashDrawer             = new VoodooPOS.objects.CashRegisterDrawer();
                cashDrawer.Amount      = double.Parse(txtCurrentAmount.Text);
                cashDrawer.Description = "Cart File didn't exist.  Cart Created";

                CashDrawerChangeReason reasonForm = new CashDrawerChangeReason();
                reasonForm.ShowDialog();

                cashDrawer.ReasonForChange = reasonForm.ReasonForChange;

                xmlData.Insert(cashDrawer, XmlData.Tables.CashRegisterDrawer);
            }
            else
            {
                double origAmount = cashDrawer.Amount;

                cashDrawer.Amount = double.Parse(txtCurrentAmount.Text);

                CashDrawerChangeReason reasonForm = new CashDrawerChangeReason();
                reasonForm.ShowDialog();

                cashDrawer.ReasonForChange = reasonForm.ReasonForChange;

                xmlData.Update(cashDrawer, XmlData.Tables.CashRegisterDrawer);

                cashDrawer.Description = "Drawer amount changed manually from " + origAmount.ToString("C") + " to " + cashDrawer.Amount.ToString("C");
            }

            Common common = new Common(Application.StartupPath);

            common.WriteToLog("CashDrawerHistory", cashDrawer);

            this.Close();
        }