private void Txt_GoodsId_EditValueChanged(object sender, EventArgs e) { string str = this.Txt_ExpID.Text.Trim(); string str2 = this.Txt_GoodsId.Text.Trim(); if (str2 != string.Empty) { this.oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT A.goods_id, A.full_name, A.packunit, A.piceunit, B.lastimppr, B.wsprice FROM tblGoods AS A INNER JOIN tblPrice AS B ON A.goods_id = B.goods_id where A.goods_id = '" + str2 + "'", this.oleDbConnection_0); DataSet dataSet = new DataSet(); this.oleDbDataAdapter_0.Fill(dataSet); this.oleDbConnection_0.Close(); if (dataSet.Tables[0].Rows.Count != 0) { this.Lbl_MercName.Text = dataSet.Tables[0].Rows[0]["full_name"].ToString(); this.Cmb_Unit.Properties.Items.Add(dataSet.Tables[0].Rows[0]["piceunit"].ToString()); this.Cmb_Unit.Properties.Items.Add(dataSet.Tables[0].Rows[0]["piceunit"].ToString()); this.Cmb_Unit.SelectedIndex = 0; Class6 class2 = new Class6(); this.Txt_EndQty.EditValue = class2.method_21(str2, str); this.Txt_Price.EditValue = class2.method_16(str, str2); this.Txt_Qty.Text = "1"; this.Txt_GoodsId.Focus(); } else { this.Lbl_MercName.Text = string.Empty; this.Txt_Price.EditValue = 0; } } }
private void method_3() { this.Txt_Barcode.Text.Trim(); double num = 1.0; string str = this.Txt_Barcode.Text.Trim(); double num2 = Class7.ParseDoubleValue(this.Txt_Rtprice.Text); string str2 = this.Lbl_MercName.Text.Trim(); string str3 = this.Txt_Unit.Text.Trim(); Class6 class2 = new Class6(); if (!class2.method_22() && (class2.method_21(str, Class7.smethod_40()) < num)) { Class7.ShowMessageBox("Số lượng tồn kh\x00f4ng đủ để xuất kho !", 1); this.Txt_Barcode.Focus(); this.Txt_Barcode.SelectAll(); } else { this.string_1 = string.Concat(new object[] { "if exists (select goods_id from ", this.string_0, " where goods_id = '", str, "') update ", this.string_0, " set qty = qty + ", num, " where goods_id = '", str, "' else insert into ", this.string_0, "(goods_id,name,qty,unit,price, rt_discpc, pc_disc,card_disc,kit_qty) values('", str, "',N'", str2, "', ", num, ",'", str3, "',", num2, ",0,", Class10.double_0, ",", Class10.double_1, ",0); delete from ", this.string_0, " where qty <= 0 " }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_1, this.oleDbConnection_0); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_0.Close(); this.method_8(); this.method_1(); this.Txt_Barcode.SelectAll(); } }
private void btn_Delete_Click(object sender, EventArgs e) { if (this.string_3 != "F") { return; } string str = this.Txt_TransNum.Text.Trim(); string str2 = this.cmbImport.Text.Trim(); Class6 class2 = new Class6(); string text = this.btn_Delete.Text; if (text == null) { return; } if (!(text == "&X\x00f3a")) { if ((text == "&Phục hồi") && (Class7.ShowMessageBox("Bạn c\x00f3 chắc chắn phục hồi giao dịch n\x00e0y kh\x00f4ng ?", 2) == 1)) { class2.method_14("tblTransaction", str, 1); class2.method_17(str); class2.method_7(str, str2); this.btn_Skip_Click(this, new EventArgs()); } return; } if (!class2.method_22()) { this.string_2 = "select goods_id, imp_id, qty from tblTransaction where trans_num = '" + str + "'"; this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_2, this.oleDbConnection_0); using (DataTable table = new DataTable()) { this.oleDbDataAdapter_0.Fill(table); this.oleDbConnection_0.Close(); IEnumerator enumerator = table.Rows.GetEnumerator(); while (enumerator.MoveNext()) { DataRow current = (DataRow)enumerator.Current; if (class2.method_21(current["goods_id"].ToString(), current["imp_id"].ToString()) < Class7.smethod_2(current["qty"])) { goto Label_0174; } } goto Label_01AB; Label_0174: Class7.ShowMessageBox("Số lượng tồn kh\x00f4ng đủ để x\x00f3a giao dịch n\x00e0y !", 1); return; } } Label_01AB: if (Class7.ShowMessageBox("Bạn c\x00f3 chắc chắn x\x00f3a giao dịch n\x00e0y kh\x00f4ng ?", 2) == 1) { class2.method_18(str); class2.method_8(str); class2.method_14("tblTransaction", str, 0); this.btn_Skip_Click(this, new EventArgs()); } }
private void btn_Add_Click(object sender, EventArgs e) { if (this.txtGoodsid.Text == string.Empty) { return; } if (!Class2.CheckCsCard(this.txtCsId.Text.Trim())) { Class7.ShowMessageBox("Số thẻ này đã hết hạn hoặc đã bị xóa !", 1); return; } if (this.lblBookName.Text == string.Empty) { this.txtGoodsid.Focus(); return; } if (System.Configuration.ConfigurationManager.AppSettings["tk"] == "1") { Class6 class2 = new Class6(); if (!class2.method_22() && (class2.method_21(this.txtGoodsid.Text, Class7.smethod_40()) < 1.0)) { Class7.ShowMessageBox("Số lượng tồn kh\x00f4ng đủ để cho mượn !", 1); this.txtGoodsid.Focus(); this.txtGoodsid.SelectAll(); return; } } try { string str = string.Format("{0:d}", this.txtDuedate.EditValue); DataRow row = this.dataSet_0.Tables["loantran"].NewRow(); row["idx"] = this.dataSet_0.Tables["loantran"].Rows.Count + 1; row["goods_id"] = this.txtGoodsid.Text; row["full_name"] = this.lblBookName.Text; row["due_date"] = str; row["csname"] = this.lblName.Text; row["address"] = this.lblAddress.Text; row["trannum"] = this.txtTransNum.Text; row["phone"] = this.cnvLekth7.Text; row["remark"] = this.txtRemark.Text; this.dataSet_0.Tables["loantran"].Rows.Add(row); this.gridControl1.Refresh(); } catch (Exception) { Class7.ShowMessageBox("Đ\x00e3 c\x00f3 s\x00e1ch n\x00e0y trong danh mục mượn", 1); } finally { this.txtGoodsid.Text = string.Empty; this.txtGoodsid.Focus(); } }
private void method_2() { string str = this.Txt_Barcode.Text.Trim(); if (str != string.Empty) { this.oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT gs.goods_id, gs.full_name ,pr.rtprice ,gs.piceunit,gs.status FROM tblGoods as gs INNER JOIN tblPrice as pr ON gs.goods_id = pr.goods_id where gs.status = 1 and gs.goods_id = '" + str + "' ", this.oleDbConnection_0); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); this.oleDbConnection_0.Close(); if (set.Tables[0].Rows.Count != 0) { this.Lbl_MercName.Text = set.Tables[0].Rows[0]["full_name"].ToString(); this.Txt_Rtprice.Text = set.Tables[0].Rows[0]["rtprice"].ToString(); this.Txt_Unit.Text = set.Tables[0].Rows[0]["piceunit"].ToString(); double num = Class7.ParseDoubleValue(this.Txt_Qty.Text); string str2 = this.Txt_Barcode.Text.Trim(); double num2 = Class7.ParseDoubleValue(this.Txt_Rtprice.Text); string str3 = this.Lbl_MercName.Text.Trim(); string str4 = this.Txt_Unit.Text.Trim(); Class6 class2 = new Class6(); if (!class2.method_22() && (class2.method_21(str2, Class7.smethod_40()) < (num + this.method_9(str2)))) { Class7.ShowMessageBox("Số lượng tồn kh\x00f4ng đủ để xuất kho !", 1); this.Txt_Barcode.Focus(); this.Txt_Barcode.SelectAll(); } else { this.string_1 = string.Concat(new object[] { "if exists (select goods_id from ", this.string_0, " where goods_id = '", str2, "') update ", this.string_0, " set qty = qty + ", num, " where goods_id = '", str2, "' else insert into ", this.string_0, "(goods_id,name,qty,unit,price, rt_discpc, pc_disc,card_disc,kit_qty) values('", str2, "',N'", str3, "', ", num, ",'", str4, "',", num2, ",", this.method_5(str2), ",", Class10.double_0, ",", Class10.double_1, ",0); delete from ", this.string_0, " where qty <= 0 " }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_1, this.oleDbConnection_0); using (DataSet set2 = new DataSet()) { this.oleDbDataAdapter_0.Fill(set2); } this.oleDbConnection_0.Close(); this.method_8(); this.method_1(); this.Txt_Barcode.SelectAll(); } } else { Class7.ShowMessageBox("M\x00e3 h\x00e0ng kh\x00f4ng tồn tại, bạn h\x00e3y kiểm tra lại", 1); this.Txt_Barcode.SelectAll(); } } } }
private void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Lbl_MercName.Text)) { this.Txt_GoodsId.Focus(); } else { string str = this.Txt_GoodsId.Text.Trim(); string str2 = this.Txt_ExpID.Text.Trim(); string str3 = this.Lbl_MercName.Text.Trim(); double num = Class7.ParseDoubleValue(this.Txt_Qty.Text); double num2 = Class7.ParseDoubleValue(this.Txt_DiscPc.Text); double num3 = Class7.ParseDoubleValue(this.Txt_Price.Text); string str4 = this.Cmb_Unit.Text.Trim(); Class6 class2 = new Class6(); if (!class2.method_22() && (class2.method_21(str, str2) < num)) { Class7.ShowMessageBox("Số lượng tồn kh\x00f4ng đủ để xuất kho !", 1); this.Txt_Qty.Focus(); } else if (Class7.ParseDoubleValue(this.Txt_Qty.Text) < 0.0) { Class7.ShowMessageBox("Số lượng nhập đăng k\x00fd kh\x00f4ng hợp lệ", 1); this.Txt_Qty.Focus(); } else { string selectCommandText = string.Concat(new object[] { "IF EXISTS (SELECT goods_id FROM ", this.string_0, " where goods_id = '", str, "') UPDATE ", this.string_0, " SET [qty] = ", num, " ,[amount] = ", num3 * num, ",[price] = ", num3, ",disc_rate = ", num2, " WHERE goods_id = '", str, "' Else INSERT INTO ", this.string_0, "(goods_id, name, qty, price, disc_rate,amount,unitsymb,merc_type) VALUES('", str, "' , N'", str3, "',", num, ",", num3, ",", num2, ",", num3 * num, ", '", str4, "', '01') ; DELETE FROM ", this.string_0, " WHERE qty <= 0 " }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_1); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_1.Close(); class2.method_2(this.string_0); this.method_1(); this.method_2(); this.Txt_Qty.Text = "1"; this.Txt_DiscPc.EditValue = 0.0; this.Txt_GoodsId.Focus(); this.Txt_GoodsId.SelectAll(); } } }
private void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Lbl_MercName.Text)) { this.Txt_GoodsId.Focus(); } else { string str = this.Txt_GoodsId.Text.Trim(); string str4 = this.Txt_ExpID.Text.Trim(); string str2 = this.Lbl_MercName.Text.Trim(); double num = Class7.ParseDoubleValue(this.Txt_Qty.Text); double num2 = Class7.ParseDoubleValue(this.Txt_Price.Text); string str3 = this.Cmb_Unit.Text.Trim(); Class6 class2 = new Class6(); if (!class2.method_22() && (class2.method_21(str, str4) < num)) { Class7.ShowMessageBox("Số lượng tồn kh\x00f4ng đủ để xuất kho !", 1); this.Txt_Qty.Focus(); } else if (Class7.ParseDoubleValue(this.Txt_Qty.Text) < 0.0) { Class7.ShowMessageBox("Số lượng nhập đăng k\x00fd kh\x00f4ng hợp lệ", 1); this.Txt_Qty.Focus(); } else { class2.method_1(this.string_0, str, str2, num, 0.0, num2, str3, "01"); class2.method_2(this.string_0); this.method_1(); this.Txt_Qty.Text = "1"; this.Txt_GoodsId.Focus(); this.Txt_GoodsId.SelectAll(); } } }
private void Txt_GoodsId_KeyDown(object sender, KeyEventArgs e) { string str; DataSet set2; if (e.KeyCode == Keys.F2) { Class7.BrowserForm1("select goods_id as 'M\x00e3 số', full_name AS 'Diễn giải' from tblGoods where status = 1 and mbc = 0", this.oleDbConnection_0); this.Txt_GoodsId.Text = BrowseForm.strReturn; } if (e.KeyCode != Keys.Return) { return; } string str2 = this.Txt_GoodsId.Text.Trim(); string str3 = Class7.smethod_14("m_plu").ToString().Trim(); if (str2.Length > 6) { DataSet set; if (str2.Substring(0, str3.Length) == str3) { this.string_0 = "select goods_id from tblNon_Plu where nplu_code = '" + str2.Substring(0, str3.Length) + "'"; this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_0); using (set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); if (set.Tables[0].Rows.Count != 0) { this.Txt_GoodsId.Text = set.Tables[0].Rows[0][0].ToString(); } this.oleDbConnection_0.Close(); goto Label_01EA; } } this.string_0 = "select goods_id from tblbarcode where barcode = '" + str2 + "'"; this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_0); using (set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); if (set.Tables[0].Rows.Count != 0) { this.Txt_GoodsId.Text = set.Tables[0].Rows[0][0].ToString(); } this.oleDbConnection_0.Close(); } } Label_01EA: str = this.Txt_GoodsId.Text.Trim(); this.oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT A.goods_id, A.full_name, A.packunit, A.piceunit, B.lastimppr, B.prefprice FROM tblGoods AS A INNER JOIN tblPrice AS B ON A.goods_id = B.goods_id where A.goods_id = '" + str + "'", this.oleDbConnection_0); using (set2 = new DataSet()) { this.oleDbDataAdapter_0.Fill(set2); this.oleDbConnection_0.Close(); if (set2.Tables[0].Rows.Count != 0) { this.Lbl_MercName.Text = set2.Tables[0].Rows[0]["full_name"].ToString(); this.Txt_Price.EditValue = Class7.ParseDoubleValue(set2.Tables[0].Rows[0]["prefprice"].ToString()); this.Cmb_Unit.Properties.Items.Add(set2.Tables[0].Rows[0]["piceunit"].ToString()); this.Cmb_Unit.Properties.Items.Add(set2.Tables[0].Rows[0]["piceunit"].ToString()); this.Cmb_Unit.SelectedIndex = 0; this.Txt_Qty.Text = "1"; this.Txt_GoodsId.Focus(); } else { this.Lbl_MercName.Text = string.Empty; this.Txt_Price.EditValue = 0; } } string str4 = this.Txt_ExpID.Text.Trim(); if (str != string.Empty) { this.oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT A.goods_id, A.full_name, A.packunit, A.piceunit, B.lastimppr,B.prefprice FROM tblGoods AS A INNER JOIN tblPrice AS B ON A.goods_id = B.goods_id where A.goods_id = '" + str + "'", this.oleDbConnection_0); using (set2 = new DataSet()) { this.oleDbDataAdapter_0.Fill(set2); this.oleDbConnection_0.Close(); if (set2.Tables[0].Rows.Count != 0) { this.Lbl_MercName.Text = set2.Tables[0].Rows[0]["full_name"].ToString(); this.Cmb_Unit.Properties.Items.Add(set2.Tables[0].Rows[0]["piceunit"].ToString()); this.Cmb_Unit.Properties.Items.Add(set2.Tables[0].Rows[0]["piceunit"].ToString()); this.Cmb_Unit.SelectedIndex = 0; this.Txt_Qty.Text = "1"; Class6 class2 = new Class6(); this.Txt_EndQty.EditValue = class2.method_21(str, str4); this.Txt_Price.EditValue = class2.method_16(str4, str); this.Txt_GoodsId.Focus(); } else { this.Lbl_MercName.Text = string.Empty; this.Txt_Price.EditValue = 0; } } } }
private void btn_Save_Click(object sender, EventArgs e) { string str7; string str = this.Txt_TransNum.Text.Trim(); string str2 = this.Txt_OldTrans.Text.Trim(); string str3 = this.Txt_ExpID.Text.Trim(); string str4 = this.Txt_ImpID.Text.Trim(); string str5 = this.Txt_Remark.Text.Trim(); string str6 = this.Txt_Voucher.Text.Trim(); if (this.TransDetail.RowCount == 0) { return; } Class6 class2 = new Class6(); if (!class2.method_22()) { this.string_4 = "select goods_id, imp_id, qty from tblTransaction where trans_num = '" + str2 + "'"; this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_4, this.oleDbConnection_1); using (DataTable table = new DataTable()) { this.oleDbDataAdapter_0.Fill(table); this.oleDbConnection_1.Close(); IEnumerator enumerator = table.Rows.GetEnumerator(); while (enumerator.MoveNext()) { DataRow current = (DataRow)enumerator.Current; if (class2.method_21(current["goods_id"].ToString(), current["imp_id"].ToString()) < Class7.smethod_2(current["qty"])) { goto Label_0149; } } goto Label_0183; Label_0149: Class7.ShowMessageBox("Số lượng tồn kh\x00f4ng đủ để xuất kho !", 1); return; } } Label_0183: str7 = Class11.string_0; if (str7 != null) { if (!(str7 == "N")) { if (str7 == "E") { this.btn_Skip_Click(this, new EventArgs()); class2.method_20(str); class2.method_10(str); class2.method_13(str); class2.method_6(this.string_0, str, this.string_1, str3, str4, str6, str5, this.string_3); class2.method_9(str, str3); } } else { this.btn_Skip_Click(this, new EventArgs()); class2.ComputeTransnum("K"); this.ddvqeXfa4(this.string_0, str, this.string_1, str3, str4, str6, str5); class2.method_19(str); class2.method_9(str, str3); } } Class6.transNum = str; Class7.CreateReportInstance(Class6.string_3).ShowPreviewDialog(); }