Work on Simplified Balance Sheet

This commit is contained in:
Falkvinge
2017-05-14 13:24:54 +02:00
parent deabf91156
commit 8827541dcc
8 changed files with 70 additions and 49 deletions
+2 -2
View File
@@ -99,9 +99,9 @@ namespace Swarmops.Logic.Financial
if (this._accountType == FinancialAccountType.Balance)
{
AnnualReportLine assetLine = new AnnualReportLine
{AccountId = assetIdentity, AccountName = "%ASSET_ACCOUNTGROUP%"};
{AccountId = assetIdentity, AccountName = "%ASSET_ACCOUNTGROUP%", AccountType = FinancialAccountType.Asset};
AnnualReportLine debtLine = new AnnualReportLine
{AccountId = debtIdentity, AccountName = "%DEBT_ACCOUNTGROUP%"};
{AccountId = debtIdentity, AccountName = "%DEBT_ACCOUNTGROUP%", AccountType = FinancialAccountType.Debt};
remapLookup[FinancialAccountType.Asset] = assetLine;
remapLookup[FinancialAccountType.Debt] = debtLine;
+18 -9
View File
@@ -348,6 +348,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to (change).
/// </summary>
internal static string BalanceSheet_AssetsDelta {
get {
return ResourceManager.GetString("BalanceSheet_AssetsDelta", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Balance Sheet for {0},.
/// </summary>
@@ -366,15 +375,6 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to (change).
/// </summary>
internal static string BalanceSheet_Delta {
get {
return ResourceManager.GetString("BalanceSheet_Delta", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to BalanceSheet.
/// </summary>
@@ -411,6 +411,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to (change).
/// </summary>
internal static string BalanceSheet_LiabilitiesDelta {
get {
return ResourceManager.GetString("BalanceSheet_LiabilitiesDelta", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Balance Sheet.
/// </summary>
+5 -1
View File
@@ -789,7 +789,7 @@
<value>Assets XXXX</value>
<comment>For the simplified view - XXXX is replaced with year</comment>
</data>
<data name="BalanceSheet_Delta" xml:space="preserve">
<data name="BalanceSheet_AssetsDelta" xml:space="preserve">
<value>(change)</value>
<comment>Change from previous year's close, which is same as from start of this year</comment>
</data>
@@ -797,4 +797,8 @@
<value>Liabilities XXXX</value>
<comment>For the simplified view - XXXX is replaced with year</comment>
</data>
<data name="BalanceSheet_LiabilitiesDelta" xml:space="preserve">
<value>(change)</value>
<comment>Change from previous year's close, which is same as from start of this year</comment>
</data>
</root>
+4 -4
View File
@@ -8,7 +8,7 @@
<UserLevel>0</UserLevel>
<Permissions />
<ImageUrl />
<NavigateUrl>/Pages/v5/Ledgers/BalanceSheet.aspx</NavigateUrl>
<NavigateUrl>/Ledgers/Balance</NavigateUrl>
<Type>Link</Type>
<Children />
</MainMenuItem>
@@ -18,7 +18,7 @@
<UserLevel>0</UserLevel>
<Permissions />
<ImageUrl />
<NavigateUrl>/Pages/v5/Ledgers/ProfitLossStatement.aspx</NavigateUrl>
<NavigateUrl>/Ledgers/ProfitLossStatement</NavigateUrl>
<Type>Link</Type>
<Children />
</MainMenuItem>
@@ -28,7 +28,7 @@
<UserLevel>0</UserLevel>
<Permissions />
<ImageUrl />
<NavigateUrl>/Pages/v5/Ledgers/BudgetActual.aspx</NavigateUrl>
<NavigateUrl>/Ledgers/BudgetActual</NavigateUrl>
<Type>Link</Type>
<Children />
</MainMenuItem>
@@ -38,7 +38,7 @@
<UserLevel>3</UserLevel>
<Permissions />
<ImageUrl />
<NavigateUrl>/Pages/v5/Ledgers/InspectLedgers.aspx</NavigateUrl>
<NavigateUrl>/Ledgers/InspectLedgers</NavigateUrl>
<Type>Link</Type>
<Children />
</MainMenuItem>
+4 -4
View File
@@ -8,14 +8,14 @@
$('#tableProfitLoss').treegrid(
{
onBeforeExpand: function (foo) {
$('span.profitlossdata-collapsed-' + foo.id).fadeOut('fast', function () {
$('span.profitlossdata-expanded-' + foo.id).fadeIn('slow');
$('span.annualreportdata-collapsed-' + foo.id).fadeOut('fast', function () {
$('span.annualreportdata-expanded-' + foo.id).fadeIn('slow');
});
},
onBeforeCollapse: function (foo) {
$('span.profitlossdata-expanded-' + foo.id).fadeOut('fast', function () {
$('span.profitlossdata-collapsed-' + foo.id).fadeIn('slow');
$('span.annualreportdata-expanded-' + foo.id).fadeOut('fast', function () {
$('span.annualreportdata-collapsed-' + foo.id).fadeIn('slow');
});
},
@@ -8,14 +8,14 @@
$('#tableAnnualReport').treegrid(
{
onBeforeExpand: function (foo) {
$('span.profitlossdata-collapsed-' + foo.id).fadeOut('fast', function () {
$('span.profitlossdata-expanded-' + foo.id).fadeIn('slow');
$('span.annualreportdata-collapsed-' + foo.id).fadeOut('fast', function () {
$('span.annualreportdata-expanded-' + foo.id).fadeIn('slow');
});
},
onBeforeCollapse: function (foo) {
$('span.profitlossdata-expanded-' + foo.id).fadeOut('fast', function () {
$('span.profitlossdata-collapsed-' + foo.id).fadeIn('slow');
$('span.annualreportdata-expanded-' + foo.id).fadeOut('fast', function () {
$('span.annualreportdata-collapsed-' + foo.id).fadeIn('slow');
});
},
@@ -27,8 +27,9 @@
var selectedYear = $('#<%=DropYears.ClientID %>').val();
$('div#linkDownloadReport').attr("onclick", "document.location='Csv-BalanceData.aspx?Year=" + selectedYear + "';");
$('#spanDownloadText').text(SwarmopsJS.unescape('<%= this.Localized_DownloadFileName %>') + selectedYear + "-<%=DateTime.Today.ToString("yyyyMMdd") %>.csv");
$('#headerStartYear').text(SwarmopsJS.unescape('<%= this.Localized_Assets %>'.replace('XXXX',selectedYear)));
$('#spanDownloadText').text(SwarmopsJS.unescape('<%= this.Localized_DownloadFileName %>') + selectedYear + "-<%=DateTime.UtcNow.ToString("yyyyMMdd") %>.csv");
$('#headerAssetsCardinal').text(SwarmopsJS.unescape('<%= this.Localized_Assets %>'.replace('XXXX',selectedYear)));
$('#headerLiabilitiesCardinal').text(SwarmopsJS.unescape('<%= this.Localized_Liabilities %>'.replace('XXXX',selectedYear)));
if (selectedYear == currentYear)
{
@@ -50,7 +51,7 @@
$('#<%=DropYears.ClientID %>').change(function () {
var selectedYear = $('#<%=DropYears.ClientID %>').val();
$('#tableAnnualReport').treegrid({ url: 'Json-BalanceSheetData.aspx?Year=' + selectedYear });
$('#tableAnnualReport').treegrid({ url: 'Json-BalanceSheetDataSimplified.aspx?Year=' + selectedYear });
$('#imageLoadIndicator').show();
$('div.datagrid').css('opacity', 0.4);
@@ -86,10 +87,10 @@
<thead>
<tr>
<th field="name" width="178"><asp:Literal ID="LiteralHeaderAccountName" runat="server"/></th>
<th field="assets" width="120" align="right"><span class="commonHeader" id="headerStartYear" style="display:none"><asp:Literal ID="LiteralAssets" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="assetdelta" width="120" align="right"><span class="commonHeader" id="headerQ1" style="display:none"><asp:Literal ID="LiteralAssetsDelta" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="liabilities" width="120" align="right"><span class="commonHeader" id="headerQ2" style="display:none"><asp:Literal ID="LiteralLiabilities" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="liabilitydelta" width="120" align="right"><span class="commonHeader" id="headerQ3" style="display:none"><asp:Literal ID="LiteralLiabilitiesDelta" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="assets" width="140" align="right"><span class="commonHeader" id="headerAssetsCardinal" style="display:none"><asp:Literal ID="LiteralAssets" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="assetdelta" width="100" align="right"><span class="commonHeader" id="headerAssetsDelta" style="display:none"><asp:Literal ID="LiteralAssetsDelta" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="liabilities" width="140" align="right"><span class="commonHeader" id="headerLiabilitiesCardinal" style="display:none"><asp:Literal ID="LiteralLiabilities" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="liabilitydelta" width="100" align="right"><span class="commonHeader" id="headerLiabilitiesDelta" style="display:none"><asp:Literal ID="LiteralLiabilitiesDelta" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
</tr>
</thead>
</table>
@@ -55,12 +55,12 @@ namespace Swarmops.Frontend.Pages.Ledgers
{
this.LabelContentHeader.Text = string.Format (Resources.Pages.Ledgers.BalanceSheet_ContentHeader,
CurrentOrganization.Name);
/*
this.LiteralHeaderQ1.Text = Resources.Pages.Ledgers.BalanceSheet_Q1;
this.LiteralHeaderQ2.Text = Resources.Pages.Ledgers.BalanceSheet_Q2;
this.LiteralHeaderQ3.Text = Resources.Pages.Ledgers.BalanceSheet_Q3;
this.LiteralHeaderQ4.Text = Resources.Pages.Ledgers.BalanceSheet_Q4;
this.LiteralHeaderYtd.Text = Resources.Pages.Ledgers.BalanceSheet_Current;*/
this.LiteralAssetsDelta.Text = Resources.Pages.Ledgers.BalanceSheet_AssetsDelta;
this.LiteralLiabilitiesDelta.Text = Resources.Pages.Ledgers.BalanceSheet_LiabilitiesDelta;
this.LiteralAssets.Text = Resources.Pages.Ledgers.BalanceSheet_Assets;
this.LiteralLiabilities.Text = Resources.Pages.Ledgers.BalanceSheet_Liabilities;
this.LiteralHeaderAccountName.Text = Resources.Pages.Ledgers.BalanceSheet_AccountName;
}
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Web.UI.WebControls;
using Swarmops.Common.Enums;
using Swarmops.Logic.Financial;
@@ -85,22 +86,24 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
{
element += ",\"" + columnCardinal + "\":" +
JsonDualString (line.AccountId, line.AccountTreeValues.ThisYear * signReverser,
line.AccountValues.ThisYear * signReverser);
line.AccountValues.ThisYear * signReverser, line.DefaultExpand);
element += ",\"" + columnDelta + "\":" +
JsonDualString (line.AccountId, (line.AccountTreeValues.ThisYear-line.AccountTreeValues.PreviousYear) * signReverser,
(line.AccountValues.ThisYear-line.AccountValues.PreviousYear) * signReverser);
(line.AccountValues.ThisYear-line.AccountValues.PreviousYear) * signReverser, line.DefaultExpand, string.Empty, "(+#,#.);(-#,#.);---");
element += ",\"state\":\"" + (line.DefaultExpand? "open":"closed") + "\",\"children\":" + RecurseReport (line.Children);
}
else
{
element += string.Format (CultureInfo.CurrentCulture, ",\"" + columnCardinal + "\":\"{0:N2}\"",
(double) line.AccountValues.PreviousYear/100.0*signReverser);
element += string.Format (CultureInfo.CurrentCulture, ",\"" + columnCardinal + "\":\"{0:N0}\"",
(double) line.AccountValues.ThisYear/100.0*signReverser);
element += string.Format (CultureInfo.CurrentCulture, ",\"" + columnDelta + "\":\"({0:+#,#;-#,#;0})\"",
(double) line.AccountValues.ThisYear/100.0*signReverser).Replace("-", "&minus;");
element += string.Format (CultureInfo.CurrentCulture, ",\"" + columnDelta + "\":\"{0:(+#,#.);(-#,#.);---}\"",
(double) (line.AccountValues.ThisYear-line.AccountValues.PreviousYear)/100.0*signReverser)
.Replace("---","<span style='color:#CCC'>&mdash;</span>")
.Replace("-", "&minus;");
}
elements.Add ("{" + element + "}");
@@ -110,17 +113,21 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
}
private string JsonDualString (int accountId, Int64 treeValue, Int64 singleValue)
private string JsonDualString (int accountId, Int64 treeValue, Int64 singleValue, bool expanded, string sigma = "<strong>&Sigma;</strong>", string format = "N0")
{
if (treeValue != 0 && singleValue == 0)
if (expanded || treeValue != 0 && singleValue == 0)
{
return string.Format (CultureInfo.CurrentCulture,
"\"<span class=\\\"annualreportdata-collapsed-{0}\\\"><strong>&Sigma;</strong> {1:N0}</span><span class=\\\"annualreportdata-expanded-{0}\\\" style=\\\"display:none\\\">&nbsp;</span>\"",
accountId, treeValue/100.00);
"\"<span class='annualreportdata-collapsed-{0}' " + (expanded? "style='display:none'": "") + ">" + sigma + " {1:" + format + "}</span><span class='annualreportdata-expanded-{0}' " + (!expanded ? "style='display:none'" : "") + ">&nbsp;</span>\"",
accountId, treeValue/100.00)
.Replace("---", "<span style='color:#CCC'>&mdash;</span>")
.Replace("-", "&minus;");
}
return string.Format (CultureInfo.CurrentCulture,
"\"<span class=\\\"annualreportdata-collapsed-{0}\\\"><strong>&Sigma;</strong> {1:N0}</span><span class=\\\"annualreportdata-expanded-{0}\\\" style=\\\"display:none\\\">{2:N0}</span>\"",
accountId, treeValue/100.0, singleValue/100.0);
"\"<span class='annualreportdata-collapsed-{0}'>" + sigma + " {1:" + format + "}</span><span class='annualreportdata-expanded-{0}' style='display:none'>{2:" + format + "}</span>\"",
accountId, treeValue/100.0, singleValue/100.0)
.Replace("---", "<span style='color:#CCC'>&mdash;</span>")
.Replace("-", "&minus;");
}
}
}