diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/CSVGenerationTask.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/CSVGenerationTask.kt index 50afdd7..a46e28f 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/CSVGenerationTask.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/CSVGenerationTask.kt @@ -71,8 +71,15 @@ class CSVGenerationTask(context: Context) : AsyncTask, Int, val assetAmount = transferDetail.assetAmount.toDouble() / Math.pow(10.0, assetPrecision.toDouble()) row[5] = String.format("%.${assetPrecision}f %s", assetAmount, transferDetail.assetSymbol) - // Fiat Equivalent TODO add once Nelson finishes - row[6] = "" + // Fiat Equivalent + 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) diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/PDFGeneratorTask.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/PDFGeneratorTask.kt index 8567693..d216180 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/PDFGeneratorTask.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/PDFGeneratorTask.kt @@ -84,7 +84,14 @@ class PDFGeneratorTask(context: Context) : AsyncTask, Int, val assetAmount = transferDetail.assetAmount.toDouble() / Math.pow(10.0, assetPrecision.toDouble()) 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()