private void btnGetListNoPrice_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); TextUtils.LoadModulePriceTPAD("TPAD.B3580", false, out dt); gridControl1.DataSource = dt; }
void loadGrid() { DataTable dt = TextUtils.Select("Select *,0 as Price,0 as TotalPrice,0 as PriceType from vBaiThucHanhModule with(nolock) where BaiThucHanhID = " + BaiThucHanh.ID); foreach (DataRow row in dt.Rows) { string code = row["Code"].ToString(); try { if (code.StartsWith("TPAD.")) { DataTable dtPrice = TextUtils.LoadModulePriceTPAD(code, false); row["Price"] = TextUtils.ToInt(dtPrice.Compute("Sum(TotalPrice)", "")); row["TotalPrice"] = TextUtils.ToInt(row["Qty"]) * TextUtils.ToInt(row["Price"]); row["PriceType"] = TextUtils.ToInt(dtPrice.Rows[0]["PriceType"]); } else { string sql = "select top 1 Price from [Parts] with(nolock) where Replace(PartsCode,' ','') = '" + code.Replace(" ", "") + "'"; DataTable dtPrice = LibQLSX.Select(sql); row["Price"] = TextUtils.ToInt(dtPrice.Rows[0][0]); row["TotalPrice"] = TextUtils.ToInt(row["Qty"]) * TextUtils.ToInt(row["Price"]); row["PriceType"] = 1; } } catch (Exception) { } } grdModule.DataSource = dt; }
void loadGrid() { DataTable dtBaiThucHanhLink = TextUtils.Select("Select * from vProductBaiThucHanhLink where ProductID = " + Product.ID); List <string> listBthID = new List <string>(); foreach (DataRow item in dtBaiThucHanhLink.Rows) { string id = item["BaiThucHanhID"].ToString(); if (!listBthID.Contains(id)) { listBthID.Add(id); } } string ids = string.Join(",", listBthID.ToArray()); DataTable dt = TextUtils.Select("Select *,0 as Price,0 as TotalPrice,0 as PriceType from vBaiThucHanhModule where [BaiThucHanhID] in (" + ids + ")"); foreach (DataRow row in dt.Rows) { string code = row["Code"].ToString(); try { if (code.StartsWith("TPAD.")) { DataTable dtPrice = TextUtils.LoadModulePriceTPAD(code, false); row["Price"] = TextUtils.ToInt(dtPrice.Compute("Sum(TotalPrice)", "")); row["TotalPrice"] = TextUtils.ToInt(row["Qty"]) * TextUtils.ToInt(row["Price"]); row["PriceType"] = TextUtils.ToInt(dtPrice.Rows[0]["PriceType"]); } else { string sql = "select top 1 Price from [Parts] with(nolock) where Replace(PartsCode,' ','') = '" + code.Replace(" ", "") + "'"; DataTable dtPrice = LibQLSX.Select(sql); row["Price"] = TextUtils.ToInt(dtPrice.Rows[0][0]); row["TotalPrice"] = TextUtils.ToInt(row["Qty"]) * TextUtils.ToInt(row["Price"]); row["PriceType"] = 1; } } catch (Exception) { } } grdModule.DataSource = dt; }
private void cboModule_EditValueChanged(object sender, EventArgs e) { string code = grvModule.GetFocusedRowCellValue(colCode).ToString(); string name = grvModule.GetFocusedRowCellValue(colName).ToString(); txtModuleCode.Text = code; txtModuleName.Text = name; using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load giá vật tư...")) { try { DataTable dtPrice = TextUtils.LoadModulePriceTPAD(code, true); txtPriceVT.Text = TextUtils.ToInt(dtPrice.Compute("Sum(TotalPrice)", "")).ToString("n0"); } catch { } } }
private void btnBrowse_Click(object sender, EventArgs e) { string filePath = ""; OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = false; if (ofd.ShowDialog() == DialogResult.OK) { filePath = ofd.FileName; txtDMVTPath.Text = filePath; } else { return; } using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load giá vật tư...")) { grdData.DataSource = TextUtils.LoadModulePriceTPAD(filePath); } }
private void frmModulePrice_Load(object sender, EventArgs e) { GridLocalizer.Active = new MyGridLocalizer(); //loadCostGroup(); ProductCode = Module.Code; this.Text += ": " + Module.Code; using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load giá vật tư...")) { if (Module.Code.StartsWith("TPAD")) { grdData.DataSource = TextUtils.LoadModulePriceTPAD(Module.Code, true); } else { grdData.DataSource = TextUtils.LoadModulePricePCB(Module.Code); } } txtTotal.EditValue = TextUtils.ToDecimal(colMaTotalPrice.SummaryItem.SummaryValue); }