Pman.Tab.XtupleReports = new Roo.XComponent({
part : ["Xtuple","Reports"],
- order : '001-Pman.Tab.XtupleReports',
+ order : '500-Pman.Tab.XtupleReports',
region : 'center',
- parent : false,
+ parent : 'Pman.Tab.Admin',
name : "unnamed module",
disabled : false,
permname : '',
layout : {
xtype: 'BorderLayout',
xns: Roo,
+ items : [
+ {
+ xtype: 'GridPanel',
+ xns: Roo,
+ title : "report",
+ fitToframe : true,
+ fitContainer : true,
+ tableName : 'report',
+ background : true,
+ region : 'center',
+ listeners : {
+ activate : function() {
+ _this.panel = this;
+ if (_this.grid) {
+ _this.grid.footer.onClick('first');
+ }
+ }
+ },
+ grid : {
+ xtype: 'Grid',
+ xns: Roo.grid,
+ listeners : {
+ render : function()
+ {
+ _this.grid = this;
+ //_this.dialog = Pman.Dialog.FILL_IN
+ if (_this.panel.active) {
+ this.footer.onClick('first');
+ }
+ },
+ rowdblclick : function (_self, rowIndex, e)
+ {
+ var rec = this.ds.getAt(rowIndex);
+ new Pman.Download({
+ url : baseURL + '/Roo/Report/' + rec.data.report_name +'-' + rec.data.report_id + '.rpt',
+ method : 'GET',
+ params : {
+ _id : rec.data.report_id,
+ _download : 1
+ }
+ });
+ Roo.MessageBox.alert("Downloading",
+
+ "Report template is downloading - use " +
+ '<a target="_new" href="http://sourceforge.net/projects/openrpt/files/openrpt/">' +
+ "report writer to edit this" +
+ '</a>'
+ );
+
+
+
+ }
+ },
+ autoExpandColumn : 'report_descrip',
+ loadMask : true,
+ dataSource : {
+ xtype: 'Store',
+ xns: Roo.data,
+ listeners : {
+ beforeload : function (_self, options)
+ {
+ options.params['search[name]'] = _this.searchName.getValue();
+ options.params._max_versions = 1;
+ }
+ },
+ remoteSort : true,
+ sortInfo : { field : 'report_name', direction: 'ASC' },
+ proxy : {
+ xtype: 'HttpProxy',
+ xns: Roo.data,
+ method : 'GET',
+ url : baseURL + '/Roo/report.php'
+ },
+ reader : {
+ xtype: 'JsonReader',
+ xns: Roo.data,
+ totalProperty : 'total',
+ root : 'data',
+ id : 'id',
+ fields : [
+ {
+ 'name': 'report_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'report_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'report_sys',
+ 'type': 'int'
+ },
+ {
+ 'name': 'report_source',
+ 'type': 'string'
+ },
+ {
+ 'name': 'report_descrip',
+ 'type': 'string'
+ },
+ {
+ 'name': 'report_grade',
+ 'type': 'int'
+ },
+ {
+ 'name': 'report_loaddate',
+ 'type': 'date',
+ 'dateFormat': 'Y-m-d'
+ }
+ ]
+ }
+ },
+ sm : {
+ xtype: 'RowSelectionModel',
+ xns: Roo.grid,
+ listeners : {
+ afterselectionchange : function (_self)
+ {
+ _this.vgrid.footer.onClick('first');
+ }
+ },
+ singleSelect : true
+ },
+ footer : {
+ xtype: 'PagingToolbar',
+ xns: Roo,
+ pageSize : 25,
+ displayInfo : true,
+ displayMsg : "Displaying report{0} - {1} of {2}",
+ emptyMsg : "No report found"
+ },
+ toolbar : {
+ xtype: 'Toolbar',
+ xns: Roo,
+ items : [
+ {
+ xtype: 'TextField',
+ xns: Roo.form,
+ listeners : {
+ render : function (_self)
+ {
+ _this.searchName = _self;
+ },
+ specialkey : function (_self, e)
+ {
+ _this.grid.footer.onClick('first');
+ }
+ }
+ },
+ {
+ xtype: 'Button',
+ xns: Roo.Toolbar,
+ listeners : {
+ click : function (_self, e)
+ {
+ _this.grid.footer.onClick('first');
+ }
+ },
+ cls : 'x-btn-icon',
+ icon : rootURL + '/Pman/templates/images/search.gif'
+ },
+ {
+ xtype: 'Button',
+ xns: Roo.Toolbar,
+ listeners : {
+ click : function (_self, e)
+ {
+ _this.searchBox.setValue('');
+ _this.publication_name_combo.setValue('');
+ _this.publication_lang_combo.setValue('');
+ _this.country_combo.setValue('');
+ _this.category_media_id_combo.setValue('');
+ _this.role_combo.setValue('');
+
+
+ _this.grid.footer.onClick('first');
+ }
+ },
+ cls : 'x-btn-icon',
+ icon : rootURL + '/Pman/templates/images/edit-clear.gif'
+ },
+ {
+ xtype: 'Fill',
+ xns: Roo.Toolbar
+ },
+ {
+ xtype: 'Button',
+ xns: Roo.Toolbar,
+ listeners : {
+ click : function (_self, e)
+ {
+
+ var sel = _this.grid.selModel.getSelected();
+ if (!sel) {
+ Roo.MessageBox.alert("Error", "Select a report");
+ return;
+ }
+
+ Pman.Dialog.Image.show(
+ {
+ _url : baseURL+'/Xtuple/Import/Report',
+ onid : sel.data.report_id
+
+
+ },
+ function (data) {
+ Roo.MessageBox.alert("Notice", "Updated");
+ _this.grid.footer.onClick('refresh');
+ }
+ );
+ }
+ },
+ text : "Upload New version"
+ }
+ ]
+ },
+ colModel : [
+ {
+ xtype: 'ColumnModel',
+ xns: Roo.grid,
+ header : 'Report name',
+ width : 200,
+ dataIndex : 'report_name',
+ renderer : function(v) { return String.format('{0}', v); }
+ },
+ {
+ xtype: 'ColumnModel',
+ xns: Roo.grid,
+ header : 'Report descrip',
+ width : 200,
+ dataIndex : 'report_descrip',
+ renderer : function(v) { return String.format('{0}', v); }
+ }
+ ]
+ }
+ },
+ {
+ xtype: 'GridPanel',
+ xns: Roo,
+ listeners : {
+ activate : function() {
+ _this.vpanel = this;
+ if (_this.vgrid) {
+ _this.vgrid.footer.onClick('first');
+ }
+ }
+ },
+ background : false,
+ fitContainer : true,
+ fitToframe : true,
+ region : 'east',
+ tableName : 'report',
+ title : "report",
+ grid : {
+ xtype: 'Grid',
+ xns: Roo.grid,
+ listeners : {
+ render : function()
+ {
+ _this.vgrid = this;
+ //_this.dialog = Pman.Dialog.FILL_IN
+ if (_this.vpanel.active) {
+ this.footer.onClick('first');
+ }
+ },
+ rowdblclick : function (_self, rowIndex, e)
+ {
+ var rec = this.ds.getAt(rowIndex);
+ new Pman.Download({
+ url : baseURL + '/Roo/Report/' + rec.data.report_name +'-' + rec.data.report_id + '.rpt',
+ method : 'GET',
+ params : {
+ _id : rec.data.report_id,
+ _download : 1
+ }
+ });
+ Roo.MessageBox.alert("Downloading",
+
+ "Report template is downloading - use " +
+ '<a target="_new" href="http://sourceforge.net/projects/openrpt/files/openrpt/">' +
+ "report writer to edit this" +
+ '</a>'
+ );
+
+
+
+ }
+ },
+ autoExpandColumn : 'Report loaddate',
+ loadMask : true,
+ dataSource : {
+ xtype: 'Store',
+ xns: Roo.data,
+ listeners : {
+ beforeload : function (_self, options)
+ {
+ if (!_this.grid) {
+ return false;
+ }
+ var sel = _this.grid.selModel.getSelected();
+ if (!sel) {
+ this.removeAll();
+ return false;
+ }
+ options.params.report_name = sel.data.report_name;
+
+
+ }
+ },
+ remoteSort : true,
+ sortInfo : { field : 'report_grade', direction: 'DESC' },
+ proxy : {
+ xtype: 'HttpProxy',
+ xns: Roo.data,
+ method : 'GET',
+ url : baseURL + '/Roo/report.php'
+ },
+ reader : {
+ xtype: 'JsonReader',
+ xns: Roo.data,
+ totalProperty : 'total',
+ root : 'data',
+ id : 'id',
+ fields : [
+ {
+ 'name': 'report_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'report_name',
+ 'type': 'string'
+ },
+ {
+ 'name': 'report_sys',
+ 'type': 'int'
+ },
+ {
+ 'name': 'report_source',
+ 'type': 'string'
+ },
+ {
+ 'name': 'report_descrip',
+ 'type': 'string'
+ },
+ {
+ 'name': 'report_grade',
+ 'type': 'int'
+ },
+ {
+ 'name': 'report_loaddate',
+ 'type': 'date',
+ 'dateFormat': 'Y-m-d'
+ }
+ ]
+ }
+ },
+ footer : {
+ xtype: 'PagingToolbar',
+ xns: Roo,
+ pageSize : 25,
+ displayInfo : true,
+ displayMsg : "Displaying report{0} - {1} of {2}",
+ emptyMsg : "No report found"
+ },
+ colModel : [
+ {
+ xtype: 'ColumnModel',
+ xns: Roo.grid,
+ dataIndex : 'report_grade',
+ header : 'Version',
+ width : 20,
+ renderer : function(v) { return String.format('{0}', v); }
+ },
+ {
+ xtype: 'ColumnModel',
+ xns: Roo.grid,
+ dataIndex : 'report_loaddate',
+ header : 'Created',
+ width : 200,
+ renderer : function(v,x,r) {
+ var vv = Date.parseDate(r.json.report_loaddate.split('.')[0], 'Y-m-d H:i:s').format('d/M/Y h:ia');
+ return String.format('{0}', vv);
+
+ }
+ }
+ ]
+ }
+ }
+ ],
center : {
xtype: 'LayoutRegion',
xns: Roo
+ },
+ east : {
+ xtype: 'LayoutRegion',
+ xns: Roo,
+ split : true,
+ title : "Versions",
+ titlebar : true,
+ width : 200
}
}
};