Enabled nonpresentation currency for outbound invoices
This commit is contained in:
@@ -301,7 +301,7 @@ namespace Swarmops.Logic.Financial
|
||||
}
|
||||
}
|
||||
|
||||
public string DisplayAmount
|
||||
public string DisplayNativeAmount
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
@@ -338,5 +338,51 @@ namespace Swarmops.Logic.Financial
|
||||
|
||||
return credit;
|
||||
}
|
||||
|
||||
|
||||
public string DisplayNativeAmount
|
||||
{
|
||||
get
|
||||
{
|
||||
if (HasNativeCurrency)
|
||||
{
|
||||
Money money = NativeCurrencyAmount;
|
||||
return money.Currency.DisplayCode + " " + (money.Cents / 100.0).ToString("N2");
|
||||
}
|
||||
else
|
||||
{
|
||||
return (AmountCents / 100.0).ToString("N2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasNativeCurrency
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
ObjectOptionalData.ForObject(this)
|
||||
.GetOptionalDataString(ObjectOptionalDataType.NativeCurrencyCode)
|
||||
.Length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Money NativeCurrencyAmount
|
||||
{
|
||||
get
|
||||
{
|
||||
ObjectOptionalData optionalData = ObjectOptionalData.ForObject(this);
|
||||
|
||||
return new Money(optionalData.GetOptionalDataInt64(ObjectOptionalDataType.NativeCurrencyAmountCents), Currency.FromCode(optionalData.GetOptionalDataString(ObjectOptionalDataType.NativeCurrencyCode)));
|
||||
}
|
||||
set
|
||||
{
|
||||
ObjectOptionalData optionalData = ObjectOptionalData.ForObject(this);
|
||||
|
||||
optionalData.SetOptionalDataInt64(ObjectOptionalDataType.NativeCurrencyAmountCents, value.Cents);
|
||||
optionalData.SetOptionalDataString(ObjectOptionalDataType.NativeCurrencyCode, value.Currency.Code);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,6 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
invoice.NativeCurrencyAmount = currencyEntered;
|
||||
}
|
||||
|
||||
|
||||
// Display success message
|
||||
|
||||
this._invoiceId = invoice.Identity; // a property returns the localized string
|
||||
|
||||
@@ -164,9 +164,17 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
|
||||
invoice.AddItem(this.TextPurpose.Text, amountCents);
|
||||
|
||||
// TODO: VAT
|
||||
// TODO: VAT -- needs to be PER ITEM, and dbfields must update for this, quite a large work item, do not short circuit hack this
|
||||
|
||||
documents.SetForeignObjectForAll (invoice);
|
||||
documents.SetForeignObjectForAll(invoice);
|
||||
|
||||
// If invoice is denominated in a non-presentation currency, record the native values for proper payment
|
||||
|
||||
if (this.CurrencyAmount.NonPresentationCurrencyUsed)
|
||||
{
|
||||
Money currencyEntered = this.CurrencyAmount.NonPresentationCurrencyAmount;
|
||||
invoice.NativeCurrencyAmount = currencyEntered;
|
||||
}
|
||||
|
||||
// Display success message
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public partial class Pages_v5_Finance_Json_ListInvoicesInbound : DataV5Base
|
||||
Response.End();
|
||||
}
|
||||
|
||||
private static int SortInvoicesByDueDate(InboundInvoice a, InboundInvoice b)
|
||||
private static int SortInvoicesByDueDateReverse(InboundInvoice a, InboundInvoice b)
|
||||
{
|
||||
return DateTime.Compare(b.DueDate, a.DueDate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user