public StepLocations(SavedReport o, IWizardStep p) : base() { prev = p; report = o; InitializeComponent(); }
public EliminationOptions(SavedReport o) : base() { report = o; options = (EliminationReportOptions)o.StandardReportOptions; InitializeComponent(); }
public override ReportResult Run(SavedReport report) { repo = new ReportRepository(); ReportResult result = new ReportResult(); result.DataTableResults = repo.RunRedistrictingReport(); result.ChartData = null; return result; }
public PersonsTreatedCoverageOptions(SavedReport o) : base() { report = o; options = (PersonsTreatedCoverageReportOptions)o.StandardReportOptions; // Clear previous report results report.ReportOptions.Columns = new Dictionary<string, AggregateIndicator>(); report.ReportOptions.SelectedIndicators = new List<ReportIndicator>(); InitializeComponent(); }
/// <summary> /// Clones a saved report so the report options can be re-used for another report. /// /// Clears out the selected indicators since that is the only report option that needs to be changed for this report /// </summary> /// <param name="report"></param> /// <returns></returns> protected SavedReport CloneReport(SavedReport report) { SavedReport newReport = new SavedReport(); newReport.ReportOptions = Util.DeepClone(report.ReportOptions); newReport.ReportOptions.SelectedIndicators = new List<ReportIndicator>(); return newReport; }
public CustomReportView(SavedReport o) : base() { report = o; InitializeComponent(); }
private void EditPersonsTreatedAndCoverageReport(SavedReport r) { WizardForm wiz = new WizardForm(new PersonsTreatedCoverageOptions(r), Translations.PersonsTreatedAndCoverageReport); wiz.Height = 685; wiz.OnRunReport = RunPersonsTreatedAndCoverageReport; wiz.Show(); }
/// <summary> /// Runs the report with the report options and collects all the disease distribution calculation /// </summary> /// <param name="mainReportOptions">The report options</param> public void Run(ReportOptions mainReportOptions) { SettingsRepository settingsRepo = new SettingsRepository(); Report = new SavedReport(); DistributionReportGenerator gen = new DistributionReportGenerator(); Report.ReportOptions = new ReportOptions(); Report.ReportOptions.SelectedIndicators = new List<ReportIndicator>(); Report.ReportOptions.Years = Util.DeepClone(mainReportOptions.Years); Report.ReportOptions.SelectedAdminLevels = Util.DeepClone(mainReportOptions.SelectedAdminLevels); Report.ReportOptions.MonthYearStarts = 1; Report.ReportOptions.IsByLevelAggregation = true; Report.ReportOptions.IsCountryAggregation = false; Report.ReportOptions.IsNoAggregation = false; // Determine the name of the reporting admin level if (mainReportOptions.SelectedAdminLevels.Count > 0) { int levelNum = mainReportOptions.SelectedAdminLevels[0].LevelNumber; AdminLevelType adminLevelType = settingsRepo.GetAdminLevelTypeByLevel(levelNum); NameOfReportingAdminLevel = adminLevelType.DisplayName; } if (NameOfReportingAdminLevel == null) throw new ArgumentException("Could not determine reporting level"); // STH Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.STH, new KeyValuePair<string, Indicator>("DDSTHPopulationRequiringPc", new Indicator { Id = 141, DisplayName = "DDSTHPopulationRequiringPc" }))); Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.STH, new KeyValuePair<string, Indicator>("DDSTHPsacAtRisk", new Indicator { Id = 142, DisplayName = "DDSTHPsacAtRisk" }))); Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.STH, new KeyValuePair<string, Indicator>("DDSTHSacAtRisk", new Indicator { Id = 143, DisplayName = "DDSTHSacAtRisk" }))); Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.STH, new KeyValuePair<string, Indicator>("DDSTHPopulationAtRisk", new Indicator { Id = 140, DisplayName = "DDSTHPopulationAtRisk" }))); // LF Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Lf, new KeyValuePair<string, Indicator>("DDLFPopulationAtRisk", new Indicator { Id = 98, DisplayName = "DDLFPopulationAtRisk" }))); Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Lf, new KeyValuePair<string, Indicator>("DDLFPopulationRequiringPc", new Indicator { Id = 99, DisplayName = "DDLFPopulationRequiringPc" }))); // Oncho Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Oncho, new KeyValuePair<string, Indicator>("DDOnchoPopulationAtRisk", new Indicator { Id = 111, DisplayName = "DDOnchoPopulationAtRisk" }))); Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Oncho, new KeyValuePair<string, Indicator>("DDOnchoPopulationRequiringPc", new Indicator { Id = 112, DisplayName = "DDOnchoPopulationRequiringPc" }))); // Schisto Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Schisto, new KeyValuePair<string, Indicator>("DDSchistoPopulationAtRisk", new Indicator { Id = 125, DisplayName = "DDSchistoPopulationAtRisk" }))); Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Schisto, new KeyValuePair<string, Indicator>("DDSchistoPopulationRequiringPc", new Indicator { Id = 126, DisplayName = "DDSchistoPopulationRequiringPc" }))); Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Schisto, new KeyValuePair<string, Indicator>("DDSchistoSacAtRisk", new Indicator { Id = 127, DisplayName = "DDSchistoSacAtRisk" }))); // Trachoma Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Trachoma, new KeyValuePair<string, Indicator>("DDTraPopulationAtRisk", new Indicator { Id = 161, DisplayName = "DDTraPopulationAtRisk" }))); // Run the report Result = gen.Run(Report); }
public StepIndicators(SavedReport o) : base() { report = o; InitializeComponent(); }
public override ReportResult Run(SavedReport report) { EliminationReportOptions standardOpts = (EliminationReportOptions)report.StandardReportOptions; ReportOptions options = report.ReportOptions; DistributionReportGenerator gen = new DistributionReportGenerator(); DiseaseRepository repo = new DiseaseRepository(); DemoRepository demo = new DemoRepository(); foreach (var disease in standardOpts.Diseases) { DiseaseDistroPc dd = repo.Create((DiseaseType)disease.Id); switch (disease.Id) { case (int)DiseaseType.Lf: AddIndicators(disease.Id, "DDLFDiseaseDistributionPcInterventions", dd, options); break; case (int)DiseaseType.Trachoma: AddIndicators(disease.Id, "DDTraDiseaseDistributionPcInterventions", dd, options); break; case (int)DiseaseType.Oncho: AddIndicators(disease.Id, "DDOnchoDiseaseDistributionPcInterventio", dd, options); break; case (int)DiseaseType.STH: AddIndicators(disease.Id, "DDSTHDiseaseDistributionPcInterventions", dd, options); break; case (int)DiseaseType.Schisto: AddIndicators(disease.Id, "DDSchistoDiseaseDistributionPcIntervent", dd, options); break; default: break; } } // need to add the proper sumation stuff report.ReportOptions.IsByLevelAggregation = true; report.ReportOptions.IsCountryAggregation = false; report.ReportOptions.IsNoAggregation = false; report.ReportOptions.SelectedAdminLevels = demo.GetAdminLevelByLevel(standardOpts.DistrictType.LevelNumber).Where(a => a.LevelNumber == standardOpts.DistrictType.LevelNumber).ToList(); // run report ReportResult result = gen.Run(report); Dictionary<string, DataRow> years = new Dictionary<string,DataRow>(); DataTable summed = new DataTable(); summed.Columns.Add(new DataColumn(TranslationLookup.GetValue("Location"))); summed.Columns.Add(new DataColumn(TranslationLookup.GetValue("Year"), typeof(string))); summed.Columns.Add(new DataColumn(string.Format(TranslationLookup.GetValue("EliminationEndemicDistricts"), standardOpts.DistrictType.DisplayName), typeof(int))); summed.Columns.Add(new DataColumn(string.Format(TranslationLookup.GetValue("EliminationStoppedDistricts"), standardOpts.DistrictType.DisplayName), typeof(int))); foreach (DataRow row in result.DataTableResults.Rows) { string endemicty = ""; int totalEndemic = 0, totalStopped = 0; if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDLFDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("LF"))) { endemicty = row[TranslationLookup.GetValue("DDLFDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("LF")].ToString(); if (endemicty == TranslationLookup.GetValue("LfEnd1") || endemicty == TranslationLookup.GetValue("LfEndPending")) totalEndemic++; else if (endemicty == TranslationLookup.GetValue("LfEnd100")) totalStopped++; } if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDOnchoDiseaseDistributionPcInterventio") + " - " + TranslationLookup.GetValue("Oncho"))) { endemicty = row[TranslationLookup.GetValue("DDOnchoDiseaseDistributionPcInterventio") + " - " + TranslationLookup.GetValue("Oncho")].ToString(); if (endemicty == TranslationLookup.GetValue("Oncho1") || endemicty == TranslationLookup.GetValue("OnchoPending")) totalEndemic++; else if (endemicty == TranslationLookup.GetValue("Oncho100")) totalStopped++; } if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDSchistoDiseaseDistributionPcIntervent") + " - " + TranslationLookup.GetValue("Schisto"))) { endemicty = row[TranslationLookup.GetValue("DDSchistoDiseaseDistributionPcIntervent") + " - " + TranslationLookup.GetValue("Schisto")].ToString(); if (endemicty == TranslationLookup.GetValue("Sch1") || endemicty == TranslationLookup.GetValue("Sch2") || endemicty == TranslationLookup.GetValue("Sch2a") || endemicty == TranslationLookup.GetValue("Sch3") || endemicty == TranslationLookup.GetValue("Sch3a") || endemicty == TranslationLookup.GetValue("Sch3b") || endemicty == TranslationLookup.GetValue("Sch20") || endemicty == TranslationLookup.GetValue("Sch30") || endemicty == TranslationLookup.GetValue("Sch40") || endemicty == TranslationLookup.GetValue("SchPending")) totalEndemic++; else if (endemicty == TranslationLookup.GetValue("Sch100")) totalStopped++; } if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDSTHDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("STH"))) { endemicty = row[TranslationLookup.GetValue("DDSTHDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("STH")].ToString(); if (endemicty == TranslationLookup.GetValue("Sth2") || endemicty == TranslationLookup.GetValue("Sth3") || endemicty == TranslationLookup.GetValue("Sth10") || endemicty == TranslationLookup.GetValue("Sth20") || endemicty == TranslationLookup.GetValue("Sth30") || endemicty == TranslationLookup.GetValue("Sth40") || endemicty == TranslationLookup.GetValue("SthPending")) totalEndemic++; else if (endemicty == TranslationLookup.GetValue("Sth100")) totalStopped++; } if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDTraDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("Trachoma"))) { endemicty = row[TranslationLookup.GetValue("DDTraDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("Trachoma")].ToString(); if (endemicty == TranslationLookup.GetValue("Tra1") || endemicty == TranslationLookup.GetValue("Tra4") || endemicty == TranslationLookup.GetValue("Tra5") || endemicty == TranslationLookup.GetValue("TraPending")) totalEndemic++; else if (endemicty == TranslationLookup.GetValue("Tra100")) totalStopped++; } if (!years.ContainsKey(row[TranslationLookup.GetValue("Year")].ToString())) { DataRow dr = summed.NewRow(); dr[TranslationLookup.GetValue("Year")] = row[TranslationLookup.GetValue("Year")]; dr[string.Format(TranslationLookup.GetValue("EliminationEndemicDistricts"), standardOpts.DistrictType.DisplayName)] = totalEndemic; dr[string.Format(TranslationLookup.GetValue("EliminationStoppedDistricts"), standardOpts.DistrictType.DisplayName)] = totalStopped; years.Add(row[TranslationLookup.GetValue("Year")].ToString(), dr); summed.Rows.Add(dr); } else { years[row[TranslationLookup.GetValue("Year")].ToString()][string.Format(TranslationLookup.GetValue("EliminationEndemicDistricts"), standardOpts.DistrictType.DisplayName)] = totalEndemic + (int)years[row[TranslationLookup.GetValue("Year")].ToString()][string.Format(TranslationLookup.GetValue("EliminationEndemicDistricts"), standardOpts.DistrictType.DisplayName)]; years[row[TranslationLookup.GetValue("Year")].ToString()][string.Format(TranslationLookup.GetValue("EliminationStoppedDistricts"), standardOpts.DistrictType.DisplayName)] = totalStopped + (int)years[row[TranslationLookup.GetValue("Year")].ToString()][string.Format(TranslationLookup.GetValue("EliminationStoppedDistricts"), standardOpts.DistrictType.DisplayName)]; } } result.DataTableResults = summed; result.ChartData = summed.Copy(); report.ReportOptions.IsByLevelAggregation = false; report.ReportOptions.IsCountryAggregation = true; // to show only year return result; }
public override ReportResult Run(SavedReport report) { PersonsTreatedCoverageReportOptions standardOpts = (PersonsTreatedCoverageReportOptions)report.StandardReportOptions; // Options report.ReportOptions.IsByLevelAggregation = true; report.ReportOptions.IsCountryAggregation = false; report.ReportOptions.IsNoAggregation = false; // Get all admin levels if (report.ReportOptions.IsAllLocations) report.ReportOptions.SelectedAdminLevels = DemoRepo.GetAdminLevelByLevel(standardOpts.DistrictType.LevelNumber).Where(a => a.LevelNumber == standardOpts.DistrictType.LevelNumber).ToList(); List<int> filteredIntvIds; if (this.GetType() == typeof(PersonsTreatedCoverageDrugPackageReportGenerator)) { // Determine intervention types IntvTypes = DetermineIntvTypes(standardOpts); // Get all the matching interventions based on the report options List<IntvBase> intvs = GetIntvsByReportOptions(IntvTypes, report.ReportOptions); // Determine the diseases Diseases = DetermineDiseases(standardOpts, intvs); // Drug package report does not need to be filtered filteredIntvIds = null; } else { // It is a disease report, so first set the diseases thats were selected Diseases = DetermineDiseases(standardOpts); // Deterine the interventions associated to the diseases IntvTypes = DetermineIntvTypes(Diseases); // Determine which interventions should be used in the report filteredIntvIds = DetermineInterventionsByDiseasesTargeted(standardOpts.AvailableDrugPackages, report.ReportOptions, Diseases); } // There was no data at this reporting level if (Diseases == null || IntvTypes == null || Diseases.Count < 1 || IntvTypes.Count < 1) { ReportResult result = new ReportResult(); result.DataTableResults = new DataTable(); return result; } // Run the distribution report for the disease dist related data ReportResult distReportResult = RunDistributionReport(CloneReport(report), standardOpts); // Aggregate the dist data AggregateDistData(distReportResult); // Run the intervention report ReportResult intvReportResult = RunIntvReport(CloneReport(report), standardOpts, filteredIntvIds); // Remove the district and year columns from the intervention report result RemovePastColumn(intvReportResult.DataTableResults, TranslationLookup.GetValue("Year")); // Aggregate the Report data DataTable intvDataTable = AggregateIntvData(intvReportResult); // Merge the results CopyDataTableToSameRows(intvDataTable, distReportResult.DataTableResults); distReportResult.ChartData = distReportResult.DataTableResults.Copy(); distReportResult.DataTableResults.Columns.Remove(TranslationLookup.GetValue("Type")); return distReportResult; }
private void RunEliminationReport(SavedReport r) { CustomReportView report = new CustomReportView(r); report.OnEditReport = EditEliminationReport; report.Show(); }
private void eliminationReport_ClickOverride() { SavedReport sr = new SavedReport { StandardReportOptions = new EliminationReportOptions() }; sr.ReportOptions.IsAllLocations = true; sr.ReportOptions.IsCountryAggregation = true; sr.ReportOptions.IsByLevelAggregation = false; sr.ReportOptions.IsNoAggregation = false; WizardForm wiz = new WizardForm(new EliminationOptions(sr), Translations.ReportProgressTowardsEliminiation); wiz.OnFinish = () => { }; wiz.Height = 685; wiz.OnRunReport = RunEliminationReport; wiz.Show(); }
private void EditCustomReport(SavedReport r) { WizardForm wiz = new WizardForm(new StepIndicators(r), Translations.CustomReportBuilder); wiz.Height = 695; wiz.OnRunReport = RunCustomReport; wiz.Show(); }
private void RunCustomReport(SavedReport r) { CustomReportView report = new CustomReportView(r); report.OnEditReport = EditCustomReport; report.OnSave = LoadSavedReports; report.Show(); }
public void DeleteCustomReport(SavedReport report, int userId) { OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString); using (connection) { connection.Open(); try { // START TRANS OleDbCommand command = new OleDbCommand("BEGIN TRANSACTION", connection); command.ExecuteNonQuery(); // START TRANS command = new OleDbCommand(@"UPDATE CustomReports SET IsDeleted= Yes, [email protected], [email protected] WHERE [email protected]", connection); command.Parameters.Add(new OleDbParameter("@UpdatedById", userId)); command.Parameters.Add(OleDbUtil.CreateDateTimeOleDbParameter("@UpdatedAt", DateTime.Now)); command.Parameters.Add(new OleDbParameter("@ID", report.Id)); command.ExecuteNonQuery(); command = new OleDbCommand("COMMIT TRANSACTION", connection); command.ExecuteNonQuery(); } catch (Exception) { throw; } } }
public void Save(SavedReport report, int userId) { bool transWasStarted = false; OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString); using (connection) { connection.Open(); try { // START TRANS OleDbCommand command = new OleDbCommand("BEGIN TRANSACTION", connection); command.ExecuteNonQuery(); transWasStarted = true; if (report.Id > 0) command = new OleDbCommand(@"UPDATE CustomReports SET [email protected], [email protected], [email protected], [email protected] WHERE [email protected]", connection); else command = new OleDbCommand(@"INSERT INTO CustomReports (DisplayName, ReportOptions, UpdatedById, UpdatedAt, CreatedById, CreatedAt) values (@DisplayName, @ReportOptions, @UpdatedById, @UpdatedAt, @CreatedById, @CreatedAt)", connection); command.Parameters.Add(new OleDbParameter("@DisplayName", report.DisplayName)); command.Parameters.Add(new OleDbParameter("@ReportOptions", report.Serialize())); command.Parameters.Add(new OleDbParameter("@UpdatedById", userId)); command.Parameters.Add(OleDbUtil.CreateDateTimeOleDbParameter("@UpdatedAt", DateTime.Now)); if (report.Id > 0) command.Parameters.Add(new OleDbParameter("@id", report.Id)); else { command.Parameters.Add(new OleDbParameter("@CreatedById", userId)); command.Parameters.Add(OleDbUtil.CreateDateTimeOleDbParameter("@CreatedAt", DateTime.Now)); } command.ExecuteNonQuery(); if (report.Id <= 0) { command = new OleDbCommand(@"SELECT Max(ID) FROM CustomReports", connection); report.Id = (int)command.ExecuteScalar(); } // COMMIT TRANS command = new OleDbCommand("COMMIT TRANSACTION", connection); command.ExecuteNonQuery(); transWasStarted = false; } catch (Exception) { if (transWasStarted) { try { OleDbCommand cmd = new OleDbCommand("ROLLBACK TRANSACTION", connection); cmd.ExecuteNonQuery(); } catch { } } throw; } } }
public List<SavedReport> GetCustomReports() { List<SavedReport> list = new List<SavedReport>(); OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString); using (connection) { connection.Open(); try { OleDbCommand command = new OleDbCommand(@"Select ID, DisplayName, ReportOptions, aspnet_users.UserName, UpdatedAt, CreatedAt, c.UserName as CreatedBy from ((CustomReports INNER JOIN aspnet_users on CustomReports.UpdatedById = aspnet_users.userid) INNER JOIN aspnet_users c on CustomReports.CreatedById = c.userid) WHERE IsDeleted=0", connection); using (OleDbDataReader reader = command.ExecuteReader()) { while (reader.Read()) { var report = new SavedReport { Id = reader.GetValueOrDefault<int>("ID"), DisplayName = reader.GetValueOrDefault<string>("DisplayName"), UpdatedBy = GetAuditInfo(reader) }; report.Deserialize(reader.GetValueOrDefault<string>("ReportOptions")); list.Add(report); } reader.Close(); } } catch (Exception) { throw; } } return list; }
protected ReportResult RunDistributionReport(SavedReport report, PersonsTreatedCoverageReportOptions standardOpts) { // Add the disease indicators to the report foreach (var disease in Diseases) { DiseaseDistroPc dd = DiseaseRepo.Create((DiseaseType)disease.Id); switch (disease.Id) { case (int)DiseaseType.Lf: AddIndicators(disease.Id, "DDLFPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; case (int)DiseaseType.Trachoma: AddIndicators(disease.Id, "DDTraPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; case (int)DiseaseType.Oncho: AddIndicators(disease.Id, "DDOnchoPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; case (int)DiseaseType.STH: AddIndicators(disease.Id, "DDSTHPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; case (int)DiseaseType.Schisto: AddIndicators(disease.Id, "DDSchistoPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions); break; default: break; } } // Run the report DistributionReportGenerator gen = new DistributionReportGenerator(); ReportResult result = gen.Run(report); return result; }
protected ReportResult RunIntvReport(SavedReport report, PersonsTreatedCoverageReportOptions standardOpts, List<int> filteredIntvIds) { // Add all the relevant intervention indicators foreach (IntvType intvType in IntvTypes) { AddIndicators(intvType.Id, "PcIntvNumEligibleIndividualsTargeted", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions); AddIndicators(intvType.Id, "PcIntvNumIndividualsTreated", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions); AddIndicators(intvType.Id, "PcIntvPsacTreated", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions); AddIndicators(intvType.Id, "PcIntvNumSacTreated", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions); } // Report gen IntvReportGenerator gen = new IntvReportGenerator(); // Set the IDs of the filtererd interventions if (filteredIntvIds != null && filteredIntvIds.Count > 0) gen.CmdTextOverride = DetermineInterventionSql(filteredIntvIds, report.ReportOptions); // Recent distro static classs RecentDistro recentDistro = RecentDistro.GetInstance(true /* instantiate */); recentDistro.Run(report.ReportOptions); // Run the report ReportResult result = gen.Run(report); // Clear the RecentDistro from memory RecentDistro.ClearInstance(); return result; }
private void EditEliminationReport(SavedReport r) { WizardForm wiz = new WizardForm(new EliminationOptions(r), Translations.ReportProgressTowardsEliminiation); wiz.Height = 685; wiz.OnRunReport = RunEliminationReport; wiz.Show(); }
private void RunReport(SavedReport options) { this.Close(); OnRunReport(options); }
public StepOptions(SavedReport o) : base() { report = o; InitializeComponent(); }
public override ReportResult Run(SavedReport report) { EliminationReportOptions standardOpts = (EliminationReportOptions)report.StandardReportOptions; ReportOptions options = report.ReportOptions; DistributionReportGenerator gen = new DistributionReportGenerator(); DiseaseRepository repo = new DiseaseRepository(); foreach (var disease in standardOpts.Diseases) { DiseaseDistroPc dd = repo.Create((DiseaseType)disease.Id); switch (disease.Id) { case (int)DiseaseType.Lf: AddIndicators(disease.Id, "DDLFPopulationAtRisk", dd, options); AddIndicators(disease.Id, "DDLFPopulationLivingInTheDistrictsThatAc", dd, options); break; case (int)DiseaseType.Trachoma: AddIndicators(disease.Id, "DDTraPopulationAtRisk", dd, options); AddIndicators(disease.Id, "DDTraPopulationLivingInAreasDistrict", dd, options); break; case (int)DiseaseType.Oncho: AddIndicators(disease.Id, "DDOnchoPopulationAtRisk", dd, options); AddIndicators(disease.Id, "DDOnchoPopulationLivingInTheDistrictsTha", dd, options); break; case (int)DiseaseType.STH: AddIndicators(disease.Id, "DDSTHPopulationAtRisk", dd, options); AddIndicators(disease.Id, "DDSTHPopulationLivingInTheDistrictsThatA", dd, options); break; case (int)DiseaseType.Schisto: AddIndicators(disease.Id, "DDSchistoPopulationAtRisk", dd, options); AddIndicators(disease.Id, "DDSchistoPopulationLivingInTheDistrictsT", dd, options); break; default: break; } } ReportResult result = gen.Run(report); // loop table, make sure column exists (with 0), sum other columns to good column and delete other columns if they have em. result.DataTableResults.Columns.Add(new DataColumn(TranslationLookup.GetValue("EliminationAtRisk"))); result.DataTableResults.Columns.Add(new DataColumn(TranslationLookup.GetValue("EliminationLiving"))); foreach (DataRow row in result.DataTableResults.Rows) { double totalAtRisk = 0, totalLiving = 0; totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDLFPopulationAtRisk") + " - " + TranslationLookup.GetValue("LF"), result.DataTableResults, row); totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDTraPopulationAtRisk") + " - " + TranslationLookup.GetValue("Trachoma"), result.DataTableResults, row); totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDOnchoPopulationAtRisk") + " - " + TranslationLookup.GetValue("Oncho"), result.DataTableResults, row); totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDSTHPopulationAtRisk") + " - " + TranslationLookup.GetValue("STH"), result.DataTableResults, row); totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDSchistoPopulationAtRisk") + " - " + TranslationLookup.GetValue("Schisto"), result.DataTableResults, row); totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDLFPopulationLivingInTheDistrictsThatAc") + " - " + TranslationLookup.GetValue("LF"), result.DataTableResults, row); totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDTraPopulationLivingInAreasDistrict") + " - " + TranslationLookup.GetValue("Trachoma"), result.DataTableResults, row); totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDSTHPopulationLivingInTheDistrictsThatA") + " - " + TranslationLookup.GetValue("STH"), result.DataTableResults, row); totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDOnchoPopulationLivingInTheDistrictsTha") + " - " + TranslationLookup.GetValue("Oncho"), result.DataTableResults, row); totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDSchistoPopulationLivingInTheDistrictsT") + " - " + TranslationLookup.GetValue("Schisto"), result.DataTableResults, row); row[TranslationLookup.GetValue("EliminationAtRisk")] = totalAtRisk; row[TranslationLookup.GetValue("EliminationLiving")] = totalLiving; } TryRemoveColumn(TranslationLookup.GetValue("DDLFPopulationAtRisk") + " - " + TranslationLookup.GetValue("LF"), result.DataTableResults); TryRemoveColumn(TranslationLookup.GetValue("DDLFPopulationLivingInTheDistrictsThatAc") + " - " + TranslationLookup.GetValue("LF"), result.DataTableResults); TryRemoveColumn(TranslationLookup.GetValue("DDTraPopulationAtRisk") + " - " + TranslationLookup.GetValue("Trachoma"), result.DataTableResults); TryRemoveColumn(TranslationLookup.GetValue("DDOnchoPopulationAtRisk") + " - " + TranslationLookup.GetValue("Oncho"), result.DataTableResults); TryRemoveColumn(TranslationLookup.GetValue("DDSTHPopulationAtRisk") + " - " + TranslationLookup.GetValue("STH"), result.DataTableResults); TryRemoveColumn(TranslationLookup.GetValue("DDSchistoPopulationAtRisk") + " - " + TranslationLookup.GetValue("Schisto"), result.DataTableResults); TryRemoveColumn(TranslationLookup.GetValue("DDTraPopulationLivingInAreasDistrict") + " - " + TranslationLookup.GetValue("Trachoma"), result.DataTableResults); TryRemoveColumn(TranslationLookup.GetValue("DDSTHPopulationLivingInTheDistrictsThatA") + " - " + TranslationLookup.GetValue("STH"), result.DataTableResults); TryRemoveColumn(TranslationLookup.GetValue("DDOnchoPopulationLivingInTheDistrictsTha") + " - " + TranslationLookup.GetValue("Oncho"), result.DataTableResults); TryRemoveColumn(TranslationLookup.GetValue("DDSchistoPopulationLivingInTheDistrictsT") + " - " + TranslationLookup.GetValue("Schisto"), result.DataTableResults); result.ChartData = result.DataTableResults.Copy(); result.DataTableResults.Columns.Remove(TranslationLookup.GetValue("Type")); if (options.IsCountryAggregation) result.DataTableResults.Columns.RemoveAt(0); return result; }
private void personsTreatedAndCoverageReport_ClickOverride() { SavedReport sr = new SavedReport { StandardReportOptions = new PersonsTreatedCoverageReportOptions() }; sr.ReportOptions.IsAllLocations = true; sr.ReportOptions.IsCountryAggregation = true; sr.ReportOptions.IsByLevelAggregation = false; sr.ReportOptions.IsNoAggregation = false; WizardForm wiz = new WizardForm(new PersonsTreatedCoverageOptions(sr), Translations.PersonsTreatedAndCoverageReport); wiz.OnFinish = () => { }; wiz.Height = 685; wiz.OnRunReport = RunPersonsTreatedAndCoverageReport; wiz.Show(); }
private void redistrictingReport_ClickOverride() { SavedReport r = new SavedReport { TypeName = Translations.RedistrictingReport }; r.ReportOptions = new ReportOptions(); r.ReportOptions.ReportGenerator = new RedistrictingReportGenerator(); CustomReportView report = new CustomReportView(r); report.OnEditReport = null; report.Show(); }
private void RunPersonsTreatedAndCoverageReport(SavedReport r) { CustomReportView report = new CustomReportView(r); report.OnEditReport = EditPersonsTreatedAndCoverageReport; report.Show(); }