Exemplo n.º 1
0
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     foreach (DataGridViewRow d in dataGridView1.SelectedRows)
     {
         if (d.Cells["confirmName"].Value.ToString() == "อนุมัติ")
         {
             return;
         }
     }
     Transf.TranferCreate c = new TranferCreate(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(), dataGridView1.CurrentRow.Cells["TranferSource"].Value.ToString());
     c.ShowDialog();
     if (c.DialogResult == DialogResult.OK)
     {
         loadGridHd();
     }
 }
Exemplo n.º 2
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     Transf.TranferCreate c = new TranferCreate();
     c.ShowDialog();
     if (c.DialogResult == DialogResult.OK) {
         loadGridHd();
     }
 }
Exemplo n.º 3
0
        public TranferAdd(String type, String id, String tw, String qtyp, String qty,String gid)
        {
            ID = id;
            Type = type;
            InitializeComponent();

            Class.clsDatabase cls = null;
            DataTable dt = null;

            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 + "'";
            try
            {
                String local = "select * from GrStockDetail where GrStockDetailId = " + gid;
                DataRow d = Class.DBConnString.clsDB.QueryDataTable(local).Rows[0];
                if (Class.DBConnString.clsDB.QueryDataTable(local).Rows.Count > 0)
                {
                    cls = new Class.clsDatabase(d["ip"].ToString(), d["db"].ToString(),
                    d["dbuser"].ToString(), d["dbpass"].ToString(), "");
                    dt = cls.QueryDataTable(sql);
                }
                else
                {
                    dt = Class.DBConnString.clsDB.QueryDataTable(sql);
                }
            }
            catch { dt = Class.DBConnString.clsDB.QueryDataTable(sql); }

            DataTable dtNew = dt;

            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;
                TranferCreate f = new TranferCreate();
                f.SetDgvWeightH(tw, dgvWeight, Type);
                txtSale.Text = CellSum(1).ToString();
                txtWeight.Text = CellSum(2).ToString();
            }
            if (Type == "2")
            {
                dgvWeight.ColumnCount = 2;
                TranferCreate f = new TranferCreate();
                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();
            }
        }