Add the equivalent value to both PDF and CSV export options.

This commit is contained in:
Severiano Jaramillo 2019-02-07 13:40:26 -06:00
parent d68b34f973
commit e5677436b1
2 changed files with 17 additions and 3 deletions

View file

@ -71,8 +71,15 @@ class CSVGenerationTask(context: Context) : AsyncTask<List<TransferDetail>, Int,
val assetAmount = transferDetail.assetAmount.toDouble() / Math.pow(10.0, assetPrecision.toDouble()) val assetAmount = transferDetail.assetAmount.toDouble() / Math.pow(10.0, assetPrecision.toDouble())
row[5] = String.format("%.${assetPrecision}f %s", assetAmount, transferDetail.assetSymbol) row[5] = String.format("%.${assetPrecision}f %s", assetAmount, transferDetail.assetSymbol)
// Fiat Equivalent TODO add once Nelson finishes // Fiat Equivalent
row[6] = "" row[6] = if (transferDetail.fiatAmount != null && transferDetail.fiatSymbol != null) {
val currency = Currency.getInstance(transferDetail.fiatSymbol)
val fiatAmount = transferDetail.fiatAmount.toDouble() /
Math.pow(10.0, currency.defaultFractionDigits.toDouble())
String.format("%.${currency.defaultFractionDigits}f %s", fiatAmount, currency.currencyCode)
} else {
""
}
csvWriter.writeNext(row) csvWriter.writeNext(row)

View file

@ -84,7 +84,14 @@ class PDFGeneratorTask(context: Context) : AsyncTask<List<TransferDetail>, Int,
val assetAmount = transferDetail.assetAmount.toDouble() / Math.pow(10.0, assetPrecision.toDouble()) val assetAmount = transferDetail.assetAmount.toDouble() / Math.pow(10.0, assetPrecision.toDouble())
table.addCell(makeCell(String.format("%.${assetPrecision}f %s", assetAmount, transferDetail.assetSymbol))) table.addCell(makeCell(String.format("%.${assetPrecision}f %s", assetAmount, transferDetail.assetSymbol)))
// Fiat Equivalent TODO add once Nelson finishes // Fiat Equivalent
if (transferDetail.fiatAmount != null && transferDetail.fiatSymbol != null) {
val currency = Currency.getInstance(transferDetail.fiatSymbol)
val fiatAmount = transferDetail.fiatAmount.toDouble() /
Math.pow(10.0, currency.defaultFractionDigits.toDouble())
table.addCell(makeCell(String.format("%.${currency.defaultFractionDigits}f %s",
fiatAmount, currency.currencyCode)))
}
table.completeRow() table.completeRow()