Fix for helper field

This commit is contained in:
Rick Falkvinge
2017-12-30 20:55:05 +01:00
parent 95fa33a192
commit 84c19d9c57
2 changed files with 6 additions and 2 deletions
@@ -70,7 +70,7 @@
$('#spanTransactionUnbalancedBy').text(data.DifferingAmount);
$('span#spanModalTransactionDate').text(data.TransactionDate);
$('input#inputTextPurchaseDescription').val(data.TransactionDescription);
$('input#inputTextPurchaseAmount').val(data.DifferingAmount.substring(1)); // removes the leading minus sign
$('input#inputTextPurchaseAmount').val(data.AmountAsPurchase);
if (data.OpenPayoutData == null) // amount is positive
{
@@ -80,6 +80,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
{
public string TransactionDate { get; set; }
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; }
@@ -125,11 +126,14 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
TransactionMatchabilityData result = new TransactionMatchabilityData();
Int64 transactionCents = transaction.Rows.AmountCentsTotal;
result.TransactionDate = transaction.DateTime.ToString ("yyyy-MMM-dd HH:mm");
result.TransactionDescription = transaction.Description;
result.AmountAsPurchase = ((-transactionCents)/100.0).ToString("N2");
result.DifferingAmount = String.Format ("{0} {1:+#,#.00;−#,#.00;0}",
// this is a UNICODE MINUS (U+2212), not the hyphen on the keyboard
authData.CurrentOrganization.Currency.DisplayCode, transaction.Rows.AmountCentsTotal/100.0);
authData.CurrentOrganization.Currency.DisplayCode, transactionCents/100.0);
if (transaction.Rows.AmountCentsTotal > 0)
{