Esempio n. 1
0
        private void setComponentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NP_Cls.hBOM = new System.Collections.Hashtable();
            NP_Cls.hBOM.Add("BOMCode", this.dgvView["clnBOMCode", this.dgvView.CurrentRow.Index].Value.ToString());
            NP_Cls.hBOM.Add("Qty", Convert.ToDouble(this.dgvView["clnQty", this.dgvView.CurrentRow.Index].Value.ToString()));
            NP_Cls.hBOM.Add("UnitName", this.dgvView["clnUnitName", this.dgvView.CurrentRow.Index].Value.ToString());
            NP_Cls.hBOM.Add("BOMType", this.dgvView["clnBOMType", this.dgvView.CurrentRow.Index].Value.ToString());
            NP_Cls.hBOM.Add("Approve", this.dgvView["clnApprove", this.dgvView.CurrentRow.Index].Value.ToString());
            NP_Cls.hBOM.Add("Material", this.dgvView["clnMaterialCode", this.dgvView.CurrentRow.Index].Value.ToString());

            WMS.BOM.frmBOMNewDetail frm = new frmBOMNewDetail();
            frm.lblSCode.Text   = this.dgvView["clnMaterialCode", this.dgvView.CurrentRow.Index].Value.ToString();
            frm.FormBorderStyle = FormBorderStyle.Sizable; frm.ControlBox = true;
            frm.lblSName.Text   = this.dgvView["clnMaterialName", this.dgvView.CurrentRow.Index].Value.ToString();
            frm.ShowDialog();
            Clear(); DGV(); this.cbMaterial.Select();
        }
Esempio n. 2
0
        private void setComponentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NP_Cls.hBOM = new System.Collections.Hashtable();
            NP_Cls.hBOM.Add("BOMCode", this.dgvView["clnBOMCode", this.dgvView.CurrentRow.Index].Value.ToString());
            NP_Cls.hBOM.Add("Qty", Convert.ToDouble(this.dgvView["clnQty", this.dgvView.CurrentRow.Index].Value.ToString()));
            NP_Cls.hBOM.Add("UnitName", this.dgvView["clnUnitName", this.dgvView.CurrentRow.Index].Value.ToString());
            NP_Cls.hBOM.Add("BOMType", this.dgvView["clnBOMType", this.dgvView.CurrentRow.Index].Value.ToString());
            NP_Cls.hBOM.Add("Approve", this.dgvView["clnApprove", this.dgvView.CurrentRow.Index].Value.ToString());
            NP_Cls.hBOM.Add("Material", this.dgvView["clnMaterialCode", this.dgvView.CurrentRow.Index].Value.ToString());

            WMS.BOM.frmBOMNewDetail frm = new frmBOMNewDetail();
            frm.lblSCode.Text = this.dgvView["clnMaterialCode", this.dgvView.CurrentRow.Index].Value.ToString();
            frm.FormBorderStyle = FormBorderStyle.Sizable; frm.ControlBox = true;
            frm.lblSName.Text = this.dgvView["clnMaterialName", this.dgvView.CurrentRow.Index].Value.ToString();
            frm.ShowDialog();
            Clear(); DGV(); this.cbMaterial.Select();
        }
Esempio n. 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //if (NP.ReqField(this.cbMaterial, "Please enter Material: !!") == false) { return; }
            if ((string.IsNullOrEmpty((this.cbMaterial.Text.Trim()))) || (this.cbMaterial.Text.Trim() == "((( Select Material )))")) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Please enter Material: !!"); this.cbMaterial.Select(); return; }
            if (NP.ReqField(this.cbPlant, "Please enter Plant: !!") == false) { return; }
            if (NP.ReqField(this.cbBOMType, "Please enter B.O.M Type: !!") == false) { return; }
            if (NP.ReqField(this.cbUnit, "Please enter Unit: !!") == false) { return; }
            if (NP.ReqField(this.txtQty, "Please enter Quantity: !!") == false) { return; }

            if (cbMaterial.Text.StartsWith("3"))
            {
                if (!NP.ReqField(this.txtFor, "please enter Formula No : !!")) { return; }
            }
            if (cbMaterial.Text.StartsWith("5") && cbBOMType.Text == "Mix")
            {
                if (!NP.ReqField(this.txtFor, "please enter Formula No : !!")) { return; }
            }
            if (ChkDup())
            {
                NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Material & Plant Duplicated !!"); this.cbMaterial.Select(); return;
            }

            if (NP.MSGB("Do you want to Add BOM Data ?") == DialogResult.Yes)
            {
                oConn = new SqlConnection(NP.ReadFileDB(NP_Cls.PathDB));
                if (oConn.State == ConnectionState.Open) { oConn.Close(); }
                oConn.Open();
                try
                {
                    SqlCommand cmdIns = new SqlCommand();
                   BuildVersion();
                    NP_Cls.SqlInsert = "INSERT INTO t_BOM " +
                      "(MaterialCode, PlantCode, BOMType, UnitCode, Quantity, BOMVersion, UserCreate, DateCreate, FileStatus, Approve, Remark, FormulaNo) " +
            "VALUES     (@MaterialCode,@PlantCode,@BOMType,@UnitCode,@Quantity,@BOMVersion,@UC, GETDATE(),@St,@Appr, @Remark, @FormulaNo)";
                    //cmdIns.Parameters.Add("@BOMCode", SqlDbType.Int).Value = NP_Cls.strBOMCode;
                    cmdIns.Parameters.Add("@MaterialCode", SqlDbType.NVarChar, 15).Value = this.cbMaterial.SelectedValue;
                    cmdIns.Parameters.Add("@PlantCode", SqlDbType.NVarChar, 4).Value = this.cbPlant.SelectedValue;
                    cmdIns.Parameters.Add("@BOMType", SqlDbType.NVarChar, 1).Value = this.cbBOMType.SelectedValue;
                    cmdIns.Parameters.Add("@UnitCode", SqlDbType.NVarChar, 3).Value = this.cbUnit.SelectedValue;
                    cmdIns.Parameters.Add("@Quantity", SqlDbType.Decimal).Value = Convert.ToDouble(this.txtQty.Text.Trim());
                    cmdIns.Parameters.Add("@BOMVersion", SqlDbType.Int).Value = this.strVersion;
                    cmdIns.Parameters.Add("@UC", SqlDbType.NVarChar, 10).Value = NP_Cls.strUsr;
                    cmdIns.Parameters.Add("@St", SqlDbType.NVarChar, 1).Value = "1";
                    cmdIns.Parameters.Add("@Appr", SqlDbType.Bit).Value = 0;
                    cmdIns.Parameters.Add("@Remark", SqlDbType.NVarChar, 200).Value = this.txtRemark.Text.Trim();
                    cmdIns.Parameters.Add("@FormulaNo", SqlDbType.NVarChar, 200).Value = this.txtFor.Text.Trim();
                    cmdIns.Connection = oConn; cmdIns.CommandText = NP_Cls.SqlInsert;
                    cmdIns.ExecuteNonQuery();

                    NP.MSGB(NP_Cls.NPMgsStyle.InfoType, "Add BOM Data Completed !!\n\n Please Add Component for this BOM ..");
                    this.cbUnit.Enabled = true;
                    NP_Cls.hBOM = new System.Collections.Hashtable();
                    NP_Cls.hBOM.Add("BOMCode", ((string)GenBOMCode()));
                    NP_Cls.hBOM.Add("Qty", Convert.ToDouble(this.txtQty.Text.Trim()));
                    NP_Cls.hBOM.Add("UnitName", ((string)this.cbUnit.Text));
                    NP_Cls.hBOM.Add("BOMType", ((string)this.cbBOMType.SelectedValue));
                    NP_Cls.hBOM.Add("Approve", Convert.ToBoolean(false));
                    NP_Cls.hBOM.Add("Material", this.cbMaterial.SelectedValue.ToString());

                    WMS.BOM.frmBOMNewDetail frm = new frmBOMNewDetail();

                    frm.lblSCode.Text = this.cbMaterial.SelectedValue.ToString();
                    frm.lblSName.Text = this.cbMaterial.Text.ToString().Split(':')[1].Trim();

                    frm.ShowDialog();
                    Clear(); DGV(); this.cbMaterial.Select();
                }
                catch (Exception ex)
                {
                    NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Add : " + ex.Message); return;
                }
                finally
                {
                    if (oConn.State == ConnectionState.Open) { oConn.Close(); }
                }
            }
            else
            {
                return;
            }
        }
Esempio n. 4
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if ((string.IsNullOrEmpty((this.cbMaterial.Text.Trim()))) || (this.cbMaterial.Text.Trim() == "((( Select Material )))"))
            {
                NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Please enter Material: !!"); this.cbMaterial.Select(); return;
            }
            if (NP.ReqField(this.cbPlant, "Please enter Plant: !!") == false) { return; }
            if (NP.ReqField(this.cbBOMType, "Please enter B.O.M Type: !!") == false) { return; }
            if (NP.ReqField(this.cbUnit, "Please enter Unit: !!") == false) { return; }
            if (NP.ReqField(this.txtQty, "Please enter Quantity: !!") == false) { return; }
            if (cbMaterial.Text.StartsWith("3"))
            {
                if (!NP.ReqField(this.txtFor, "please enter Formula No : !!")) { return; }
            }
            if (cbMaterial.Text.StartsWith("5") && cbBOMType.Text == "Mix")
            {
                if (!NP.ReqField(this.txtFor, "please enter Formula No : !!")) { return; }
            }
            if (NP.MSGB("Do you want to Edit BOM Data ?") == DialogResult.Yes)
            {
                oConn = new SqlConnection(NP.ReadFileDB(NP_Cls.PathDB));
                if (oConn.State == ConnectionState.Open) { oConn.Close(); }
                oConn.Open(); SqlTransaction Tr; Tr = oConn.BeginTransaction();
                try
                {
                    SqlCommand cmdEdit = new SqlCommand();
                    NP_Cls.sqlUpdate = "UPDATE    t_BOM "+
            "SET BOMType = @BOMType, UnitCode = @UnitCode, Quantity = @Qty, UserChange = @UC, DateChange = GETDATE(), Remark = @Remark, FormulaNo = @FormulaNo " +
            "WHERE     (MaterialCode = @MaterialCode) AND (PlantCode = @PlantCode)";
                    cmdEdit.Parameters.Add("@MaterialCode", SqlDbType.NVarChar, 15).Value = this.cbMaterial.SelectedValue;
                    cmdEdit.Parameters.Add("@PlantCode", SqlDbType.NVarChar, 4).Value = this.cbPlant.SelectedValue;
                    cmdEdit.Parameters.Add("@BOMType", SqlDbType.NVarChar, 1).Value = this.cbBOMType.SelectedValue;
                    cmdEdit.Parameters.Add("@UnitCode", SqlDbType.NVarChar, 3).Value = this.cbUnit.SelectedValue;
                    cmdEdit.Parameters.Add("@Qty", SqlDbType.Decimal).Value = Convert.ToDouble(this.txtQty.Text.Trim());
                    cmdEdit.Parameters.Add("@UC", SqlDbType.NVarChar, 10).Value = NP_Cls.strUsr;
                    cmdEdit.Parameters.Add("@Remark", SqlDbType.NVarChar, 200).Value = this.txtRemark.Text.Trim();
                    cmdEdit.Parameters.Add("@FormulaNo", SqlDbType.NVarChar, 200).Value = this.txtFor.Text.Trim();
                    cmdEdit.Connection = oConn; cmdEdit.CommandText = NP_Cls.sqlUpdate; cmdEdit.Transaction = Tr;
                    cmdEdit.ExecuteNonQuery();

                    // Edit Detail
                    if (!BOMQtyChk(oConn, Tr))
                    {
                        Tr.Commit();
                        if (this.cbBOMType.SelectedValue.ToString().ToUpper() == "M")
                        {
                            NP.MSGB(NP_Cls.NPMgsStyle.InfoType, "Edit BOM Data Completed !!\n\n Please Edit Component for this BOM ..");

                            NP_Cls.hBOM = new System.Collections.Hashtable();
                            NP_Cls.hBOM.Add("BOMCode", ((string)GenBOMCode()));
                            NP_Cls.hBOM.Add("Qty", Convert.ToDouble(this.txtQty.Text.Trim()));
                            NP_Cls.hBOM.Add("UnitName", ((string)this.cbUnit.Text));
                            NP_Cls.hBOM.Add("BOMType", ((string)this.cbBOMType.SelectedValue));
                            NP_Cls.hBOM.Add("Approve", Convert.ToBoolean(this.dgvView["clnApprove", this.dgvView.CurrentRow.Index].ToString()));

                            WMS.BOM.frmBOMNewDetail frm = new frmBOMNewDetail();
                            frm.ShowDialog();
                        }
                        this.btnAdd.Visible = true; this.btnEdit.Visible = false; this.cbMaterial.Enabled = true; this.cbPlant.Enabled = true;
                        this.cbMaterial.Select(); this.cbUnit.Enabled = true;
                        Clear(); DGV(); this.cbMaterial.Select();
                    }
                    else
                    {
                        Tr.Commit();
                        Clear();
                        DGV(); NP.MSGB(NP_Cls.NPMgsStyle.InfoType, "Edit BOM Data Completed !!"); this.cbMaterial.Select(); this.cbPlant.Enabled = true; this.cbUnit.Enabled = true;
                        this.btnAdd.Visible = true; this.btnEdit.Visible = false; this.cbMaterial.Enabled = true; this.cbMaterial.Select();
                    }
                    //
                }
                catch (Exception ex)
                {
                    if (oConn.State == ConnectionState.Open) { Tr.Rollback(); }
                    NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Edit : " + ex.Message); return;
                }
                finally
                {
                    if (oConn.State == ConnectionState.Open) { oConn.Close(); }
                }
            }
            else
            {
                return;
            }
        }
Esempio n. 5
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if ((string.IsNullOrEmpty((this.cbMaterial.Text.Trim()))) || (this.cbMaterial.Text.Trim() == "((( Select Material )))"))
            {
                NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Please enter Material: !!"); this.cbMaterial.Select(); return;
            }
            if (NP.ReqField(this.cbPlant, "Please enter Plant: !!") == false)
            {
                return;
            }
            if (NP.ReqField(this.cbBOMType, "Please enter B.O.M Type: !!") == false)
            {
                return;
            }
            if (NP.ReqField(this.cbUnit, "Please enter Unit: !!") == false)
            {
                return;
            }
            if (NP.ReqField(this.txtQty, "Please enter Quantity: !!") == false)
            {
                return;
            }
            if (cbMaterial.Text.StartsWith("3"))
            {
                if (!NP.ReqField(this.txtFor, "please enter Formula No : !!"))
                {
                    return;
                }
            }
            if (cbMaterial.Text.StartsWith("5") && cbBOMType.Text == "Mix")
            {
                if (!NP.ReqField(this.txtFor, "please enter Formula No : !!"))
                {
                    return;
                }
            }
            if (NP.MSGB("Do you want to Edit BOM Data ?") == DialogResult.Yes)
            {
                oConn = new SqlConnection(NP.ReadFileDB(NP_Cls.PathDB));
                if (oConn.State == ConnectionState.Open)
                {
                    oConn.Close();
                }
                oConn.Open(); SqlTransaction Tr; Tr = oConn.BeginTransaction();
                try
                {
                    SqlCommand cmdEdit = new SqlCommand();
                    NP_Cls.sqlUpdate = "UPDATE    t_BOM " +
                                       "SET BOMType = @BOMType, UnitCode = @UnitCode, Quantity = @Qty, UserChange = @UC, DateChange = GETDATE(), Remark = @Remark, FormulaNo = @FormulaNo " +
                                       "WHERE     (MaterialCode = @MaterialCode) AND (PlantCode = @PlantCode)";
                    cmdEdit.Parameters.Add("@MaterialCode", SqlDbType.NVarChar, 15).Value = this.cbMaterial.SelectedValue;
                    cmdEdit.Parameters.Add("@PlantCode", SqlDbType.NVarChar, 4).Value     = this.cbPlant.SelectedValue;
                    cmdEdit.Parameters.Add("@BOMType", SqlDbType.NVarChar, 1).Value       = this.cbBOMType.SelectedValue;
                    cmdEdit.Parameters.Add("@UnitCode", SqlDbType.NVarChar, 3).Value      = this.cbUnit.SelectedValue;
                    cmdEdit.Parameters.Add("@Qty", SqlDbType.Decimal).Value             = Convert.ToDouble(this.txtQty.Text.Trim());
                    cmdEdit.Parameters.Add("@UC", SqlDbType.NVarChar, 10).Value         = NP_Cls.strUsr;
                    cmdEdit.Parameters.Add("@Remark", SqlDbType.NVarChar, 200).Value    = this.txtRemark.Text.Trim();
                    cmdEdit.Parameters.Add("@FormulaNo", SqlDbType.NVarChar, 200).Value = this.txtFor.Text.Trim();
                    cmdEdit.Connection = oConn; cmdEdit.CommandText = NP_Cls.sqlUpdate; cmdEdit.Transaction = Tr;
                    cmdEdit.ExecuteNonQuery();

                    // Edit Detail
                    if (!BOMQtyChk(oConn, Tr))
                    {
                        Tr.Commit();
                        if (this.cbBOMType.SelectedValue.ToString().ToUpper() == "M")
                        {
                            NP.MSGB(NP_Cls.NPMgsStyle.InfoType, "Edit BOM Data Completed !!\n\n Please Edit Component for this BOM ..");

                            NP_Cls.hBOM = new System.Collections.Hashtable();
                            NP_Cls.hBOM.Add("BOMCode", ((string)GenBOMCode()));
                            NP_Cls.hBOM.Add("Qty", Convert.ToDouble(this.txtQty.Text.Trim()));
                            NP_Cls.hBOM.Add("UnitName", ((string)this.cbUnit.Text));
                            NP_Cls.hBOM.Add("BOMType", ((string)this.cbBOMType.SelectedValue));
                            NP_Cls.hBOM.Add("Approve", Convert.ToBoolean(this.dgvView["clnApprove", this.dgvView.CurrentRow.Index].ToString()));


                            WMS.BOM.frmBOMNewDetail frm = new frmBOMNewDetail();
                            frm.ShowDialog();
                        }
                        this.btnAdd.Visible = true; this.btnEdit.Visible = false; this.cbMaterial.Enabled = true; this.cbPlant.Enabled = true;
                        this.cbMaterial.Select(); this.cbUnit.Enabled = true;
                        Clear(); DGV(); this.cbMaterial.Select();
                    }
                    else
                    {
                        Tr.Commit();
                        Clear();
                        DGV(); NP.MSGB(NP_Cls.NPMgsStyle.InfoType, "Edit BOM Data Completed !!"); this.cbMaterial.Select(); this.cbPlant.Enabled = true; this.cbUnit.Enabled = true;
                        this.btnAdd.Visible = true; this.btnEdit.Visible = false; this.cbMaterial.Enabled = true; this.cbMaterial.Select();
                    }
                    //
                }
                catch (Exception ex)
                {
                    if (oConn.State == ConnectionState.Open)
                    {
                        Tr.Rollback();
                    }
                    NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Edit : " + ex.Message); return;
                }
                finally
                {
                    if (oConn.State == ConnectionState.Open)
                    {
                        oConn.Close();
                    }
                }
            }
            else
            {
                return;
            }
        }
Esempio n. 6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //if (NP.ReqField(this.cbMaterial, "Please enter Material: !!") == false) { return; }
            if ((string.IsNullOrEmpty((this.cbMaterial.Text.Trim()))) || (this.cbMaterial.Text.Trim() == "((( Select Material )))"))
            {
                NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Please enter Material: !!"); this.cbMaterial.Select(); return;
            }
            if (NP.ReqField(this.cbPlant, "Please enter Plant: !!") == false)
            {
                return;
            }
            if (NP.ReqField(this.cbBOMType, "Please enter B.O.M Type: !!") == false)
            {
                return;
            }
            if (NP.ReqField(this.cbUnit, "Please enter Unit: !!") == false)
            {
                return;
            }
            if (NP.ReqField(this.txtQty, "Please enter Quantity: !!") == false)
            {
                return;
            }

            if (cbMaterial.Text.StartsWith("3"))
            {
                if (!NP.ReqField(this.txtFor, "please enter Formula No : !!"))
                {
                    return;
                }
            }
            if (cbMaterial.Text.StartsWith("5") && cbBOMType.Text == "Mix")
            {
                if (!NP.ReqField(this.txtFor, "please enter Formula No : !!"))
                {
                    return;
                }
            }
            if (ChkDup())
            {
                NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Material & Plant Duplicated !!"); this.cbMaterial.Select(); return;
            }

            if (NP.MSGB("Do you want to Add BOM Data ?") == DialogResult.Yes)
            {
                oConn = new SqlConnection(NP.ReadFileDB(NP_Cls.PathDB));
                if (oConn.State == ConnectionState.Open)
                {
                    oConn.Close();
                }
                oConn.Open();
                try
                {
                    SqlCommand cmdIns = new SqlCommand();
                    BuildVersion();
                    NP_Cls.SqlInsert = "INSERT INTO t_BOM " +
                                       "(MaterialCode, PlantCode, BOMType, UnitCode, Quantity, BOMVersion, UserCreate, DateCreate, FileStatus, Approve, Remark, FormulaNo) " +
                                       "VALUES     (@MaterialCode,@PlantCode,@BOMType,@UnitCode,@Quantity,@BOMVersion,@UC, GETDATE(),@St,@Appr, @Remark, @FormulaNo)";
                    //cmdIns.Parameters.Add("@BOMCode", SqlDbType.Int).Value = NP_Cls.strBOMCode;
                    cmdIns.Parameters.Add("@MaterialCode", SqlDbType.NVarChar, 15).Value = this.cbMaterial.SelectedValue;
                    cmdIns.Parameters.Add("@PlantCode", SqlDbType.NVarChar, 4).Value     = this.cbPlant.SelectedValue;
                    cmdIns.Parameters.Add("@BOMType", SqlDbType.NVarChar, 1).Value       = this.cbBOMType.SelectedValue;
                    cmdIns.Parameters.Add("@UnitCode", SqlDbType.NVarChar, 3).Value      = this.cbUnit.SelectedValue;
                    cmdIns.Parameters.Add("@Quantity", SqlDbType.Decimal).Value          = Convert.ToDouble(this.txtQty.Text.Trim());
                    cmdIns.Parameters.Add("@BOMVersion", SqlDbType.Int).Value            = this.strVersion;
                    cmdIns.Parameters.Add("@UC", SqlDbType.NVarChar, 10).Value           = NP_Cls.strUsr;
                    cmdIns.Parameters.Add("@St", SqlDbType.NVarChar, 1).Value            = "1";
                    cmdIns.Parameters.Add("@Appr", SqlDbType.Bit).Value                = 0;
                    cmdIns.Parameters.Add("@Remark", SqlDbType.NVarChar, 200).Value    = this.txtRemark.Text.Trim();
                    cmdIns.Parameters.Add("@FormulaNo", SqlDbType.NVarChar, 200).Value = this.txtFor.Text.Trim();
                    cmdIns.Connection = oConn; cmdIns.CommandText = NP_Cls.SqlInsert;
                    cmdIns.ExecuteNonQuery();

                    NP.MSGB(NP_Cls.NPMgsStyle.InfoType, "Add BOM Data Completed !!\n\n Please Add Component for this BOM ..");
                    this.cbUnit.Enabled = true;
                    NP_Cls.hBOM         = new System.Collections.Hashtable();
                    NP_Cls.hBOM.Add("BOMCode", ((string)GenBOMCode()));
                    NP_Cls.hBOM.Add("Qty", Convert.ToDouble(this.txtQty.Text.Trim()));
                    NP_Cls.hBOM.Add("UnitName", ((string)this.cbUnit.Text));
                    NP_Cls.hBOM.Add("BOMType", ((string)this.cbBOMType.SelectedValue));
                    NP_Cls.hBOM.Add("Approve", Convert.ToBoolean(false));
                    NP_Cls.hBOM.Add("Material", this.cbMaterial.SelectedValue.ToString());

                    WMS.BOM.frmBOMNewDetail frm = new frmBOMNewDetail();

                    frm.lblSCode.Text = this.cbMaterial.SelectedValue.ToString();
                    frm.lblSName.Text = this.cbMaterial.Text.ToString().Split(':')[1].Trim();

                    frm.ShowDialog();
                    Clear(); DGV(); this.cbMaterial.Select();
                }
                catch (Exception ex)
                {
                    NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "Add : " + ex.Message); return;
                }
                finally
                {
                    if (oConn.State == ConnectionState.Open)
                    {
                        oConn.Close();
                    }
                }
            }
            else
            {
                return;
            }
        }