diff --git a/Site/App_GlobalResources/Pages.Ledgers.designer.cs b/Site/App_GlobalResources/Pages.Ledgers.designer.cs
index b7a78636..abd895b3 100644
--- a/Site/App_GlobalResources/Pages.Ledgers.designer.cs
+++ b/Site/App_GlobalResources/Pages.Ledgers.designer.cs
@@ -402,6 +402,15 @@ namespace Resources.Pages {
}
}
+ ///
+ /// Looks up a localized string similar to The Balance Sheet is an overview of assets and debts at a snapshot in time, and is used to see how results affect the overall financial health of the organization. You may also want to look at the <a href="BalanceSheet">advanced balance sheet</a> for more detail, or the <a href="ProfitLossStatement">profit-and-loss statement</a> which is the overview of income and expenditure..
+ ///
+ internal static string BalanceSheet_Info_Simplified {
+ get {
+ return ResourceManager.GetString("BalanceSheet_Info_Simplified", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Liabilities XXXX.
///
@@ -420,6 +429,15 @@ namespace Resources.Pages {
}
}
+ ///
+ /// Looks up a localized string similar to Loss to date ({0}).
+ ///
+ internal static string BalanceSheet_LossToDate {
+ get {
+ return ResourceManager.GetString("BalanceSheet_LossToDate", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Balance Sheet.
///
@@ -429,6 +447,15 @@ namespace Resources.Pages {
}
}
+ ///
+ /// Looks up a localized string similar to Profit to date ({0}).
+ ///
+ internal static string BalanceSheet_ProfitToDate {
+ get {
+ return ResourceManager.GetString("BalanceSheet_ProfitToDate", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Change Q1.
///
diff --git a/Site/App_GlobalResources/Pages.Ledgers.resx b/Site/App_GlobalResources/Pages.Ledgers.resx
index 78cd14f0..92a828e6 100644
--- a/Site/App_GlobalResources/Pages.Ledgers.resx
+++ b/Site/App_GlobalResources/Pages.Ledgers.resx
@@ -793,6 +793,9 @@
(change)
Change from previous year's close, which is same as from start of this year
+
+ The Balance Sheet is an overview of assets and debts at a snapshot in time, and is used to see how results affect the overall financial health of the organization. You may also want to look at the <a href="BalanceSheet">advanced balance sheet</a> for more detail, or the <a href="ProfitLossStatement">profit-and-loss statement</a> which is the overview of income and expenditure.
+
Liabilities XXXX
For the simplified view - XXXX is replaced with year
@@ -801,4 +804,12 @@
(change)
Change from previous year's close, which is same as from start of this year
+
+ Loss to date ({0})
+ The {0} is the year of the report
+
+
+ Profit to date ({0})
+ The {0} is the year of the report
+
\ No newline at end of file
diff --git a/Site/Pages/v5/Ledgers/BalanceSheetSimplified.aspx b/Site/Pages/v5/Ledgers/BalanceSheetSimplified.aspx
index 3f368e0e..5e759882 100644
--- a/Site/Pages/v5/Ledgers/BalanceSheetSimplified.aspx
+++ b/Site/Pages/v5/Ledgers/BalanceSheetSimplified.aspx
@@ -62,6 +62,13 @@
$('div.datagrid').css('opacity', 0.4);
});
+ function formatGray(val, row, index) {
+ if (val === undefined) {
+ return undefined;
+ }
+ return "" + val + "";
+ }
+
var currentYear = <%=DateTime.Today.Year %>;
@@ -72,6 +79,14 @@
color: #1C397E;
letter-spacing: 1px;
}
+ .datagrid-row-selected,.datagrid-row-over{
+ background:transparent;
+ }
+ table.datagrid-ftable {
+ font-weight: 500;
+ }
+
+
@@ -82,15 +97,15 @@
url="Json-BalanceSheetDataSimplified.aspx"
rownumbers="false"
animate="true"
- fitColumns="true"
+ fitColumns="true" showFooter="true"
idField="id" treeField="name">
|
|
- |
+ |
|
- |
+ |
diff --git a/Site/Pages/v5/Ledgers/BalanceSheetSimplified.aspx.cs b/Site/Pages/v5/Ledgers/BalanceSheetSimplified.aspx.cs
index f57c4540..2216a43d 100644
--- a/Site/Pages/v5/Ledgers/BalanceSheetSimplified.aspx.cs
+++ b/Site/Pages/v5/Ledgers/BalanceSheetSimplified.aspx.cs
@@ -19,7 +19,7 @@ namespace Swarmops.Frontend.Pages.Ledgers
PageIcon = "iconshock-treasure";
PageTitle = Resources.Pages.Ledgers.BalanceSheet_PageTitle;
- InfoBoxLiteral = Resources.Pages.Ledgers.BalanceSheet_Info;
+ InfoBoxLiteral = Resources.Pages.Ledgers.BalanceSheet_Info_Simplified;
// Security: If the org has open ledgers, then anyone may read. Otherwise, Financials.Read.
diff --git a/Site/Pages/v5/Ledgers/Json-BalanceSheetDataSimplified.aspx.cs b/Site/Pages/v5/Ledgers/Json-BalanceSheetDataSimplified.aspx.cs
index c736b170..68c54be5 100644
--- a/Site/Pages/v5/Ledgers/Json-BalanceSheetDataSimplified.aspx.cs
+++ b/Site/Pages/v5/Ledgers/Json-BalanceSheetDataSimplified.aspx.cs
@@ -35,13 +35,59 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
FinancialAccountType.Balance);
LocalizeRoot (report.ReportLines);
+ _totals = new BalanceSimplifiedTotals();
+
Response.ContentType = "application/json";
- Response.Output.WriteLine (RecurseReport (report.ReportLines));
+ Response.Output.WriteLine("{\"rows\": " + RecurseReport(report.ReportLines) + ", \"footer\": [" +
+ WriteFooter() + "]}");
+
Response.End();
}
+ private class BalanceSimplifiedTotals
+ {
+ public Int64 AssetsCents { get; set; }
+ public Int64 LiabilitiesCents { get; set; }
+ }
+
+ private BalanceSimplifiedTotals _totals;
+
+ private string WriteFooter()
+ {
+ string line1 = string.Format("\"name\":\"{0}\"", Resources.Global.Global_Total);
+
+ line1 += string.Format(CultureInfo.CurrentCulture, ",\"assets\":\"{0:N0}\"",
+ _totals.AssetsCents / 100.0);
+
+ line1 += string.Format(CultureInfo.CurrentCulture, ",\"liabilities\":\"{0:N0}\"", _totals.LiabilitiesCents/-100.0);
+
+ if (_totals.AssetsCents == _totals.LiabilitiesCents)
+ {
+ return "{" + line1 + "}";
+ }
+ else if (_totals.AssetsCents > _totals.LiabilitiesCents) // Predicted profit
+ {
+ string line2 = string.Format("\"name\":\"{0}\"", string.Format(Resources.Pages.Ledgers.BalanceSheet_ProfitToDate, _year));
+
+ line2 += string.Format(CultureInfo.CurrentCulture, ",\"liabilities\":\"{0:N0}\"",
+ (_totals.AssetsCents-_totals.LiabilitiesCents) / 100.0);
+
+ return "[{" + line1 + "},{" + line2 + "}]";
+ }
+ else
+ {
+ string line2 = string.Format("\"name\":\"{0}\"", string.Format(Resources.Pages.Ledgers.BalanceSheet_LossToDate, _year));
+
+ line2 += string.Format(CultureInfo.CurrentCulture, ",\"assets\":\"{0:N0}\"",
+ (_totals.LiabilitiesCents - _totals.AssetsCents) / 100.0);
+
+ return "[{" + line1 + "},{" + line2 + "}]";
+ }
+ }
+
+
private void LocalizeRoot (List lines)
{
Dictionary localizeMap = new Dictionary();
@@ -77,6 +123,11 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
columnCardinal = "liabilities";
columnDelta = "liabilitydelta";
signReverser = -1;
+ this._totals.LiabilitiesCents += line.AccountValues.ThisYear;
+ }
+ else
+ {
+ this._totals.AssetsCents += line.AccountValues.ThisYear;
}
string element = string.Format ("\"id\":\"{0}\",\"name\":\"{1}\"", line.AccountId,