diff --git a/Logic/Financial/InboundInvoice.cs b/Logic/Financial/InboundInvoice.cs index 42aacd21..b6acc943 100644 --- a/Logic/Financial/InboundInvoice.cs +++ b/Logic/Financial/InboundInvoice.cs @@ -169,7 +169,7 @@ namespace Swarmops.Logic.Financial } public static InboundInvoice Create (Organization organization, DateTime dueDate, Int64 amountCents, - FinancialAccount budget, string supplier, string description, string payToAccount, string ocr, + Int64 amountVatCents, FinancialAccount budget, string supplier, string description, string payToAccount, string ocr, string invoiceReference, Person creatingPerson) { InboundInvoice newInvoice = FromIdentity (SwarmDb.GetDatabaseForWriting(). @@ -186,7 +186,17 @@ namespace Swarmops.Logic.Financial "Invoice #" + newInvoice.Identity + " from " + supplier); transaction.AddRow (organization.FinancialAccounts.DebtsInboundInvoices, -amountCents, creatingPerson); - transaction.AddRow (budget, amountCents, creatingPerson); + if (amountVatCents > 0) + { + transaction.AddRow(organization.FinancialAccounts.AssetsVatInboundUnreported, amountVatCents, + creatingPerson); + transaction.AddRow(budget, amountCents - amountVatCents, creatingPerson); + } + else + { + transaction.AddRow(budget, amountCents, creatingPerson); + } + // Make the transaction dependent on the inbound invoice diff --git a/Site/App_GlobalResources/Pages.Financial.designer.cs b/Site/App_GlobalResources/Pages.Financial.designer.cs index 9c6e374c..6ae70d26 100644 --- a/Site/App_GlobalResources/Pages.Financial.designer.cs +++ b/Site/App_GlobalResources/Pages.Financial.designer.cs @@ -19,7 +19,7 @@ namespace Resources.Pages { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option or rebuild the Visual Studio project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "11.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "14.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Financial { @@ -493,7 +493,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Invoice amount (in {0}). + /// Looks up a localized string similar to Invoice amount total (in {0}). /// internal static string CreateInboundInvoice_Amount { get { @@ -501,6 +501,15 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to VAT part of total ({0}). + /// + internal static string CreateInboundInvoice_AmountVat { + get { + return ResourceManager.GetString("CreateInboundInvoice_AmountVat", resourceCulture); + } + } + /// /// Looks up a localized string similar to Create. /// diff --git a/Site/App_GlobalResources/Pages.Financial.resx b/Site/App_GlobalResources/Pages.Financial.resx index 2ca7d77d..87a5bbd5 100644 --- a/Site/App_GlobalResources/Pages.Financial.resx +++ b/Site/App_GlobalResources/Pages.Financial.resx @@ -283,7 +283,7 @@ <strong>WARNING: UNINITIALIZED BUDGET</strong><br/><br/>The cost you're approving belongs to an uninitialized budget -- an account in the ledger that lacks owner and doesn't have a set budget allowance for the year. Consider visiting the Account Plan and allocating budgets for the expected revenue and expenses.<br/><br/>This message will only display once per visit to Attestations.<br/> - Invoice amount (in {0}) + Invoice amount total (in {0}) {0} is the organization's main currency. @@ -611,4 +611,7 @@ Request + + VAT part of total ({0}) + \ No newline at end of file diff --git a/Site/Pages/v5/Financial/CreateInboundInvoice.aspx b/Site/Pages/v5/Financial/CreateInboundInvoice.aspx index 94c8919f..fbd78f6a 100644 --- a/Site/Pages/v5/Financial/CreateInboundInvoice.aspx +++ b/Site/Pages/v5/Financial/CreateInboundInvoice.aspx @@ -13,6 +13,10 @@ $(document).ready(function () { + if (vatEnabled) { // if VAT is enabled, show those controls + $('.vatEnabled').show(); + } + $('#DropTags<%# Eval("TagSetId") %>').combotree({ animate: true, @@ -73,6 +77,25 @@ } }); + if (vatEnabled) { + $.ajax({ + type: "POST", + url: "/Automation/FieldValidation.aspx/IsAmountValid", + data: $.toJSON(jsonData), + contentType: "application/json; charset=utf-8", + dataType: "json", + async: false, // blocks until function returns - race conditions otherwise + success: function(msg) { + if (msg.d != true) { + isValid = false; + $('#<%=CurrencyAmount.ClientID %>_TextInput').addClass("entryError"); + alertify.error(SwarmopsJS.unescape('<%= this.Localized_ValidationError_Amount %>')); + <%=CurrencyAmount.ClientID %>_focus(); + } + } + }); + } + $.ajax({ type: "POST", url: "/Automation/FieldValidation.aspx/AreDocumentsUploaded", @@ -103,10 +126,18 @@ return true; } - + var vatEnabled = <%= this.CurrentOrganization.FinancialAccounts.AssetsVatInbound == null? "false": "true" %>; var successMessage = SwarmopsJS.unescape('<%= this.Localized_ForGreatJustice %>'); + + + @@ -116,6 +147,7 @@
+
@@ -137,6 +169,7 @@