Beispiel #1
0
        private void btnAddModule_Click(object sender, EventArgs e)
        {
            frmListModules frm = new frmListModules();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                foreach (DataRow row in frm.dtSeleted.Rows)
                {
                    DataRow[] rows = dtModule.Select("Code = '" + row["Code"].ToString() + "'");
                    if (rows.Count() > 0)
                    {
                        continue;
                    }

                    DataRow dr = dtModule.NewRow();
                    dr["ID"]        = 0;
                    dr["ProductID"] = Product.ID;
                    dr["Code"]      = row["Code"].ToString();
                    dr["Name"]      = row["Name"].ToString();
                    dr["Qty"]       = 1;
                    dr["Hang"]      = row["Hang"].ToString();
                    dr["Type"]      = 0;
                    dr["CVersion"]  = row["CVersion"].ToString();
                    dr["NVersion"]  = row["NVersion"].ToString();
                    dtModule.Rows.Add(dr);
                }

                grdModule.DataSource = dtModule;
            }
        }
Beispiel #2
0
        private void btnAddModule_Click(object sender, EventArgs e)
        {
            frmListModules frm = new frmListModules();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang thêm module..."))
                {
                    foreach (DataRow r in frm.dtSeleted.Rows)
                    {
                        string code = TextUtils.ToString(r["Code"]);
                        if (code == "")
                        {
                            continue;
                        }
                        DataRow[] drs = _dtDMVT.Select("Code = '" + code + "'");
                        if (drs.Length > 0)
                        {
                            continue;
                        }

                        decimal price = TextUtils.GetPrice(code, true);

                        DataRow dr = _dtDMVT.NewRow();
                        dr["Code"]       = TextUtils.ToString(r["Code"]);
                        dr["Name"]       = TextUtils.ToString(r["Name"]);
                        dr["Hang"]       = TextUtils.ToString(r["Hang"]);
                        dr["Unit"]       = "Bộ";
                        dr["Price"]      = price;
                        dr["TotalPrice"] = price;
                        dr["Qty"]        = 1;
                        dr["SolutionID"] = TextUtils.ToInt(Solution.ID);
                        _dtDMVT.Rows.Add(dr);
                    }
                }
            }
        }
Beispiel #3
0
        private void btnAddModule_Click(object sender, EventArgs e)
        {
            frmListModules frm = new frmListModules();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang thêm module..."))
                {
                    foreach (DataRow r in frm.dtSeleted.Rows)
                    {
                        string code = TextUtils.ToString(r["Code"]);
                        if (code == "")
                        {
                            continue;
                        }
                        DataRow[] drs = _dtVT.Select("Code = '" + code + "'");
                        if (drs.Length > 0)
                        {
                            continue;
                        }

                        decimal price = TextUtils.GetPrice(code, true);

                        int deliveryTime = -1;
                        if (code.StartsWith("PCB."))
                        {
                            //string sqlM = "SELECT top 1 * FROM  vGetPriceOfPart with(nolock)"
                            //        + " WHERE Price > 1 AND replace(replace([PartsCode],'/','#'),')','#') = '"
                            //        + "TPAT." + code.Substring(4, 7) + "'"
                            //        + " ORDER BY DateAboutF DESC";
                            //DataTable dtPrice = LibQLSX.Select(sqlM);

                            string    sqlM    = "exec spGetPriceOfPart 'TPAT." + code.Substring(4, 7) + "'";
                            DataTable dtPrice = LibQLSX.Select(sqlM);

                            deliveryTime = TextUtils.ToInt(dtPrice.Rows[0]["DeliveryTime"]);
                        }

                        DataRow dr = _dtVT.NewRow();
                        dr["Code"]  = TextUtils.ToString(r["Code"]);
                        dr["Name"]  = TextUtils.ToString(r["Name"]);
                        dr["Hang"]  = TextUtils.ToString(r["Hang"]);
                        dr["Unit"]  = "Bộ";
                        dr["Price"] = price.ToString("n0");
                        dr["Total"] = price.ToString("n0");
                        dr["Qty"]   = 1;

                        if (deliveryTime != -1)
                        {
                            dr["Time"] = deliveryTime;

                            DateTime dateP       = TextUtils.ToDate1(txtDateP.Text);
                            int      dateCurrent = TextUtils.ToInt(dr["Time"]);
                            if (dateCurrent < 0)
                            {
                                dr["Status"] = "Không đạt";
                            }
                            else
                            {
                                DateTime dateVT = DateTime.Now.AddDays(dateCurrent);
                                if (dateVT.Date <= dateP.Date)
                                {
                                    dr["Status"] = "Đạt";
                                }
                                else
                                {
                                    dr["Status"] = "Không đạt";
                                }
                            }
                        }

                        _dtVT.Rows.Add(dr);
                    }

                    txtTotalM.Text = TextUtils.ToDecimal(colMaTotal.SummaryItem.SummaryValue).ToString("n0");
                }
            }
        }