Added denial of salaries

This commit is contained in:
Rick Falkvinge
2017-12-09 17:22:11 +01:00
parent 17226304bd
commit 9ca0bbdc7c
4 changed files with 43 additions and 3 deletions
@@ -194,6 +194,7 @@ namespace Swarmops.Logic.Communications.Payload
Salary_MonthlyStatement,
Salary_Paid,
Salary_LastYearSummary,
Salary_Denied,
OutboundComm_Resolved,
OutboundComm_Sent
}
+14 -3
View File
@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using Swarmops.Basic.Types;
using Swarmops.Basic.Types.Financial;
using Swarmops.Basic.Types.Swarm;
using Swarmops.Common.Enums;
using Swarmops.Database;
using Swarmops.Logic.Communications;
using Swarmops.Logic.Communications.Payload;
using Swarmops.Logic.Swarm;
namespace Swarmops.Logic.Financial
@@ -140,10 +143,18 @@ namespace Swarmops.Logic.Financial
public void DenyAttestation (Person denyingPerson, string reason)
{
// Denying a salary payout is not to be taken lightly. This needs to be a larger feature. Until
// then, it's not implemented at all.
Attested = false;
Open = false;
throw new NotImplementedException();
SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Kill,
FinancialDependencyType.ExpenseClaim, Identity,
DateTime.UtcNow, denyingPerson.Identity, this.CostTotalCents);
OutboundComm.CreateNotificationOfFinancialValidation(Budget, this.PayrollItem.Person, NetSalaryCents / 100.0, this.PayoutDate.ToString("MMMM yyyy"),
NotificationResource.Salary_Denied, reason);
FinancialTransaction transaction = FinancialTransaction.FromDependency(this);
transaction.RecalculateTransaction(new Dictionary<int, long>(), denyingPerson); // zeroes out the tx
}
#endregion
@@ -723,6 +723,26 @@ namespace Swarmops.Logic.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Your salary payout for [RequestPurpose] was cancelled. It will not be paid out.
///
///If this comes as a surprise to you, please contact the organization and/or your supervisor urgently..
/// </summary>
internal static string Salary_Denied_Body {
get {
return ResourceManager.GetString("Salary_Denied_Body", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to [[OrganizationName]] Salary payout denied: [CurrencyCode] [BudgetAmountFloat].
/// </summary>
internal static string Salary_Denied_Subject {
get {
return ResourceManager.GetString("Salary_Denied_Subject", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This is your summary salary statement for [LastYear]. It is not a statement of a new salary, but a statement of the monthly salaries paid to you over the course of the last year as well as any taxes deducted. The purpose of this statement is to serve as data for your records and/or for tax declaration purposes for last year.
///
@@ -396,6 +396,14 @@ Please log on to [InstallationName] at [ExternalUrl]Financial/ValidateReceipts t
<value>[[OrganizationName] - ACTION ITEM] Receipts Filed - Validation Needed</value>
<comment>ACTION ITEM should be translated.</comment>
</data>
<data name="Salary_Denied_Body" xml:space="preserve">
<value>Your salary payout for [RequestPurpose] was cancelled. It will not be paid out.
If this comes as a surprise to you, please contact the organization and/or your supervisor urgently.</value>
</data>
<data name="Salary_Denied_Subject" xml:space="preserve">
<value>[[OrganizationName]] Salary payout denied: [CurrencyCode] [BudgetAmountFloat]</value>
</data>
<data name="Salary_LastYearSummary_Body" xml:space="preserve">
<value>This is your summary salary statement for [LastYear]. It is not a statement of a new salary, but a statement of the monthly salaries paid to you over the course of the last year as well as any taxes deducted. The purpose of this statement is to serve as data for your records and/or for tax declaration purposes for last year.