private void Gv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridView senderGrid = (DataGridView)sender;

                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                {
                    switch (senderGrid.Columns[e.ColumnIndex].Name)
                    {
                    case "Edit":
                        var frm = new Form_ProductionOrderDetail();
                        frm.poNo            = txtPoNo.Text;
                        frm.productCode     = dtPoItem.Rows[e.RowIndex]["product_code"].ToString();
                        frm.qtyWgh          = Convert.ToDecimal(dtPoItem.Rows[e.RowIndex]["qty_wgh"]);
                        frm.issueUnitMethod = dtPoItem.Rows[e.RowIndex]["issue_unit_method"].ToString();
                        frm.unitCode        = Convert.ToInt16(dtPoItem.Rows[e.RowIndex]["unit_code"]);
                        frm.unitName        = dtPoItem.Rows[e.RowIndex]["unit_name"].ToString();
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            dtPoItem.Rows[e.RowIndex]["product_code"]      = frm.productCode;
                            dtPoItem.Rows[e.RowIndex]["product_name"]      = frm.productName;
                            dtPoItem.Rows[e.RowIndex]["qty_wgh"]           = frm.qtyWgh;
                            dtPoItem.Rows[e.RowIndex]["issue_unit_method"] = frm.issueUnitMethod;
                            dtPoItem.Rows[e.RowIndex]["unit_code"]         = frm.unitCode;
                            dtPoItem.Rows[e.RowIndex]["unit_name"]         = frm.unitName;
                            dtPoItem.AcceptChanges();
                            gv.Refresh();
                        }
                        break;

                    case "Del":
                        dtPoItem.Rows[e.RowIndex].Delete();
                        dtPoItem.AcceptChanges();
                        gv.Refresh();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void BtnAddPoItem_Click(object sender, System.EventArgs e)
        {
            var frm = new Form_ProductionOrderDetail();

            frm.qtyWgh = 0;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                DataRow dr;
                dr = dtPoItem.NewRow();

                dr["seq"]               = 0;
                dr["product_code"]      = frm.productCode;
                dr["product_name"]      = frm.productName;
                dr["qty_wgh"]           = frm.qtyWgh;
                dr["issue_unit_method"] = frm.issueUnitMethod;
                dr["unit_code"]         = frm.unitCode;
                dr["unit_name"]         = frm.unitName;
                dtPoItem.Rows.Add(dr);
                dtPoItem.AcceptChanges();
            }
        }