Currency conversion on dashboard completed payments is incorrect. #562
This commit is contained in:
parent
9b8d6ea8d4
commit
5fef99ac1b
|
|
@ -458,14 +458,22 @@ List<ChartDataGroup> chartPayments(
|
|||
double completedAmount = payment.completedAmount;
|
||||
double refunded = payment.refunded;
|
||||
|
||||
var invoice = InvoiceEntity();
|
||||
if (payment.invoicePaymentables.isNotEmpty) {
|
||||
final paymentable = payment.invoicePaymentables.first;
|
||||
invoice = invoiceMap[paymentable.invoiceId] ?? InvoiceEntity();
|
||||
}
|
||||
|
||||
// Handle "All"
|
||||
if (settings.currencyId == kCurrencyAll &&
|
||||
client.currencyId != company.currencyId) {
|
||||
final exchangeRate = payment.hasExchangeRate
|
||||
? payment.exchangeRate
|
||||
: getExchangeRate(currencyMap,
|
||||
fromCurrencyId: client.currencyId,
|
||||
toCurrencyId: company.currencyId);
|
||||
: invoice.hasExchangeRate
|
||||
? invoice.exchangeRate
|
||||
: getExchangeRate(currencyMap,
|
||||
fromCurrencyId: client.currencyId,
|
||||
toCurrencyId: company.currencyId);
|
||||
completedAmount *= exchangeRate;
|
||||
refunded *= exchangeRate;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue