public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrystalReportThongKeLoaiMonAn rpt = new CrystalReportThongKeLoaiMonAn(); rpt.Site = this.Site; return(rpt); }
/// <summary> /// Xem chi tiết báo cáo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChiTiet_Click(object sender, EventArgs e) { switch (((PhuongThuctimKiem)cbThongKe.SelectedItem).Loai) { case 0: string tenma = StaticClass.xoakhoangtrang(txbSearchFood.Text); DateTime tuNgay = dtpkTuNgay.Value; DateTime denNgay = dtpkDenNgay.Value; CrystalReportThongKeTenMonAn cr = new CrystalReportThongKeTenMonAn(); cr.SetDataSource(HoaDonDAO.Instance.USP_getThongKeTheoTenchiTiet(tenma, tuNgay, denNgay)); ParameterFieldDefinitions crParameterFieldDefinitions = cr.DataDefinition.ParameterFields; ParameterFieldDefinition crParameterFieldDefinition = crParameterFieldDefinitions["TuNgay"]; ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue(); crParameterDiscreteValue.Value = tuNgay; ParameterValues crParameterValues = new ParameterValues(); //reset lại value crParameterValues = crParameterFieldDefinition.CurrentValues; crParameterValues.Add(crParameterDiscreteValue); crParameterFieldDefinition.ApplyCurrentValues(crParameterValues); ParameterFieldDefinition crParameterFieldDefinitionDenNgay = crParameterFieldDefinitions["DenNgay"]; ParameterDiscreteValue crParameterDiscreteValueDenNgay = new ParameterDiscreteValue(); crParameterDiscreteValueDenNgay.Value = denNgay; ParameterValues crParameterValuesDenNgay = new ParameterValues(); //reset lại value crParameterValuesDenNgay = crParameterFieldDefinitionDenNgay.CurrentValues; crParameterValuesDenNgay.Add(crParameterDiscreteValueDenNgay); crParameterFieldDefinitionDenNgay.ApplyCurrentValues(crParameterValuesDenNgay); fReport f = new fReport(cr); f.ShowDialog(); break; case 1: string tenLoai = StaticClass.xoakhoangtrang(txbSearchFood.Text); DateTime tuNgayLoai = dtpkTuNgay.Value; DateTime denNgayLoai = dtpkDenNgay.Value; CrystalReportThongKeLoaiMonAn crLoai = new CrystalReportThongKeLoaiMonAn(); crLoai.SetDataSource(HoaDonDAO.Instance.USP_getThongKeTheoLoaichiTiet(tenLoai, tuNgayLoai, denNgayLoai)); ParameterFieldDefinitions crParameterFieldDefinitionsLoai = crLoai.DataDefinition.ParameterFields; ParameterFieldDefinition crParameterFieldDefinitionLoai = crParameterFieldDefinitionsLoai["TuNgay"]; ParameterDiscreteValue crParameterDiscreteValueLoai = new ParameterDiscreteValue(); crParameterDiscreteValueLoai.Value = tuNgayLoai; ParameterValues crParameterValuesLoai = new ParameterValues(); //reset lại value crParameterValues = crParameterFieldDefinitionLoai.CurrentValues; crParameterValues.Add(crParameterDiscreteValueLoai); crParameterFieldDefinitionLoai.ApplyCurrentValues(crParameterValues); ParameterFieldDefinition crParameterFieldDefinitionDenNgayLoai = crParameterFieldDefinitionsLoai["DenNgay"]; ParameterDiscreteValue crParameterDiscreteValueDenNgayLoai = new ParameterDiscreteValue(); crParameterDiscreteValueDenNgayLoai.Value = denNgayLoai; ParameterValues crParameterValuesDenNgayLoai = new ParameterValues(); //reset lại value crParameterValuesDenNgayLoai = crParameterFieldDefinitionDenNgayLoai.CurrentValues; crParameterValuesDenNgayLoai.Add(crParameterDiscreteValueDenNgayLoai); crParameterFieldDefinitionDenNgayLoai.ApplyCurrentValues(crParameterValuesDenNgayLoai); fReport fLoai = new fReport(crLoai); fLoai.ShowDialog(); break; } }