Esempio n. 1
0
        private void btn_xembaocaox_Click_1(object sender, EventArgs e)
        {
            Frm_BaoCaoX_F.TenKho    = cbx_khox.Text;
            Frm_BaoCaoX_F.TenNcc_Kh = cbx_khachhangx.Text;
            Frm_BaoCaoX_F.TenNv     = cbx_nvx.Text;
            Frm_BaoCaoX_F.TenSp     = cbx_spx.Text;
            Frm_BaoCaoX_F.TuNgay    = tbx_tungayx.Text;
            Frm_BaoCaoX_F.NgayNh_Xu = tbx_ngayxuatx.Text;
            Frm_BaoCaoX_F.DenNgay   = tbx_denngayx.Text;
            Frm_BaoCaoX_F.Gia       = cbx_giax.Text;

            Frm_BaoCaoX_F m = new Frm_BaoCaoX_F();

            m.ShowDialog();
        }
Esempio n. 2
0
        private void BaoCaoX_F_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();
            string        sql = @"Data Source=DESKTOP-3SFFPGN\HAUMTA;Initial Catalog=QuanLyKhoHang;Integrated Security=True";

            con.ConnectionString = sql;
            con.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "BCX";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@TENNV", TenNv));
            cmd.Parameters.Add(new SqlParameter("@TENSP", TenSp));
            cmd.Parameters.Add(new SqlParameter("@TENKH", TenNcc_Kh));
            cmd.Parameters.Add(new SqlParameter("@TENKHO", TenKho));
            cmd.Parameters.Add(new SqlParameter("@NGAYXUAT", NgayNh_Xu));
            cmd.Parameters.Add(new SqlParameter("@GIA", Gia));
            cmd.Parameters.Add(new SqlParameter("@TUNGAY", TuNgay));
            cmd.Parameters.Add(new SqlParameter("@DENNGAY", DenNgay));
            cmd.Connection = con;
            cmd.ExecuteNonQuery();
            DataSet        ds  = new DataSet();
            SqlDataAdapter sda = new SqlDataAdapter(cmd);

            sda.Fill(ds);
            reportViewer1.ProcessingMode         = ProcessingMode.Local;
            reportViewer1.LocalReport.ReportPath = "BaoCaoXuat.rdlc";
            if (ds.Tables[0].Rows.Count > 0)
            {
                ReportDataSource rds = new ReportDataSource();
                rds.Name  = "BaoCaoXuat";
                rds.Value = ds.Tables[0];
                reportViewer1.LocalReport.DataSources.Clear();
                reportViewer1.LocalReport.DataSources.Add(rds);
                reportViewer1.RefreshReport();
            }
            else
            {
                MessageBox.Show("Không Có Dữ Liệu!");
                Frm_BaoCaoX_F bcf = new Frm_BaoCaoX_F();
                bcf.Hide();
            }
        }