示例#1
0
        private void checkType(String type, Color c, String price, String dpu, String d, String p, String s, String QuantityMax)
        {
            String id = dataGridView1.CurrentRow.Cells[15].Value.ToString();
            String tw = dataGridView1.CurrentRow.Cells[16].Value.ToString();
            String dist = dataGridView1.CurrentRow.Cells[9].Value.ToString();
            String proname = dataGridView1.CurrentRow.Cells[1].Value.ToString();
            String us = dataGridView1.CurrentRow.Cells[5].Value.ToString();
            String up = dataGridView1.CurrentRow.Cells[3].Value.ToString();
            String t = "0";
            String proid = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            String strQuantityMax = QuantityMax;
            SalePosNew.DialogAddRe FrmAddReq = new SalePosNew.DialogAddRe(textBox1.Text, price, id, type, tw, d, p, s, proid, dpu, dist, t, proname, us, up, QuantityMax, "Edit unit price only");
            FrmAddReq.ShowDialog();
            if (FrmAddReq.DialogResult == DialogResult.Yes)
            {
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells[0].Value.ToString() == proid)
                    {
                        row.Cells[2].Value = "";
                        row.Cells[2].Value = Convert.ToDouble(FrmAddReq.txtPack.Text).ToString("#,##0.00");
                        row.Cells[4].Value = "";
                        row.Cells[4].Value = Convert.ToDouble(FrmAddReq.txtSale.Text).ToString("#,##0.00");
                        row.Cells[6].Value = "";
                        row.Cells[6].Value = Convert.ToDouble(FrmAddReq.txtWeight.Text).ToString("#,##0.00");
                        row.Cells[7].Value = "";
                        row.Cells[7].Value = Convert.ToDouble(FrmAddReq.txtPrice.Text).ToString("#,##0.00");
                        row.Cells[8].Value = "";
                        row.Cells[8].Value = (Convert.ToDouble(FrmAddReq.txtSale.Text) * Convert.ToDouble(FrmAddReq.txtPrice.Text)).ToString("#,##0.00");
                        row.Cells[10].Value = "";
                        row.Cells[10].Value = Convert.ToDouble(FrmAddReq.DisperUnit.Text).ToString("#,##0.00");
                        row.Cells[9].Value = "";
                        row.Cells[9].Value = FrmAddReq.TxtPerDiscount.Text;
                        row.Cells[11].Value = "";
                        row.Cells[11].Value = Convert.ToDouble(FrmAddReq.TxtDiscount.Text).ToString("#,##0.00");
                        row.Cells[12].Value = "";
                        row.Cells[12].Value = ((Convert.ToDouble(FrmAddReq.txtSale.Text) * Convert.ToDouble(FrmAddReq.txtPrice.Text)) - Convert.ToDouble(FrmAddReq.TxtDiscount.Text)).ToString("#,##0.00");
                        row.Cells[13].Value = "";
                        row.Cells[13].Value = (Convert.ToDouble(FrmAddReq.txtTotal.Text) / Convert.ToDouble(FrmAddReq.txtSale.Text)).ToString("#,##0.00");
                        row.Cells[14].Value = "";
                        row.Cells[14].Value = Convert.ToDouble(FrmAddReq.txtTotal.Text).ToString("#,##0.00");
                        row.Cells[16].Value = "";
                        row.Cells[16].Value = "";
                        row.Cells[17].Value = type;

                        foreach (DataGridViewRow roww in FrmAddReq.dgvWeight.Rows)
                        {
                            foreach (DataGridViewCell cell in roww.Cells)
                            {
                                if (roww.Index < FrmAddReq.dgvWeight.RowCount - 1)
                                    if (!cell.Size.IsEmpty) row.Cells[16].Value += cell.Value + "#";
                            }
                        }
                        Class.Function.SetDgvWeightFnc(row.Cells[16].Value.ToString(), dataGridView2, type);
                        var x = lProidOld.Where(a => a.ProductId == proid).FirstOrDefault();
                        //try
                        //{

                            x.QuantityPack = row.Cells[2].Value.ToString();
                            x.Quantity = row.Cells[4].Value.ToString();
                            x.Weight = row.Cells[6].Value.ToString();
                            x.price = row.Cells[7].Value.ToString();
                            x.type = row.Cells[17].Value.ToString();
                            x.total = row.Cells[14].Value.ToString();
                            x.distext = row.Cells[9].Value.ToString();
                            x.disper = row.Cells[10].Value.ToString();
                            x.dis = row.Cells[11].Value.ToString();
                            x.Detail = row.Cells[16].Value.ToString();
                       // }
                        //catch { }

                    }
                    setCalulate();
                }
            }
        }
示例#2
0
        /*ตรวจสอบประเภทของน้ำหนักสินค้า และรับจำนวนสินค้าจาก Dialog*/
        private void checkType(String type, String price, String dpu, String d, String p, String s,String QuantityMax,String dist)
        {
            String id = dataGridView1.CurrentRow.Cells["sid"].Value.ToString();
            String tw = dataGridView1.CurrentRow.Cells["dt"].Value.ToString();
            //String dist = dataGridView1.CurrentRow.Cells[9].Value.ToString();
            //String distper = dataGridView1.CurrentRow.Cells[10].Value.ToString();
            String proname = dataGridView1.CurrentRow.Cells["proname"].Value.ToString();
            String us = dataGridView1.CurrentRow.Cells["us"].Value.ToString();
            String up = dataGridView1.CurrentRow.Cells["up"].Value.ToString();
            String t = type;
            String proid = dataGridView1.CurrentRow.Cells["proid"].Value.ToString();
            String strQuantityMax = QuantityMax;
            SalePosNew.DialogAddRe FrmAddReq = new SalePosNew.DialogAddRe(textBox1.Text, price,id, type, tw, d, p, s, proid, dpu, dist, t, proname, us, up,QuantityMax,"");
            FrmAddReq.ShowDialog();
            if (FrmAddReq.DialogResult == DialogResult.Yes)
            {
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells["proid"].Value.ToString() == proid)
                    {
                        row.Cells["qtyp"].Value = "";
                        row.Cells["qtyp"].Value = Convert.ToDouble(FrmAddReq.txtPack.Text).ToString("#,##0.00");
                        row.Cells["qty"].Value = "";
                        row.Cells["qty"].Value = Convert.ToDouble(FrmAddReq.txtSale.Text).ToString("#,##0.00");
                        row.Cells["w"].Value = "";
                        row.Cells["w"].Value = Convert.ToDouble(FrmAddReq.txtWeight.Text).ToString("#,##0.00");
                        row.Cells["ppu"].Value = "";
                        row.Cells["ppu"].Value = Convert.ToDouble(FrmAddReq.txtPrice.Text).ToString("#,##0.00");
                        row.Cells["p"].Value = "";
                        row.Cells["p"].Value = (Convert.ToDouble(FrmAddReq.txtSale.Text) * Convert.ToDouble(FrmAddReq.txtPrice.Text)).ToString("#,##0.00");
                        row.Cells["du"].Value = "";
                        row.Cells["du"].Value = Convert.ToDouble(FrmAddReq.DisperUnit.Text).ToString("#,##0.00");
                        row.Cells["dp"].Value = "";
                        row.Cells["dp"].Value = FrmAddReq.TxtPerDiscount.Text;
                        row.Cells["d"].Value = "";
                        row.Cells["d"].Value = Convert.ToDouble(FrmAddReq.TxtDiscount.Text).ToString("#,##0.00");
                        row.Cells["pd"].Value = "";
                        row.Cells["pd"].Value = ((Convert.ToDouble(FrmAddReq.txtSale.Text) * Convert.ToDouble(FrmAddReq.txtPrice.Text)) - Convert.ToDouble(FrmAddReq.TxtDiscount.Text)).ToString("#,##0.00");
                        row.Cells["ppus"].Value = "";
                        row.Cells["ppus"].Value = (Convert.ToDouble(FrmAddReq.txtTotal.Text) / Convert.ToDouble(FrmAddReq.txtSale.Text)).ToString("#,##0.00");
                        row.Cells["ps"].Value = "";
                        row.Cells["ps"].Value = Convert.ToDouble(FrmAddReq.txtTotal.Text).ToString("#,##0.00");
                        row.Cells["dt"].Value = "";
                        row.Cells["t"].Value = type;
                        row.Cells["receive"].Value = "";
                        row.Cells["receive"].Value = Convert.ToDouble(FrmAddReq.textBox1.Text).ToString("#,##0.00");

                        foreach (DataGridViewRow roww in FrmAddReq.dgvWeight.Rows)
                        {
                            foreach (DataGridViewCell cell in roww.Cells)
                            {
                                if (roww.Index < FrmAddReq.dgvWeight.RowCount - 1)
                                    if (!cell.Size.IsEmpty) row.Cells["dt"].Value += cell.Value + "#";
                            }
                        }
                        Class.Function.SetDgvWeightFnc(row.Cells["dt"].Value.ToString(), dataGridView2, type);
                        var x = lProidOld.Where(a => a.ProductId == proid).FirstOrDefault();
                        try
                        {
                            x.QuantityPack = row.Cells["qtyp"].Value.ToString();
                            x.Quantity = row.Cells["qty"].Value.ToString();
                            x.Weight = row.Cells["w"].Value.ToString();
                            x.price = row.Cells["ppu"].Value.ToString();
                            x.type = row.Cells["t"].Value.ToString();
                            x.total = row.Cells["ps"].Value.ToString();
                            x.distext = row.Cells["dp"].Value.ToString();
                            x.disper = row.Cells["du"].Value.ToString();
                            x.dis = row.Cells["d"].Value.ToString();
                            x.Detail = row.Cells["dt"].Value.ToString();
                            x.receive = row.Cells["receive"].Value.ToString();
                        }
                        catch { }

                    }
                    setCalulate();
                }
            }
        }