Exemple #1
0
        // Calculates the transaction and displays the amount of change.
        public void finalize(decimal tendered, transactionScreen form)
        {
            decimal change;                     // Stores the amount of change to be given

            change = tendered - totals.total;   // Calculated change

            // If change is negative, throw an error indicating invalid tendered ammount (tendered < total)
            if (change < 0.00M)
            {
                throw new System.ArgumentException("Invalid Tendered Ammount");
            }

            // Set/display change and update the form upon completion of transaction
            form.changeTitleLabel.Visible  = true;
            form.changeLabel.Text          = change.ToString("c");
            form.amountTenderedBox.Enabled = false;
            form.finalizeButton.Enabled    = false;
            form.skuBox.ResetText();
            form.skuBox.Enabled = false;

            // Decrement quantities in database
            for (int i = 0; i < numOfItems; i++)
            {
                form.inventoryTableAdapter.DecreaseQuantity(this.items[i]);
            }
        }
Exemple #2
0
 // Opens up the window to deal with transactions on button click.
 private void transactionButton_Click(object sender, EventArgs e)
 {
     Hide();
     transactionScreen window = new transactionScreen();
     window.ShowDialog();
     Show();
 }
Exemple #3
0
        // Opens up the window to deal with transactions on button click.
        private void transactionButton_Click(object sender, EventArgs e)
        {
            Hide();
            transactionScreen window = new transactionScreen();

            window.ShowDialog();
            Show();
        }
Exemple #4
0
        // Adds items to the transaction and increases the item count
        public int AddItem(int sku, transactionScreen form)
        {
            // Attempt to find and fill the table with the SKU
            int returnValue = form.inventoryTableAdapter.FillBySKU(form.pOSDataSet.Inventory, sku);

            // Check if an item was returned, and that the quantity is less than or equal to 0, and display the row in red
            if (returnValue != 0 && form.inventoryTableAdapter.GetQuantity(sku) <= 0)
                form.inventoryDataGridView.Rows[numOfItems].DefaultCellStyle.BackColor = Color.Red;

            // Clear selection of the view upon entry of a sku
            form.inventoryDataGridView.ClearSelection();

            // If an item was returned, increase number of items
            if (returnValue != 0)
            {
                this.items[numOfItems] = sku;
                this.numOfItems++;
            }

            // Return number of items
            return this.numOfItems;
        }
Exemple #5
0
        // Calculates the transaction and displays the amount of change.
        public void finalize(decimal tendered, transactionScreen form)
        {
            decimal change;                     // Stores the amount of change to be given
            change = tendered - totals.total;   // Calculated change

            // If change is negative, throw an error indicating invalid tendered ammount (tendered < total)
            if (change < 0.00M)
                throw new System.ArgumentException("Invalid Tendered Ammount");

            // Set/display change and update the form upon completion of transaction
            form.changeTitleLabel.Visible = true;
            form.changeLabel.Text = change.ToString("c");
            form.amountTenderedBox.Enabled = false;
            form.finalizeButton.Enabled = false;
            form.skuBox.ResetText();
            form.skuBox.Enabled = false;

            // Decrement quantities in database
            for (int i = 0; i < numOfItems; i++)
            {
                form.inventoryTableAdapter.DecreaseQuantity(this.items[i]);
            }
        }
Exemple #6
0
        // Adds items to the transaction and increases the item count
        public int AddItem(int sku, transactionScreen form)
        {
            // Attempt to find and fill the table with the SKU
            int returnValue = form.inventoryTableAdapter.FillBySKU(form.pOSDataSet.Inventory, sku);

            // Check if an item was returned, and that the quantity is less than or equal to 0, and display the row in red
            if (returnValue != 0 && form.inventoryTableAdapter.GetQuantity(sku) <= 0)
            {
                form.inventoryDataGridView.Rows[numOfItems].DefaultCellStyle.BackColor = Color.Red;
            }

            // Clear selection of the view upon entry of a sku
            form.inventoryDataGridView.ClearSelection();

            // If an item was returned, increase number of items
            if (returnValue != 0)
            {
                this.items[numOfItems] = sku;
                this.numOfItems++;
            }

            // Return number of items
            return(this.numOfItems);
        }
Exemple #7
0
 // Updates the total and the labels during the transaction.
 public void UpdateTotals(decimal price, transactionScreen form)
 {
     totals.UpdateTotal(price);
     totals.UpdateTotalLabels(form);
 }
Exemple #8
0
 // Updates total labels
 public void UpdateTotalLabels(transactionScreen form)
 {
     form.subtotalLabel.Text = this.subtotal.ToString("c");
     form.taxLabel.Text      = this.tax.ToString("c");
     form.totalLabel.Text    = this.total.ToString("c");
 }
Exemple #9
0
 // Updates the total and the labels during the transaction.
 public void UpdateTotals(decimal price, transactionScreen form)
 {
     totals.UpdateTotal(price);
     totals.UpdateTotalLabels(form);
 }
Exemple #10
0
 // Updates total labels
 public void UpdateTotalLabels(transactionScreen form)
 {
     form.subtotalLabel.Text = this.subtotal.ToString("c");
     form.taxLabel.Text = this.tax.ToString("c");
     form.totalLabel.Text = this.total.ToString("c");
 }