Hi,
I am a little stuck on how to format rest output since the new updates to database interaction. How to I include the javascript money formatting as described by Maryna Brodina in this post ( "https://c.getsatisfaction.com/apperyi... )
My code looks like this :
// Database Results //
if(value.constructor == Array)
return;
// Start attorney block //
var amount_attorney = value.amnt_atfees;
var attorneyFeesTotal = value.attorneyFeesTotal;
var attorneyFeesTotal = amount_attorney * 1.14 ;
Apperyio('attorneyFeesTotal').text('R ' + attorneyFeesTotal.toFixed(2));
// End attorney block //
// Start deeds block //
var amount_do_fees = value.amnt_dofees;
var deedsOfficeFees = value.deedsOfficeFees;
var deedsOfficeFees = amount_do_fees ;
Apperyio('deedsOfficeFees').text('R ' + deedsOfficeFees.toFixed(2));
// End deeds block //
// Start misc block //
var bond_misc_fees = value.amnt_misc;
var miscFees = value.miscFees;
var miscFees = bond_misc_fees ;
Apperyio('miscFees').text('R ' + miscFees.toFixed(2));
// End misc block //
var bondRegTotal = Number(Apperyio("bondRegTotal").val());
var bondRegTotal = attorneyFeesTotal + deedsOfficeFees + miscFees ;
Apperyio('bondRegTotal').text('R ' + bondRegTotal.toFixed(2));
This is the code (below) that was noted to format the output...just not sure how to add this now since the database changes...
function formatMoney (n) {
var c = 2, /decimals count/
d = ".",/decimal separator/
t = ",", /thousands separator/
s = n < 0 ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
j = (j = i.length) 3 ? j % 3 : 0;
return '$' + s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};
var formattedValue = formatMoney(value);
element.html(formattedValue);
return formattedValue;
Your assistance would be greatly appreciated.
Kind Regards
Sean