Better fix for forex tolerance

This commit is contained in:
Rick Falkvinge
2017-12-31 08:14:38 +01:00
parent 2aa41f3176
commit 50273d40b6
2 changed files with 17 additions and 18 deletions
@@ -78,10 +78,9 @@
$('#divNegativeDifference').hide();
if (data.OpenOutboundInvoiceData != null) {
if (data.OpenOutboundInvoiceData.ExactMatches.length > 0 || data.OpenOutboundInvoiceData.TolerantMatches.length > 0) {
if (data.OpenOutboundInvoiceData.length > 0) {
$('#divOutboundInvoice').show();
<%=this.DropOpenOutboundInvoices.ClientID%>_loadData(data.OpenOutboundInvoiceData.ExactMatches);
<%=this.DropOpenOutboundInvoices.ClientID%>_loadData(data.OpenOutboundInvoiceData.TolerantMatches);
<%=this.DropOpenOutboundInvoices.ClientID%>_loadData(data.OpenOutboundInvoiceData);
<%=this.DropOpenOutboundInvoices.ClientID%>_text("<%=Resources.Global.Global_SelectOne%>");
} else {
$('#divOutboundInvoice').hide();
@@ -95,9 +94,8 @@
$('#divNegativeDifference').show();
if (data.OpenPayoutData != null) {
if (data.OpenPayoutData.ExactMatches.length > 0 || data.OpenPayoutData.TolerantMatches.length > 0) {
<%=this.DropOpenPayouts.ClientID%>_loadData(data.OpenPayoutData.ExactMatches);
<%=this.DropOpenPayouts.ClientID%>_loadData(data.OpenPayoutData.TolerantMatches);
if (data.OpenPayoutData.length > 0) {
<%=this.DropOpenPayouts.ClientID%>_loadData(data.OpenPayoutData);
<%=this.DropOpenPayouts.ClientID%>_text("<%=Resources.Global.Global_SelectOne%>");
} else {
<%=this.DropOpenPayouts.ClientID%>_loadData({});
@@ -82,16 +82,15 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
public string DifferingAmount { get; set; }
public string AmountAsPurchase { get; set; }
public string TransactionDescription { get; set; }
public DropdownOptions OpenPayoutData { get; set; }
public DropdownOptions OpenOutboundInvoiceData { get; set; }
public DropdownOption[] OpenPayoutData { get; set; }
public DropdownOption[] OpenOutboundInvoiceData { get; set; }
public DropdownOption[] OpenVatReportData { get; set; }
}
[Serializable]
public class DropdownOptions
{
public DropdownOption[] ExactMatches { get; set; }
public DropdownOption[] TolerantMatches { get; set; }
public DropdownOption[] Matches { get; set; }
}
[Serializable]
@@ -151,7 +150,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
return result;
}
private static DropdownOptions GetOpenPayoutData(FinancialTransaction transaction)
private static DropdownOption[] GetOpenPayoutData(FinancialTransaction transaction)
{
DateTime transactionDateTime = transaction.DateTime;
Int64 matchAmount = transaction.Rows.AmountCentsTotal;
@@ -193,14 +192,15 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
}
}
result.ExactMatches = listExact.ToArray();
result.TolerantMatches = listTolerant.ToArray();
List<DropdownOption> listCombined = new List<DropdownOption>();
listCombined.AddRange(listExact);
listCombined.AddRange(listTolerant);
return result;
return listCombined.ToArray();
}
private static DropdownOptions GetOpenOutboundInvoiceData(FinancialTransaction transaction)
private static DropdownOption[] GetOpenOutboundInvoiceData(FinancialTransaction transaction)
{
DateTime txDateTime = transaction.DateTime;
Int64 matchAmount = transaction.Rows.AmountCentsTotal;
@@ -250,10 +250,11 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
}
}
result.ExactMatches = listExact.ToArray();
result.TolerantMatches = listTolerant.ToArray();
List<DropdownOption> listCombined = new List<DropdownOption>();
listCombined.AddRange(listExact);
listCombined.AddRange(listTolerant);
return result;
return listCombined.ToArray();
}
private static bool DescriptionContainsInvoiceReference(string ourReference, string theirReference, string description)