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_6() { string str = this.Txt_ExpID.Text.Trim(); Class6 class2 = new Class6(); this.oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT goods_id,qty,amount FROM " + this.string_0, this.oleDbConnection_1); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_1.Close(); string str2 = string.Format("{0:d}", Class6.string_13); foreach (DataRow row in dataTable.Rows) { double num = Class7.ParseDoubleValue(row["qty"].ToString()); double num2 = class2.method_16(str, row["goods_id"].ToString()) * num; object obj2 = string.Concat(new object[] { "IF EXISTS (SELECT id FROM tblStockInfo WHERE id = '", str, "' AND goods_id = '", row["goods_id"], "') " }); obj2 = string.Concat(new object[] { obj2, "UPDATE tblStockInfo SET exp_qty = exp_qty + ", row["qty"], " ," }); obj2 = string.Concat(new object[] { obj2, "exp_amt = exp_amt + ", num2, ", last_date ='", str2, "' " }); obj2 = string.Concat(new object[] { obj2, "WHERE id = '", str, "' AND goods_id = '", row["goods_id"], "' Else " }) + "INSERT INTO tblStockInfo(id,goods_id, exp_qty,exp_amt,last_date ) "; string selectCommandText = string.Concat(new object[] { obj2, "VALUES('", str, "','", row["goods_id"], "',", row["qty"], ",", num2, ",'", str2, "')" }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_1); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_1.Close(); } }
private void method_3() { string str = this.Txt_TransNum.Text.Trim(); string str2 = this.Txt_ExpID.Text.Trim(); string str3 = this.Txt_ImpID.Text.Trim(); string str4 = this.Txt_Remark.Text.Trim(); string str5 = this.Txt_Voucher.Text.Trim(); string str6 = Class7.smethod_53(); this.oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT goods_id,qty,price,amount,idx,unitsymb, disc_rate,merc_type FROM " + this.string_0, this.oleDbConnection_1); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_1.Close(); string str7 = string.Format("{0:d}", Class6.string_13); foreach (DataRow row in dataTable.Rows) { Class6 class2 = new Class6(); double num = Class7.smethod_2(row["qty"]); double num2 = Class7.smethod_2(row["price"]); double num3 = Class7.smethod_2(row["disc_rate"]) / 100.0; double num4 = class2.method_16(str2, row["goods_id"].ToString()) * num; double num5 = Math.Round((double)((num2 * (1.0 - num3)) * num), 2) - num4; double num6 = Math.Round((double)((num * num2) * num3), 2); string selectCommandText = "INSERT INTO tblTransaction(tran_date, tran_time, trans_num, trans_code, voucher, invoice, post, exp_id, imp_id, "; string str9 = selectCommandText + "goods_id, qty, unit_symb, amount, discount, vat_amt, surplus, commis_amt, user_id, cs_id, " + "remark, updated, merc_type, tax_code, vat_incl, discpervat, disc_incl, copies, recnum, Status,station) "; object obj2 = str9 + "VALUES('" + str7 + "','" + str6 + "','" + str + "','" + this.string_1 + "','" + str5 + "','',0,'" + str2 + "',"; obj2 = string.Concat(new object[] { obj2, "'", str3, "','", row["goods_id"], "', ", row["qty"], ", '", row["unitsymb"], "',", num4, ", " }); selectCommandText = string.Concat(new object[] { obj2, num6, ", 0, ", num5, ", 0, ", Class7.GetUserId(), ",'' ,N'", str4, "' ,0 ,'", row["merc_type"], "' ,'' ,0 ,0 ,0 ,0 ,", row["idx"], " ,1,", Class7.smethod_51(), " )" }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_1); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_1.Close(); } }
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) { if (this.Sales_View.RowCount != 0) { this.Txt_Barcode.Enabled = false; this.Txt_Qty.Enabled = false; this.Txt_Unit.Enabled = false; this.btn_New.Enabled = true; this.btn_Save.Enabled = false; Class6 class2 = new Class6(); class2.ComputeTransnum("P"); Class6.transNum = this.Txt_TransNum.Text.Trim(); string str5 = Class7.smethod_19(); string str2 = Class7.smethod_40(); string str6 = Class7.smethod_53(); int num12 = Class7.GetUserId(); string str8 = "B\x00e1n lẻ h\x00e0ng h\x00f3a"; string str4 = ""; this.string_1 = "select idx, goods_id,price, qty, qty*price as amount,(qty*price)*(rt_discpc + pc_disc + card_disc) as discamt, kit_qty, kit_id from " + this.string_0 + " where goods_id <> '' "; this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_1, this.oleDbConnection_0); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_0.Close(); string str7 = this.Txt_Unit.Text.Trim(); foreach (DataRow row in dataTable.Rows) { string str = row["goods_id"].ToString().Trim(); double num2 = class2.method_16(str2, str); double num3 = Class7.smethod_2(row["qty"]); double num4 = Class7.smethod_2(row["kit_qty"]); string str3 = row["kit_id"].ToString().Trim(); double num5 = Class7.smethod_2(row["price"]); Math.Round((double)(num2 * num3), 2); double num6 = Class7.smethod_2(row["discamt"]); double num7 = Class7.smethod_2(row["amount"]) - num6; double num8 = Math.Round((double)((num7 / (1.0 + (Class10.smethod_1(str) / 100.0))) * (Class10.smethod_1(str) / 100.0)), 2); double num9 = Math.Round((double)((((num5 - num2) * num3) - num8) - num6), 2); int num10 = Class7.smethod_51(); str4 = Class10.smethod_1(str).ToString(); this.string_1 = string.Concat(new object[] { "INSERT INTO tblTransaction(tran_date, tran_time, trans_num, trans_code, voucher, kit_id, kit_qty, goods_id, qty,unit_symb, amount, discount, surplus, vat_amt, commis_amt, user_id, ref, custax_id,card_id, exp_id, cs_id, merc_type, tax_code, vat_incl, invoice, updated, copies, Shift, recnum,remark, status, discpervat, disc_incl,station) VALUES('", str5, "','", str6, "','", Class6.transNum, "','00','','", str3, "', ", num4, ",'", str, "',", num3, ",'", str7, "',", num5 * num3, ",", num6, ",", num9, ",", num8, ",0,", num12, ",'','','','", str2, "','','01','", str4, "',0,'',0,1,0,", row["idx"], ",N'", str8, "',1,0,0,", num10, ")" }); 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.oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT goods_id,qty,amount FROM tblTransaction where trans_num = '" + Class6.transNum + "'", this.oleDbConnection_0); DataTable table = new DataTable(); this.oleDbDataAdapter_0.Fill(table); this.oleDbConnection_0.Close(); foreach (DataRow row in table.Rows) { double num13 = class2.method_16(str2, row["goods_id"].ToString()) * Class7.ParseDoubleValue(row["qty"].ToString()); this.string_1 = string.Concat(new object[] { "IF EXISTS (SELECT id FROM tblStockInfo WHERE id = '", str2, "' AND goods_id = '", row["goods_id"], "') UPDATE tblStockInfo SET exp_qty = exp_qty + ", row["qty"], " , exp_amt = exp_amt + ", num13, ", last_date ='", str5, "' WHERE id = '", str2, "' AND goods_id = '", row["goods_id"], "' Else INSERT INTO tblStockInfo(id,goods_id, exp_qty,exp_amt,last_date ) VALUES('", str2, "','", row["goods_id"], "',", row["qty"], ",", num13, ",'", str5, "')" }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_1, this.oleDbConnection_0); using (DataSet set3 = new DataSet()) { this.oleDbDataAdapter_0.Fill(set3); } this.oleDbConnection_0.Close(); } this.string_2 = "D"; if (Class10.double_2 != 0.0) { double num = Class7.ParseDoubleValue(this.Lbl_LastAmount.Text); this.string_1 = string.Concat(new object[] { "INSERT INTO tblTransValue([trans_num],[amount],[frcustomer]) VALUES('", Class6.transNum, "',", num, ",", Class10.double_2, ")" }); 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(); } } Class11.string_1 = "N"; voucher_1 r_ = new voucher_1(); r_.PrintingSystem.ShowMarginsWarning = false; r_.PrintingSystem.ShowPrintStatusDialog = false; this.btn_Skip_Click(this, new EventArgs()); this.btn_New.Focus(); try { r_.Print(); } catch (Exception) { Class7.ShowMessageBox("Kh\x00f4ng t\x00ecm thấy m\x00e1y in", 1); } } }