From ef913a7c89db00dfd6dde3b7f27d00fcedcfb0f8 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 17 Feb 2013 00:17:09 +0000 Subject: [PATCH] Testing adding pending payouts and diff before closing work for today --- .../Ledgers/Json-OutstandingAccounts.aspx.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Site5/Pages/v5/Ledgers/Json-OutstandingAccounts.aspx.cs b/Site5/Pages/v5/Ledgers/Json-OutstandingAccounts.aspx.cs index 938d3784..0d178d67 100644 --- a/Site5/Pages/v5/Ledgers/Json-OutstandingAccounts.aspx.cs +++ b/Site5/Pages/v5/Ledgers/Json-OutstandingAccounts.aspx.cs @@ -34,15 +34,18 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers balanceAccount = _authenticationData.CurrentOrganization.FinancialAccounts.DebtsExpenseClaims; ExpenseClaims claims = null; + Payouts payouts = null; if (renderPresentTime) { claims = ExpenseClaims.ForOrganization(_authenticationData.CurrentOrganization); + payouts = Payouts.ForOrganization(_authenticationData.CurrentOrganization); balanceAmountCents = balanceAccount.GetDeltaCents(DateTime.MinValue, DateTime.MaxValue); // get ALL transactions } else { // TODO claims = new ExpenseClaims(); + payouts = new Payouts(); balanceAmountCents = balanceAccount.GetDeltaCents(DateTime.MinValue, targetDateTime); } @@ -52,6 +55,13 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers { outstandingAccounts.Add((OutstandingAccount) claim); } + foreach (Payout payout in payouts) + { + foreach (ExpenseClaim claim in payout.DependentExpenseClaims) + { + outstandingAccounts.Add((OutstandingAccount)claim); + } + } Response.ContentType = "application/json"; @@ -101,13 +111,13 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers result.Append("},{"); - result.AppendFormat("\"description\":\"{0}\",\"amount\":\"{2:N2}\"", - "Expected", balanceExpectedCents, centsTotal / 100.0); + result.AppendFormat("\"description\":\"{0}\",\"amount\":\"{1:N2}\"", + "Expected", balanceExpectedCents / 100.0); result.Append("},{"); - result.AppendFormat("\"description\":\"{0}\",\"amount\":\"{2:N2}\"", - "Difference", balanceExpectedCents, 0.0); + result.AppendFormat("\"description\":\"{0}\",\"amount\":\"{1:N2}\"", + "Difference", (centsTotal - balanceExpectedCents) / 100.0); result.Append("}]}"); // on separate line to suppress warning