Add the equivalent value to both PDF and CSV export options.
This commit is contained in:
parent
d68b34f973
commit
e5677436b1
2 changed files with 17 additions and 3 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue