protected override void Setup() { base.Setup(); Helpers.MessageHolder(); Singular.Reporting.IReport Report = (Singular.Reporting.IReport)Model; if (Report.CustomCriteriaControlType == null) { Singular.Reporting.Dynamic.ROParameterList ParameterList = Report.ReportCriteriaGeneric.ParameterList; if (ParameterList != null) { SetupDynamicReportCriteria(ParameterList); } else { SetupStronglyTypedReportCriteria(ViewModel.Report.ReportName); } } else { Helpers.Control(Activator.CreateInstance(Report.CustomCriteriaControlType).GetType()); } Report.CustomButtons.Where(c => !c.AfterNormalButtons).ToList().ForEach(AddCustomButton); if (Report.CrystalReportType != null & Report.HideCrystalReport == false) { { var withBlock = Helpers.Button("View as PDF"); // .AddBinding(KnockoutBindingString.click, "ViewPDF()") withBlock.PostBackType = PostBackType.Full; withBlock.Image.Src = "~/Singular/Images/IconPDF.png"; withBlock.Validate = true; withBlock.ID = "PDF"; } if (Report.ShowWordExport) { { var withBlock = Helpers.Button("Word", "View As Word"); withBlock.AddClass("btn btn-primary"); withBlock.PostBackType = PostBackType.Full; withBlock.Image.Src = "~/Singular/Images/IconWord.png"; withBlock.Validate = true; Style.BackgroundColour = "transparent"; } } } if (Report.AllowDataExport) { { var withBlock = Helpers.Button("Export Data"); withBlock.AddClass("btn btn-primary btn-outline"); withBlock.PostBackType = PostBackType.Full; withBlock.Image.Src = "~/Singular/Images/IconExcelData.png"; withBlock.Validate = true; } } var gi = Report.GridInfo; if (gi != null) { { var withBlock = Helpers.Button("GridData", "View Data"); withBlock.AddClass("btn btn-info btn-outline"); withBlock.Image.Src = "~/Singular/Images/IconExcelData.png"; withBlock.AddBinding(KnockoutBindingString.click, "Singular.GridReport.ShowOptions(e)"); } } Report.CustomButtons.Where(c => c.AfterNormalButtons).ToList().ForEach(AddCustomButton); { var withBlock = Helpers.Div(); withBlock.Style.ClearBoth(); withBlock.Style.Height = "30px"; } }
private void SetupDynamicReportCriteria(Singular.Reporting.Dynamic.ROParameterList ParameterList) { { var withBlock = Helpers.With <Singular.Reporting.ReportCriteria>(c => c.Report.ReportCriteriaGeneric); ROParameter StartDateP = ParameterList.Find("StartDate"); ROParameter EndDateP = ParameterList.Find("EndDate"); if (StartDateP != null || EndDateP != null) { // Add Date container { var withBlock1 = withBlock.Helpers.FieldSet("Date Selection"); { var withBlock2 = withBlock1.Helpers.DivC("ibox"); { var withBlock3 = withBlock2.Helpers.DivC("row"); { var withBlock4 = withBlock3.Helpers.DivC("col-md-12 paddingTopBottom"); { var withBlock5 = withBlock4.Helpers.DivC("ibox-content"); { var withBlock6 = withBlock5.Helpers.DivC("row"); // Julzy We need to add java script here for an on click event for the date picker "date" heading to change color - it also needs to be font size 16px // Start Date if (StartDateP != null) { { var withBlock7 = withBlock6.Helpers.Div(); withBlock7.Style.FloatLeft(); //withBlock7.Style("padding") = "5px"; { var withBlock8 = withBlock7.Helpers.HTMLTag("span"); // withBlock8.Style.Padding(null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, "5px"); //withBlock8.Style("font-size") = "16px"; withBlock8.Style.Display = Display.block; withBlock8.AddBinding(KnockoutBindingString.text, "'Start Date: '+ dateFormat(StartDate(), 'dd MMM yyyy')"); } Singular.Web.CustomControls.DateEditor <object> de = new Singular.Web.CustomControls.DateEditor <object>("StartDate", "", new Singular.DataAnnotations.DateField() { AlwaysShow = true, AutoChange = Singular.DataAnnotations.AutoChangeType.StartOfMonth, MaxDateProperty = EndDateP != null ? "EndDate" : "" }); withBlock7.Helpers.Control(de); } } // End Date if (EndDateP != null) { { var withBlock7 = withBlock6.Helpers.Div(); withBlock7.Style.FloatLeft(); //withBlock7.Style("padding") = "5px"; { var withBlock8 = withBlock7.Helpers.HTMLTag("span"); // withBlock8.Style.Padding(null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, "5px"); //withBlock8.Style.FontSize() = "16px"; withBlock8.Style.Display = Display.block; withBlock8.AddBinding(KnockoutBindingString.text, "'End Date: '+ dateFormat(EndDate(), 'dd MMM yyyy')"); } Singular.Web.CustomControls.DateEditor <object> de = new Singular.Web.CustomControls.DateEditor <object>("EndDate", "", new Singular.DataAnnotations.DateField() { AlwaysShow = true, AutoChange = Singular.DataAnnotations.AutoChangeType.EndOfMonth, MinDateProperty = StartDateP != null ? "StartDate" : "" }); withBlock7.Helpers.Control(de); } } } } } } } } } Singular.Web.CustomControls.FieldSet <Singular.Reporting.ReportCriteria, Singular.Reporting.ReportCriteria> mCriteriaGroup = null /* TODO Change to default(_) if this is not a reference type */; { var withBlock1 = withBlock.Helpers.DivC("ibox"); { var withBlock2 = withBlock1.Helpers.DivC("row"); { var withBlock3 = withBlock2.Helpers.DivC("col-md-12 paddingTopBottom"); { var withBlock4 = withBlock3.Helpers.DivC("ibox-content"); { var withBlock5 = withBlock4.Helpers.DivC("row"); foreach (ROParameter Param in ParameterList) { if (Param != StartDateP && Param != EndDateP && Param.Visible) { if (mCriteriaGroup == null) { mCriteriaGroup = withBlock5.Helpers.FieldSet("Criteria"); } Singular.Web.CustomControls.EditorBase <object> Editor = null /* TODO Change to default(_) if this is not a reference type */; Singular.Reporting.Dynamic.DynamicDropDown ddd = null /* TODO Change to default(_) if this is not a reference type */; if (Param.DropDownSource != null) { ddd = Singular.Reporting.Dynamic.Settings.DropDowns.IncludeDatabaseDropDowns().GetItem(Param.DropDownSource); } if (ddd != null) { // Drop down var di = ddd.GetDynamicInfo(); if (di.Data != null) { ViewModel.ClientDataProvider.AddDataSource(di.DropDownInfo.ClientName, di.Data, false); } Editor = new Singular.Web.CustomControls.DropDownEditor <object>(Param.ParameterName, "", di.DropDownInfo); } else { // Other switch (Param.ParamDataType) { case Singular.Reflection.SMemberInfo.MainType.String: { Editor = new Singular.Web.CustomControls.TextEditor <object>(Param.ParameterName, "", null); break; } case Singular.Reflection.SMemberInfo.MainType.Number: { Editor = new Singular.Web.CustomControls.NumericEditor <object>(Param.ParameterName, "", null); break; } case Singular.Reflection.SMemberInfo.MainType.Date: { Editor = new Singular.Web.CustomControls.DateEditor <object>(Param.ParameterName, "", null); break; } case Singular.Reflection.SMemberInfo.MainType.Boolean: { Editor = new Singular.Web.CustomControls.CheckBoxEditor <object>(Param.ParameterName, ""); break; } } } mCriteriaGroup.Helpers.Control(new Singular.Web.CustomControls.EditorRow <object>(Editor, new Singular.Web.CustomControls.FieldLabel <object>(Param.ParameterName, Param.DisplayName))); //Editor.Style.Width = 300; } } } } } } } } }