This commit is contained in:
Rick Falkvinge
2016-04-03 20:30:39 +02:00
4 changed files with 28 additions and 16 deletions
@@ -735,6 +735,10 @@
<data name="BudgetActual_ContentHeader" xml:space="preserve">
<value>Budget vs Actual</value>
</data>
<data name="BudgetActual_ExpectedYtd" xml:space="preserve">
<value>Expected YTD</value>
<comment>As in "expected actuals", as in when compared to budget. From the context, just "Expected" will also work.</comment>
</data>
<data name="BudgetActual_Info" xml:space="preserve">
<value>This page displays the budgeted breakdown compared to a breakdown of the actual outcome so far.</value>
</data>
+8 -14
View File
@@ -32,15 +32,17 @@
{
$('span.previousYearsHeader').hide();
$('span.currentYearHeader').show();
$('#tableBudgetActual').treegrid('showColumn', 'yearExpected');
}
else
{
$('#previousLastActual').text(actualLoc + ' ' + (selectedYear - 1));
$('#previousBudget').text(budgetLoc + ' ' + selectedYear);
$('#previousYtd').text(actualLoc + ' ' + selectedYear);
$('#previousActual').text(actualLoc + ' ' + selectedYear);
$('span.currentYearHeader').hide();
$('span.previousYearsHeader').show();
$('#tableBudgetActual').treegrid('hideColumn', 'yearExpected');
}
}
});
@@ -88,9 +90,10 @@
<tr>
<th field="name" width="178"><asp:Literal ID="LiteralHeaderAccountName" runat="server"/></th>
<th field="lastYearActual" width="80" align="right"><span class="previousYearsHeader" id="previousLastActual" style="display:none"></span><span class="currentYearHeader" style="display:none"><asp:Literal ID="LiteralHeaderLastYearActual" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="yearBudget" width="80" align="right"><span class="previousYearsHeader" id="previousBudget" style="display:none"></span><span class="currentYearHeader" style="display:none" id="currentQ1"><asp:Literal ID="LiteralHeaderBudget" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="yearActual" width="80" align="right"><span class="previousYearsHeader" id="previousYtd" style="display:none"></span><span class="currentYearHeader" style="display:none" id="currentQ2"><asp:Literal ID="LiteralHeaderActual" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="flags" width="40" align="right"><span class="allYearsHeader" style="display:none" id="currentFlags"><asp:Literal ID="LiteralHeaderFlags" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="yearBudget" width="80" align="right"><span class="previousYearsHeader" id="previousBudget" style="display:none"></span><span class="currentYearHeader" style="display:none" id="currentBudget"><asp:Literal ID="LiteralHeaderBudget" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="yearActual" width="80" align="right"><span class="previousYearsHeader" id="previousActual" style="display:none"></span><span class="currentYearHeader" style="display:none" id="currentActual"><asp:Literal ID="LiteralHeaderActual" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="yearExpected" width="80" align="right"><span class="previousYearsHeader" id="previousNeverShowing" style="display:none"></span><span class="currentYearHeader" style="display:none" id="currentExpected"><asp:Literal ID="LiteralHeaderExpected" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
<th field="flags" width="40" align="center"><span class="allYearsHeader" style="display:none" id="currentFlags"><asp:Literal ID="LiteralHeaderFlags" runat="server" /></span><span class="loadingHeader">&mdash;</span></th>
</tr>
</thead>
</table>
@@ -98,16 +101,7 @@
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
<h2 class="blue"><asp:Label ID="LabelSidebarDownload" Text="Download This" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<div class="link-row-encaps" id="linkDownloadReport" onclick="document.location='placeholder';" >
<div class="link-row-icon" style="background-image:url('/Images/Icons/iconshock-downarrow-16px.png');background-position:-1px -1px"></div>
<span id="spanDownloadText">ProfitLossxxxx-yyyymmdd.csv</span>
</div>
</div>
</div>
</asp:Content>
@@ -56,6 +56,7 @@ public partial class Pages_v5_Ledgers_BudgetActual : PageV5Base
this.LiteralHeaderLastYearActual.Text = Global.Financial_Actuals + @" " + (year - 1).ToString(CultureInfo.InvariantCulture);
this.LiteralHeaderBudget.Text = Global.Financial_Budget + @" " + year.ToString(CultureInfo.InvariantCulture); ;
this.LiteralHeaderActual.Text = Global.Financial_Actuals + @" " + Global.Financial_YTD;
this.LiteralHeaderExpected.Text = Ledgers.BudgetActual_ExpectedYtd;
this.LiteralActual.Text = Global.Financial_Actuals;
this.LiteralBudget.Text = Global.Financial_Budget;
this.LiteralHeaderAccountName.Text = Ledgers.ProfitLossStatement_AccountName;
@@ -9,6 +9,7 @@ public partial class Pages_v5_Ledgers_Json_BudgetActualData : DataV5Base
{
private AuthenticationData _authenticationData;
private int _year = 2012;
private int _yearProgressionMilli = 0;
protected void Page_Load (object sender, EventArgs e)
{
@@ -16,9 +17,11 @@ public partial class Pages_v5_Ledgers_Json_BudgetActualData : DataV5Base
this._authenticationData = GetAuthenticationDataAndCulture();
// Get current year
// Get current year and part of year
this._year = DateTime.Today.Year;
DateTime utcNow = DateTime.UtcNow;
this._year = utcNow.Year;
this._yearProgressionMilli = utcNow.DayOfYear*1000/365; // Ignore leap years
string yearParameter = Request.QueryString["Year"];
@@ -69,6 +72,8 @@ public partial class Pages_v5_Ledgers_Json_BudgetActualData : DataV5Base
result += string.Format(CultureInfo.CurrentCulture, ",\"yearActual\":\"{0:N0}\"", (double)totals.ThisYear / -100.0);
result += string.Format(CultureInfo.CurrentCulture, ",\"yearExpected\":\"{0:N0}\"", (double)totals.ThisYearBudget / 100.0 * _yearProgressionMilli / 1000);
return "{" + result + "}";
}
@@ -94,6 +99,10 @@ public partial class Pages_v5_Ledgers_Json_BudgetActualData : DataV5Base
element += ",\"yearActual\":" +
JsonDualString (line.AccountId, line.AccountTreeValues.ThisYear, line.AccountValues.ThisYear);
element += ",\"yearExpected\":" +
JsonDualString(line.AccountId, -line.AccountTreeValues.ThisYearBudget * _yearProgressionMilli / 1000, -line.AccountValues.ThisYearBudget * _yearProgressionMilli / 1000);
element += ",\"state\":\"closed\",\"children\":" + RecurseReport (line.Children);
}
@@ -107,6 +116,10 @@ public partial class Pages_v5_Ledgers_Json_BudgetActualData : DataV5Base
element += string.Format (CultureInfo.CurrentCulture, ",\"yearActual\":\"{0:N0}\"",
(double) line.AccountValues.ThisYear/-100.0);
element += string.Format(CultureInfo.CurrentCulture, ",\"yearExpected\":\"{0:N0}\"",
(double)line.AccountValues.ThisYearBudget / 100.0 * _yearProgressionMilli / 1000);
}
elements.Add ("{" + element + "}");