Added VAT field to inbound invoices
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
+11
-2
@@ -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 {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Invoice amount (in {0}).
|
||||
/// Looks up a localized string similar to Invoice amount total (in {0}).
|
||||
/// </summary>
|
||||
internal static string CreateInboundInvoice_Amount {
|
||||
get {
|
||||
@@ -501,6 +501,15 @@ namespace Resources.Pages {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to VAT part of total ({0}).
|
||||
/// </summary>
|
||||
internal static string CreateInboundInvoice_AmountVat {
|
||||
get {
|
||||
return ResourceManager.GetString("CreateInboundInvoice_AmountVat", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Create.
|
||||
/// </summary>
|
||||
|
||||
@@ -283,7 +283,7 @@
|
||||
<value><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/></value>
|
||||
</data>
|
||||
<data name="CreateInboundInvoice_Amount" xml:space="preserve">
|
||||
<value>Invoice amount (in {0})</value>
|
||||
<value>Invoice amount total (in {0})</value>
|
||||
<comment>{0} is the organization's main currency.</comment>
|
||||
</data>
|
||||
<data name="CreateInboundInvoice_Description" xml:space="preserve">
|
||||
@@ -611,4 +611,7 @@
|
||||
<data name="RequestCashAdvance_ButtonRequest" xml:space="preserve">
|
||||
<value>Request</value>
|
||||
</data>
|
||||
<data name="CreateInboundInvoice_AmountVat" xml:space="preserve">
|
||||
<value>VAT part of total ({0})</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -13,6 +13,10 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
if (vatEnabled) { // if VAT is enabled, show those controls
|
||||
$('.vatEnabled').show();
|
||||
}
|
||||
|
||||
<asp:Repeater ID="RepeaterTagDropScript" runat="server"><ItemTemplate>
|
||||
$('#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 %>');
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
.vatEnabled
|
||||
{ display: none;}
|
||||
|
||||
</style>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
|
||||
@@ -116,6 +147,7 @@
|
||||
<div class="entryFields">
|
||||
<div class="stacked-input-control"><asp:TextBox runat="server" ID="TextSupplier" /></div>
|
||||
<Swarmops5:CurrencyAmount runat="server" ID="CurrencyAmount" />
|
||||
<span class="vatEnabled"><Swarmops5:CurrencyAmount runat="server" ID="CurrencyVat" /></span>
|
||||
<div class="stacked-input-control"><asp:TextBox runat="server" ID="TextPurpose" /></div>
|
||||
<div class="stacked-input-control"><asp:TextBox runat="server" ID="TextDueDate" /></div>
|
||||
<Swarmops5:ComboBudgets ID="ComboBudgets" runat="server" />
|
||||
@@ -137,6 +169,7 @@
|
||||
<div class="entryLabels">
|
||||
<asp:Label runat="server" ID="LabelSupplier" /><br/>
|
||||
<asp:Label runat="server" ID="LabelAmount" /><br/>
|
||||
<span class="vatEnabled"><asp:Label runat="server" ID="LabelVat" /><br/></span>
|
||||
<asp:Label runat="server" ID="LabelPurpose" /><br/>
|
||||
<asp:Label runat="server" ID="LabelDueDate" /><br/>
|
||||
<asp:Label runat="server" ID="LabelBudget" /><br/>
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
// Prime bank details
|
||||
|
||||
this.CurrencyAmount.Cents = 0;
|
||||
this.CurrencyVat.Cents = 0;
|
||||
this.TextSupplier.Focus();
|
||||
this.TextDueDate.Text = DateTime.Today.AddDays (30).ToShortDateString(); // Use current culture
|
||||
|
||||
@@ -114,6 +115,8 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
this.LabelDueDate.Text = Global.Financial_DueDate;
|
||||
this.LabelAmount.Text = string.Format (Resources.Pages.Financial.CreateInboundInvoice_Amount,
|
||||
CurrentOrganization.Currency.Code);
|
||||
this.LabelVat.Text = string.Format(Resources.Pages.Financial.CreateInboundInvoice_AmountVat,
|
||||
CurrentOrganization.Currency.Code);
|
||||
this.LabelPurpose.Text = Resources.Pages.Financial.CreateInboundInvoice_Description;
|
||||
this.LabelBudget.Text = Global.Financial_Budget;
|
||||
this.LabelHeaderBankDetails.Text = Resources.Pages.Financial.CreateInboundInvoice_HeaderPaymentDetails;
|
||||
@@ -132,6 +135,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
// People who choose to disable JavaScript and then submit bad input almost deserve to be hurt.
|
||||
|
||||
Int64 amountCents = this.CurrencyAmount.Cents;
|
||||
Int64 amountVatCents = this.CurrencyVat.Cents;
|
||||
|
||||
string description = this.TextPurpose.Text;
|
||||
|
||||
@@ -157,7 +161,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
throw new InvalidOperationException ("No documents uploaded");
|
||||
}
|
||||
|
||||
InboundInvoice invoice = InboundInvoice.Create (CurrentOrganization, dueDate, amountCents, budget,
|
||||
InboundInvoice invoice = InboundInvoice.Create (CurrentOrganization, dueDate, amountCents, amountVatCents, budget,
|
||||
this.TextSupplier.Text, this.TextPurpose.Text, this.TextAccount.Text, string.Empty,
|
||||
this.TextReference.Text, CurrentUser);
|
||||
|
||||
|
||||
@@ -66,6 +66,15 @@ namespace Swarmops.Frontend.Pages.v5.Financial {
|
||||
/// </remarks>
|
||||
protected global::Swarmops.Frontend.Controls.Financial.CurrencyTextBox CurrencyAmount;
|
||||
|
||||
/// <summary>
|
||||
/// CurrencyVat control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Swarmops.Frontend.Controls.Financial.CurrencyTextBox CurrencyVat;
|
||||
|
||||
/// <summary>
|
||||
/// TextPurpose control.
|
||||
/// </summary>
|
||||
@@ -156,6 +165,15 @@ namespace Swarmops.Frontend.Pages.v5.Financial {
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LabelAmount;
|
||||
|
||||
/// <summary>
|
||||
/// LabelVat control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LabelVat;
|
||||
|
||||
/// <summary>
|
||||
/// LabelPurpose control.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user