diff --git a/Logic/Financial/VatReport.cs b/Logic/Financial/VatReport.cs index c9d31c30..a688f29c 100644 --- a/Logic/Financial/VatReport.cs +++ b/Logic/Financial/VatReport.cs @@ -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; } diff --git a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs index 65b42960..3401dee9 100644 --- a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs +++ b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs @@ -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);