Esempio n. 1
0
 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();
             }
         }
     }
 }
Esempio n. 2
0
        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();
                    }
                }
            }
        }
Esempio n. 3
0
 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 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)
         {
             Class6 class2 = new Class6();
             string str    = Class11.string_0;
             if (str != null)
             {
                 if (!(str == "N"))
                 {
                     if (str == "E")
                     {
                         this.btn_Skip_Click(this, new EventArgs());
                         class2.method_20(str2);
                         class2.method_10(str2);
                         class2.method_13(str2);
                         class2.method_6(this.string_0, str2, this.string_1, str3, str4, str6, str5, this.string_3);
                         class2.method_9(str2, str3);
                     }
                 }
                 else
                 {
                     this.btn_Skip_Click(this, new EventArgs());
                     class2.ComputeTransnum("K");
                     string str7 = Class7.smethod_53();
                     class2.method_6(this.string_0, str2, this.string_1, str3, str4, str6, str5, str7);
                     class2.method_19(str2);
                     class2.method_9(str2, str3);
                 }
             }
             Class6.transNum = str2;
             v_tosupp sup = new v_tosupp();
             sup.ShowPreviewDialog();
         }
     }
 }
Esempio n. 4
0
 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();
         this.Txt_ExpID.Text.Trim();
         this.Txt_ImpID.Text.Trim();
         this.Txt_Remark.Text.Trim();
         this.Txt_Voucher.Text.Trim();
         if (this.TransDetail.RowCount != 0)
         {
             Class6 class2 = new Class6();
             string str    = Class11.string_0;
             if (str != null)
             {
                 if (!(str == "N"))
                 {
                     if (str == "E")
                     {
                         this.btn_Skip_Click(this, new EventArgs());
                         class2.method_10(str2);
                         this.method_5(str2);
                         class2.method_13(str2);
                         this.method_3();
                         this.method_6();
                         this.method_4();
                     }
                 }
                 else
                 {
                     this.btn_Skip_Click(this, new EventArgs());
                     class2.ComputeTransnum("K");
                     this.method_3();
                     this.method_6();
                     this.method_4();
                 }
             }
             Class6.transNum = str2;
             Class7.CreateReportInstance(Class6.string_3).ShowPreviewDialog();
             Class7.CreateReportInstance(Class6.string_4).ShowPreviewDialog();
         }
     }
 }
Esempio n. 5
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (this.Lbl_ExpName.Text == string.Empty)
     {
         this.Txt_ExpID.Focus();
     }
     else if (this.TransDetail.RowCount == 0)
     {
         this.Txt_GoodsId.Focus();
     }
     else
     {
         string str2 = this.Txt_TransNum.Text.Trim();
         string str3 = this.Txt_ExpID.Text.Trim();
         string str5 = this.Txt_Remark.Text.Trim();
         string str4 = string.Empty;
         if (this.TransDetail.RowCount != 0)
         {
             Class6 class2 = new Class6();
             string str    = Class11.string_0;
             if (str != null)
             {
                 if (!(str == "N"))
                 {
                     if (str == "E")
                     {
                         this.btn_Skip_Click(this, new EventArgs());
                         class2.method_10(str2);
                         class2.method_13(str2);
                         class2.method_6(this.string_1, str2, this.string_2, str3, "", str4, str5, this.string_3);
                         class2.method_9(str2, str3);
                     }
                 }
                 else
                 {
                     this.btn_Skip_Click(this, new EventArgs());
                     class2.ComputeTransnum("K");
                     string str6 = Class7.smethod_53();
                     class2.method_6(this.string_1, str2, this.string_2, str3, "", str4, str5, str6);
                     class2.method_9(str2, str3);
                 }
             }
             Class6.transNum = str2;
             Class7.CreateReportInstance(Class6.string_3).ShowPreviewDialog();
         }
     }
 }
Esempio n. 6
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (this.Lbl_StockName.Text == string.Empty)
     {
         this.Txt_StockId.Focus();
     }
     else if (this.TransDetail.RowCount != 0)
     {
         string str5   = Class7.smethod_19();
         string str4   = DateTime.Now.ToString("HH:mm");
         string str3   = this.Txt_TransNum.Text.Trim();
         string str2   = this.Txt_StockId.Text.Trim();
         string str    = this.Txt_Remark.Text.Trim();
         Class6 class2 = new Class6();
         string str6   = Class11.string_0;
         if (str6 != null)
         {
             if (!(str6 == "N"))
             {
                 if (str6 == "E")
                 {
                     this.bool_0 = false;
                     this.btn_Skip_Click(this, new EventArgs());
                     this.method_4();
                     class2.method_13(str3);
                     this.method_3();
                     this.method_2();
                 }
             }
             else
             {
                 this.bool_0 = true;
                 this.btn_Skip_Click(this, new EventArgs());
                 class2.ComputeTransnum("K");
                 this.method_3();
                 this.method_2();
             }
         }
         Class6.string_8 = str;
         Class6.string_9 = str2;
         Class6.transNum = str3;
         Class6.string_6 = str4;
         Class6.string_7 = str5;
         Class7.CreateReportInstance(Class6.string_3).ShowPreviewDialog();
     }
 }
Esempio n. 7
0
 private void kCnalMegv(object sender, EventArgs e)
 {
     if (this.Lbl_ImpName.Text == string.Empty)
     {
         this.Txt_ImpID.Focus();
     }
     else if (this.Lbl_ExpName.Text == string.Empty)
     {
         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 str2 = 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.Cmb_TaxCode.Text.Trim();
         if (this.TransDetail.RowCount != 0)
         {
             Class6 class2 = new Class6();
             string str4   = this.string_3;
             if (str4 != null)
             {
                 if (!(str4 == "N"))
                 {
                     if (str4 == "E")
                     {
                         this.bool_0 = false;
                         this.btn_Skip_Click(this, new EventArgs());
                         class2.method_18(str);
                         class2.method_8(str);
                         class2.method_13(str);
                         this.method_4();
                         class2.method_17(str);
                         class2.method_7(str, str2);
                         class2.kCnalMegv(this.string_0);
                         class2.method_11(this.string_0, str3);
                     }
                 }
                 else
                 {
                     this.bool_0 = true;
                     this.btn_Skip_Click(this, new EventArgs());
                     WaitDialogForm form = new WaitDialogForm();
                     form.Caption = "Xin đợi một ch\x00fat ....";
                     class2.ComputeTransnum("K");
                     this.method_4();
                     class2.method_17(str);
                     class2.method_7(str, str2);
                     class2.kCnalMegv(this.string_0);
                     class2.method_11(this.string_0, str3);
                     this.string_2           = "UPDATE tblOn_order SET status = 0 WHERE trans_num = '" + this.Txt_OrderNumber.Text + "'  ";
                     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();
                     }
                     form.Close();
                 }
             }
             Class6.transNum = str;
             Class7.CreateReportInstance("v_frsupp").ShowPreviewDialog();
         }
     }
 }
Esempio n. 8
0
 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();
         }
     }
 }
Esempio n. 9
0
        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();
                }
            }
        }
Esempio n. 10
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);
                }
            }
        }
Esempio n. 11
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();
        }