From ec70d6c075a862fb484df194ce8e231b866408a2 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Tue, 29 Jan 2019 11:58:14 +0100 Subject: [PATCH] Work on Payment History --- .../Json-MasterPersonEditPaymentHistory.aspx.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.cs b/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.cs index f8ddd4ef..0f3600b5 100644 --- a/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.cs +++ b/Site/Automation/Json-MasterPersonEditPaymentHistory.aspx.cs @@ -60,6 +60,12 @@ namespace Swarmops.Frontend.Automation newItem.Description = claim.Description; newItem.OwedToPerson = claim.AmountCents; + Payout payout = claim.Payout; + if (payout != null && payout.Open == false) + { + newItem.ClosedDate = payout.FinancialTransaction.DateTime; + } + items.Add(newItem); } @@ -80,11 +86,15 @@ namespace Swarmops.Frontend.Automation { result.Append("{"); result.AppendFormat( - "\"id\":\"{0}\",\"name\":\"{1}\",\"description\":\"{2}\",\"owedToPerson\":\"{3:N2}\"", + "\"id\":\"{0}\",\"name\":\"{1}\",\"description\":\"{2}\",\"opened\":\"{3}\",\"owedToPerson\":\"{4}\",\"paidToPerson\":\"{5}\",\"closed\":\"{6}\"", JsonSanitize(item.Id), JsonSanitize(item.Name), + item.OpenedDate.ToString("yyyy-MMM-dd"), JsonSanitize(item.Description), - item.OwedToPerson/100.0 + item.OwedToPerson > 0 ? (item.OwedToPerson/100.0).ToString("N2") : string.Empty, + string.Empty, + item.ClosedDate.ToString("yyyy-MMM-dd") + ); result.Append("},");