HUGE improvements to Attestation
This commit is contained in:
@@ -145,7 +145,7 @@
|
||||
<comment>The XXXX is replaced with year number.</comment>
|
||||
</data>
|
||||
<data name="BalanceSheet_Info" xml:space="preserve">
|
||||
<value>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="ProfitLossStatement.aspx">profit-and-loss statement</a> which is the overview of income and expenditure.</value>
|
||||
<value>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="ProfitLossStatement">profit-and-loss statement</a> which is the overview of income and expenditure.</value>
|
||||
</data>
|
||||
<data name="BalanceSheet_PageTitle" xml:space="preserve">
|
||||
<value>Balance Sheet</value>
|
||||
@@ -178,7 +178,7 @@
|
||||
<comment>Must ONLY contain A-Z, a-z characters - nothing accented!</comment>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_Info" xml:space="preserve">
|
||||
<value>The P&L is an overview of income and expenditures, which are grouped by budgets or cost/income type. The sum of all income and expenditure is the yearly result. You may also want to look at the <a href="BalanceSheet.aspx">balance sheet</a> which is the overview of assets and debts.</value>
|
||||
<value>The P&L is an overview of income and expenditures, which are grouped by budgets or cost/income type. The sum of all income and expenditure is the yearly result. You may also want to look at the <a href="BalanceSheet">balance sheet</a> which is the overview of assets and debts.</value>
|
||||
</data>
|
||||
<data name="ProfitLossStatement_LastYear" xml:space="preserve">
|
||||
<value>Last Year</value>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 913 B |
@@ -1,5 +1,5 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="AttestCosts.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Financial.AttestCosts" %>
|
||||
<%@ Register src="~/Controls/v5/UI/ExternalScripts.ascx" tagname="ExternalScripts" tagprefix="Swarmops5" %>
|
||||
<%@ Register src="~/Controls/v5/Base/ModalDialog.ascx" tagname="ModalDialog" tagprefix="Swarmops5" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<script type="text/javascript" src="/Scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
|
||||
@@ -18,6 +18,7 @@
|
||||
'/Images/Abstract/ajaxloader-medium.gif',
|
||||
'/Images/Icons/iconshock-balloon-yes-16px-hot.png',
|
||||
'/Images/Icons/iconshock-balloon-yes-16px-disabled.png',
|
||||
'/Images/Icons/iconshock-balloon-yes-16px-disabled-hot.png',
|
||||
'/Images/Icons/iconshock-balloon-no-16px-hot.png',
|
||||
'/Images/Icons/iconshock-greentick-16px.png',
|
||||
'/Images/Icons/iconshock-redcross-16px.png',
|
||||
@@ -27,80 +28,135 @@
|
||||
$(document).ready(function () {
|
||||
$('#TableAttestableCosts').datagrid(
|
||||
{
|
||||
rowStyler: function (index, rowData) {
|
||||
if (rowData.itemId != null) {
|
||||
return { class: "row" + rowData.itemId.replace(/\|/g, '') };
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
|
||||
onLoadSuccess: function () {
|
||||
$(".LocalIconApproval").attr("src", "/Images/Icons/iconshock-balloon-yes-16px.png");
|
||||
$(".LocalIconApproval").attr("src", "/Images/Icons/iconshock-balloon-yes-16px-disabled.png"); // initialize as disabled until budgets known
|
||||
$(".LocalIconApproved").attr("src", "/Images/Icons/iconshock-greentick-16px.png");
|
||||
$(".LocalIconApproved, .LocalIconDenied").css("display", "none");
|
||||
$(".LocalIconUndo").attr("src", "/Images/Icons/iconshock-balloon-undo-16px.png");
|
||||
$(".LocalIconApproved, .LocalIconDenied, .LocalIconUndo").css("display", "none");
|
||||
$(".LocalIconDenial").attr("src", "/Images/Icons/iconshock-balloon-no-16px.png");
|
||||
$(".LocalIconApproval, .LocalIconApproved, .LocalIconDenial").css("cursor", "pointer");
|
||||
$(".LocalIconApproval, .LocalIconUndo, .LocalIconDenial").css("cursor", "pointer");
|
||||
|
||||
$(".LocalIconApproval").mouseover(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px-hot.png");
|
||||
if ($(this).hasClass("LocalFundsInsufficient")) {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px-disabled-hot.png");
|
||||
} else {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px-hot.png");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproval").mouseout(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px.png");
|
||||
if ($(this).hasClass("LocalFundsInsufficient")) {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px-disabled.png");
|
||||
} else {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px.png");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproved").mouseover(function () {
|
||||
$(".LocalIconUndo").mouseover(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/undo-16px.png");
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-undo-16px-hot.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproved").mouseout(function () {
|
||||
$(".LocalIconUndo").mouseout(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-greentick-16px.png");
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-undo-16px.png");
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproval").click(function () {
|
||||
if ($(this).hasClass("LocalFundsInsufficient")) {
|
||||
alertify.error (decodeURIComponent('<asp:Literal id="LiteralErrorInsufficientBudget" runat="server" />'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("rel", "loading");
|
||||
$(this).attr("src", "/Images/Abstract/ajaxloader-medium.gif");
|
||||
$("#IconDenial" + $(this).attr("baseid")).fadeTo(1000, 0.01).css("cursor", "default");
|
||||
var thisIcon = this;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Pages/v5/Financial/AttestCosts.aspx/Attest",
|
||||
data: "{'identifier': '" + escape($(this).attr("baseid")) + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
$(thisIcon).css("display", "none");
|
||||
$(thisIcon).attr("src", "/Images/Icons/iconshock-balloon-yes-16px.png");
|
||||
$(thisIcon).attr("rel", "active");
|
||||
$("#IconApproved" + $(thisIcon).attr("baseid")).fadeIn(100);
|
||||
alertify.success(unescape(msg.d));
|
||||
}
|
||||
success: $.proxy(function (msg) {
|
||||
var baseid = $(this).attr("baseid");
|
||||
if (msg.d.Success) {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px.png");
|
||||
$(this).attr("rel", "active");
|
||||
$(this).hide();
|
||||
$("#IconApproved" + baseid).fadeIn(100);
|
||||
$("#IconDenial" + baseid).css('opacity', 1.0).hide();
|
||||
$("#IconUndo" + baseid).fadeIn(100);
|
||||
$('.row' + baseid).animate({ color: "#888" }, 400);
|
||||
alertify.success(msg.d.DisplayMessage);
|
||||
|
||||
var accountId = $(this).attr("accountid");
|
||||
var funds = parseFloat($(this).attr("amount"));
|
||||
budgetRemainingLookup[accountId] -= funds;
|
||||
setAttestability();
|
||||
recheckBudgets(); // will double-check budgets against server
|
||||
} else {
|
||||
// failure, likely from attesting too quickly and overrunning budget
|
||||
$(this).attr("rel", "");
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px-disabled.png");
|
||||
$("#IconDenial" + baseid).css('opacity', 1.0).css("cursor", "pointer");
|
||||
alertify.error(msg.d.DisplayMessage);
|
||||
|
||||
recheckBudgets();
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".LocalIconApproved").click(function () {
|
||||
$(".LocalIconUndo").click(function () {
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("rel", "loading");
|
||||
$(this).attr("src", "/Images/Abstract/ajaxloader-medium.gif");
|
||||
var thisIcon = this;
|
||||
$("#IconApproved" + $(this).attr("baseid")).fadeTo(1000, 0.01);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/Pages/v5/Financial/AttestCosts.aspx/Deattest",
|
||||
data: "{'identifier': '" + escape($(this).attr("baseid")) + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
$(thisIcon).css("display", "none");
|
||||
$(thisIcon).attr("src", "/Images/Icons/iconshock-greentick-16px.png");
|
||||
$(thisIcon).attr("rel", "");
|
||||
$("#IconApproval" + $(thisIcon).attr("baseid")).fadeIn(100);
|
||||
$("#" + $(thisIcon).attr("rel"), "");
|
||||
alertify.log(unescape(msg.d).replace('+', ' '));
|
||||
$("#IconDenial" + $(thisIcon).attr("baseid")).fadeTo(100, 1).css("cursor", "pointer");
|
||||
}
|
||||
success: $.proxy(function (msg) {
|
||||
if (msg.d.Success) {
|
||||
var baseid = $(this).attr("baseid");
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-undo-16px.png");
|
||||
$(this).attr("rel", "");
|
||||
$(this).hide();
|
||||
$("#IconApproved" + baseid).css('opacity', 1.0).hide();
|
||||
$("#IconApproval" + baseid).fadeIn(100);
|
||||
$("#IconDenial" + baseid).fadeIn(100).css("cursor", "pointer");
|
||||
$('.row' + baseid).animate({ color: "#000" }, 100);
|
||||
alertify.log(msg.d.DisplayMessage);
|
||||
|
||||
var accountId = $("#IconApproval" + baseid).attr("accountid");
|
||||
var funds = parseFloat($("#IconApproval" + baseid).attr("amount"));
|
||||
budgetRemainingLookup[accountId] += funds;
|
||||
setAttestability();
|
||||
recheckBudgets(); // will double-check budgets against server
|
||||
} else {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-greentick-16px.png");
|
||||
alertify.error(msg.d.DisplayMessage);
|
||||
// TODO: Add alert box?
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
|
||||
}
|
||||
@@ -137,6 +193,15 @@
|
||||
'type': 'image',
|
||||
'opacity': true
|
||||
});
|
||||
|
||||
|
||||
// Check if budgets have been fetched, and if so, initialize attestability
|
||||
|
||||
if (budgetRemainingLookup.budgetsLoaded == true) {
|
||||
setAttestability();
|
||||
}
|
||||
|
||||
budgetRemainingLookup.rowsLoaded = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -147,9 +212,52 @@
|
||||
data.forEach(function(accountData, dummy1, dummy2) {
|
||||
budgetRemainingLookup[accountData.AccountId] = accountData.Remaining;
|
||||
});
|
||||
|
||||
if (budgetRemainingLookup.rowsLoaded == true) {
|
||||
setAttestability();
|
||||
}
|
||||
|
||||
budgetRemainingLookup.budgetsLoaded = true;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function recheckBudgets() {
|
||||
SwarmopsJS.ajaxCall("/Pages/v5/Financial/AttestCosts.aspx/GetRemainingBudgets", {}, function(data) {
|
||||
data.forEach(function(accountData, dummy1, dummy2) {
|
||||
budgetRemainingLookup[accountData.AccountId] = accountData.Remaining;
|
||||
});
|
||||
|
||||
setAttestability();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function setAttestability() {
|
||||
|
||||
$('.LocalIconApproval').each(function() {
|
||||
var accountId = $(this).attr('accountid');
|
||||
var amountRequested = $(this).attr('amount');
|
||||
|
||||
var fundsInBudget = budgetRemainingLookup[accountId];
|
||||
if (fundsInBudget >= amountRequested) {
|
||||
$(this).removeClass("LocalFundsInsufficient");
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px.png");
|
||||
}
|
||||
}
|
||||
else if (!$(this).hasClass("LocalFundsInsufficient")) {
|
||||
$(this).addClass("LocalFundsInsufficient");
|
||||
if ($(this).attr("rel") != "loading") {
|
||||
$(this).attr("src", "/Images/Icons/iconshock-balloon-yes-16px-disabled.png");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
budgetRemainingLookup.attestabilityInitialized = true;
|
||||
}
|
||||
|
||||
var budgetRemainingLookup = {};
|
||||
|
||||
</script>
|
||||
@@ -178,6 +286,12 @@
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<Swarmops5:ModalDialog ID="DialogDeny" runat="server" >
|
||||
<DialogCode>
|
||||
|
||||
</DialogCode>
|
||||
</Swarmops5:ModalDialog>
|
||||
|
||||
<div style="display:none">
|
||||
<!-- a href links for FancyBox to trigger on -->
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.ServiceModel.Security;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using Resources;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
@@ -61,7 +63,8 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
foreach (FinancialAccount account in accounts)
|
||||
{
|
||||
if (account.OwnerPersonId == authData.CurrentUser.Identity)
|
||||
if (account.OwnerPersonId == authData.CurrentUser.Identity ||
|
||||
(account.OwnerPersonId == 0 && authData.CurrentUser.HasAccess (new Access (authData.CurrentOrganization, AccessAspect.Administration))))
|
||||
{
|
||||
result[account.Identity] = true;
|
||||
}
|
||||
@@ -82,23 +85,124 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
this.LabelGridHeaderDocs.Text = Resources.Pages.Financial.AttestCosts_GridHeader_Docs;
|
||||
this.LabelGridHeaderItem.Text = Resources.Pages.Financial.AttestCosts_GridHeader_Item;
|
||||
this.LabelGridHeaderRequested.Text = Resources.Pages.Financial.AttestCosts_GridHeader_Requested;
|
||||
|
||||
this.LiteralErrorInsufficientBudget.Text =
|
||||
System.Uri.EscapeDataString (Resources.Pages.Financial.AttestCosts_OutOfBudget);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static BudgetRemainder[] GetRemainingBudgets()
|
||||
{
|
||||
Dictionary<int, bool> accountLookup = GetAttestationRights();
|
||||
|
||||
if (accountLookup.Count == 0)
|
||||
{
|
||||
return new BudgetRemainder[0];
|
||||
}
|
||||
|
||||
Organization organization = FinancialAccount.FromIdentity (accountLookup.Keys.First()).Organization;
|
||||
|
||||
List<BudgetRemainder> result = new List<BudgetRemainder>();
|
||||
int currentYear = DateTime.UtcNow.Year;
|
||||
Dictionary<int, Int64> budgetAdjustments = GetAccountingAdjustments (organization);
|
||||
|
||||
foreach (int accountId in accountLookup.Keys)
|
||||
{
|
||||
result.Add (new BudgetRemainder { AccountId = accountId, Remaining = FinancialAccount.FromIdentity (accountId).GetBudgetCents (currentYear)/100.0 });
|
||||
FinancialAccount account = FinancialAccount.FromIdentity (accountId);
|
||||
Int64 remaining = GetBudgetRemaining (account, currentYear);
|
||||
|
||||
if (budgetAdjustments.ContainsKey (accountId))
|
||||
{
|
||||
remaining += budgetAdjustments[accountId];
|
||||
}
|
||||
|
||||
result.Add (new BudgetRemainder { AccountId = accountId, Remaining = remaining/100.0 });
|
||||
}
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
private static Dictionary<int, Int64> GetAccountingAdjustments (Organization organization)
|
||||
{
|
||||
// This function returns a dictionary for the cents that are either accounted for but not attested,
|
||||
// or attested but accounted for, to be used to understand how much is really left in budget
|
||||
|
||||
// Positive adjustment means more [cost] budget available, negative less [cost] budget available
|
||||
|
||||
Dictionary<int, Int64> result = new Dictionary<int, long>();
|
||||
|
||||
// Cash advances are accounted for when paid out. Make sure they count toward the budget when attested.
|
||||
|
||||
CashAdvances advances = CashAdvances.ForOrganization (organization);
|
||||
foreach (CashAdvance advance in advances)
|
||||
{
|
||||
if (!result.ContainsKey (advance.BudgetId))
|
||||
{
|
||||
result[advance.BudgetId] = 0;
|
||||
}
|
||||
|
||||
if (advance.Attested)
|
||||
{
|
||||
result[advance.BudgetId] -= advance.AmountCents;
|
||||
}
|
||||
}
|
||||
|
||||
// Expense claims, Inbound invoices, and Salaries are accounted for when filed. Make sure they DON'T
|
||||
// count toward the budget while they are NOT attested.
|
||||
|
||||
ExpenseClaims claims = ExpenseClaims.ForOrganization (organization); // gets all open claims
|
||||
foreach (ExpenseClaim claim in claims)
|
||||
{
|
||||
if (!result.ContainsKey(claim.BudgetId))
|
||||
{
|
||||
result[claim.BudgetId] = 0;
|
||||
}
|
||||
|
||||
if (!claim.Attested)
|
||||
{
|
||||
result[claim.BudgetId] += claim.AmountCents;
|
||||
}
|
||||
}
|
||||
|
||||
InboundInvoices invoices = InboundInvoices.ForOrganization (organization);
|
||||
foreach (InboundInvoice invoice in invoices)
|
||||
{
|
||||
if (!result.ContainsKey(invoice.BudgetId))
|
||||
{
|
||||
result[invoice.BudgetId] = 0;
|
||||
}
|
||||
|
||||
if (!invoice.Attested)
|
||||
{
|
||||
result[invoice.BudgetId] += invoice.AmountCents;
|
||||
}
|
||||
}
|
||||
|
||||
Salaries salaries = Salaries.ForOrganization (organization);
|
||||
foreach (Salary salary in salaries)
|
||||
{
|
||||
if (!result.ContainsKey(salary.PayrollItem.BudgetId))
|
||||
{
|
||||
result[salary.PayrollItem.BudgetId] = 0;
|
||||
}
|
||||
|
||||
if (!salary.Attested)
|
||||
{
|
||||
result[salary.PayrollItem.BudgetId] += (salary.GrossSalaryCents + salary.AdditiveTaxCents);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Int64 GetBudgetRemaining (FinancialAccount account, int year)
|
||||
{
|
||||
Int64 deltaCentsYear = account.GetDeltaCents(new DateTime(year, 1, 1),
|
||||
new DateTime(year + 1, 1, 1));
|
||||
Int64 budgetYear = account.GetBudgetCents(year);
|
||||
return -(budgetYear - deltaCentsYear);
|
||||
}
|
||||
|
||||
public class BudgetRemainder
|
||||
{
|
||||
public int AccountId { get; set; }
|
||||
@@ -108,27 +212,23 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static string Attest (string identifier)
|
||||
public static AttestOperationResult Attest (string identifier)
|
||||
{
|
||||
identifier = HttpUtility.UrlDecode (identifier);
|
||||
|
||||
string result = HandleAttestationDeattestation (identifier, AttestationMode.Attestation);
|
||||
|
||||
return HttpUtility.UrlEncode (result).Replace ("+", "%20");
|
||||
return HandleAttestationDeattestation (identifier, AttestationMode.Attestation);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static string Deattest (string identifier)
|
||||
public static AttestOperationResult Deattest (string identifier)
|
||||
{
|
||||
identifier = HttpUtility.UrlDecode (identifier);
|
||||
|
||||
string result = HandleAttestationDeattestation (identifier, AttestationMode.Deattestation);
|
||||
|
||||
return HttpUtility.UrlEncode (result).Replace ("+", "%20");
|
||||
return HandleAttestationDeattestation (identifier, AttestationMode.Deattestation);
|
||||
}
|
||||
|
||||
|
||||
private static string HandleAttestationDeattestation (string identifier, AttestationMode mode)
|
||||
private static AttestOperationResult HandleAttestationDeattestation (string identifier, AttestationMode mode)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
@@ -250,6 +350,23 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
if (mode == AttestationMode.Attestation)
|
||||
{
|
||||
Int64 budgetRemaining = GetBudgetRemaining (attestableItem.Budget, DateTime.UtcNow.Year);
|
||||
Dictionary<int, Int64> budgetAdjustments = GetAccountingAdjustments (authData.CurrentOrganization);
|
||||
|
||||
if (budgetAdjustments.ContainsKey (attestableItem.Budget.Identity))
|
||||
{
|
||||
budgetRemaining += budgetAdjustments[attestableItem.Budget.Identity];
|
||||
}
|
||||
|
||||
if (amountCents > budgetRemaining)
|
||||
{
|
||||
return new AttestOperationResult
|
||||
{
|
||||
DisplayMessage = Resources.Pages.Financial.AttestCosts_OutOfBudget,
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
|
||||
attestableItem.Attest (authData.CurrentUser);
|
||||
result = string.Format (attestedTemplate, itemId, beneficiary,
|
||||
authData.CurrentOrganization.Currency.Code,
|
||||
@@ -267,7 +384,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
throw new InvalidOperationException ("Unknown Attestation Mode: " + mode);
|
||||
}
|
||||
|
||||
return result;
|
||||
return new AttestOperationResult {DisplayMessage = result, Success = true};
|
||||
}
|
||||
|
||||
|
||||
@@ -341,5 +458,12 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
public string BaseId { get; set; }
|
||||
public string Title { get; set; }
|
||||
}
|
||||
|
||||
public struct AttestOperationResult
|
||||
{
|
||||
public string DisplayMessage;
|
||||
public bool Success;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -49,14 +49,15 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base
|
||||
"\"item\":\"{0}\",\"beneficiary\":\"{1}\",\"description\":\"{2}\",\"budgetName\":\"{3}\",\"amountRequested\":\"{4:N2}\",\"itemId\":\"{5}\"," +
|
||||
"\"dox\":\"" + (item.HasDox ? hasDoxString : " ") + "\"," +
|
||||
"\"actions\":\"<span style=\\\"position:relative;top:3px\\\">" +
|
||||
"<img id=\\\"IconApproval{5}\\\" class=\\\"LocalIconApproval\\\" baseid=\\\"{5}\\\" height=\\\"16\\\" width=\\\"16\\\" />" +
|
||||
"<img id=\\\"IconApproval{5}\\\" class=\\\"LocalIconApproval LocalFundsInsufficient\\\" accountid=\\\"{6}\\\" amount=\\\"{4}\\\" baseid=\\\"{5}\\\" height=\\\"16\\\" width=\\\"16\\\" />" +
|
||||
"<img id=\\\"IconApproved{5}\\\" class=\\\"LocalIconApproved\\\" baseid=\\\"{5}\\\" height=\\\"16\\\" width=\\\"16\\\" /> " +
|
||||
"<img id=\\\"IconDenial{5}\\\" class=\\\"LocalIconDenial\\\" baseid=\\\"{5}\\\" height=\\\"16\\\" width=\\\"16\\\" />" +
|
||||
"<img id=\\\"IconDenied{5}\\\" class=\\\"LocalIconDenied\\\" baseid=\\\"{5}\\\" height=\\\"16\\\" width=\\\"16\\\" /></span>\"",
|
||||
JsonSanitize (GetGlobalResourceObject ("Global", item.IdentityDisplay).ToString()),
|
||||
"<img id=\\\"IconDenied{5}\\\" class=\\\"LocalIconDenied\\\" baseid=\\\"{5}\\\" height=\\\"16\\\" width=\\\"16\\\" />" +
|
||||
"<img id=\\\"IconUndo{5}\\\" class=\\\"LocalIconUndo\\\" baseid=\\\"{5}\\\" height=\\\"16\\\" width=\\\"16\\\" /></span>\"",
|
||||
JsonSanitize(GetGlobalResourceObject("Global", item.IdentityDisplay).ToString()),
|
||||
JsonSanitize (item.Beneficiary), JsonSanitize (TryLocalize (item.Description)),
|
||||
JsonSanitize (item.BudgetName),
|
||||
item.AmountRequestedCents/100.0, item.Identity);
|
||||
item.AmountRequestedCents/100.0, item.Identity, item.Budget.Identity);
|
||||
result.Append ("},");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user