public frmAddReq(String type,String id,String tw,String qtyp,String qty) { ID = id; Type = type; InitializeComponent(); String sql = "select p.productid,p.productname,u.unitpackname,us.unitsalename from product p left join unitpack u on p.unitpackid = u.unitpackid " + "left join unitsale us on p.unitsaleid = us.unitsaleid where p.productid = '" + id + "'"; DataTable dtNew = Class.DBConnString.clsDB.QueryDataTable(sql); foreach (DataRow row in dtNew.Rows) { TxtProductId.Text = row["ProductId"].ToString(); TxtProductName.Text = row["ProductName"].ToString(); lblSale1.Text = row["UnitSaleName"].ToString(); lblPack.Text = row["UnitPackName"].ToString(); } this.Text = "หน้าจอเพิ่มรายการเบิกขายสินค้า"; if (Type == "1") { dgvWeight.ColumnCount = 3; RequisitionNew f = new RequisitionNew(); f.SetDgvWeightH(tw, dgvWeight, Type); txtSale.Text = CellSum(1).ToString(); txtWeight.Text = CellSum(2).ToString(); } if (Type == "2") { dgvWeight.ColumnCount = 2; RequisitionNew f = new RequisitionNew(); f.SetDgvWeightH(tw, dgvWeight, Type); txtSale.Text = CellSum(1).ToString(); txtWeight.Text = "0"; } if (Type == "3") { dgvWeight.ColumnCount = 2; txtPack.Text = qtyp; txtSale.Text = qty; dgvWeight.Visible = false; txtPack.Enabled = true; txtPack.BackColor = Color.White; txtSale.Enabled = true; txtSale.BackColor = Color.White; btnAdd.Enabled = false; btnDel.Enabled = false; txtRunPack.Enabled = false; txtWeight.Text = "0"; txtPack.Focus(); txtPack.SelectAll(); } }
private void toolStripButton1_Click(object sender, EventArgs e) { Requisition.RequisitionNew frm = new RequisitionNew(); frm.Show(); }