private void method_3() { string str = Class7.smethod_19(); string text1 = this.bool_0 ? Class7.smethod_53() : this.string_3; string str2 = this.Txt_TransNum.Text.Trim(); string str3 = this.Txt_StockId.Text.Trim(); string str4 = this.Txt_Remark.Text.Trim(); this.oleDbDataAdapter_0 = new OleDbDataAdapter("select * from " + this.string_1, this.oleDbConnection_1); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_1.Close(); foreach (DataRow row in dataTable.Rows) { string str6 = (Class7.ParseDoubleValue(row["mqty"].ToString()) == 0.0) ? "" : str3; string str5 = (Class7.ParseDoubleValue(row["pqty"].ToString()) == 0.0) ? "" : str3; double num = (Class7.ParseDoubleValue(row["pqty"].ToString()) == 0.0) ? Class7.ParseDoubleValue(row["mqty"].ToString()) : Class7.ParseDoubleValue(row["pqty"].ToString()); double num2 = (Class7.ParseDoubleValue(row["mamount"].ToString()) == 0.0) ? Class7.ParseDoubleValue(row["pamount"].ToString()) : Class7.ParseDoubleValue(row["mamount"].ToString()); string selectCommandText = string.Concat(new object[] { "INSERT INTO tblTransaction(tran_date, tran_time, trans_num, trans_code, voucher, invoice, post, exp_id, imp_id,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) VALUES('", str, "',convert(VARCHAR(5),getdate(),108),'", str2, "','", this.string_2, "','','',0,'", str6, "','", str5, "','", row["goods_id"], "',", num, ",'", row["unitsymb"], "',", num2, ",0,0,0,0, ", Class7.GetUserId(), ",'',N'", str4, "',0,'01','',0,0,0,0,", row["idx"], ",1,", Class7.smethod_51(), ")" }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_1); DataSet dataSet = new DataSet(); this.oleDbDataAdapter_0.Fill(dataSet); this.oleDbConnection_1.Close(); } }
private void btn_Add_Click(object sender, EventArgs e) { if (!((Class7.ParseDoubleValue(this.Txt_Qty.Text) <= 0.0) | (this.Lbl_FullName.Text == string.Empty))) { this.Txt_PosId.Text.Trim(); string str = this.Txt_GoodsId.Text.Trim(); string str2 = this.Lbl_FullName.Text.Trim(); string text = this.Lbl_Rtprice.Text; string str4 = DateTime.Now.ToString("HH:mm:ss"); double num = Class7.ParseDoubleValue(this.Txt_Qty.Text); this.string_0 = string.Concat(new object[] { "IF NOT EXISTS(select kit_id from ", base.Tag.ToString(), " where kit_id = '", str, "' and user_id = ", Class7.GetUserId(), ") INSERT INTO ", base.Tag.ToString(), "([timeinput],[kit_id],[description],[rtprice],[copies],user_id) VALUES('", str4, "','", str, "',N'", str2, "','", text, "',", num, ", ", Class7.GetUserId(), ") Else UPDATE ", base.Tag.ToString(), " SET copies = copies + ", num, ",timeinput = '", str4, "' where kit_id = '", str, "' and user_id = ", Class7.GetUserId() }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_0); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_0.Close(); this.method_0(); this.method_1(); this.Txt_Qty.Text = "1"; this.Txt_GoodsId.Focus(); } }
private void btnCreateTrans_Click(object sender, EventArgs e) { if (Class7.ShowMessageBox("Bạn c\x00f3 chắc chắn tạo giao dịch đặt h\x00e0ng n\x00e0y kh\x00f4ng ?", 2) == 1) { Class6 class2 = new Class6(); string str = class2.method_5("H"); string str2 = DateTime.ParseExact(this.Txt_DtDelivery.Text, "dd/MM/yyyy", null).ToString(); string str3 = Class7.smethod_53(); string str4 = (this.Txt_Remark.Text == string.Empty) ? "Đặt h\x00e0ng từ nh\x00e0 cung cấp" : this.Txt_Remark.Text; string str5 = this.Txt_ExpID.Text.Trim(); if (this.Lbl_ExpName.Text == string.Empty) { Class7.ShowMessageBox("Bạn chưa chọn m\x00e3 nh\x00e0 cung cấp", 1); this.Txt_ExpID.Focus(); } else { using (WaitDialogForm form = new WaitDialogForm()) { form.Caption = "Tạo giao dịch số " + str; this.oleDbDataAdapter_0 = new OleDbDataAdapter("select goods_id,unitsymb, Name, qty, price,end_qty from " + this.string_0, this.oleDbConnection_0); using (DataTable table = new DataTable()) { this.oleDbDataAdapter_0.Fill(table); this.oleDbConnection_0.Close(); foreach (DataRow row in table.Rows) { this.string_2 = string.Concat(new object[] { "INSERT INTO tblOn_order (tran_date, tran_time, deliver_dt, trans_num, trans_code, exp_id, goods_id, qty, unit_symb, price, merc_type, user_id, remark,status,end_qty) VALUES ('", Class7.smethod_19(), "','", str3, "','", str2, "','", str, "','30','", str5, "','", row["goods_id"], "',", row["qty"], ",'", row["unitsymb"], "',", row["price"], ",'01',", Class7.GetUserId(), ",N'", str4, "',1,", row["end_qty"], ") " }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_2, this.oleDbConnection_0); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); this.oleDbConnection_0.Close(); continue; } } } this.oleDbDataAdapter_0 = new OleDbDataAdapter("DELETE FROM " + this.string_0, this.oleDbConnection_0); using (DataSet set2 = new DataSet()) { this.oleDbDataAdapter_0.Fill(set2); this.oleDbConnection_0.Close(); } form.Close(); this.Txt_GoodsId.Text = string.Empty; this.Txt_ExpID.Text = string.Empty; this.Txt_ExpID.Enabled = true; this.Lbl_ExpName.Text = string.Empty; this.Lbl_MercName.Text = string.Empty; class2.ComputeTransnum("H"); Class6.transNum = str; this.method_0(); this.Txt_ExpID.Focus(); } } } }
private void method_4() { this.oleDbDataAdapter_0 = new OleDbDataAdapter("delete from tblNotePrn where user_id = " + Class7.GetUserId(), this.oleDbConnection_1); DataSet dataSet = new DataSet(); this.oleDbDataAdapter_0.Fill(dataSet); this.oleDbConnection_1.Close(); this.oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { "SELECT * FROM ", base.Tag.ToString(), " where user_id = ", Class7.GetUserId(), " order by timeinput" }), this.oleDbConnection_1); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_1.Close(); foreach (DataRow row in dataTable.Rows) { for (int i = 1; i < (int.Parse(row["qty"].ToString()) + 1); i++) { OleDbDataAdapter adapter = new OleDbDataAdapter(string.Concat(new object[] { "INSERT INTO tblNotePrn([timeinput],[goods_id],[barcode],[shortname],[fullname],[grp_id],[supp_id],[rtprice],Pos_id,user_id) VALUES('", row["timeinput"], "', '", row["goods_id"], "', '", row["barcode"], "',N'", row["shortname"], "' ,N'", row["fullname"], "','", row["grp_id"], "','", row["supp_id"], "',", row["rtprice"], ",'", row["pos_id"], "',", Class7.GetUserId(), ")" }), this.oleDbConnection_1); using (DataSet set2 = new DataSet()) { adapter.Fill(set2); } this.oleDbConnection_1.Close(); } } }
private void btn_Correct_Click(object sender, EventArgs e) { if (this.GridView1.RowCount != 0) { if (this.Lbl_StockName.Text == string.Empty) { Class7.ShowMessageBox("Bạn chưa chọn m\x00e3 kho, quầy !", 1); this.Txt_StockId.Focus(); } else if (Class7.ShowMessageBox("Bạn c\x00f3 chắc chắn hiệu chỉnh kh\x00f4ng ?", 2) == 1) { Class6 class2 = new Class6(); string str5 = class2.method_5("K"); WaitDialogForm form = new WaitDialogForm(); form.Caption = "Tạo giao dịch " + str5; this.oleDbDataAdapter_0 = new OleDbDataAdapter("select tblAdjust.*, tblgoods.piceunit from tblAdjust inner join tblgoods on tblAdjust.goods_id = tblgoods.goods_id where tblAdjust.real_qty <> 0 ", this.oleDbConnection_0); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_0.Close(); if (dataTable.Rows.Count == 0) { Class7.ShowMessageBox("Kh\x00f4ng c\x00f3 sự ch\x00eanh lệch, kh\x00f4ng cần hiệu chỉnh !", 1); form.Close(); } else { string str = Class7.smethod_19(); string str2 = Class7.smethod_53(); string str3 = this.Txt_StockId.Text.Trim(); string str4 = "Giao dịch c\x00e2n đối kiểm k\x00ea tự động"; int num = 1; foreach (DataRow row in dataTable.Rows) { string str6 = (Class7.ParseDoubleValue(row["real_qty"].ToString()) > 0.0) ? "" : str3; string str7 = (Class7.ParseDoubleValue(row["real_qty"].ToString()) < 0.0) ? "" : str3; double num2 = Math.Abs(Class7.ParseDoubleValue(row["real_qty"].ToString())); double num3 = num2 * Class7.ParseDoubleValue(row["averimppr"].ToString()); string selectCommandText = string.Concat(new object[] { "INSERT INTO tblTransaction(tran_date, tran_time, trans_num, trans_code, voucher, invoice, post, exp_id, imp_id,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) VALUES('", str, "','", str2, "','", str5, "','", this.string_0, "','','',0,'", str6, "','", str7, "','", row["goods_id"], "',", num2, ",'", row["piceunit"], "',", num3, ",0,0,0,0, ", Class7.GetUserId(), ",'',N'", str4, "',0,'01','',0,0,0,0,", num, ",1)" }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_0); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); this.oleDbConnection_0.Close(); } num++; } class2.ComputeTransnum("K"); form.Caption = "Tạo giao dịch " + str5; this.method_2(); Class7.ShowMessageBox("Hiệu chỉnh dữ liệu th\x00e0nh c\x00f4ng !", 1); form.Close(); } } } }
public static void smethod_3(object object_2, object object_3, object object_4, object object_5, double double_2, double double_3, object object_6, object object_7, int int_0) { new Class6(); string_0 = string.Concat(new object[] { "INSERT INTO tblAccTrans (tran_date, tran_time, ef_date, trans_num, voucher, trans_code, account_id, db_amount, cr_amount, user_id, corr_acc, remark, updated, recnum, status) VALUES ('", object_3, "','", Class7.smethod_53(), "','", Class7.smethod_19(), "','", object_2, "' ,'", object_4, "','", Class6.string_2, "','", object_5, "',", double_2, ", ", double_3, ",", Class7.GetUserId(), ",'", object_6, "',N'", object_7, "',0,", int_0, ",1) " }); oleDbDataAdapter_0 = new OleDbDataAdapter(string_0, oleDbConnection_0); using (DataSet set = new DataSet()) { oleDbDataAdapter_0.Fill(set); oleDbConnection_0.Close(); } }
private void Chk_SelectAll_CheckedChanged(object sender, EventArgs e) { if (this.Chk_SelectAll.Checked) { if (Class7.ShowMessageBox("Bạn c\x00f3 chắc chắn in bảng c\x00e0i kệ cho to\x00e0n bộ mặt h\x00e0ng", 2) != 1) { this.Chk_SelectAll.Checked = false; } else { DataSet set; WaitDialogForm form = new WaitDialogForm(); form.Caption = "Xin chờ một ch\x00fat ...."; this.string_0 = string.Concat(new object[] { "DELETE FROM ", base.Tag.ToString(), " WHERE user_id = ", Class7.GetUserId() }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_1); using (set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); this.oleDbConnection_1.Close(); } this.string_0 = "SELECT gs.goods_id,gs.barcode, gs.grp_id, gs.short_name, gs.full_name, gs.supp_id, pr.rtprice FROM tblGoods AS gs INNER JOIN tblPrice AS pr ON gs.goods_id = pr.goods_id "; this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_1); using (DataTable table = new DataTable()) { this.oleDbDataAdapter_0.Fill(table); this.oleDbConnection_1.Close(); int num = 1; foreach (DataRow row in table.Rows) { DateTime.Now.ToString("HH:mm:ss"); string str = row["rtprice"].ToString(); this.string_0 = string.Concat(new object[] { "INSERT INTO ", base.Tag.ToString(), "(idx,[pos_id],[goods_id],[barcode],[shortname],[fullname],[grp_id],[supp_id],[rtprice],[qty],[remark],user_id) VALUES(", num, ", '00002' ,'", row["goods_id"], "','", row["barcode"], "', N'", row["short_name"], "',N'", row["full_name"], "','", row["grp_id"], "','", row["supp_id"], "','", str, "',1,'', ", Class7.GetUserId(), ") " }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_1); using (set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); this.oleDbConnection_1.Close(); } num++; form.Caption = "M\x00e3 h\x00e0ng số " + row["goods_id"].ToString(); } } this.method_1(); form.Close(); } } }
private void btnSuspend_Click(object sender, EventArgs e) { string str = this.Txt_TransNum.Text.Trim(); string str2 = this.string_2; if (str2 != null) { if (!(str2 == "N")) { if (str2 == "D") { this.method_0(); this.Txt_TransNum.Enabled = true; this.Txt_TransNum.Focus(); this.btn_New.Enabled = false; this.method_1(); } } else if (this.Sales_View.RowCount != 0) { this.btn_Skip_Click(this, new EventArgs()); new Class6().ComputeTransnum("P"); this.oleDbDataAdapter_0 = new OleDbDataAdapter("select * from " + this.string_0, this.oleDbConnection_0); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_0.Close(); foreach (DataRow row in dataTable.Rows) { this.string_1 = string.Concat(new object[] { "INSERT INTO tblSuspend(trans_num, idx, goods_id, Name, qty, unit, price, rt_discpc, pc_disc, card_disc,user_id,pos_id) VALUES ('", str, "',", row["idx"], ",'", row["goods_id"], "',N'", row["Name"], "',", row["qty"], ",'", row["unit"], "',", row["price"], ",", row["rt_discpc"], ",", row["pc_disc"], ",", row["card_disc"], ",", Class7.GetUserId(), ", '", Class7.smethod_40(), "')" }); 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(); } Class6.transNum = str; voucher_3 r = new voucher_3(); r.PrintingSystem.ShowMarginsWarning = false; r.PrintingSystem.ShowPrintStatusDialog = false; r.Print(); } } }
private void Insert() { string str = string.Format("{0:d}", this.txtDuedate.EditValue); string str2 = this.txtTransNum.Text.Trim(); string str4 = (this.txtRemark.Text == string.Empty) ? "Phiếu cho mượn s\x00e1ch" : this.txtRemark.Text.Trim(); string str3 = this.txtCsId.Text.Trim(); for (int i = 0; i < this.dataSet_0.Tables["loantran"].Rows.Count; i++) { object obj2 = this.dataSet_0.Tables["loantran"].Rows[i]["goods_id"]; this.string_0 = string.Concat(new object[] { "INSERT INTO tblLoanTran(trans_num, tran_date,trans_code, tran_time, exp_id, cs_id, goods_id, qty, due_date, user_id, remark, status) VALUES ('", str2, "','", Class7.smethod_19(), "','", this.string_2, "','", Class7.smethod_53(), "','", Class7.smethod_40(), "','", str3, "','", obj2, "',1,'", str, "',", Class7.GetUserId(), ",N'", str4, "',1)" }); Class7.smethod_4(this.string_0); Class2.iWyIskLbe(Class7.smethod_40(), obj2.ToString(), 1.0); } }
private void method_4() { string str = Class7.smethod_19(); string str2 = this.Txt_TransNum.Text.Trim(); string str3 = Class7.smethod_53(); string str4 = this.Txt_ExpID.Text.Trim(); string str5 = this.Txt_ImpID.Text.Trim(); string str6 = (this.Txt_Remark.Text == string.Empty) ? "Nhập h\x00e0ng khuyến mại từ nh\x00e0 cung cấp" : this.Txt_Remark.Text.Trim(); string str7 = this.Txt_Voucher.Text.Trim(); int num = 0; int num2 = 0; int num3 = 0; string str8 = "NT"; this.oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT goods_id,qty,price,amount,idx,unitsymb, disc_amt,vat_amt,surplus,merc_type,disc_pc FROM " + this.string_0, this.oleDbConnection_0); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); double num4 = 0.0; double num5 = 0.0; double num6 = 0.0; foreach (DataRow row in dataTable.Rows) { num6 = 0.0; string selectCommandText = "INSERT INTO tblTransaction(tran_date, tran_time, trans_num, trans_code, voucher, invoice, post, exp_id, imp_id, "; string str10 = 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 = str10 + "VALUES('" + str + "','" + str3 + "','" + str2 + "','" + this.string_1 + "','" + str7 + "','',0,'" + str4 + "',"; obj2 = string.Concat(new object[] { obj2, "'", str5, "','", row["goods_id"], "', ", row["qty"], ", '", row["unitsymb"], "',", num4, ", " }); obj2 = string.Concat(new object[] { obj2, num5, ", ", num6, ", ", row["surplus"], ", 0, " }); obj2 = string.Concat(new object[] { obj2, Class7.GetUserId(), ",'' ,N'", str6, "' ,0 ,'", row["merc_type"], "' ," }); selectCommandText = string.Concat(new object[] { obj2, "'", str8, "' ,", num, ",", num3, ",", num2, ",0 ,", row["idx"], " ,1 ,", Class7.smethod_51(), ")" }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_0); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_0.Close(); } }
private void btn_Add_Click(object sender, EventArgs e) { if (!((Class7.ParseDoubleValue(this.Txt_Qty.Text) <= 0.0) | (this.Lbl_FullName.Text == string.Empty))) { string str = this.Txt_PosId.Text.Trim(); string str2 = this.Txt_GoodsId.Text.Trim(); string str3 = this.Lbl_ShortName.Text.Trim(); string str4 = this.Lbl_FullName.Text.Trim(); string str5 = this.Lbl_GrpId.Text.Trim(); string str6 = this.Lbl_SuppId.Text.Trim(); double num = Class7.ParseDoubleValue(this.Lbl_Rtprice.Text); string str7 = this.Txt_Remark.Text.Trim(); string text = this.Lbl_Barcode.Text; string str9 = DateTime.Now.ToString("HH:mm:ss"); double num2 = Class7.ParseDoubleValue(this.Txt_Qty.Text); string selectCommandText = string.Concat(new object[] { "IF NOT EXISTS(select goods_id from ", base.Tag.ToString(), " where goods_id = '", str2, "' and user_id = ", Class7.GetUserId(), ") INSERT INTO ", base.Tag.ToString(), "([timeinput],[pos_id],[goods_id],[barcode],[shortname],[fullname],[grp_id],[supp_id],[rtprice],[qty],[remark],user_id) VALUES('", str9, "', '", str, "' ,'", str2, "','", text, "' ,N'", str3, "',N'", str4, "','", str5, "','", str6, "','", num, "',", num2, ",'", str7, "', ", Class7.GetUserId(), ") Else UPDATE ", base.Tag.ToString(), " SET qty = qty + ", num2, ",timeinput = '", str9, "' where goods_id = '", str2, "' and user_id = ", Class7.GetUserId() }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_1); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_1.Close(); this.method_0(); this.method_1(); this.Txt_Qty.Text = "1"; this.Txt_GoodsId.Focus(); } }
private void method_0() { this.oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { "select goods_id from ", base.Tag.ToString(), " where user_id = ", Class7.GetUserId(), " Order by timeinput" }), this.oleDbConnection_1); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_1.Close(); int num = 1; foreach (DataRow row in dataTable.Rows) { this.oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { " UPDATE ", base.Tag.ToString(), " set idx = ", num, " where goods_id = '", row["goods_id"], "' and user_id = ", Class7.GetUserId() }), this.oleDbConnection_1); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); num++; } this.oleDbConnection_1.Close(); } }
private void method_1() { string selectCommandText = string.Concat(new object[] { "SELECT [idx] AS [TT],[goods_id] AS [M\x00e3 h\x00e0ng] ,barcode,[fullname] AS [T\x00ean h\x00e0ng], [qty] AS [Lượng tem], rtprice AS [Gi\x00e1 b\x00e1n lẻ] FROM ", base.Tag.ToString(), " where user_id = ", Class7.GetUserId(), " ORDER BY timeinput" }); using (this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_1)) { using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); this.Grd_Labels.DataSource = set.Tables[0]; this.Labels_View.OptionsBehavior.Editable = false; this.Labels_View.BestFitColumns(); this.Labels_View.Columns["Lượng tem"].SummaryItem.FieldName = "Lượng tem"; this.Labels_View.Columns["Lượng tem"].SummaryItem.SummaryType = SummaryItemType.Sum; this.Labels_View.Columns["Lượng tem"].SummaryItem.DisplayFormat = "{0:n0}"; this.Labels_View.Columns["Gi\x00e1 b\x00e1n lẻ"].DisplayFormat.FormatType = FormatType.Numeric; this.Labels_View.Columns["Gi\x00e1 b\x00e1n lẻ"].DisplayFormat.FormatString = "n0"; } } this.oleDbConnection_1.Close(); }
private void btn_Reset_Click(object sender, EventArgs e) { if ((this.Labels_View.RowCount != 0) && (Class7.ShowMessageBox("Bạn c\x00f3 chắc chắn x\x00f3a hết lượng tem đ\x00e3 đặt in kh\x00f4ng", 2) == 1)) { this.oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { "DELETE FROM ", base.Tag.ToString(), " where user_id = ", Class7.GetUserId() }), this.oleDbConnection_1); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_1.Close(); this.method_1(); } }
private void Txt_TransNum_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F2) { Class7.BrowserForm1(" SELECT trans_num, goods_id, Name, qty FROM tblSuspend WHERE user_id = " + Class7.GetUserId(), this.oleDbConnection_0); this.Txt_TransNum.Text = BrowseForm.strReturn; } if (e.KeyCode == Keys.Return) { this.oleDbDataAdapter_0 = new OleDbDataAdapter("select * from tblsuspend where trans_num = '" + this.Txt_TransNum.Text.Trim() + "'", this.oleDbConnection_0); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_0.Close(); if (dataTable.Rows.Count != 0) { DataSet set; foreach (DataRow row in dataTable.Rows) { this.oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { "insert into ", this.string_0, "(goods_id,name,qty,unit,price, rt_discpc,pc_disc,card_disc) values('", row["goods_id"], "',N'", row["name"], "', ", row["qty"], ",'", row["unit"], "',", row["price"], ",", row["rt_discpc"], ",", row["pc_disc"], ",", row["card_disc"], ")" }), this.oleDbConnection_0); using (set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_0.Close(); } this.oleDbDataAdapter_0 = new OleDbDataAdapter("delete from tblsuspend where trans_num = '" + this.Txt_TransNum.Text.Trim() + "'", this.oleDbConnection_0); using (set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_0.Close(); this.method_1(); this.Txt_TransNum.Enabled = false; this.btn_New.Enabled = false; this.btn_Save.Enabled = true; this.Txt_Barcode.Enabled = true; this.Txt_Qty.Enabled = true; this.btnSuspend.Text = "F12-Ho\x00e3n"; this.Txt_Barcode.Focus(); } } }
public void method_6(string string_14, string string_15, string string_16, string string_17, string string_18, string string_19, string string_20, string string_21) { oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT goods_id,qty,price,amount,idx,unitsymb, disc_amt,vat_amt,surplus,merc_type FROM " + string_14, oleDbConnection_0); DataTable dataTable = new DataTable(); oleDbDataAdapter_0.Fill(dataTable); string str = string.Format("{0:d}", string_13); double num = 0.0; foreach (DataRow row in dataTable.Rows) { num = Class7.smethod_2(row["amount"]); string str2 = "INSERT INTO tblTransaction(tran_date, tran_time, trans_num, trans_code, voucher, invoice, post, exp_id, imp_id, "; string str3 = str2 + "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 = str3 + "VALUES('" + str + "','" + string_21 + "','" + string_15 + "','" + string_16 + "','" + string_19 + "','',0,'" + string_17 + "',"; obj2 = string.Concat(new object[] { obj2, "'", string_18, "','", row["goods_id"], "', ", row["qty"], ", '", row["unitsymb"], "',", num, ", " }); oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { obj2, row["disc_amt"], ", ", row["vat_amt"], ", ", row["surplus"], ", 0, ", Class7.GetUserId(), ",'' ,N'", string_20, "' ,0 ,'", row["merc_type"], "' ,'' ,0 ,0 ,0 ,0 ,", row["idx"], " ,1,", Class7.smethod_51(), " )" }), oleDbConnection_0); using (DataSet set = new DataSet()) { oleDbDataAdapter_0.Fill(set); } oleDbConnection_0.Close(); } }
public void method_0(string string_14, string string_15, double double_1, double double_2) { oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT * FROM tblPrice WHERE goods_id = '" + string_14 + "'", oleDbConnection_0); using (DataSet set = new DataSet()) { oleDbDataAdapter_0.Fill(set); oleDbConnection_0.Close(); double num = Class7.ParseDoubleValue(set.Tables[0].Rows[0]["rtprice"].ToString()); double num2 = Class7.ParseDoubleValue(set.Tables[0].Rows[0]["wsprice"].ToString()); string str = "INSERT INTO tblHisprice(Hisdate, Histime, goods_id, oldwsprice, newwsprice, oldrtprice, newrtprice, user_id) "; object obj2 = str; obj2 = string.Concat(new object[] { obj2, " VALUES('", string_13, "','", string_15, "','", string_14, "',", num2, ",", double_1, ",", num, "," }); oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { obj2, " ", double_1, " ,", Class7.GetUserId(), " )" }), oleDbConnection_0); using (DataSet set2 = new DataSet()) { oleDbDataAdapter_0.Fill(set2); } } oleDbConnection_0.Close(); }
private void Labels109_BeforePrint(object sender, PrintEventArgs e) { OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT Pos_id ,goods_id,shortname,fullname,grp_id,supp_id,rtprice,remark ,user_id ,timeinput FROM tblLabelPrn where user_id = " + Class7.GetUserId() + " Order By timeinput ", Class7.oleDbConnection_1); DataSet dataSet = new DataSet(); adapter.Fill(dataSet); Class7.oleDbConnection_1.Close(); base.DataAdapter = adapter; base.DataSource = dataSet.Tables[0]; this.xrlabel_0.DataBindings.Add("Text", base.DataSource, "rtprice", "{0:n0}"); this.xrbarCode_0.DataBindings.Add("Text", base.DataSource, "goods_id", ""); }
private void btn_Save_Click(object sender, EventArgs e) { if (this.Lbl_ImpName.Text == string.Empty) { Class7.ShowMessageBox("Bạn chưa khai b\x00e1o nơi nhập h\x00e0ng", 1); this.Txt_ImpID.Focus(); } else if (this.Lbl_ExpName.Text == string.Empty) { Class7.ShowMessageBox("Bạn chưa khai b\x00e1o nơi xuất h\x00e0ng", 1); this.Txt_ExpID.Focus(); } else if (this.TransDetail.RowCount == 0) { this.Txt_GoodsId.Focus(); } else { string str = this.Txt_TransNum.Text.Trim(); string str3 = this.Txt_ExpID.Text.Trim(); string str4 = this.Txt_ImpID.Text.Trim(); string str6 = this.Txt_Remark.Text.Trim(); string str5 = string.Empty; if (this.TransDetail.RowCount != 0) { Class6 class2 = new Class6(); WaitDialogForm form = new WaitDialogForm(); form.Caption = "Xin chờ một ch\x00fat ...."; string str7 = Class11.string_0; if (str7 != null) { if (!(str7 == "N")) { if (str7 == "E") { this.iWyIskLbe(this, new EventArgs()); class2.method_18(str); this.IjSwogAv6(); this.method_4(); this.method_2(); this.method_3(); class2.method_13(str); class2.method_6(this.string_1, str, this.string_4, str3, str4, str5, str6, this.string_3); } } else { this.iWyIskLbe(this, new EventArgs()); class2.ComputeTransnum("K"); string str8 = Class7.smethod_53(); class2.method_6(this.string_1, str, this.string_4, str3, str4, str5, str6, str8); class2.method_17(str); this.method_3(); this.method_2(); } } if (this.chkLabelPrn.Checked) { this.oleDbDataAdapter_0 = new OleDbDataAdapter("DELETE FROM tblLABELS", this.oleDbConnection_1); DataSet dataSet = new DataSet(); this.oleDbDataAdapter_0.Fill(dataSet); this.oleDbConnection_1.Close(); string selectCommandText = "SELECT A.goods_id, A.full_name, A.grp_id,A.piceunit, A.merc_type, B.rtprice, C.trans_num,C.qty, C.exp_id,C.imp_id, C.recnum FROM tblGoods AS A INNER JOIN tblPrice AS B ON A.goods_id = B.goods_id INNER JOIN tblTransaction AS C ON A.goods_id = C.goods_id where C.trans_num = '" + str + "' "; this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, Class7.oleDbConnection_1); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); Class7.oleDbConnection_1.Close(); foreach (DataRow row in dataTable.Rows) { selectCommandText = "INSERT INTO tblLABELS([idx],[timeinput],[goods_id],[fullname],[shortname],[grp_id],[supp_id],[rtprice],[qty],user_id) "; object obj2 = selectCommandText; obj2 = string.Concat(new object[] { obj2, "VALUES(", row["recnum"], ",'", row["recnum"].ToString(), "','", row["goods_id"], "','", row["full_name"], "','", row["full_name"], "'," }); OleDbDataAdapter adapter = new OleDbDataAdapter(string.Concat(new object[] { obj2, "'", row["grp_id"], "','", row["exp_id"], "','", row["rtprice"], "',", row["qty"], ",", Class7.GetUserId(), ")" }), this.oleDbConnection_1); using (DataSet set2 = new DataSet()) { adapter.Fill(set2); } this.oleDbConnection_1.Close(); } } form.Close(); Class6.transNum = str; Class7.CreateReportInstance("v_mercmove").ShowPreviewDialog(); Class7.CreateReportInstance("v_mercmove1").ShowPreviewDialog(); } } }
private void method_2() { this.oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { "delete from ", base.Tag.ToString(), " where qty <= 0 and user_id = ", Class7.GetUserId() }), this.oleDbConnection_1); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_1.Close(); }
private void method_5() { string str = string.Empty; string str2 = string.Empty; string str3 = string.Empty; string str4 = string.Empty; string str5 = string.Empty; this.oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { "SELECT * FROM ", base.Tag.ToString(), " where user_id = ", Class7.GetUserId(), " order by timeinput" }), this.oleDbConnection_1); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_1.Close(); using (StreamWriter writer = new StreamWriter(@"C:\labels.txt", false)) { foreach (DataRow row in dataTable.Rows) { str = row["goods_id"].ToString(); str2 = Class7.smethod_47(row["name"].ToString()); str3 = row["grp_id"].ToString(); str4 = row["supp_id"].ToString(); str5 = row["rtprice"].ToString(); for (int i = 1; i < (int.Parse(row["qty"].ToString()) + 1); i++) { writer.WriteLine(string.Format("{0};{1};{2};{3};{4}", new object[] { str, str2, str3, str4, str5 })); } } } }
private void Txt_TransNum_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Return: if (Class11.string_0 == "S") { if (Class7.GetUserId() == 1) { this.string_0 = "SELECT * FROM tblTransaction WHERE trans_num = '" + this.Txt_TransNum.Text.Trim() + "' "; } else { this.string_0 = "SELECT * FROM tblTransaction WHERE trans_num = '" + this.Txt_TransNum.Text.Trim() + "' AND tran_date = '" + Class7.smethod_19() + "'"; } this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_1); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); this.oleDbConnection_1.Close(); if (set.Tables[0].Rows.Count == 0) { Class7.ShowMessageBox("Kh\x00f4ng t\x00ecm thấy giao dịch n\x00e0y", 1); this.Txt_TransNum.Focus(); this.Txt_TransNum.SelectAll(); return; } } string str = this.Txt_TransNum.Text.Trim(); string str2 = null; string str3 = null; string str4 = null; string str5 = null; bool flag = false; new Class6().method_15(this.string_1, str, ref str2, ref str3, ref str4, ref flag, ref str5, ref this.string_3); this.Txt_ImpID.Text = str2; this.Txt_ExpID.Text = str3; this.Txt_Remark.Text = str4; this.method_1(); if (this.Lbl_ImpName.Text != string.Empty) { Class11.smethod_3(this); if (!Class7.smethod_50()) { this.btn_Edit.Enabled = Class7.smethod_49(this.Txt_TransNum.Text); this.btn_Delete.Enabled = Class7.smethod_49(this.Txt_TransNum.Text); } Class11.smethod_5(this, "F"); } if (flag) { this.btn_Delete.Text = "&X\x00f3a"; this.btn_Edit.Enabled = true; } else { this.btn_Delete.Text = "&Phục hồi"; this.btn_Edit.Enabled = false; } } break; case Keys.F2: Class7.BrowserForm1("select trans_num as 'Số giao dịch', goods_id AS 'M\x00e3 h\x00e0ng', exp_id AS 'Nơi xuất', qty AS 'Số lượng', amount AS 'Tổng tiền', Status from tblTransaction where tran_date = '" + Class7.smethod_19() + "' and trans_code = '" + this.string_4 + "' order by trans_num ", this.oleDbConnection_1); this.Txt_TransNum.Text = BrowseForm.strReturn; break; } }
private void btn_Save_Click(object sender, EventArgs e) { if (this.TransDetail.RowCount != 0) { double num; double num2; double num3; double num4; this.btn_Skip_Click(this, new EventArgs()); new Class6().ComputeTransnum("P"); Class6.transNum = this.Txt_TransNum.Text.Trim(); string str4 = this.Txt_OldTrans.Text.Trim(); string str = Class7.smethod_19(); string str3 = Class7.smethod_53(); string str2 = this.Txt_PosId.Text.Trim(); int num6 = Class7.GetUserId(); int num7 = Class7.smethod_51(); string str5 = "Trả lại h\x00e0ng b\x00e1n lẻ"; this.string_1 = "select idx,goods_id, Name, qty, unit, amount, discount, surplus, vat_amt from " + this.string_0; this.cnvLekth7 = new OleDbDataAdapter(this.string_1, this.oleDbConnection_0); DataTable dataTable = new DataTable(); this.cnvLekth7.Fill(dataTable); this.oleDbConnection_0.Close(); foreach (DataRow row in dataTable.Rows) { num = Class7.smethod_2(row["amount"]); num2 = Class7.smethod_2(row["vat_amt"]); num3 = Class7.smethod_2(row["discount"]); num4 = Class7.smethod_2(row["surplus"]); this.string_1 = string.Concat(new object[] { "INSERT INTO tblTransaction(tran_date, tran_time, trans_num, trans_code, kit_id, kit_qty, goods_id, qty, 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,station) VALUES('", str, "','", str3, "','", Class6.transNum, "','01','',0,'", row["goods_id"], "',", row["qty"], ",", num, ",", num3, ",", num4, ",", num2, ",0,", num6, ",'", str4, "','','','", str2, "','','01','',0,'',0,1,0,", row["idx"], ",N'", str5, "',1,", num7, ")" }); this.cnvLekth7 = new OleDbDataAdapter(this.string_1, this.oleDbConnection_0); using (DataSet set3 = new DataSet()) { this.cnvLekth7.Fill(set3); } this.oleDbConnection_0.Close(); } this.cnvLekth7 = new OleDbDataAdapter("SELECT * FROM tblTransaction where trans_num = '" + Class6.transNum + "'", this.oleDbConnection_0); DataTable table = new DataTable(); this.cnvLekth7.Fill(table); this.oleDbConnection_0.Close(); foreach (DataRow row in table.Rows) { num = Class7.smethod_2(row["amount"]); num2 = Class7.smethod_2(row["vat_amt"]); num3 = Class7.smethod_2(row["discount"]); num4 = Class7.smethod_2(row["surplus"]); double num5 = num - ((num2 + num3) + num4); this.string_1 = string.Concat(new object[] { "UPDATE tblStockInfo SET exp_qty = exp_qty - ", row["qty"], " , exp_amt = exp_amt - ", num5, ", last_date ='", str, "' WHERE id = '", str2, "' AND goods_id = '", row["goods_id"], "' " }); this.cnvLekth7 = new OleDbDataAdapter(this.string_1, this.oleDbConnection_0); using (DataSet set = new DataSet()) { this.cnvLekth7.Fill(set); } this.oleDbConnection_0.Close(); this.string_1 = string.Concat(new object[] { "UPDATE tblStockInfo SET averimppr = CASE ((begin_qty + imp_qty) - exp_qty) WHEN 0 THEN 0 ELSE ((begin_amt + imp_amt) - exp_amt)/((begin_qty + imp_qty) - exp_qty) END WHERE goods_id = '", row["goods_id"], "' and id = '", row["exp_id"], "'" }); this.cnvLekth7 = new OleDbDataAdapter(this.string_1, this.oleDbConnection_0); using (DataSet set2 = new DataSet()) { this.cnvLekth7.Fill(set2); this.oleDbConnection_0.Close(); continue; } } voucher_2 v2 = new voucher_2(); v2.PrintingSystem.ShowMarginsWarning = false; v2.PrintingSystem.ShowPrintStatusDialog = false; v2.Print(); this.btn_New.Focus(); } }
private void NoteA4_BeforePrint(object sender, PrintEventArgs e) { OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT Pos_id ,goods_id,barcode,shortname,fullname,grp_id,supp_id,rtprice,remark ,user_id ,timeinput FROM tblNotePrn where user_id = " + Class7.GetUserId() + " Order By timeinput ", Class7.oleDbConnection_1); DataSet dataSet = new DataSet(); adapter.Fill(dataSet); Class7.oleDbConnection_1.Close(); base.DataAdapter = adapter; base.DataSource = dataSet.Tables[0]; this.xrtableCell_1.DataBindings.Add("Text", base.DataSource, "rtprice", "{0:n0}"); if (FrmNoteLabelPrn._notebarcode) { this.xrtableCell_4.DataBindings.Add("Text", base.DataSource, "barcode", ""); } else { this.xrtableCell_4.DataBindings.Add("Text", base.DataSource, "goods_id", ""); } this.xrtableCell_0.DataBindings.Add("Text", base.DataSource, "fullname", ""); this.xrtableCell_2.Text = Class7.smethod_14("m_labeltitle").ToString(); }
private void Txt_TransNum_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Return: if (this.string_3 == "S") { string str = this.Txt_TransNum.Text.Trim(); new Class6(); if (Class7.GetUserId() == 1) { this.string_2 = "SELECT * FROM tblTransaction WHERE trans_num = '" + str + "' "; } else { this.string_2 = "SELECT * FROM tblTransaction WHERE trans_num = '" + str + "' AND tran_date = '" + Class7.smethod_19() + "' "; } this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_2, this.oleDbConnection_0); DataSet dataSet = new DataSet(); this.oleDbDataAdapter_0.Fill(dataSet); this.oleDbConnection_0.Close(); if (dataSet.Tables[0].Rows.Count != 0) { this.Txt_ImpID.Text = dataSet.Tables[0].Rows[0]["imp_id"].ToString(); this.Txt_ExpID.Text = dataSet.Tables[0].Rows[0]["exp_id"].ToString(); this.Txt_Remark.Text = dataSet.Tables[0].Rows[0]["remark"].ToString(); this.Txt_Voucher.Text = dataSet.Tables[0].Rows[0]["voucher"].ToString(); this.chk_inclVat.Checked = (bool)dataSet.Tables[0].Rows[0]["vat_incl"]; this.Chk_discpervat.Checked = (bool)dataSet.Tables[0].Rows[0]["discpervat"]; this.Chk_includedisc.Checked = (bool)dataSet.Tables[0].Rows[0]["disc_incl"]; this.CgeIdZyqWF.Text = dataSet.Tables[0].Rows[0]["tax_code"].ToString(); this.method_3(this.string_0, dataSet.Tables[0].Rows[0]["trans_num"].ToString()); Class11.smethod_3(this); this.string_3 = "F"; if (!Class7.smethod_50()) { this.btn_Edit.Enabled = Class7.smethod_49(this.Txt_TransNum.Text); this.btn_Delete.Enabled = Class7.smethod_49(this.Txt_TransNum.Text); } Class11.smethod_5(this, "F"); this.oleDbDataAdapter_0 = new OleDbDataAdapter("select sum(amount) + sum(vat_amt) AS t_amt, sum(amount) AS a_amt, sum(disc_amt) AS d_amt, sum(vat_amt) AS v_amt from " + this.string_0, this.oleDbConnection_0); DataSet set = new DataSet(); this.oleDbDataAdapter_0.Fill(set); this.oleDbConnection_0.Close(); this.method_5(); this.method_1(); } if ((bool)dataSet.Tables[0].Rows[0]["status"]) { this.btn_Delete.Text = "&X\x00f3a"; this.btn_Edit.Enabled = true; } else { this.btn_Delete.Text = "&Phục hồi"; this.btn_Edit.Enabled = false; } } break; case Keys.F2: Class7.BrowserForm1("select trans_num as 'Số giao dịch', goods_id AS 'M\x00e3 h\x00e0ng', exp_id AS 'Nơi xuất', qty AS 'Số lượng', amount AS 'Tổng tiền', Status from tblTransaction where tran_date = '" + Class7.smethod_19() + "' and trans_code = '" + this.string_1 + "' order by trans_num ", this.oleDbConnection_0); this.Txt_TransNum.Text = BrowseForm.strReturn; break; } }
private void method_4() { this.oleDbDataAdapter_0 = new OleDbDataAdapter("delete from tblKitLabelPrn where user_id = " + Class7.GetUserId(), this.oleDbConnection_0); DataSet dataSet = new DataSet(); this.oleDbDataAdapter_0.Fill(dataSet); this.oleDbConnection_0.Close(); this.oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { "SELECT * FROM ", base.Tag.ToString(), " where user_id = ", Class7.GetUserId(), " order by timeinput" }), this.oleDbConnection_0); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); this.oleDbConnection_0.Close(); foreach (DataRow row in dataTable.Rows) { for (int i = 1; i < (int.Parse(row["copies"].ToString()) + 1); i++) { OleDbDataAdapter adapter = new OleDbDataAdapter(string.Concat(new object[] { "INSERT INTO tblKitLabelPrn([timeinput],[kit_id],[description],[rtprice],user_id) VALUES('", row["timeinput"], "', '", row["kit_id"], "',N'", row["description"], "','", row["rtprice"], "',", Class7.GetUserId(), ")" }), this.oleDbConnection_0); using (DataSet set2 = new DataSet()) { adapter.Fill(set2); } this.oleDbConnection_0.Close(); } } }
private void btn_Move_Click(object sender, EventArgs e) { if ((this.Labels_View.RowCount != 0) && (Class7.ParseDoubleValue(this.Txt_Qty.Text) > 0.0)) { double num = Class7.ParseDoubleValue(this.Txt_Qty.Text); string str = this.Txt_GoodsId.Text.Trim(); string str2 = DateTime.Now.ToString("HH:mm:ss"); this.oleDbDataAdapter_0 = new OleDbDataAdapter(string.Concat(new object[] { "update ", base.Tag.ToString(), " set qty = qty - ", num, ", timeinput = '", str2, "' where goods_id = '", str, "' and user_id = ", Class7.GetUserId() }), this.oleDbConnection_1); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_1.Close(); this.method_2(); this.method_1(); } }
private void btn_Save_Click(object sender, EventArgs e) { if (this.Lbl_ImpName.Text == string.Empty) { Class7.ShowMessageBox("Bạn chưa khai b\x00e1o nơi nhập h\x00e0ng", 1); this.Txt_ImpID.Focus(); } else if (this.Lbl_ExpName.Text == string.Empty) { Class7.ShowMessageBox("Bạn chưa khai b\x00e1o nơi xuất h\x00e0ng", 1); this.Txt_ExpID.Focus(); } else if (this.TransDetail.RowCount == 0) { this.Txt_GoodsId.Focus(); } else { string str2 = this.Txt_TransNum.Text.Trim(); string str4 = this.Txt_ExpID.Text.Trim(); string str3 = this.Txt_ImpID.Text.Trim(); this.Txt_Remark.Text.Trim(); this.Txt_Voucher.Text.Trim(); int num1 = this.chk_inclVat.Checked ? 1 : 0; int num2 = this.Chk_includedisc.Checked ? 1 : 0; int num3 = this.Chk_discpervat.Checked ? 1 : 0; this.CgeIdZyqWF.Text.Trim(); if (this.TransDetail.RowCount != 0) { Class6 class2 = new Class6(); string str5 = this.string_3; if (str5 != null) { if (!(str5 == "N")) { if (str5 == "E") { this.iWyIskLbe(this, new EventArgs()); class2.method_18(str2); class2.method_8(str2); class2.method_13(str2); this.method_4(); class2.method_17(str2); class2.method_7(str2, str3); class2.kCnalMegv(this.string_0); class2.method_11(this.string_0, str4); } } else { this.iWyIskLbe(this, new EventArgs()); class2.ComputeTransnum("K"); this.method_4(); class2.method_17(str2); class2.method_7(str2, str3); class2.kCnalMegv(this.string_0); class2.method_11(this.string_0, str4); } } if (this.chkLabelPrn.Checked) { this.oleDbDataAdapter_0 = new OleDbDataAdapter("DELETE FROM tblLABELS", this.oleDbConnection_0); DataSet dataSet = new DataSet(); this.oleDbDataAdapter_0.Fill(dataSet); this.oleDbConnection_0.Close(); string selectCommandText = "SELECT A.goods_id, A.full_name, A.grp_id,A.piceunit, A.merc_type, B.rtprice, C.trans_num,C.qty, C.exp_id,C.imp_id, C.recnum FROM tblGoods AS A INNER JOIN tblPrice AS B ON A.goods_id = B.goods_id INNER JOIN tblTransaction AS C ON A.goods_id = C.goods_id where C.trans_num = '" + str2 + "' "; this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, Class7.oleDbConnection_1); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); Class7.oleDbConnection_1.Close(); foreach (DataRow row in dataTable.Rows) { selectCommandText = "INSERT INTO tblLABELS([idx],[timeinput],[goods_id],[fullname],[shortname],[grp_id],[supp_id],[rtprice],[qty],user_id) "; object obj2 = selectCommandText; obj2 = string.Concat(new object[] { obj2, "VALUES(", row["recnum"], ",'", row["recnum"].ToString(), "','", row["goods_id"], "','", row["full_name"], "','", row["full_name"], "'," }); OleDbDataAdapter adapter = new OleDbDataAdapter(string.Concat(new object[] { obj2, "'", row["grp_id"], "','", row["exp_id"], "','", row["rtprice"], "',", row["qty"], ",", Class7.GetUserId(), ")" }), this.oleDbConnection_0); using (DataSet set = new DataSet()) { adapter.Fill(set); } this.oleDbConnection_0.Close(); } } Class6.transNum = str2; Class7.CreateReportInstance("v_frsupp").ShowPreviewDialog(); } } }
private void method_1() { string str = this.txtTransNum.Text.Trim(); string str3 = (this.txtRemark.Text == string.Empty) ? "Phiếu trả s\x00e1ch" : this.txtRemark.Text.Trim(); string str2 = this.txtCsId.Text.Trim(); for (int i = 0; i < this.dataSet_0.Tables["loantran"].Rows.Count; i++) { if ((bool)this.dataSet_0.Tables["loantran"].Rows[i]["chk_rb"]) { object obj2 = this.dataSet_0.Tables["loantran"].Rows[i]["goods_id"]; object obj3 = this.dataSet_0.Tables["loantran"].Rows[i]["oldtran"]; this.string_0 = string.Concat(new object[] { "INSERT INTO tblLoanTran(trans_num, tran_date,trans_code, tran_time, exp_id, cs_id, goods_id, qty, user_id, remark, status, corr_tran) VALUES ('", str, "','", Class7.smethod_19(), "','", this.string_2, "','", Class7.smethod_53(), "','", Class7.smethod_40(), "','", str2, "','", obj2, "',1,", Class7.GetUserId(), ",N'", str3, "',1,'", obj3, "')" }); Class7.smethod_4(this.string_0); Class2.smethod_1(Class7.smethod_40(), obj2.ToString(), 1.0); } } }
private void method_4() { string str = this.Txt_TransNum.Text.Trim(); string str2 = this.Txt_OrderNumber.Text.Trim(); string str4 = this.bool_0 ? Class7.smethod_53() : this.string_4; string str5 = this.Txt_ExpID.Text.Trim(); string str6 = this.Txt_ImpID.Text.Trim(); string str7 = this.Txt_Remark.Text.Trim(); string str8 = this.Txt_Voucher.Text.Trim(); int num8 = this.chk_inclVat.Checked ? 1 : 0; int num7 = this.Chk_includedisc.Checked ? 1 : 0; int num = this.Chk_discpervat.Checked ? 1 : 0; string str3 = this.Cmb_TaxCode.Text.Trim(); double num2 = Class7.ParseDoubleValue(this.Txt_Vatrate.Text) / 100.0; this.oleDbDataAdapter_0 = new OleDbDataAdapter("SELECT goods_id,qty,price,amount,idx,unitsymb, disc_amt,vat_amt,surplus,merc_type,disc_pc FROM " + this.string_0, this.oleDbConnection_0); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); double num3 = 0.0; double num4 = 0.0; double num5 = 0.0; double num6 = 0.0; foreach (DataRow row in dataTable.Rows) { num3 = Class7.smethod_2(row["price"]) * Class7.smethod_2(row["qty"]); double num9 = Class7.smethod_2(row["disc_pc"]); if (this.Chk_discpervat.Checked) { if (this.Chk_includedisc.Checked) { num3 /= 1.0 + ((num9 / 100.0) / (1.0 - (num9 / 100.0))); } num4 = Math.Round((double)((num3 * (num9 / 100.0)) / (1.0 - (num9 / 100.0))), 2); if (this.chk_inclVat.Checked) { num3 /= 1.0 + num2; } } else { num5 = 0.0; if (this.chk_inclVat.Checked) { num5 = num2; } if (this.Chk_includedisc.Checked) { num5 += (num9 / 100.0) / (1.0 - (num9 / 100.0)); } num3 = Math.Round((double)((Class7.smethod_2(row["price"]) * Class7.smethod_2(row["qty"])) / (1.0 + num5)), 2); num4 = Math.Round((double)((num3 * (num9 / 100.0)) / (1.0 - (num9 / 100.0))), 2); } num6 = Math.Round((double)(num3 * num2), 2); string selectCommandText = "INSERT INTO tblTransaction(tran_date, tran_time, trans_num, trans_code, voucher, invoice, post, exp_id, imp_id, "; string str10 = 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,ref,station) "; object obj2 = str10 + "VALUES('" + Class7.smethod_19() + "','" + str4 + "','" + str + "','" + this.string_1 + "','" + str8 + "','',0,'" + str5 + "',"; obj2 = string.Concat(new object[] { obj2, "'", str6, "','", row["goods_id"], "', ", row["qty"], ", '", row["unitsymb"], "',", num3, ", " }); obj2 = string.Concat(new object[] { obj2, num4, ", ", num6, ", ", row["surplus"], ", 0, " }); obj2 = string.Concat(new object[] { obj2, Class7.GetUserId(), ",'' ,N'", str7, "' ,0 ,'", row["merc_type"], "' ," }); selectCommandText = string.Concat(new object[] { obj2, "'", str3, "' ,", num8, ",", num, ",", num7, ",0 ,", row["idx"], " ,1,'", str2, "',", Class7.smethod_51(), ")" }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_0); using (DataSet set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_0.Close(); } }