diff --git a/Site5/Controls/v5/Financial/CurrencyTextBox.ascx.cs b/Site5/Controls/v5/Financial/CurrencyTextBox.ascx.cs index c9d88ac7..907d65ee 100644 --- a/Site5/Controls/v5/Financial/CurrencyTextBox.ascx.cs +++ b/Site5/Controls/v5/Financial/CurrencyTextBox.ascx.cs @@ -41,5 +41,10 @@ namespace Swarmops.Frontend.Controls.v5.Financial } // TODO: Add other-currency parsing + + public new void Focus() + { + this.Input.Focus(); + } } } \ No newline at end of file diff --git a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx index 2865a7a0..70453cbd 100644 --- a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx +++ b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx @@ -1,6 +1,7 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="CreateInboundInvoice.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Financial.CreateInboundInvoice" %> <%@ Register src="~/Controls/v5/Base/FileUpload.ascx" tagname="FileUpload" tagprefix="Swarmops5" %> <%@ Register TagPrefix="Swarmops5" TagName="ComboBudgets" Src="~/Controls/v5/Financial/ComboBudgets.ascx" %> +<%@ Register TagPrefix="Swarmops5" TagName="CurrencyAmount" Src="~/Controls/v5/Financial/CurrencyTextBox.ascx" %> @@ -53,7 +54,7 @@ isValid = validateTextField('#<%=this.TextPurpose.ClientID %>', "") && isValid; var jsonData = {}; - jsonData.amount = $('#<%=this.TextAmount.ClientID %>').val(); + jsonData.amount = $('#<%=this.CurrencyAmount.ClientID %>_Input').val(); $.ajax({ type: "POST", @@ -65,9 +66,9 @@ success: function(msg) { if (msg.d != true) { isValid = false; - $('#TextAmount').addClass("entryError"); + $('#<%=CurrencyAmount.ClientID %>_Input').addClass("entryError"); alertify.error(""); - $('#<%=this.TextAmount.ClientID %>').focus(); + $('#<%=CurrencyAmount.ClientID %>_Input').focus(); } } }); @@ -114,7 +115,7 @@
​
- ​
+ ​
​
​
 
diff --git a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs index dcaf0a67..e7fbd090 100644 --- a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs +++ b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs @@ -96,7 +96,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial { // Prime bank details - this.TextAmount.Text = 0.ToString ("N2"); + this.CurrencyAmount.Value = 0; this.TextSupplier.Focus(); this.TextDueDate.Text = DateTime.Today.AddDays (30).ToShortDateString(); // Use current culture @@ -137,9 +137,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial // The data has been validated client-side already. We'll throw unfriendly exceptions if invalid data is passed here. // People who choose to disable JavaScript and then submit bad input almost deserve to be hurt. - double amount = Double.Parse (this.TextAmount.Text, NumberStyles.Number); - // parses in current culture - intentional - Int64 amountCents = (Int64) (amount*100); + Int64 amountCents = (Int64) (this.CurrencyAmount.Value*100.0); string description = this.TextPurpose.Text; @@ -200,7 +198,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial this.TextAccount.Text = String.Empty; this.TextPurpose.Text = String.Empty; this.TextReference.Text = String.Empty; - this.TextAmount.Text = 0.ToString ("N2"); + this.CurrencyAmount.Value = 0; this.TextDueDate.Text = DateTime.Today.AddDays (30).ToShortDateString(); // Use current culture // the easyUI combo fields should reset automatically on form submission unless we explicitly reconstruct diff --git a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx index 942bb8a2..2365e1d0 100644 --- a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx +++ b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx @@ -1,6 +1,7 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="FileExpenseClaim.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Financial.FileExpenseClaim" %> <%@ Register src="~/Controls/v5/Base/FileUpload.ascx" tagname="FileUpload" tagprefix="Swarmops5" %> <%@ Register TagPrefix="Swarmops5" TagName="ComboBudgets" Src="~/Controls/v5/Financial/ComboBudgets.ascx" %> +<%@ Register TagPrefix="Swarmops5" TagName="CurrencyAmount" Src="~/Controls/v5/Financial/CurrencyTextBox.ascx" %> @@ -50,7 +51,7 @@ isValid = validateTextField('#<%=this.TextPurpose.ClientID %>', "") && isValid; var jsonData = {}; - jsonData.amount = $('#<%=this.TextAmount.ClientID %>').val(); + jsonData.amount = $('#<%=this.CurrencyAmount.ClientID %>_Input').val(); $.ajax({ type: "POST", @@ -62,9 +63,9 @@ success: function (msg) { if (msg.d != true) { isValid = false; - $('#TextAmount').addClass("entryError"); + $('#<%=this.CurrencyAmount.ClientID %>_Input').addClass("entryError"); alertify.error(""); - $('#<%=this.TextAmount.ClientID %>').focus(); + $('#<%=this.CurrencyAmount.ClientID %>_Input').focus(); } } }); @@ -107,7 +108,7 @@

- ​
+ ​
​
 
"> 
diff --git a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs index c377d7b0..e52e0954 100644 --- a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs +++ b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs @@ -104,8 +104,8 @@ namespace Swarmops.Frontend.Pages.v5.Financial this.TextBank.Text = CurrentUser.BankName; this.TextClearing.Text = CurrentUser.BankClearing; this.TextAccount.Text = CurrentUser.BankAccount; - this.TextAmount.Text = 0.ToString ("N2"); - this.TextAmount.Focus(); + this.CurrencyAmount.Value = 0; + this.CurrencyAmount.Focus(); Localize(); } @@ -144,9 +144,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial // The data has been validated client-side already. We'll throw unfriendly exceptions if invalid data is passed here. // People who choose to disable JavaScript and then submit bad input almost deserve to be hurt. - double amount = Double.Parse (this.TextAmount.Text, NumberStyles.Number); - // parses in current culture - intentional - Int64 amountCents = (Int64) (amount*100.0); + Int64 amountCents = (Int64) (this.CurrencyAmount.Value*100.0); string description = this.TextPurpose.Text;