add a new record for network fees

This commit is contained in:
Matias Alejo Garcia 2015-07-17 15:51:12 -03:00
parent 4fa62b0e4e
commit c7caf71e93
1 changed files with 12 additions and 12 deletions

View File

@ -608,8 +608,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (txs && txs.length > 0) {
allTxs.push(txs);
return getHistory(skip + 100, cb);
}
else {
} else {
return cb(null, lodash.flatten(allTxs));
}
});
@ -637,7 +636,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.satToUnit = 1 / self.unitToSatoshi;
var data = txs;
var satToBtc = 1 / 100000000;
var filename = 'Copay-' + (self.alias || self.walletName ) + '.csv';
var filename = 'Copay-' + (self.alias || self.walletName) + '.csv';
var csvContent = '';
if (!isNode) csvContent = 'data:text/csv;charset=utf-8,';
csvContent += 'Date,Destination,Note,Amount,Currency,Spot Value,Total Value,Tax Type,Category\n';
@ -650,23 +649,24 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (it.action == 'moved')
amount = 0;
if (it.action == 'sent' || it.action=='moved')
amount += it.fees;
_amount = (it.action == 'sent' ? '-' : '') + (amount * satToBtc).toFixed(8);
_note = formatString((it.message ? 'Note: ' + it.message + ' - ' : '') + 'TxId: ' + it.txid + ' Fee'+ (it.fees * satToBtc).toFixed(8)) ;
_amount = (it.action == 'sent' ? '-' : '') + (amount * satToBtc).toFixed(8);
_note = formatString((it.message ? it.message : '') + ' TxId: ' + it.txid + ' Fee:' + (it.fees * satToBtc).toFixed(8));
if (it.action == 'moved')
_note += ' Moved:' + (it.amount * satToBtc).toFixed(8)
_note += ' Moved:' + (it.amount * satToBtc).toFixed(8)
dataString = formatDate(it.time * 1000) + ',' + formatString(it.addressTo) + ',' + _note + ',' + _amount + ',BTC,,,,';
csvContent += index < data.length ? dataString + "\n" : dataString;
csvContent += dataString + "\n";
if (it.fees && (it.action == 'moved' || it.action == 'sent')) {
var _fee = (it.fees * satToBtc).toFixed(8)
csvContent += formatDate(it.time * 1000) + ',Bitcoin Network Fees,, -' + _fee + ',BTC,,,,' + "\n";
}
});
if (isNode) {
saveFile('#export_file', csvContent);
}
else {
} else {
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);