[open-ils-commits] r11760 - in trunk/Open-ILS: web/opac/common/js xul/staff_client/server/admin
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 7 16:39:28 EST 2009
Author: miker
Date: 2009-01-07 16:39:24 -0500 (Wed, 07 Jan 2009)
New Revision: 11760
Modified:
trunk/Open-ILS/web/opac/common/js/fm_table.js
trunk/Open-ILS/web/opac/common/js/fm_table_conf.js
trunk/Open-ILS/xul/staff_client/server/admin/cash_reports.js
Log:
right-justify cash report; format all numeric fields; provide summary row
Modified: trunk/Open-ILS/web/opac/common/js/fm_table.js
===================================================================
--- trunk/Open-ILS/web/opac/common/js/fm_table.js 2009-01-07 20:59:29 UTC (rev 11759)
+++ trunk/Open-ILS/web/opac/common/js/fm_table.js 2009-01-07 21:39:24 UTC (rev 11760)
@@ -30,6 +30,7 @@
this.subtables = [];
this.display = args.display;
this.selectCol = args.selectCol;
+ this.moneySummaryRow = args.moneySummaryRow;
this.selectColName = args.selectColName;
this.selectAllName = args.selectAllName;
this.selectNoneName = args.selectNoneName;
@@ -81,6 +82,28 @@
td.appendChild(none);
this.thead_tr.appendChild(td);
}
+
+ if (this.moneySummaryRow) {
+ this.moneySummaryRow = elem('tr');
+
+ if( this.selectCol )
+ this.moneySummaryRow.appendChild(elem('td'));
+
+ for( var i = 0; i < this.keys.length; i++ ) {
+ var key = this.keys[i];
+
+ var td = elem('td');
+ td.setAttribute('name', this.table.id + key);
+
+ if (this.money && grep(this.money,function(i){return (i==key)}) )
+ td.appendChild(text('0.00'));
+
+ this.moneySummaryRow.appendChild(td);
+ }
+
+ this.tbody.appendChild(this.moneySummaryRow);
+ }
+
for( var i = 0; i < this.keys.length; i++ )
this.thead_tr.appendChild(elem('td',null,this.keys[i]));
@@ -113,6 +136,7 @@
if( this.display[o.classname] ) {
this.keys = this.display[o.classname].fields;
this.bold = this.display[o.classname].bold;
+ this.money = this.display[o.classname].money;
}
if(!this.keys && FM_TABLE_DISPLAY[o.classname])
@@ -121,6 +145,9 @@
if(!this.bold && FM_TABLE_DISPLAY[o.classname])
this.bold = FM_TABLE_DISPLAY[o.classname].bold;
+ if(!this.money && FM_TABLE_DISPLAY[o.classname])
+ this.money = FM_TABLE_DISPLAY[o.classname].money;
+
if(!this.keys) {
this.keys = fmclasses[o.classname];
sortme = true;
@@ -155,6 +182,7 @@
row.appendChild(td);
}
this.tbody.appendChild(row);
+ if (this.moneySummaryRow) this.tbody.appendChild(this.moneySummaryRow);
}
FMObjectBuilder.prototype.munge = function(data) {
@@ -165,6 +193,7 @@
data = data.replace(/:\d{2}-.*/,'');
}
}
+
return data;
}
@@ -217,6 +246,18 @@
}
} else {
+ if (this.money && grep(this.money,function(i){return (i==key)}) ) {
+ td.setAttribute('align', 'right');
+ data = parseFloat(data).toFixed(2);
+
+ if (isNaN(data)) data = '0.00';
+
+ if (this.moneySummaryRow) {
+ var summary_td = $n(this.moneySummaryRow, this.table.id + key);
+ summary_td.innerHTML = parseFloat(parseFloat(summary_td.innerHTML) + parseFloat(data)).toFixed(2);
+ }
+ }
+
if( this.bold && grep(this.bold,function(i){return (i==key)}) ) {
var span = elem('span',{'class':'fm_table_bold'}, data);
td.appendChild(span);
Modified: trunk/Open-ILS/web/opac/common/js/fm_table_conf.js
===================================================================
--- trunk/Open-ILS/web/opac/common/js/fm_table_conf.js 2009-01-07 20:59:29 UTC (rev 11759)
+++ trunk/Open-ILS/web/opac/common/js/fm_table_conf.js 2009-01-07 21:39:24 UTC (rev 11760)
@@ -65,6 +65,11 @@
'cash_payment',
'check_payment',
'credit_card_payment'
+ ],
+ money : [
+ 'cash_payment',
+ 'check_payment',
+ 'credit_card_payment'
]
},
@@ -75,6 +80,12 @@
'forgive_payment',
'work_payment',
'goods_payment'
+ ],
+ money : [
+ 'credit_payment',
+ 'forgive_payment',
+ 'work_payment',
+ 'goods_payment'
]
},
'rr' : {
Modified: trunk/Open-ILS/xul/staff_client/server/admin/cash_reports.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/cash_reports.js 2009-01-07 20:59:29 UTC (rev 11759)
+++ trunk/Open-ILS/xul/staff_client/server/admin/cash_reports.js 2009-01-07 21:39:24 UTC (rev 11760)
@@ -97,7 +97,7 @@
org, $('cr_start').value, $('cr_end').value );
req.callback(
function(r) {
- drawFMObjectTable( { dest : 'cr_desk_payments', obj : r.getResultObject() });
+ drawFMObjectTable( { dest : 'cr_desk_payments', obj : r.getResultObject(), moneySummaryRow : true });
sortables_init();
}
);
@@ -107,7 +107,7 @@
org, $('cr_start').value, $('cr_end').value );
req.callback(
function(r) {
- drawFMObjectTable( { dest : 'cr_user_payments', obj : r.getResultObject() });
+ drawFMObjectTable( { dest : 'cr_user_payments', obj : r.getResultObject(), moneySummaryRow : true });
sortables_init();
}
);
More information about the open-ils-commits
mailing list