public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { RptDRSummaryPerArea_ rpt = new RptDRSummaryPerArea_(); rpt.Site = this.Site; return rpt; }
private void InitializeReport() { int year = int.Parse(Request.QueryString["Year"]); int days_count = GetMonthDayCount(year, 2); string DRStatus = Request.QueryString["Status"]; string Template = Request.QueryString["Template"]; DateTime DateTo = new DateTime(year, 12, 31); DateTime DateFrom = new DateTime(year, 1, 1); ReportDocument REPORT_DOC = new ReportDocument(); string reportCacheKey = string.Concat("DRSummaryPerArea", year, Request.QueryString["Brand"],DRStatus); string reportCacheKey_Sum = string.Concat("DRSummaryPerAreaSum", year, Request.QueryString["Brand"],DRStatus); ParameterField prmDateFrom = new ParameterField(); ParameterField prmDateTo = new ParameterField(); ParameterField prmBrand = new ParameterField(); ParameterField prmFebDaysCount = new ParameterField(); ParameterField prmDRStatus = new ParameterField(); ParameterFields prmList = new ParameterFields(); prmDateFrom.ParameterFieldName = "@DATE_FROM_PARAM"; prmDateTo.ParameterFieldName = "@DATE_TO_PARAM"; prmBrand.ParameterFieldName = "@BRAND_NAME"; prmFebDaysCount.ParameterFieldName="@FEB_DAY_"; prmDRStatus.ParameterFieldName = "@DR_STATUS"; ParameterDiscreteValue prmDateFromValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmDateToValue = new ParameterDiscreteValue(); ParameterDiscreteValue pramBrandValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmFebDaysCountValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmDRStatusValue = new ParameterDiscreteValue(); prmDateFromValue.Value = DateFrom; prmDateToValue.Value = DateTo; pramBrandValue.Value = Request.QueryString["Brand"]; prmFebDaysCountValue.Value = days_count; prmDRStatusValue.Value = DRStatus; prmDateFrom.CurrentValues.Add(prmDateFromValue); prmDateTo.CurrentValues.Add(prmDateToValue); prmBrand.CurrentValues.Add(pramBrandValue); prmFebDaysCount.CurrentValues.Add(prmFebDaysCountValue); prmDRStatus.CurrentValues.Add(prmDRStatusValue); prmList.Add(prmDateFrom); prmList.Add(prmDateTo); prmList.Add(prmBrand); prmList.Add(prmFebDaysCount); prmList.Add(prmDRStatus); if (Template.Equals("ALL")) { if (Cache[reportCacheKey] != null) { REPORT_DOC = (RptDRSummaryPerArea)Cache[reportCacheKey]; } else { REPORT_DOC = new RptDRSummaryPerArea(); Cache.Insert(reportCacheKey, REPORT_DOC); } } else { if (Cache[reportCacheKey_Sum] != null) { REPORT_DOC = (RptDRSummaryPerArea_)Cache[reportCacheKey_Sum]; } else { REPORT_DOC = new RptDRSummaryPerArea_(); Cache.Insert(reportCacheKey_Sum, REPORT_DOC); } } DataBaseLogIn(REPORT_DOC); this.DRSummaryPerAreaReport.ParameterFieldInfo = prmList; DRSummaryPerAreaReport.ReportSource = REPORT_DOC; }