Work on Payment History
This commit is contained in:
+72
@@ -186,6 +186,15 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to All Balances Are Settled.
|
||||
/// </summary>
|
||||
internal static string Financial_AllBalancesSettled {
|
||||
get {
|
||||
return ResourceManager.GetString("Financial_AllBalancesSettled", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Amount.
|
||||
/// </summary>
|
||||
@@ -393,6 +402,15 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Current Balance.
|
||||
/// </summary>
|
||||
internal static string Financial_CurrentBalance {
|
||||
get {
|
||||
return ResourceManager.GetString("Financial_CurrentBalance", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Liabilities.
|
||||
/// </summary>
|
||||
@@ -663,6 +681,24 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Person Is Owed.
|
||||
/// </summary>
|
||||
internal static string Financial_PersonIsOwed {
|
||||
get {
|
||||
return ResourceManager.GetString("Financial_PersonIsOwed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Person Owes Amount.
|
||||
/// </summary>
|
||||
internal static string Financial_PersonOwes {
|
||||
get {
|
||||
return ResourceManager.GetString("Financial_PersonOwes", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Annual Profit/Loss To Date ({0}).
|
||||
/// </summary>
|
||||
@@ -816,6 +852,15 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unconfirmed Payout.
|
||||
/// </summary>
|
||||
internal static string Financial_UnconfirmedPayout {
|
||||
get {
|
||||
return ResourceManager.GetString("Financial_UnconfirmedPayout", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Yearly result.
|
||||
/// </summary>
|
||||
@@ -825,6 +870,24 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} Owes You.
|
||||
/// </summary>
|
||||
internal static string Financial_YouAreOwed {
|
||||
get {
|
||||
return ResourceManager.GetString("Financial_YouAreOwed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to You Owe This Amount.
|
||||
/// </summary>
|
||||
internal static string Financial_YouOwe {
|
||||
get {
|
||||
return ResourceManager.GetString("Financial_YouOwe", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to YTD.
|
||||
/// </summary>
|
||||
@@ -834,6 +897,15 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Zero.
|
||||
/// </summary>
|
||||
internal static string Financial_Zero {
|
||||
get {
|
||||
return ResourceManager.GetString("Financial_Zero", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Two-factor authentication.
|
||||
/// </summary>
|
||||
|
||||
@@ -1011,6 +1011,13 @@
|
||||
<value>EBITDA</value>
|
||||
<comment>Earnings before Interest, Taxes, Depreciation, and Amortization - a financial term</comment>
|
||||
</data>
|
||||
<data name="Financial_AllBalancesSettled" xml:space="preserve">
|
||||
<value>All Balances Are Settled</value>
|
||||
<comment>Nobody owes anybody anything</comment>
|
||||
</data>
|
||||
<data name="Financial_CurrentBalance" xml:space="preserve">
|
||||
<value>Current Balance</value>
|
||||
</data>
|
||||
<data name="Financial_PaymentSpecification" xml:space="preserve">
|
||||
<value>Payment #{0:N0}</value>
|
||||
<comment>A Payment (as opposed to payout) is money entering the organization</comment>
|
||||
@@ -1019,4 +1026,28 @@
|
||||
<value>Payout #{0:N0}</value>
|
||||
<comment>A Pay-OUT is always money leaving the organization</comment>
|
||||
</data>
|
||||
<data name="Financial_PersonIsOwed" xml:space="preserve">
|
||||
<value>Person Is Owed</value>
|
||||
<comment>This is the amount the organization owes to a person, like after filing expense claims.</comment>
|
||||
</data>
|
||||
<data name="Financial_PersonOwes" xml:space="preserve">
|
||||
<value>Person Owes Amount</value>
|
||||
<comment>This is the amount a person owes to the organization, like after a cash advance.</comment>
|
||||
</data>
|
||||
<data name="Financial_UnconfirmedPayout" xml:space="preserve">
|
||||
<value>Unconfirmed Payout</value>
|
||||
<comment>This is a payout that's not yet been seen in a Connected Account, like a bank account</comment>
|
||||
</data>
|
||||
<data name="Financial_YouAreOwed" xml:space="preserve">
|
||||
<value>{0} Owes You</value>
|
||||
<comment>The {0} is the organization name</comment>
|
||||
</data>
|
||||
<data name="Financial_YouOwe" xml:space="preserve">
|
||||
<value>You Owe This Amount</value>
|
||||
<comment>Like Person Owes, but directed at the user at the screen</comment>
|
||||
</data>
|
||||
<data name="Financial_Zero" xml:space="preserve">
|
||||
<value>Zero</value>
|
||||
<comment>This is used when a debt is zero; there is no debt to settle</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Resources;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
@@ -48,8 +49,8 @@ namespace Swarmops.Frontend.Automation
|
||||
list.Sort(LineItemSorterByDate);
|
||||
|
||||
Response.ContentType = "application/json";
|
||||
Response.Output.WriteLine("{\"rows\": " + JsonWriteItems(list) + ", \"footer\": [" +
|
||||
JsonWriteFooter(list) + "]}");
|
||||
Response.Output.WriteLine("{\"rows\": " + JsonWriteItems(list) + ", \"footer\": [{" +
|
||||
JsonWriteFooter(list) + "}]}");
|
||||
|
||||
Response.End();
|
||||
|
||||
@@ -148,7 +149,7 @@ namespace Swarmops.Frontend.Automation
|
||||
{
|
||||
if (payout.Open)
|
||||
{
|
||||
continue; // do not list unconfirmed payouts
|
||||
_payoutDescriptionOverride[payout.Identity] = Resources.Global.Financial_UnconfirmedPayout;
|
||||
}
|
||||
|
||||
PaymentHistoryLineItem newItem = new PaymentHistoryLineItem();
|
||||
@@ -166,7 +167,7 @@ namespace Swarmops.Frontend.Automation
|
||||
newItem.OpenedDate = payout.CreatedDateTime;
|
||||
|
||||
FinancialTransaction closeTx = payout.FinancialTransaction;
|
||||
if (closeTx != null) // it damn well should not be null since Open is false
|
||||
if (closeTx != null)
|
||||
{
|
||||
newItem.ClosedDate = closeTx.DateTime;
|
||||
}
|
||||
@@ -186,7 +187,7 @@ namespace Swarmops.Frontend.Automation
|
||||
{
|
||||
result.Append("{");
|
||||
result.AppendFormat(
|
||||
"\"id\":\"{0}\",\"name\":\"{1}\",\"description\":\"{2}\",\"opened\":\"{3}\",\"owedToPerson\":\"{4}\",\"paidToPerson\":\"{5}\",\"closed\":\"{6}\"",
|
||||
"\"id\":\"{0}\",\"name\":\"{1}\",\"description\":\"{2}\",\"opened\":\"{3}\",\"owedToPerson\":\"<span class='medium'>{4}</span>\",\"paidToPerson\":\"<span class='medium'>{5}</span>\",\"closed\":\"{6}\"",
|
||||
JsonSanitize(item.Id),
|
||||
JsonSanitize(item.Name),
|
||||
JsonSanitize(item.Description),
|
||||
@@ -208,7 +209,50 @@ namespace Swarmops.Frontend.Automation
|
||||
|
||||
public string JsonWriteFooter(List<PaymentHistoryLineItem> items)
|
||||
{
|
||||
return string.Empty;
|
||||
Int64 currentBalance = 0;
|
||||
|
||||
foreach (PaymentHistoryLineItem item in items)
|
||||
{
|
||||
currentBalance += item.OwedToPerson;
|
||||
currentBalance -= item.PaidToPerson;
|
||||
}
|
||||
|
||||
string summary = string.Empty;
|
||||
if (_person.Identity == _authenticationData.CurrentUser.Identity)
|
||||
{
|
||||
if (currentBalance > 0)
|
||||
{
|
||||
summary = Resources.Global.Financial_YouAreOwed;
|
||||
}
|
||||
else
|
||||
{
|
||||
summary = Resources.Global.Financial_YouOwe;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentBalance > 0)
|
||||
{
|
||||
summary = Resources.Global.Financial_PersonIsOwed;
|
||||
}
|
||||
else
|
||||
{
|
||||
summary = Resources.Global.Financial_PersonOwes;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentBalance == 0)
|
||||
{
|
||||
summary = Resources.Global.Financial_AllBalancesSettled;
|
||||
}
|
||||
|
||||
return String.Format(
|
||||
"\"id\":\"Footer\",\"name\":\"<span class='strong uppercase'>{0}</span>\",\"description\":\"<span class='medium uppercase'>{1}</span>\",\"owedToPerson\":\"<span class='strong uppercase'>{2}</span>\",\"paidToPerson\":\"<span class='strong uppercase'>{3}</span>\"",
|
||||
JsonSanitize(Resources.Global.Financial_CurrentBalance),
|
||||
JsonSanitize(summary),
|
||||
currentBalance == 0 ? Resources.Global.Financial_Zero : currentBalance > 0 ? (currentBalance / 100.0).ToString("N2") : string.Empty,
|
||||
currentBalance == 0 ? Resources.Global.Financial_Zero : currentBalance < 0 ? (currentBalance / -100.0).ToString("N2") : string.Empty
|
||||
);
|
||||
}
|
||||
|
||||
public static int LineItemSorterByDate(PaymentHistoryLineItem a, PaymentHistoryLineItem b)
|
||||
|
||||
@@ -1439,7 +1439,25 @@ span.spanGrayedOut {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
span.light {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
span.regular-weight {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
span.medium {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
span.strong {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
span.uppercase {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* COLOR SCHEME
|
||||
|
||||
|
||||
Reference in New Issue
Block a user