2 Pman.Xtuple.DashboardRender = {
9 'au-0': 'Australia Online',
10 'au-1': 'Australia Trade',
23 revenuebycustomer : '',
24 profitbycustomer : '',
35 'perday-type' : 'voice',
36 'perday-vtype' : 'value',
37 'perday-date' : (new Date()).format('Y') +'' // 2001 2001Q1 200012 W2012-01-01
44 'country': "Filter by Country",
45 'language': "Filter by Language",
46 'mediatype': "Filter by Media Type",
47 //'publication': "Filter by Publication",
48 'tonality': "Filter by Tonality",
49 'keywords': "Filter by Voice"
57 initPaper : function(rg)
59 this.papers = this.papers || {};
62 var ge = rg.select('.report-graph',true).first();
64 Roo.log("NO report-graph ("+ this.view +") found - skipping");
67 Roo.log("init paper?");
69 this.dash = Pman.Tab.XtupleDashboard;
71 this.paper = Raphael(ge.dom);
72 var sz = ge.getSize();
73 this.paper.setSize(sz.width,sz.height);
74 this.papers[this.view] = this.paper;
79 resize : function(w,h)
82 //this.paper.setSize(width,400);
88 // top level load ....
92 Pman.Tab.XtupleDashboard.panel.el.mask("Loading");
93 // if no combined - only show current..
94 var cdb = baseURL.split('/').pop().split('.').shift();
97 if (!Pman.hasPerm('Xtuple.AccountsCombined', 'S') || cdb !='hk'){ //|| window.location.host == 'localhost') {
100 offices[ cdb ] = this.offices[cdb];
101 this.offices = offices;
105 this.dash = Pman.Tab.XtupleDashboard;
106 this.tree = Pman.Tab.XtupleDashboard.tree.tree;
107 this.treeroot = this.tree.getRootNode();
108 //var sn = this.dash.tpanel.tree.getSelectionModel().getSelectedNode();
109 this.view = 'summary';
112 // this.view = sn.attributes.id.toLowerCase();
116 this.state = Roo.apply({}, this.default_state);
119 this.updateStateFromTree();
121 // build a list of views to fetch,
123 for (var i in this.templates) {
124 if (i == 'summary') {
127 for (k in this.offices) {
128 if(k == 'au' && i == 'totals'){
129 this.views.push(i + '-' + k + '-0');
130 this.views.push(i + '-' + k + '-1');
133 this.views.push(i + '-' + k);
137 this.papers = {}; // reset papers..
139 this.templates.summary.overwrite( this.templateEl(), {
140 dates : this.buildDates() ,
141 curdates : this.parseDate()
144 // resize height for Month..
145 var dt = this.parseDate();
146 if (dt.type == 'M') {
147 this.templateEl().select('.report-group-perday',true).setStyle('height', '530px');
148 this.templateEl().select('.report-graph-perday',true).setStyle('height', '300px');
152 //this.dash.viewPanel.el.mask("Loading");
160 parseDate : function()
174 ret.type = this.dash.viewType.getValue();
176 var df = Date.parseDate(this.dash.mfrom.getValue(),'Y-m-d');
177 var dt = Date.parseDate(this.dash.mto.getValue(),'Y-m-d');
178 var dp = Date.parseDate(this.dash.daypick.getValue(),'Y-m-d');
185 //ret.year = this.state['perday-date'] *1;
187 ret.dateto = df.add(Date.YEAR, 1);
188 ret.breadcrumb = df.format('F Y') + ' to ' + ret.dateto.format('F Y');
192 ret.dateto = df.add(Date.MONTH, 6);
193 ret.breadcrumb = df.format('F Y') + ' to ' + ret.dateto.format('F Y');
199 ret.dateto = df.add(Date.MONTH, 3);
200 ret.breadcrumb = df.format('F Y') + ' to ' + ret.dateto.format('F Y');
205 ret.dateto = df.add(Date.MONTH, 1);
206 ret.breadcrumb = df.format('F Y');
213 ret.breadcrumb = df.format('F Y') + ' to ' + ret.dateto.format('F Y');
219 buildDates : function()
221 var dt = this.parseDate();
230 if (dt.date.add(Date.YEAR, 1) <= (new Date())) {
231 ret.ynext = dt.year +1;
234 for (var i =0; i < 2; i++) {
235 // is it greater than now..
236 var qs = new Date(dt.year, i * 6, 1);
237 if (qs <= new Date()) {
239 qtitle : 'H' + (i+1),
240 qlink : dt.year + 'H' + (i+1)
248 for (var i =0; i < 4; i++) {
249 // is it greater than now..
250 var qs = new Date(dt.year, i * 3, 1);
251 if (qs <= new Date()) {
253 qtitle : 'Q' + (i+1),
254 qlink : dt.year + 'Q' + (i+1)
260 for (var i =0; i < 12; i++) {
261 // is it greater than now..
262 var qs = new Date(dt.year, i , 1);
263 if (qs <= new Date()) {
265 mtitle : qs.format('M')[0],
266 mlink : dt.year + 'M' + (i+1)
283 loadNextView : function()
285 if (!this.views.length || !this.dash.panel.active) {
286 //this.dash.viewPanel.el.unmask();
287 //this.showFilters();
288 //this.boldSelected();
289 Pman.Tab.XtupleDashboard.panel.el.unmask();
293 this.view = this.views.shift();
294 //Roo.log(this.view);
295 var rg = this.view == Roo.select('.report-group-' + this.view,true).first();
297 // no hiding in this version??
298 // also need to hide all the share of voices???
304 //if (['keywords'].indexOf(this.view) > -1) {
305 // this.loadNextView();
308 var dt = this.parseDate();
310 var view = this.view.toUpperCase();
312 var ext = view.split('-');
315 // var ext = view.match(/\-[A-Z]+$/i);
316 // view = view.replace(/\-[A-Z]+$/, '');
317 // var office = ext[0].substr(1);
318 var url = office == 'HK' ? baseURL+'/Roo/Dragon_report' : baseURL+'/Xtuple/Roo/Dragon_report';
321 if(dt.type == 'M' && view == 'SALESTREND') {
322 // it should just mask that entry?
323 Roo.log("skip sales trend");
324 //dash.viewPanel.el.mask("No data available");
325 _this.loadNextView();
330 var country = this.dash.countryCombo.getValue();
332 if (view == 'PERCOUNTRY' && country.length) {
333 Roo.log("skip per country");
334 //dash.viewPanel.el.mask("No data available");
335 _this.loadNextView();
340 if ( office == 'ALL') {
343 var rg = Roo.select('.report-group-' + this.view ,true).first();
345 _this.loadNextView();
346 Roo.log("missing : .report-group-" + this.view);
350 var res = (view == 'TOTALS') ? { data : [ {} ] } :
351 { data : [ ] }; // use data from totals.
355 for(var k in this.offices) {
356 var dk = view.toLowerCase()+'-' +k;
358 if (typeof(this.data[dk]) == 'undefined') {
359 Roo.log('skip combined - missing data :'+dk);
363 if (view == 'TOTALS') {
364 //Roo.log("combined : " + view + " " + dk);
365 //Roo.log(this.data[dk]);
367 var dv = this.data[dk][0];
370 res.data[0][kk] = typeof(res.data[0][kk]) == 'undefined' ? 0 : res.data[0][kk] ;
373 res.data[0][kk] = dv[kk] ;
375 res.data[0][kk] += n;
383 // Roo.log('combined non-totals : DATA');
384 // add the rows for each country together..
386 // australia double reports...
387 var unsplit_country = dk.replace(/-[0-9]+$/,'');
388 if (dk != unsplit_country && typeof(this.data[unsplit_country]) != 'undefined') {
392 var dv = this.data[dk];
394 Roo.each(dv, function (dvr) {
398 if (typeof (map[dvr.rkey] ) == 'undefined') {
400 map[dvr.rkey] = Roo.apply({}, dvr);
401 map[dvr.rkey].percent = '';
402 res.data.push(map[dvr.rkey]);
405 map[dvr.rkey].qtysold += dvr.qtysold ;
406 map[dvr.rkey].rvalue += dvr.rvalue ;
416 Roo.log("MAP for combined");
418 if (view != 'TOTALS') {
419 //_this.data[_this.view] = res.data.slice(0); // copy..
421 // percents are borked..
422 res.data.sort(function(a,b) {
423 //Roo.log(a.rvalue +' ?= ' + b.rvalue);
424 if (a.rvalue == b.rvalue) {
427 return a.rvalue > b.rvalue ? -1 : 1;
433 var meth = 'render' + _this.view.toUpperCase().split('-').shift();
435 if (typeof(_this[meth]) == 'undefined') {
436 if (res.data.length) {
437 _this.renderDefault( res, _this.view.toLowerCase())
444 _this[meth]( res , _this.view.toLowerCase());
448 res.office = this.offices[office.toLowerCase()];
449 if (res.data.length) {
450 this.templates[view.toLowerCase()].overwrite( rg, res);
462 //dash.viewPanel.el.mask("No data available");
463 _this.loadNextView();
468 'query[report]' : view,
469 'query[dateFrom]' : dt.date.format('Y-m-d'),
470 'query[dateUpto]' : dt.dateto.format('Y-m-d'),
471 'query[country]' : country,
472 'query[showExtra]' : 0,
474 '_roo_office' : office.toLowerCase(),
476 //_columns : 'rkey,rvalue,rkid,radvalue,rcirculation,rcountry,rkiso'
478 // combined all in HKD..
479 if (Pman.hasPerm('Xtuple.AccountsCombined', 'S') && baseURL.match(/hk\.php$/)) {
480 p['query[currency]'] = 'HKD';
484 p['query[showExtra]'] = 1;
485 p['query[notmg]'] = ext[2];
489 timeout: 600000, // 10 mins ?!
494 failure : function() {
495 _this.loadNextView();
498 success: function(res)
500 if(!res.data.length) {
501 // it should just mask that entry?
503 //dash.viewPanel.el.mask("No data available");
504 _this.loadNextView();
509 //_this.dash.viewPanel.el.unmask();
511 //var sz = this.dash.viewPanel.el.getSize()
512 // h = sz.height - 20;
513 //_this.width = sz.width;
514 //_this.paper.setSize(sz.width, 400);
515 //_this.paper.clear();
517 _this.data[_this.view] = res.data.slice(0);
519 var meth = 'render' + _this.view.toUpperCase().split('-').shift();
521 if (typeof(_this[meth]) == 'undefined') {
522 _this.renderDefault( res, _this.view.toLowerCase())
527 _this[meth]( res , _this.view.toLowerCase());
529 _this.loadNextView();
537 currentColor : function()
539 var dash = Pman.Tab.XtupleDashboard;
541 var clr = dash.themeCombo.getValue();
542 var clname = dash.themeCombo.el.dom.value;
545 clr = dash.themeCombo.store.getAt(0).data.themeData;
546 clname = dash.themeCombo.store.getAt(0).data.name;
549 if(clname.indexOf('Spectral') != 0) {
559 colorthemes : function() {
560 // too damn lazy to write
561 // something elegant here
563 map['RdYlGn'] = 'Red Yellow Green';
564 map['RdYlBu'] = 'Red Yellow Blue';
565 map['YlOrBr'] = 'Yellow Orange Brown';
566 map['YlOrRd'] = 'Yellow Orange Red';
567 map['PuBuGn'] = 'Purple Blue Green';
568 map['YlGnBu'] = 'Yellow Green Blue';
571 Roo.each(colorbrewer, function(cb, i) {
574 for(var k in cb[j]) {
576 var cn = (map[j] != undefined) ? map[j] : j;
577 arr.push([cn+' - '+(k-8), cb[j][k]]);
588 renderDefault : function(res, tmplname)
590 // var view = this.view.replace(/\-[A-Z]+$/i, '');
592 var ext = this.view.split('-');
596 var rg = Roo.select('.report-group-' + this.view ,true).first();
598 Roo.log("missing : .report-group-" + this.view);
603 // var ext = this.view.match(/\-[A-Z]+$/i);
604 // var office = ext[0].substr(1);
607 //res.dates = this.buildDates();
608 //res.curdates = this.parseDate();
609 res.office = this.offices[office];
610 if (typeof(res.data[0].currency) != 'undefined') {
611 Roo.log("Got currency:" + res.data[0].currency)
612 this.currency = res.data[0].currency;
614 Roo.log("Setting currency to " + this.currency)
615 res.currency = this.currency;
617 if (typeof(res.data[0].total_type) != 'undefined') {
618 res.total_type = res.data[0].total_type;
621 var dash = Pman.Tab.XtupleDashboard;
623 var clr = this.currentColor();
627 per = 1.0 / Math.min(n, 10), // use 10 colours..
634 Roo.each(res.data, function(r,i) {
635 if (this.state[this.view] &&
636 this.state[this.view].length &&
637 this.state[this.view].split(',').indexOf(r.rkid) < 0)
643 data.push(r.rvalue * 1);
644 total+=r.rvalue * 1.0 ;
647 l.push(' %% - ' + r.rkey ); //+ ' (' + r.rvalue + ')');
648 colours.push(clr[i % clr.length]);
653 //Roo.log("total:" + total);
655 Roo.each(res.data, function(r,i) {
656 // the type of r.rvalue is string;
657 r.percent = ((parseInt(r.rvalue) *1.0/ total) * 100.0).toFixed() + '%';
660 this.templates[view].overwrite( rg, res);
662 if (!this.initPaper(rg)) {
663 Roo.log("no paper found for " + this.view);
668 var sdata = data.length > 20 ? data.slice(0,20) : data;
669 dash.bar = this.paper.hbarchart(
681 //dash.bar.label(l,true);
682 dash.pie = this.paper.piechart(
683 (this.paper.height - 70) / 2,
684 this.paper.height / 2 ,
685 (this.paper.height / 2) - 60,
699 this.sector.scale(1.1, 1.1, this.cx, this.cy);
702 this.label[0].stop();
703 this.label[0].attr({ r: 7.5 });
704 this.label[1].attr({ "font-weight": 800 });
709 this.sector.animate({ transform: 's1 1 ' + this.cx + ' ' + this.cy }, 500, "bounce");
712 this.label[0].animate({ r: 5 }, 500, "bounce");
713 this.label[1].attr({ "font-weight": 400 });
720 if (tmplname == 'publication') {
724 if (tmplname == 'country') {
728 res.data = res.data.splice(0,mx);
729 if (tmplname !== false) {
730 this.templates[tmplname].overwrite(
731 this.templateEl().select('.report-data-' + this.view,true).first(),
736 //this.templates[tmplname].overwrite( this.templateEl(), res );
740 renderSALESTREND : function(res)
742 var view = this.view.replace(/\-[A-Z]+$/i, '');
744 var rg = Roo.select('.report-group-' + this.view ,true).first();
746 Roo.log("missing : .report-group-" + this.view);
750 Roo.log("do template");
751 var ext = this.view.match(/\-[A-Z]+$/i);
753 var office = ext[0].substr(1);
755 res.office = this.offices[office];
757 if (typeof(res.data[0].currency) != 'undefined') {
758 this.currency = res.data[0].currency;
760 res.currency = this.currency;
764 Roo.each(res.data, function(r, i) {
766 r.rmonth = Date.parseDate(r.rkey, 'Y-m-d').format('M Y');
767 r.shortMonth = Date.parseDate(r.rkey, 'Y-m-d').format('My');
771 var dt = this.parseDate();
772 // range is more than a year, then do not show last..
773 var showlast = (dt.dateto > dt.date.add(Date.YEAR, 1)) ? false : true;
775 this.templates[view].overwrite( rg, res);
776 Roo.log("done template");
777 var dash = Pman.Tab.XtupleDashboard;
779 var clr = this.currentColor();
780 var qty = [ [], [] ],
786 var fc = (res.data[0].rkid +'')[0];
792 for (var i = 0; i < res.data.length; i++) {
793 xlabels[i] = res.data[i].shortMonth;
794 qty[1][i] = 0; // make sure previous year is filled out.
798 // fill in the extra data points.
801 // fc can be 'W' or 'M'
808 rcirculationtotal : 0
811 Roo.each(res.data, function(r, i) {
815 // depending on type of view:
818 // anything else... -> nolink...
820 //res.data.rklink = 'nolink';
822 var d= Date.parseDate(r.rkey, 'Y-m-d');
823 r.rklink = d.format('Y')+'M'+d.format('m');
828 //qty[i] = [ r.sales * 1, r.salespy * 1 ];
830 qty[ 0][i] = r.sales * 1
833 if (showlast && r.salespy *1) {
834 qty[1][i] = r.salespy * 1 ;
837 //xlabels[i] = r.rkey;
838 // not sure if this is needed...
839 colors.push(clr[i%clr.length]);
841 adata.salestotal += (r.sales *1);
846 // fill in any empty holes in the original data.
847 for(var i = 0; i < qty[0].length;i++) {
848 qty[0][i] = typeof(qty[0][i] ) == 'undefined' ? 0 : qty[0][i] ;
853 //Roo.apply(res, adata);
855 // will not work yet..
856 if (this.state['perday-vtype'] == 'cumulative') {
859 for (var i = 0 ; i < last+1;i++) {
867 var xdata = qty; //qty.length > 20 ? qty.slice(0, 20) : qty;
868 var ydata = dates; //date.length > 20 ? date.slice(0, 20) : date;
875 if (xdata.length < 2) {
876 //dash.viewPanel.el.mask("Not enough data");
877 rg.dom.innerHTML = "not big enough range";
882 if (!this.initPaper(rg)) {
883 Roo.log("no paper found for " + this.view);
886 var w = this.paper.width - 90,
887 h = this.paper.height - 25;
890 Roo.log("Draw linechart");
891 this.line = this.paper.linechart(
904 axisxlabels : xlabels,
905 axisxstep : xlabels.length -1,
906 axisxorientation : 3,
913 this.line.labels = this.paper.set();
915 Roo.log("Set labels");
917 var qtyLbl = this.paper.text(
929 this.line.labels.push(qtyLbl);
931 var timeLbl = dash.paper.text(
937 'text-anchor' : 'start',
941 this.line.labels.push(timeLbl);
943 var snum = xdata.length -1;
944 Roo.log("Draw grid labels");
946 xpos + 8, //+(snum/2) ,
947 ypos + 8, //+(snum/2) ,
952 // 'rgba(192,192,192,0.2)'
955 // Roo.log(res.data);
958 //this.templates.perday.overwrite( this.templateEl(), res );
962 _template_el : false,
963 templateEl : function ()
965 if (this._template_el) {
966 return this._template_el;
969 var dash = Pman.Tab.XtupleDashboard;
970 this._template_el = dash.viewPanel.el.createChild( '<div></div' );
971 this._template_el.on('click', this.handleClick, this);
972 return this._template_el ;
974 handleClick : function(a,b)
978 if (typeof(b.href) != 'string') {
981 var href= b.href.replace(/^[^#]*#/, '');
982 var parts = href.split('-');
984 if ((!parts[0].length) || typeof(_t['handleClick' + parts[0]]) == 'undefined') {
985 Roo.log("No handler for " + parts[0] + ' (' + b.href +')');
989 var type = parts.shift();
990 _t['handleClick' + type](parts);
997 handleClickperday: function(parts)
999 var old = this.state['perday-' + parts[0]] ;
1000 this.state['perday-' + parts[0]] = parts[1];
1001 if (old == parts[1]) {
1008 updateStateFromTree : function() {
1012 var ids = this.tree.getChecked('id');
1027 Roo.each(ids, function(i) {
1028 var ar = i.split('-');
1030 var r = ar.join('-');
1031 var old = this.state[l].length ? this.state[l].split(',') : [];
1033 this.state[l] = old.join(',');
1039 /*boldSelected: function()
1042 Roo.log(this.state);
1043 Pman.Clipping.DashboardRender.templateEl().select('a.report-select',true).each(
1046 var href = e.dom.href.replace(/^[^#]*#/, '');
1047 var parts = href.split('-');
1051 var state = _this.state['perday-'+parts[1]];
1052 Roo.log("CHECK " + parts[2] + '?=' + state);
1053 if (parts[2] == state) {
1054 e.addClass('report-selected');
1062 var k = parts.shift();
1063 var v = parts.join('-');
1064 var state = _this.state[k].split(',');
1065 //Roo.log(JSON.stringify(state) + ' ?= ' + parts[1]);
1066 if (state.indexOf(v) > -1) {
1067 e.addClass('report-selected-on');
1073 Roo.log("no style handler for " + parts[0]);
1086 handleClickdownloadpdf: function(parts)
1088 this.downloadSvg(this.papers[parts[0]],'application/pdf');
1090 handleClickdownload: function(parts)
1092 this.downloadSvg(this.papers[parts[0]],'image/jpeg');
1094 downloadSvg : function(paper, to)
1100 url : baseURL + '/Core/Images',
1103 mimetype : 'image/svg',
1104 data : paper.toSVG() ,
1105 width : paper.width * 2 ,
1106 height: paper.height * 2
1115 replaceSvgAll: function(acb)
1118 for (var i in this.papers) {
1132 _t.replaceSvg(_t.papers[p], p, cb);
1141 replaceSvg: function(paper ,view, cb )
1147 url : baseURL + '/Core/Images',
1150 mimetype : 'image/svg',
1151 data : paper.toSVG(),
1153 width : paper.width ,
1154 height: paper.height
1156 success: function(data){
1158 var g = Roo.get(_t.clonedBase).select('.report-graph-' + view, true).first();
1160 g.dom.innerHTML = '<img src="' + 'data:image/jpeg;base64,' +data.data + '">';
1176 downloadDoc : function()
1180 Roo.MessageBox.alert("Notice", "Creating Graphs");
1182 var tp = _t.templateEl();
1184 // copy and rmeove stufff.
1185 var cp = document.importNode(tp.dom,true);
1188 cp.removeAttribute('id');
1189 this.clonedBase= cp;
1190 // remove the top level style..
1191 Roo.get(cp).select('style',true).remove();
1193 // remove hidden stuff..
1195 Roo.get(cp).select('.report-no-print',true).remove();
1197 //this.printReplace(cp); -- this does not appear to work.
1200 this.replaceSvgAll(function() {
1203 //Roo.log(cp.innerHTML);
1206 var html = '<HTML>' +
1207 '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' +
1208 '<BODY><div style="font-family:sans-serif;font-size:10pt">' + cp.innerHTML + '</div></BODY></HTML>';
1213 url : baseURL + '/Core/Images',
1215 // as : 'application/msword',
1216 as : 'application/rtf',
1217 mimetype : 'text/html',
1224 Roo.MessageBox.alert("Notice", "Download will start shortly");
1228 /// downloading dialog.?
1233 printReplace : function(cp)
1235 Roo.log('print replace');
1236 var st = document.styleSheets;
1237 Roo.log('n sheets' + st.length);
1239 for (var i = 0;i < st.length; i++) {
1241 Roo.log(st[i].media[0] );
1242 if (st[i].media[0] != 'print') {
1249 var rules = st[i].rules; // or cssRules?
1251 for (var j = 0; j < rules.length; j++) {
1252 var rule = rules[j];
1253 var sel = rule.selectorText;
1254 var val = rule.style.cssText;
1255 Roo.log("SEL : "+ sel + " => " + val);
1257 Roo.get(cp).select(sel,true).each(function(el) {
1258 el.dom.setAttribute('style', val);
1273 showFilters : function()
1276 // build filters from array
1278 while( this.treeroot.firstChild){
1279 this.treeroot.removeChild( this.treeroot.firstChild);
1281 //this.treeroot = this.tree.getRootNode();
1282 this.treeroot.childrenRendered = true;
1286 for (var box in this.filterCfg.titles) {
1293 name : this.filterCfg.titles[box],
1296 if (!this.data[box]) {
1300 if (box != 'keywords') {
1301 Roo.log("Add to root");
1303 gnode = this.treeroot.appendChild( new Roo.tree.TreeNode({
1305 text : this.filterCfg.titles[box],
1312 var kword_nodes = {};
1313 Roo.each(this.data[box], function(e) {
1318 if (box == 'keywords') {
1319 if (typeof(kword_nodes[e.parent_id]) == 'undefined') {
1321 kword_nodes[e.parent_id] = this.treeroot.appendChild(new Roo.tree.TreeNode({
1322 text: e.parent_id_keyword ,
1323 id : box +'-'+ e.parent_id,
1325 checked : this.state[box].split(',').indexOf(e.parent_id) > -1 ? true : false,
1330 kword_nodes[e.parent_id].appendChild(new Roo.tree.TreeNode({
1331 text: e.rkey + ' (' + e.rvalue + ')',
1332 id : box +'-'+ e.rkid,
1334 checked : this.state[box].split(',').indexOf(e.rkid) > -1 ? true : false
1338 // need to add child data on?
1342 filter.options.push({
1343 text: (e.rkey && e.rkey.length ? e.rkey : (e.rkid +' (Untitled)')) + '(' + e.rvalue + ')',
1344 id : box +'-'+ e.rkid,
1346 checked : this.state[box].split(',').indexOf(e.rkid) > -1 ? true : false
1354 filter.options.sort( function(r1, r2){
1355 var st = Roo.data.SortTypes.asUCString;
1356 var v1 = st(r1.text), v2 = st(r2.text);
1357 return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
1359 Roo.each(filter.options, function (n) {
1361 gnode.appendChild(new Roo.tree.TreeNode( n));
1366 filters.push(filter);
1375 //this.templates.filters.overwrite(
1376 // this.templateEl().select('.report-filters', true).first(),
1377 // { filters : filters }
1385 // load all the templates.
1386 for (var i in Pman.Xtuple.DashboardRender.templates) {
1387 Pman.Xtuple.DashboardRender.templates[i] = new Roo.DomTemplate({
1388 url : rootURL + '/Pman/Xtuple/domtemplates/' + i +'.html'