From 4a2d7b74f38e9363aedf83af9efa469780238887 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Fri, 22 Sep 2017 21:11:09 +0200 Subject: [PATCH] Sort attempt too --- .../v5/Financial/Json-ListInvoicesInbound.aspx.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Site/Pages/v5/Financial/Json-ListInvoicesInbound.aspx.cs b/Site/Pages/v5/Financial/Json-ListInvoicesInbound.aspx.cs index 4a08aa17..fd61ae8d 100644 --- a/Site/Pages/v5/Financial/Json-ListInvoicesInbound.aspx.cs +++ b/Site/Pages/v5/Financial/Json-ListInvoicesInbound.aspx.cs @@ -21,6 +21,8 @@ public partial class Pages_v5_Finance_Json_ListInvoicesInbound : DataV5Base this._attestationRights = GetAttestationRights(); this._invoices = InboundInvoices.ForOrganization(this.CurrentOrganization, true); + _invoices.Sort(SortInvoicesByDueDate); + // Format as JSON and return Response.ContentType = "application/json"; @@ -29,6 +31,12 @@ public partial class Pages_v5_Finance_Json_ListInvoicesInbound : DataV5Base Response.End(); } + private static int SortInvoicesByDueDate(InboundInvoice a, InboundInvoice b) + { + return DateTime.Compare(a.DueDate, b.DueDate); + } + + private string FormatAsJson() { // Fields: item, dueDate, sender, budget, amount, progress, docs, action @@ -78,8 +86,8 @@ public partial class Pages_v5_Finance_Json_ListInvoicesInbound : DataV5Base private string _emptyTick = ""; private string _greenTick = ""; - private string _redCross = ""; - private string _filler = ""; + private string _redCross = ""; + private string _fillerTwo = ""; private string GetProgressTicks(InboundInvoice invoice)