コード例 #1
0
        private void frmReport_CTBanHang_Load(object sender, EventArgs e)
        {
            DataTable tableMaMon = new DataTable();

            tableMaMon            = monBO.getMaMon();
            cbMaMon.DataSource    = tableMaMon;
            cbMaMon.DisplayMember = "MaMon";
            cbMaMon.ValueMember   = "MaMon";
            cbMaMon.SelectedIndex = 0;
            SqlConnection connect;

            connect = new SqlConnection(@"server=.\SQLEXPRESS; Database=QuanLiCaPhe;integrated security=true");
            connect.Open();
            SqlDataAdapter da    = new SqlDataAdapter();
            string         query = "Select * from tblCTDoanhThu";
            SqlDataAdapter dscm  = new SqlDataAdapter(query, connect);
            DSBangLuong    ds    = new DSBangLuong();

            dscm.Fill(ds, "tblCTDoanhThu");
            connect.Close();
            Report_CTBan objRpt = new Report_CTBan();

            objRpt.SetDataSource(ds.Tables[1]);
            crystalReportViewer_BH.ReportSource = objRpt;
            crystalReportViewer_BH.Refresh();
        }
コード例 #2
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            int    t     = 0;
            string thang = cbThang.Text;

            Int32.TryParse(thang, out t);
            SqlConnection connect;

            connect = new SqlConnection(@"server=.\SQLEXPRESS; Database=QuanLiCaPhe;integrated security=true");
            connect.Open();
            SqlDataAdapter da    = new SqlDataAdapter();
            string         query = "SELECT Thang,MaNV,TenNV,TongGioLam,MucLuong,TienLuong FROM tblBangLuong where Thang='" + t + "'";
            SqlDataAdapter dscm  = new SqlDataAdapter(query, connect);
            DSBangLuong    ds    = new DSBangLuong();

            dscm.Fill(ds, "tblBangLuong");
            connect.Close();
            Report_BL objRpt = new Report_BL();

            objRpt.SetDataSource(ds.Tables[1]);
            crystalReportViewer_BL.ReportSource = objRpt;
            crystalReportViewer_BL.Refresh();
        }
コード例 #3
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            string query = "";

            if (rdXemTheoNgay.Checked == true)
            {
                DateTime ngay = Convert.ToDateTime(dtNgay.Value.ToShortDateString());
                query = "Select * from tblCTDoanhThu where Ngay='" + ngay + "'";
            }
            if (rdXemTheoMaMon.Checked == true)
            {
                string maMon = cbMaMon.SelectedValue.ToString();
                query = "Select * from tblCTDoanhThu where MaMon='" + maMon + "'";
            }
            if (rdXemTheoCaHai.Checked == true)
            {
                DateTime ngay  = Convert.ToDateTime(dtNgay.Value.ToShortDateString());
                string   maMon = cbMaMon.SelectedValue.ToString();
                query = "Select * from tblCTDoanhThu where MaMon='" + maMon + "' and Ngay='" + ngay + "'";
            }
            SqlConnection connect;

            connect = new SqlConnection(@"server=.\SQLEXPRESS; Database=QuanLiCaPhe;integrated security=true");
            connect.Open();
            SqlDataAdapter da   = new SqlDataAdapter();
            SqlDataAdapter dscm = new SqlDataAdapter(query, connect);
            DSBangLuong    ds   = new DSBangLuong();

            dscm.Fill(ds, "tblCTDoanhThu");
            connect.Close();
            Report_CTBan objRpt = new Report_CTBan();

            objRpt.SetDataSource(ds.Tables[1]);
            crystalReportViewer_BH.ReportSource = objRpt;
            crystalReportViewer_BH.Refresh();
        }