diff --git a/Logic/Communications/Payload/NotificationPayload.cs b/Logic/Communications/Payload/NotificationPayload.cs index c1ce925c..35f7f62e 100644 --- a/Logic/Communications/Payload/NotificationPayload.cs +++ b/Logic/Communications/Payload/NotificationPayload.cs @@ -194,6 +194,7 @@ namespace Swarmops.Logic.Communications.Payload Salary_MonthlyStatement, Salary_Paid, Salary_LastYearSummary, + Salary_Denied, OutboundComm_Resolved, OutboundComm_Sent } diff --git a/Logic/Financial/Salary.cs b/Logic/Financial/Salary.cs index fd253315..a58134df 100644 --- a/Logic/Financial/Salary.cs +++ b/Logic/Financial/Salary.cs @@ -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(), denyingPerson); // zeroes out the tx } #endregion diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs index d87366a1..c6c17381 100644 --- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs +++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs @@ -723,6 +723,26 @@ namespace Swarmops.Logic.Resources { } } + /// + /// 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.. + /// + internal static string Salary_Denied_Body { + get { + return ResourceManager.GetString("Salary_Denied_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [[OrganizationName]] Salary payout denied: [CurrencyCode] [BudgetAmountFloat]. + /// + internal static string Salary_Denied_Subject { + get { + return ResourceManager.GetString("Salary_Denied_Subject", resourceCulture); + } + } + /// /// 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. /// diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx index 51f0fdb5..4462c0a1 100644 --- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx +++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx @@ -396,6 +396,14 @@ Please log on to [InstallationName] at [ExternalUrl]Financial/ValidateReceipts t [[OrganizationName] - ACTION ITEM] Receipts Filed - Validation Needed ACTION ITEM should be translated. + + 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. + + + [[OrganizationName]] Salary payout denied: [CurrencyCode] [BudgetAmountFloat] + 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.