예제 #1
0
        private void btn_BaoCao_Click(object sender, EventArgs e)
        {
            List <int> SelectedDV = new List <int>();

            if (clb_DonVi.GetItemCheckState(0) == CheckState.Checked)
            {
                SelectedDV = null;
            }
            else
            {
                foreach (object item in clb_DonVi.CheckedItems)
                {
                    DataRowView drv = (DataRowView)item;

                    SelectedDV.Add(Convert.ToInt32(drv["id"]));
                }

                if (SelectedDV.Count <= 0)
                {
                    SelectedDV = null;
                }
            }

            List <int> SelectedHocHam = new List <int>();

            if (clb_HocHam.GetItemCheckState(0) == CheckState.Checked)
            {
                SelectedHocHam = null;
            }
            else
            {
                foreach (object item in clb_HocHam.CheckedItems)
                {
                    DataRowView drv = (DataRowView)item;

                    SelectedHocHam.Add(Convert.ToInt32(drv["id"]));
                }

                if (SelectedHocHam.Count <= 0)
                {
                    SelectedHocHam = null;
                }
            }

            List <int> SelectedChucDanh = new List <int>();

            if (clb_ChucDanh.GetItemCheckState(0) == CheckState.Checked)
            {
                SelectedChucDanh = null;
            }
            else
            {
                foreach (object item in clb_ChucDanh.CheckedItems)
                {
                    DataRowView drv = (DataRowView)item;

                    SelectedChucDanh.Add(Convert.ToInt32(drv["id"]));
                }

                if (SelectedChucDanh.Count <= 0)
                {
                    SelectedChucDanh = null;
                }
            }

            DataTable dt_NV = oBaoCao.NV_Theo_HocHam_HocVi_GioiTinh(SelectedDV, SelectedChucDanh, SelectedHocHam);

            DataSet.NVTheo_HocHam_HocVi_GioiTinh ds  = new DataSet.NVTheo_HocHam_HocVi_GioiTinh();
            Reports.NVTheo_HocHam_HocVi_GioiTinh rpt = new Reports.NVTheo_HocHam_HocVi_GioiTinh();

            rpt.SetDataSource(dt_NV);
            crystalReportViewer1.ReportSource = rpt;

            ((TextObject)(rpt.Subreports["Header.rpt"].ReportDefinition.ReportObjects["rptName"])).Text = "Báo cáo thống kê nhân viên";
        }
        private void btn_BaoCao_Click(object sender, EventArgs e)
        {
            List<int> SelectedDV = new List<int>();

            if (clb_DonVi.GetItemCheckState(0) == CheckState.Checked)
                SelectedDV = null;
            else
            {
                foreach (object item in clb_DonVi.CheckedItems)
                {
                    DataRowView drv = (DataRowView)item;

                    SelectedDV.Add(Convert.ToInt32(drv["id"]));
                }

                if (SelectedDV.Count <= 0) SelectedDV = null;
            }

            List<int> SelectedHocHam = new List<int>();

            if (clb_HocHam.GetItemCheckState(0) == CheckState.Checked)
                SelectedHocHam = null;
            else
            {
                foreach (object item in clb_HocHam.CheckedItems)
                {
                    DataRowView drv = (DataRowView)item;

                    SelectedHocHam.Add(Convert.ToInt32(drv["id"]));
                }

                if (SelectedHocHam.Count <= 0) SelectedHocHam = null;
            }

            List<int> SelectedChucDanh = new List<int>();

            if (clb_ChucDanh.GetItemCheckState(0) == CheckState.Checked)
                SelectedChucDanh = null;
            else
            {
                foreach (object item in clb_ChucDanh.CheckedItems)
                {
                    DataRowView drv = (DataRowView)item;

                    SelectedChucDanh.Add(Convert.ToInt32(drv["id"]));
                }

                if (SelectedChucDanh.Count <= 0) SelectedChucDanh = null;
            }

            DataTable dt_NV = oBaoCao.NV_Theo_HocHam_HocVi_GioiTinh(SelectedDV, SelectedChucDanh, SelectedHocHam);

            DataSet.NVTheo_HocHam_HocVi_GioiTinh ds = new DataSet.NVTheo_HocHam_HocVi_GioiTinh();
            Reports.NVTheo_HocHam_HocVi_GioiTinh rpt = new Reports.NVTheo_HocHam_HocVi_GioiTinh();

            rpt.SetDataSource(dt_NV);
            crystalReportViewer1.ReportSource = rpt;

            ((TextObject)(rpt.Subreports["Header.rpt"].ReportDefinition.ReportObjects["rptName"])).Text = "Báo cáo thống kê nhân viên";


        }