public static void LoadDanhMucSKU() { try { if (CheckFileINVMST()) { try { SplashScreen.SetCommentaryString("Load Danh mục ......."); TPSDataAccess access = new TPSDataAccess(@"C:\WINDOWS\Temp\INVMST.tps"); _tableDMSKU = access.GetDataTable("Select SKU,UPC,DESCRIPTION from INVMST where CONF_PRICE='N' and UPC<>''"); //_tableDMSKU.Columns.Add("GhiChu"); } catch (Exception e) { CTLError.WriteError("GetDMSKU config GetConfiguration", e.Message); } } } catch (Exception e) { CTLError.WriteError("LoadDanhMucSKU config GetConfiguration", e.Message); return; throw; } }
private void button1_Click(object sender, EventArgs e) { TPSDataAccess acces = new TPSDataAccess(@"D:\WinDSS\Data\INVEVT.tps"); DataTable dt = new DataTable(); dt = acces.GetDataTable("Select * from INVEVT where Method=25 and Stop>=108847 and Stop<=109211"); GridDSMa.DataSource = dt; }
private void FrmCheckGia_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { if (txtsku.Text != string.Empty) { string masku = txtsku.Text; if (txtsku.Text.Length <= 7) { masku = "00" + txtsku.Text; } else if (txtsku.Text.Length > 9) { if (txtsku.Text.Length <= 14) { masku = GetSKU(PhatSinhUPC.Substring(0, 18 - txtsku.Text.Length) + txtsku.Text); } else { masku = GetSKU(txtsku.Text); } } TPSDataAccess access = new TPSDataAccess(Path.Combine(Config._pathfileWinDSS, this._pathFileDM)); DataTable dt = access.GetDataTable("Select SKU,Description,Price from INVMST where 1=1" + ((txtsku.Text == string.Empty) ? "" : " and SKU='" + masku + "'")); if (dt.Rows.Count > 0) { _sku = dt.Rows[0]["SKU"].ToString(); labten.Text = dt.Rows[0]["Description"].ToString(); labgia.Text = Convert.ToDecimal(dt.Rows[0]["PRICE"]).ToString("N2") + " VND"; LoadPromo(_sku); } else { _sku = ""; //labten.Text = "_ _"; //labgia.Text = "_ _"; //labslpos.Text = "0"; //labgiapos.Text = "_ _"; //labslKMTL.Text = "0"; //labGiaKMTL.Text = "_ _"; //gridControl1.DataSource = null; } } else { labten.Text = "_ _"; labgia.Text = "_ _"; labslpos.Text = "0"; labgiapos.Text = "_ _"; labslKMTL.Text = "0"; labGiaKMTL.Text = "_ _"; // gridControl1.DataSource = null; return; } } }
private void BTLoadDS_Click(object sender, EventArgs e) { WaitingMsg waitingMsg = new WaitingMsg("Chương trình đang load dữ liệu!", "Please Waiting ......."); try { if (CopyFileINVMST()) { if (_PathFileINVMST == string.Empty) { InfoMessage.HienThi("Thong bao", "Không lấy đữ liệu được ! Vui lòng kiểm tra lại H:\\ hoặc Server 21", "Lay du lieu khong thanh cong", HinhAnhThongBao.THONGTIN, NutThongBao.DONGY); return; } //_PathFileINVMST = @"C:\WINDOWS\Temp\INVMST.tps"; TPSDataAccess access = new TPSDataAccess(_PathFileINVMST); string strsql = string.Format(@"Select SKU,Description,Disc_Flag,0 as Check from INVMST where Disc_Flag='N'"); DataTable dt = new DataTable(); dt = access.GetDataTable(strsql); GrDSPriceSKU.DataSource = null; if (dt != null && dt.Rows.Count > 0) { GrDSPriceSKU.DataSource = dt; repositoryItemCheckEdit2.ValueChecked = 1; repositoryItemCheckEdit2.ValueUnchecked = 0; } } else { InfoMessage.HienThi("Thong bao", "Không lấy đữ liệu được ! Vui lòng kiểm tra lại H:\\ hoặc Server 21", "Lay du lieu khong thanh cong", HinhAnhThongBao.THONGTIN, NutThongBao.DONGY); return; } waitingMsg.Finish(); } catch (Exception exception) { CTLError.WriteError("btLoadData ", exception.Message); waitingMsg.Finish(); return; } }
public bool LoadForm(string sku) { try { TPSDataAccess access = new TPSDataAccess(Path.Combine(Config._pathfileWinDSS, @"INVMST.tps")); DataTable dtinv = access.GetDataTable(string.Format(@"select SKU,PRICE,Description,UPC from INVMST Where SKU='{0}'", sku)); if (dtinv != null && dtinv.Rows.Count > 0) { labsku.Text = dtinv.Rows[0]["SKU"].ToString(); labUPC.Text = dtinv.Rows[0]["UPC"].ToString(); labname.Text = dtinv.Rows[0]["Description"].ToString(); labGiagoc.Text = Convert.ToDecimal(dtinv.Rows[0]["Price"]).ToString("N0"); LoadPromotion(sku); } return(true); } catch (Exception ex) { CTLError.WriteError("FrmThongTinKMOfSKU FrmThongTinKMOfSKU ", ex.Message); return(false); } }
private void BTHienthi_Click(object sender, EventArgs e) { WaitingMsg waitingMsg = new WaitingMsg("Chương trình đang load dữ liệu!", "Please Waiting ......."); try { _tbDSGia.Clear(); copyfile(Config._pathfileWinDSS); //TPSDataAccess access = new TPSDataAccess(Path.Combine(CTLConfig._pathfileWinDSS, "INVMST")); TPSDataAccess access = new TPSDataAccess(_PathFileINVMST); TPSDataAccess accessPathWSS = new TPSDataAccess(Path.Combine(Config._pathfileWinDSS, "SYSMST")); SQLHelper helper = new SQLHelper(true); string MaST = "0"; MaST = accessPathWSS.getMaSieuthi(); _storeName = MaST; helper.AddParameterToSQLCommand("@STR", SqlDbType.NVarChar, 8); helper.SetSQLCommandParameterValue("@STR", MaST); if (MaST == "0") { InfoMessage.HienThi("Khong lay duoc StoreNumber " + MaST + " ", "Vui long lien he voi quan tri", "Loi Get StoreNumber", HinhAnhThongBao.LOI, NutThongBao.DONGY); return; } string strconf = ""; string strsale = ""; string strupc = ""; if (!radConfirAll.Checked) { strconf = " and CONF_PRICE=" + (radconfirYes.Checked ? "'Y'" : "'N'"); helper.AddParameterToSQLCommand("@ISTYPE", SqlDbType.NVarChar, 8); helper.SetSQLCommandParameterValue("@ISTYPE", (radconfirNo.Checked) ? "01" : "CS"); } if (!radsaleAll.Checked) { strsale = " and SELL_UNIT=" + (radsaleEA.Checked ? "'EA'" : "'KG'"); helper.AddParameterToSQLCommand("@ISLUM", SqlDbType.NVarChar, 8); helper.SetSQLCommandParameterValue("@ISLUM", (radsaleKG.Checked) ? radsaleKG.Text : radsaleEA.Text); } if (!radUPCALL.Checked) { strupc = " and UPC<>''"; helper.AddParameterToSQLCommand("@ISUPC", SqlDbType.NVarChar, 8); helper.SetSQLCommandParameterValue("@ISUPC", 1); } DataTable dt = helper.GetDatatableBySP("PRLN_spGetPricebyStore"); string sql = string.Format("Select SKU,Price,Description from INVMST where 1=1 {0}{1}{2} order by SKU", strconf, strsale, strupc); DataTable tbg = access.GetDataTable(sql); int dem = 0; foreach (DataRow dataRow in dt.Rows) { decimal p = Convert.ToDecimal(dataRow["PLNITM"].ToString()); for (int i = dem; i < tbg.Rows.Count; i++) { decimal pMMS = Convert.ToDecimal(tbg.Rows[i]["SKU"].ToString()); if (p == pMMS) { if (Convert.ToDecimal(tbg.Rows[i]["Price"]) != Convert.ToDecimal(dataRow["PLNAMT"].ToString())) { DataRow r = _tbDSGia.NewRow(); r["SKU"] = "00" + dataRow["PLNITM"].ToString(); r["Check"] = false; r["Description"] = tbg.Rows[i]["Description"].ToString(); r["Price"] = Convert.ToDecimal(dataRow["PLNAMT"].ToString()); r["PriceMMS"] = Convert.ToDecimal(tbg.Rows[i]["Price"]); _tbDSGia.Rows.Add(r); } dem = i + 1; break; } else if (pMMS > p) { dem = i; break; } } } GrDSPriceSKU.DataSource = _tbDSGia; waitingMsg.Finish(); } catch (Exception exception) { CTLError.WriteError("btLoadData ", exception.Message); waitingMsg.Finish(); return; throw; } }
private void txtsku_TextChanged_1(object sender, EventArgs e) { if (txtsku.Text == string.Empty) { //labten.Text = "_ _"; //labgia.Text = "_ _"; //labslpos.Text = "0"; //labgiapos.Text = "_ _"; //labslKMTL.Text = "0"; //labGiaKMTL.Text = "_ _"; //gridControl1.DataSource = null; return; } if (txtsku.Text != string.Empty) { string masku = txtsku.Text; if (txtsku.Text.Length <= 7) { masku = "00" + txtsku.Text; } else if (txtsku.Text.Length > 9) { if (txtsku.Text.Length <= 14) { masku = GetSKU(PhatSinhUPC.Substring(0, 18 - txtsku.Text.Length) + txtsku.Text); } else { masku = GetSKU(txtsku.Text); } } try { Image myimg = Code128Rendering.MakeBarcodeImage(masku, 3, true); pictureBox2.Image = myimg; } catch (Exception ex) { MessageBox.Show(this, ex.Message, this.Text); } TPSDataAccess access = new TPSDataAccess(Path.Combine(Config._pathfileWinDSS, this._pathFileDM)); DataTable dt = access.GetDataTable("Select SKU,Description,Price from INVMST where 1=1" + ((txtsku.Text == string.Empty) ? "" : " and SKU='" + masku + "'")); if (dt.Rows.Count > 0) { _sogiay = 60; if (Config._timemer != string.Empty) { _sogiay = Convert.ToInt64(Config._timemer) * 60; } flag = true; labelControl3.Visible = true; labelControl5.Visible = true; labten.Visible = true; labgia.Visible = true; pictureBox2.Visible = true; pictBarcode.Visible = true; labGiaKMTL.Visible = true; labslKMTL.Visible = true; labelControl10.Visible = true; labgiapos.Visible = true; labslpos.Visible = true; labelControl4.Visible = true; labnameItem.Visible = true; labelMa13.Visible = true; labGiaMH.Visible = true; _sku = dt.Rows[0]["SKU"].ToString(); labten.Text = dt.Rows[0]["Description"].ToString(); labgia.Text = Convert.ToDecimal(dt.Rows[0]["PRICE"]).ToString("N2") + " VND"; labnameItem.Text = dt.Rows[0]["Description"].ToString(); //labGiaMH.Text ="Giá Gốc: "+ Convert.ToDecimal(dt.Rows[0]["PRICE"]).ToString("N2"); labelMa13.Text = _sku; LoadPromo(_sku); //txtsku.Clear(); } else { labten.Text = "_ _"; labgia.Text = "_ _"; labslpos.Text = "0"; labgiapos.Text = "_ _"; labslKMTL.Text = "0"; labGiaKMTL.Text = "_ _"; labelControl3.Visible = false; labelControl5.Visible = false; labten.Visible = false; labgia.Visible = false; pictureBox2.Visible = false; pictBarcode.Visible = false; labGiaKMTL.Visible = false; labslKMTL.Visible = false; labelControl10.Visible = false; labgiapos.Visible = false; labslpos.Visible = false; labelControl4.Visible = false; labnameItem.Visible = false; labelMa13.Visible = false; labGiaMH.Visible = false; //gridControl1.DataSource = null; //return; } if (txtsku.Text.Length == 7 || txtsku.Text.Length == 13) { string ma13 = ""; SQLHelper helper = new SQLHelper(); DataTable dtcustommer = helper.InfoCustommer(txtsku.Text); if (dtcustommer != null) { if (dtcustommer.Rows.Count > 0) { ConvertBarCode cv = new ConvertBarCode(); if (Convert.ToInt64(txtsku.Text) > 25000) { ma13 = cv.CreaBarCode(txtsku.Text); } else if (txtsku.Text.Length != 13) { ma13 = cv.CreaBarCodeTV(txtsku.Text); } if (txtsku.Text.Length == 13) { ma13 = txtsku.Text; } Frmkiot frmkiot = new Frmkiot(this, dtcustommer, ma13); frmkiot.rtbarcode += new Frmkiot.ReturnBarcode(retunbarcode); this.OpenDialog(frmkiot); txtsku.Clear(); } } } if (txtsku.Text.Length > 13) { txtsku.Clear(); } } }
private void FrmCheckGia_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5 || e.KeyCode == Keys.Enter) { if (txtsku.Text != string.Empty) { string masku = txtsku.Text; if (txtsku.Text.Length <= 7) { masku = "00" + txtsku.Text; } else if (txtsku.Text.Length > 7) { if (txtsku.Text.Length <= 14) { masku = GetSKU(PhatSinhUPC.Substring(0, 18 - txtsku.Text.Length) + txtsku.Text); } else { masku = GetSKU(txtsku.Text); } } TPSDataAccess access = new TPSDataAccess(Path.Combine(Config._pathfileWinDSS, this._pathFileDM)); DataTable dt = access.GetDataTable("Select SKU,Description,Price,Vendor,Buy_Unit,Sell_Unit from INVMST where 1=1" + ((txtsku.Text == string.Empty) ? "" : " and SKU='" + masku + "'")); if (dt.Rows.Count > 0) { labgiapos.Text = "Không có khuyến mãi tại POS"; //labslKMTL.Text = "0"; labGiaKMTL.Text = "Không có khuyến mãi theo lượng"; _sku = dt.Rows[0]["SKU"].ToString(); labten.Text = dt.Rows[0]["Description"].ToString(); labgia.Text = Convert.ToDecimal(dt.Rows[0]["PRICE"]).ToString("N2"); labelVendor.Text = dt.Rows[0]["Vendor"].ToString(); labelBuyUnit.Text = dt.Rows[0]["Buy_Unit"].ToString(); labelSelunit.Text = dt.Rows[0]["Sell_Unit"].ToString(); LoadPromo(_sku); txtsku.Clear(); return; } else { _sku = ""; labten.Text = "_ _"; labgia.Text = "_ _"; labelSelunit.Text = "_ _"; labelBuyUnit.Text = "_ _"; labelVendor.Text = "_ _"; //labslpos.Text = "0"; labgiapos.Text = "Không có khuyến mãi tại POS"; //labslKMTL.Text = "0"; labGiaKMTL.Text = "Không có khuyến mãi theo lượng"; //panel2.Visible = false; //panel1.Visible = false; gridControl1.DataSource = null; if (_ListLabel.Count > 0) { foreach (LabelControl labelControl in _ListLabel) { labelControl.Dispose(); } } _ListLabel.Clear(); } //if (txtsku.Text.Length == 7 || txtsku.Text.Length == 13) //{ // string ma13 = ""; // SQLHelper helper = new SQLHelper(); // DataTable dtcustommer = helper.InfoCustommer(txtsku.Text); // if (dtcustommer != null) // if (dtcustommer.Rows.Count > 0) // { // ConvertBarCode cv = new ConvertBarCode(); // if (Convert.ToInt64(txtsku.Text) > 25000) // ma13 = cv.CreaBarCode(txtsku.Text); // else if (txtsku.Text.Length != 13) // ma13 = cv.CreaBarCodeTV(txtsku.Text); // if (txtsku.Text.Length == 13) // ma13 = txtsku.Text; // Frmkiot frmkiot = new Frmkiot(this, dtcustommer, ma13); // frmkiot.rtbarcode += new Frmkiot.ReturnBarcode(retunbarcode); // this.OpenDialog(frmkiot); // //txtsku.Clear(); // } //} if (txtsku.Text.Length > 13) { txtsku.Clear(); } } else { labten.Text = "_ _"; labgia.Text = "_ _"; labelSelunit.Text = "_ _"; labelBuyUnit.Text = "_ _"; labelVendor.Text = "_ _"; labgiapos.Text = "Không có khuyến mãi tại POS"; //labslKMTL.Text = "0"; labGiaKMTL.Text = "Không có khuyến mãi theo lượng"; gridControl1.DataSource = null; if (_ListLabel.Count > 0) { foreach (LabelControl labelControl in _ListLabel) { labelControl.Dispose(); } } _ListLabel.Clear(); //panel2.Visible = false; //panel1.Visible = false; txtsku.Clear(); return; } txtsku.Clear(); } }