Beispiel #1
0
        void conclusion()
        {
            // End the transaction
            concludeTransaction = true;
            toggleEncoding(false);

            Inventory inventory = null;

            foreach (ProductInvoice item in carts)
            {
                dbController.insertProductInvoice(item);
                inventory = new Inventory()
                {
                    Barcode     = item.product.Barcode,
                    QtyReceived = 0,
                    QtyOnHand   = -item.QuantitySold,
                };
                dbController.pullInventory(inventory);
                dbController.checkProductCriticalLevel(item.product);
            }

            // audit
            string message = string.Format("completed a transaction: {0}", lblTransactionno.Text);

            dbController.insertAuditTrail(message);
            masterController.clientClock();
        }
Beispiel #2
0
        public void fillgdInventory()
        {
            inventoryTable = new DataTable();
            if (rbInventory.Checked)
            {
                dbController.readInventory(inventoryTable);
            }
            else if (rbPurchased.Checked)
            {
                dbController.readPurchasedProduct(inventoryTable);
            }

            dgInventory.DataSource = inventoryTable;
            dgInventory.ColumnHeadersDefaultCellStyle.Font = new Font("Arial", 10, FontStyle.Bold);
            dgInventory.Focus();

            if (rbInventory.Checked)
            {
                colorCodedRows();
            }
            else if (rbPurchased.Checked)
            {
                highlightQtySoldCells();
            }

            string product_name;

            foreach (DataGridViewRow row in dgInventory.Rows)
            {
                product_name = (string)row.Cells[PRODUCT_NAME_INDEX].Value;
                Product product = dbController.getProductThroughName(product_name);
                if (rbInventory.Checked && mainTab.SelectedTab == tabPage1)
                {
                    dbController.checkProductCriticalLevel(product);
                }
            }
        }