Beispiel #1
0
 private void StockAdjustments_Load(object sender, EventArgs e)
 {
     stockview();
     Nav_panel.Hide();
     ShowAdjusted_stockPanel.Hide();
     rdo_minus.Checked = true;
 }
Beispiel #2
0
 private void btn_cancel_Click(object sender, EventArgs e)
 {
     Nav_panel.SendToBack();
     Nav_panel.Hide();
     clear();
     StockAdjustments_Load(null, null);
 }
Beispiel #3
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            string username = AdminAccess.username;

            if (txt_qty.Text == "0" || txt_notes.Text == "")
            {
                MessageBox.Show("Input is Wrong.", "Input Error Notice:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (rdo_minus.Checked == true)
            {
                quantityConverter();

                stockonhand = Convert.ToDecimal(lbl_stockonHand.Text) - quantity;
                int m = bls.Decreasestock(category_id, product_id, quantity, 1, cbo_location.Text, cmb_unit.Text);
                if (m > 0)
                {
                    int i           = bsa.InsertAdjustStock(Convert.ToInt32(lbl_stockid.Text), Convert.ToDateTime(today), cmb_unit.Text, Convert.ToDecimal(txt_qty.Text), stockonhand, txt_notes.Text, "Decreased", username);
                    int AddStockLog = bls.createstockLog(category_id, product_id, Convert.ToDecimal(txt_qty.Text), department_id, cbo_location.Text, cmb_unit.Text, Convert.ToDateTime(DateTime.Now.ToString()), "Decrease Adjust");
                    MessageBox.Show("Product Decreased Successfully .", "Decrease Success Alert !!", MessageBoxButtons.OK, MessageBoxIcon.None);
                    Nav_panel.Hide();
                    stockview();
                }
            }
            else if (rdo_plus.Checked == true)
            {
                quantityConverter();
                stockonhand = Convert.ToDecimal(lbl_stockonHand.Text) + quantity;
                int p = bls.createstock(category_id, product_id, quantity, department_id, cbo_location.Text, cmb_unit.Text);
                if (p > 0)
                {
                    int i           = bsa.InsertAdjustStock(Convert.ToInt32(lbl_stockid.Text), Convert.ToDateTime(today), cmb_unit.Text, Convert.ToDecimal(txt_qty.Text), stockonhand, txt_notes.Text, "Added", username);
                    int AddStockLog = bls.createstockLog(category_id, product_id, Convert.ToDecimal(txt_qty.Text), department_id, cbo_location.Text, cmb_unit.Text, Convert.ToDateTime(DateTime.Now.ToString()), "Add Adjust");
                    MessageBox.Show("Product Added Successfully .", "Add Success Alert !!", MessageBoxButtons.OK, MessageBoxIcon.None);
                    Nav_panel.Hide();
                    stockview();
                }
            }
            clear();
        }
Beispiel #4
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dataGridView1.Columns["colAdjust"].Index && e.RowIndex >= 0)
            {
                AdminAccess acc = new AdminAccess();
                acc.ShowDialog();
                user_access_check = AdminAccess.discount_access_value;
                if (user_access_check == true)
                {
                    category_id          = Convert.ToInt32(dataGridView1.CurrentRow.Cells["col_categoryid"].Value.ToString());
                    product_id           = Convert.ToInt32(dataGridView1.CurrentRow.Cells["col_productid"].Value.ToString());
                    department_id        = Convert.ToInt32(dataGridView1.CurrentRow.Cells["col_departmentid"].Value.ToString());
                    lbl_productName.Text = dataGridView1.CurrentRow.Cells["calproduct_name"].Value.ToString();
                    lbl_stockonHand.Text = dataGridView1.CurrentRow.Cells["calquantity"].Value.ToString();
                    lbl_stockid.Text     = dataGridView1.CurrentRow.Cells["calstock_id"].Value.ToString();
                    cbo_location.Text    = dataGridView1.CurrentRow.Cells["col_location"].Value.ToString();
                    lbl_department.Text  = dataGridView1.CurrentRow.Cells["col_department"].Value.ToString();
                    DataTable dt = bls.getproductunit(product_id, category_id);
                    if (dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0]["inhouse_unit_3"].ToString() != "")
                        {
                            lbl_unit.Text = dt.Rows[0]["inhouse_unit_3"].ToString();
                        }
                        else if (dt.Rows[0]["inhouse_unit_2"].ToString() != "")
                        {
                            lbl_unit.Text = dt.Rows[0]["inhouse_unit_2"].ToString();
                        }
                        else
                        {
                            lbl_unit.Text = dt.Rows[0]["inhouse_unit_1"].ToString();
                        }
                    }
                    Nav_panel.BringToFront();
                    Nav_panel.Show();
                }
                else
                {
                    Nav_panel.SendToBack();
                    Nav_panel.Hide();
                    clear();
                    StockAdjustments_Load(null, null);
                }
            }
            if (e.ColumnIndex == dataGridView1.Columns["colviewAdjusts"].Index && e.RowIndex >= 0)
            {
                string    id          = dataGridView1.CurrentRow.Cells["calstock_id"].Value.ToString();
                string    productname = dataGridView1.CurrentRow.Cells["calproduct_name"].Value.ToString();
                DataTable getalldata  = bsa.getallAdStocksbyId(id);
                if (getalldata.Rows.Count > 0)
                {
                    lbl_productnames.Text = productname;
                    dgv_stocks.Rows.Clear();
                    dgv_stocks.ClearSelection();
                    for (int ink = 0; ink < getalldata.Rows.Count; ink++)
                    {
                        dgv_stocks.Rows.Add(getalldata.Rows[ink]["stock_id"].ToString(), productname, getalldata.Rows[ink]["qty"].ToString() + " " + getalldata.Rows[ink]["unit"].ToString(), getalldata.Rows[ink]["unit"].ToString(), Convert.ToDecimal(getalldata.Rows[ink]["stockon_hand"].ToString()), getalldata.Rows[ink]["username"].ToString(), getalldata.Rows[ink]["adjust_date"].ToString(), getalldata.Rows[ink]["status"].ToString());
                    }
                    ShowAdjusted_stockPanel.BringToFront();
                    ShowAdjusted_stockPanel.Show();
                }

                else
                {
                    MessageBox.Show("No Adjustments on Selected Product", "No Adjustments Notice:", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }