diff --git a/Site/App_GlobalResources/Global.designer.cs b/Site/App_GlobalResources/Global.designer.cs index 9536e9ae..95e5fd3c 100644 --- a/Site/App_GlobalResources/Global.designer.cs +++ b/Site/App_GlobalResources/Global.designer.cs @@ -1122,6 +1122,15 @@ namespace Resources { } } + /// + /// Looks up a localized string similar to {0:MMMM} {0:d}. + /// + internal static string Global_DateFormatLongDateMonth { + get { + return ResourceManager.GetString("Global_DateFormatLongDateMonth", resourceCulture); + } + } + /// /// Looks up a localized string similar to MMMM d, yyyy. /// @@ -1131,6 +1140,15 @@ namespace Resources { } } + /// + /// Looks up a localized string similar to {0:MMM} {0:dd}. + /// + internal static string Global_DateFormatShortDateMonth { + get { + return ResourceManager.GetString("Global_DateFormatShortDateMonth", resourceCulture); + } + } + /// /// Looks up a localized string similar to MM/DD/YYYY. /// diff --git a/Site/App_GlobalResources/Global.resx b/Site/App_GlobalResources/Global.resx index d5dafb15..a5abd251 100644 --- a/Site/App_GlobalResources/Global.resx +++ b/Site/App_GlobalResources/Global.resx @@ -1092,4 +1092,12 @@ This line item can be automatically scanned by an app. This is when Swarmops can display an expense-to-be-paid in a format, that a mobile banking app can read directly, such as a QR code or other machine-readable format. + + {0:MMMM} {0:d} + Format used for just date and month (no year). The formats are MMMM for month name, dd for zero-padded two-digit date, and d for date without padding. This is included as different languages use different ways to write month and date, for example, German would write "23. Dezember" (note the dot), a format which would be "{0:d}. {0:MMMM}". + + + {0:MMM} {0:dd} + Format used for just date and month (no year). The formats are MMM for three-letter month name, dd for zero-padded two-digit date, and d for date without padding. This is included as different languages write month and date in different orders and with different separators. Do keep the month NAME though, rather than using the month number, even if that's common in the target language. + \ No newline at end of file diff --git a/Site/App_GlobalResources/Pages.Financial.designer.cs b/Site/App_GlobalResources/Pages.Financial.designer.cs index 5cc9fd9c..13427d2d 100644 --- a/Site/App_GlobalResources/Pages.Financial.designer.cs +++ b/Site/App_GlobalResources/Pages.Financial.designer.cs @@ -1473,6 +1473,15 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to Payment is late. + /// + internal static string PayOutMoney_PaymentLate { + get { + return ResourceManager.GetString("PayOutMoney_PaymentLate", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cannot undo payout #{0}: it has already settled or closed.. /// diff --git a/Site/App_GlobalResources/Pages.Financial.resx b/Site/App_GlobalResources/Pages.Financial.resx index b9cec191..16175c42 100644 --- a/Site/App_GlobalResources/Pages.Financial.resx +++ b/Site/App_GlobalResources/Pages.Financial.resx @@ -763,4 +763,8 @@ Transfer Method As in "money transfer method"; this can be a domestic bank transfer, mailing a check, et cetera. + + Payment is late + "Late" in this context means "after its due date". + \ No newline at end of file diff --git a/Site/Pages/v5/Financial/PayOutMoney.aspx b/Site/Pages/v5/Financial/PayOutMoney.aspx index 87d82ebb..9281c753 100644 --- a/Site/Pages/v5/Financial/PayOutMoney.aspx +++ b/Site/Pages/v5/Financial/PayOutMoney.aspx @@ -80,6 +80,7 @@ $('#idModalInputCurrencyAmount').val(loadingBreadcrumb); $('#idModalReference').val(loadingBreadcrumb); $('#idModalTransferMethod').val(loadingBreadcrumb); + $('#idModalDueDate').text(loadingBreadcrumb); // Show or hide the correct count of extra data fields @@ -118,6 +119,8 @@ $('#idModalReference').val($(this).attr("data-reference")); // load reference from JSON data $('#idModalTransferMethod').val(result.TransferMethod); + $('#idModalDueDate').text(result.DueBy + ')'); + var customFieldCount = parseInt($(this).attr("data-fieldcount")); for (var index = 0; index < customFieldCount; index++) { @@ -354,30 +357,49 @@ -

-
​
- ​
- ​
- ​
- ​
- ​
- ​
- ​
- ​
- +

(

+
+ ​
+ + ​
+ ​
+ ​
+
+ + ​
+ ​
+ ​
+
+ +
diff --git a/Site/Pages/v5/Financial/PayOutMoney.aspx.cs b/Site/Pages/v5/Financial/PayOutMoney.aspx.cs index 7964fb66..fb3e2ce6 100644 --- a/Site/Pages/v5/Financial/PayOutMoney.aspx.cs +++ b/Site/Pages/v5/Financial/PayOutMoney.aspx.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Resources; using System.Security; using System.Web; using System.Web.Services; using System.Web.UI; +using Swarmops.Common; using Swarmops.Common.Enums; using Swarmops.Logic.Financial; using Swarmops.Logic.Security; @@ -54,6 +56,7 @@ namespace Swarmops.Frontend.Pages.Financial this.LabelModalHeader.Text = Resources.Pages.Financial.PayOutMoney_Modal_Header; this.LabelModalCurrencyAmount.Text = Resources.Pages.Financial.PayOutMoney_Modal_CurrencyAmount; this.LabelModalTransferMethod.Text = Resources.Pages.Financial.PayOutMoney_Modal_TransferMethod; + this.LabelModalHeaderDue.Text = Resources.Pages.Financial.PayOutMoney_GridHeader_DueDate; this.LabelSidebarOptions.Text = Resources.Global.Sidebar_Options; this.LabelOptionsShowOcr.Text = Resources.Pages.Financial.PayoutMoney_OptionShowOcr; @@ -141,6 +144,8 @@ namespace Swarmops.Frontend.Pages.Financial // with one exception -- we need to determine the amount by adding all the objects // together, if applicable + DateTime paymentDueBy = Constants.DateTimeLow; + switch (Char.ToUpperInvariant(payoutComponents[0][0])) { case 'C': // expense claim @@ -156,14 +161,14 @@ namespace Swarmops.Frontend.Pages.Financial new Money(GetSumCentsTotal(prototypeId), authData.CurrentOrganization.Currency)); break; case 'S': // salary - info = - PaymentTransferInfo.FromObject( - Salary.FromIdentity(Int32.Parse(payoutComponents[0].Substring(1)))); + Salary salary = Salary.FromIdentity(Int32.Parse(payoutComponents[0].Substring(1))); + info = PaymentTransferInfo.FromObject(salary); + paymentDueBy = salary.PayoutDate; break; case 'I': // inbound invoice - info = - PaymentTransferInfo.FromObject( - InboundInvoice.FromIdentity(Int32.Parse(payoutComponents[0].Substring(1)))); + InboundInvoice invoice = InboundInvoice.FromIdentity(Int32.Parse(payoutComponents[0].Substring(1))); + info = PaymentTransferInfo.FromObject(invoice); + paymentDueBy = invoice.DueDate; break; default: throw new NotImplementedException("Unrecognized payment type"); @@ -179,6 +184,29 @@ namespace Swarmops.Frontend.Pages.Financial TransferMethod = info.LocalizedPaymentMethodName }; + if (paymentDueBy < Constants.DateTimeLowThreshold) + { + result.DueBy = Resources.Global.Global_ASAP; + } + else + { + DateTime nowUtc = DateTime.UtcNow; + + if (paymentDueBy.Year != nowUtc.Year || paymentDueBy < nowUtc.AddMonths(-3)) + { + result.DueBy = paymentDueBy.ToString(Resources.Global.Global_DateFormatLongSansWeekday); + } + else + { + result.DueBy = paymentDueBy.ToString(Resources.Global.Global_DateFormatLongDateMonth); + } + + if (paymentDueBy < nowUtc.AddDays(-1)) + { + result.DueBy += " - " + Resources.Pages.Financial.PayOutMoney_PaymentLate; + } + } + List listTransferMethodLabels = new List(); List listTransferMethodData = new List(); @@ -231,6 +259,7 @@ namespace Swarmops.Frontend.Pages.Financial { public string Recipient { get; set; } public string CurrencyAmount { get; set; } + public string DueBy { get; set; } public string Reference { get; set; } public string TransferMethod { get; set; } public string[] TransferMethodLabels { get; set; } diff --git a/Site/Pages/v5/Financial/PayOutMoney.aspx.designer.cs b/Site/Pages/v5/Financial/PayOutMoney.aspx.designer.cs index 2d9c6f9b..9cceea90 100644 --- a/Site/Pages/v5/Financial/PayOutMoney.aspx.designer.cs +++ b/Site/Pages/v5/Financial/PayOutMoney.aspx.designer.cs @@ -84,6 +84,15 @@ namespace Swarmops.Frontend.Pages.Financial { /// protected global::System.Web.UI.WebControls.Label LabelModalHeader; + /// + /// LabelModalHeaderDue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label LabelModalHeaderDue; + /// /// ToggleModalMachineReadable control. /// @@ -129,6 +138,33 @@ namespace Swarmops.Frontend.Pages.Financial { /// protected global::System.Web.UI.WebControls.Label LabelModalTransferMethod; + /// + /// LabelModalAutomation1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label LabelModalAutomation1; + + /// + /// LabelModalAutomation2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label LabelModalAutomation2; + + /// + /// LabelModalAutomation3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label LabelModalAutomation3; + /// /// LabelModalOcr1 control. ///