Fix to report name when completed

This commit is contained in:
Rick Falkvinge
2018-12-05 18:27:04 +01:00
parent b406b233d8
commit 39e1f32961
2 changed files with 15 additions and 1 deletions
+11
View File
@@ -418,7 +418,18 @@ namespace Swarmops.Logic.Financial
nextReportConcerns, nextReportConcerns.AddMonths(monthInterval - 1));
}
}
public static string LastReportDescription(Organization organization)
{
VatReports reports = VatReports.ForOrganization(organization, true);
if (reports.Count == 0)
{
throw new InvalidOperationException("Cannot look up last description of nonexistent VAT report collection");
}
reports.Sort(VatReports.VatReportSorterByDate);
return reports.Last().Description;
}
+4 -1
View File
@@ -49,8 +49,11 @@ namespace Swarmops.Frontend.Pages.Ledgers
EomItem vatReport = new EomItem();
vatReport.Id = "VatReport";
vatReport.Callback = "CreateVatReport";
vatReport.Name = String.Format(Resources.Pages.Ledgers.EndOfMonth_CreateVatReport, VatReport.NextReportDescription (this.CurrentOrganization));
vatReport.Completed = (vatRequired == ReportRequirement.Completed ? true : false);
vatReport.Name = String.Format(Resources.Pages.Ledgers.EndOfMonth_CreateVatReport,
(vatReport.Completed
? VatReport.LastReportDescription(this.CurrentOrganization)
: VatReport.NextReportDescription(this.CurrentOrganization);
vatReport.Icon = "document";
group2.Items.Add(vatReport);