private void BtnSaveAdjustment_Click(object sender, EventArgs e) { try { //Validation for empty fields if (txtProductCode.Text == String.Empty) { WarningIndicator.Visible = true; WarningIndicator.Location = new System.Drawing.Point(418, 116); return; } if (txtQuantity.Text == String.Empty) { WarningIndicator.Visible = true; WarningIndicator.Location = new System.Drawing.Point(418, 60); return; } if (cmbCommand.Text == String.Empty) { WarningIndicator.Visible = true; WarningIndicator.Location = new System.Drawing.Point(418, 101); return; } if (txtRemarks.Text == String.Empty) { WarningIndicator.Visible = true; WarningIndicator.Location = new System.Drawing.Point(418, 167); return; } //Validate the quantity input if (int.Parse(txtQuantity.Text) > _qty) { MessageBox.Show("Stock on Hand Quantity should be greater than Adjustment Quantity.", "Stock Adjustment", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cmbCommand.Text == "Remove from Inventory") { SqlStatement("UPDATE tblProduct SET prodqty = (prodqty - " + int.Parse(txtQuantity.Text) + ") WHERE id like '" + lblID.Text + "'"); } else if (cmbCommand.Text == "Add to Inventory") { SqlStatement("UPDATE tblProduct SET prodqty = (prodqty + " + int.Parse(txtQuantity.Text) + ") WHERE id like '" + lblID.Text + "'"); } string StockDate = DateTime.Now.ToString("dd-MMM-yyyy"); SqlStatement("INSERT INTO tblStockAdjustment (referenceno, prodcode, proddescrip, prodqty, action, remarks, stockdate, stockby) VALUES ('" + txtReferenceNo.Text + "', '" + txtProductCode.Text + "', '" + txtDescription.Text + "', '" + txtQuantity.Text + "', '" + cmbCommand.Text + "', '" + txtRemarks.Text + "', '" + StockDate + "', '" + txtAdjustBy.Text + "')"); MessageBox.Show("Stock Adjustment Process Completely", "Stock Adjustment Success", MessageBoxButtons.OK, MessageBoxIcon.Information); ShowStockAdjustmentInInventory(); AdminInventory inv = new AdminInventory(); inv.ShowInventoryProducts(); Clear(); } catch (Exception ex) { cn.Close(); MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnInventory_Click(object sender, EventArgs e) { if (!AdminAdministrator.Instance.PnlContainer.Controls.ContainsKey("AdminInventory")) { AdminInventory inv = new AdminInventory(); inv.Dock = DockStyle.Fill; AdminAdministrator.Instance.PnlContainer.Controls.Add(inv); inv.ShowInventoryProducts(); } AdminAdministrator.Instance.PnlContainer.Controls["AdminInventory"].BringToFront(); AdminAdministrator.Instance.BackButton.Visible = true; }
private void BtnInventoryFlow_Click(object sender, EventArgs e) { if (!AdminAdministrator.Instance.PnlContainer.Controls.ContainsKey("AdminInventory")) { AdminInventory inv = new AdminInventory(); inv.Dock = DockStyle.Fill; AdminAdministrator.Instance.PnlContainer.Controls.Add(inv); inv.ShowInventoryProducts(); AdminAdministrator admin = new AdminAdministrator(); PassStockUsername = admin.lblUsername.Text; } AdminAdministrator.Instance.PnlContainer.Controls["AdminInventory"].BringToFront(); AdminAdministrator.Instance.BackButton.Visible = true; AdminAdministrator.Instance.BackToReportsButton.Visible = false; }
private void BtnCancel_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to cancel Stocking-In?", "Cancel Stock-In", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearStockIn(); if (!AdminAdministrator.Instance.PnlContainer.Controls.ContainsKey("AdminInventory")) { AdminInventory inv = new AdminInventory(); inv.Dock = DockStyle.Fill; AdminAdministrator.Instance.PnlContainer.Controls.Add(inv); inv.ShowInventoryProducts(); } AdminAdministrator.Instance.PnlContainer.Controls["AdminInventory"].BringToFront(); AdminAdministrator.Instance.BackButton.Visible = true; } else { return; } }