Exemple #1
0
        /// <summary>
        /// calculates the customer's change (total amount - customer payment),
        /// this will determine whether or not the cashier can proceed to the next form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CalculateButton_Click(object sender, EventArgs e)
        {
            GlobalUtilities.setCashPayment(cashTextBox.Text);
            GlobalUtilities.setCreditPayment(creditTextBox.Text);
            GlobalUtilities.setDebitPayment(debitTextBox.Text);
            GlobalUtilities.setCheckPayment(checkTextBox.Text);
            GlobalUtilities.setSalaryDeductionPayment(salaryDeductionTextBox.Text);
            GlobalUtilities.setTotalCustomerPayment();
            GlobalUtilities.setTotalChange();

            changeTextBox.Text = String.Format("{0:n}", GlobalUtilities.getTotalChange());
            totalCustomerPaymentTextBox.Text = String.Format("{0:n}", (Double.Parse(GlobalUtilities.getCashPayment()) + Double.Parse(GlobalUtilities.getCreditPayment()) + Double.Parse(GlobalUtilities.getDebitPayment())
                                                                       + Double.Parse(GlobalUtilities.getCheckPayment()) + Double.Parse(GlobalUtilities.getSalaryDeductionPayment())).ToString());

            if (Double.Parse(GlobalUtilities.getTotalChange()) >= 0)
            {
                proceedButton.Enabled = true;
            }
            else
            {
                proceedButton.Enabled = false;
            }
        }