Made the app controller include the action by default. Added virtual callouts for data order and limit. Changed fields to use formatting, including a custom format for currency and id. Added a function for auto conversion from PHP variables to javascript. Fixed some minor bugs in the controllers already converted to jqGrid. Moved leases onto jqGrid.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@118 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -114,3 +114,23 @@ $("#debug").append(htmlEncode(html));
|
||||
function removeElement(elem_id) {
|
||||
$('#'+elem_id).remove();
|
||||
}
|
||||
|
||||
|
||||
function fmtCurrency(amount) {
|
||||
if (amount == null || isNaN(amount))
|
||||
return '-';
|
||||
|
||||
// Get rid of any extraneous characters, determine
|
||||
// the sign, and round to the nearest cent.
|
||||
amount = amount.toString().replace(/\$|\,/g,'');
|
||||
sign = (amount == (amount = Math.abs(amount)));
|
||||
amount = (amount+0.0000000001).toFixed(2);
|
||||
|
||||
// Insert thousands separator
|
||||
while (amount != (amount = amount.replace(/(\d)(\d\d\d[.,])/, "$1,$2")));
|
||||
|
||||
// Return formatted amount
|
||||
return (sign?'$':'($') + amount + (sign?'':')');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user