Exemplo n.º 1
0
 private void btnReprint_Click(object sender, EventArgs e)
 {
     if ((this.string_2 == "D") && !(this.Txt_TransNum.Text == string.Empty))
     {
         Class11.string_1 = "R";
         Class6.transNum  = this.Txt_TransNum.Text.Trim();
         voucher_1 r_ = new voucher_1();
         r_.PrintingSystem.ShowMarginsWarning    = false;
         r_.PrintingSystem.ShowPrintStatusDialog = false;
         try
         {
             r_.Print();
         }
         catch (Exception)
         {
             Class7.ShowMessageBox("Kh\x00f4ng t\x00ecm thấy m\x00e1y in", 1);
         }
     }
 }
Exemplo n.º 2
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);
                }
            }
        }