createColModel = function () {
var colModelArray = [];
var alignReportData;
alignReportData = function () {
alignLeft = function (index) {
colModelArray.push(
{
filter: {
type: 'textbox',
condition: 'begin',
listeners: ['keyup']
},
title: reportHeadings[index],
align: "left"
}
)
};
alignRight = function (index) {
colModelArray.push(
{
filter: {
type: 'textbox',
condition: 'begin',
listeners: ['keyup']
},
title: reportHeadings[index],
align: "right",
format: '#.###,00',
dataType: "float"
}
)
};
$.each(dataArray[0], function (index, value) {
if (value === null || value.match(/^\D/)) {
alignLeft(index);
} else {
alignRight(index);
}
});
};
alignReportData();
return colModelArray;
};
reportTable.colModel = createColModel();
summaryData: [
{ rank:'Total', summaryRow: true, pq_fn:{revenues:'sum(C:C)', profits:'sum(profits)', diff:'sum(E:E)' }},
{ rank:'Average', summaryRow: true, pq_fn:{revenues:'average(C:C)', profits:'average(D:D)', diff:'average(E:E)' }},
{ rank:'Std deviation', summaryRow: true, pq_fn:{revenues:'stdev(C:C)', profits:'stdev(D:D)', diff:'stdev(E:E)' }}
]
reportTable = {
title: report.description,
editable: false,
maxWidth: '100%',
height: '100%',
flex: {
on: true,
one: true,
all: true
},
groupModel: {
on: true,
dataIndx: [],
merge: true,
grandSummary: true
},
showBottom: false,
resizable: true,
filterModel: {
on: true,
header: true,
},
toolbar: {
items: [
{
type: 'select',
label: '',
attr: 'id="export_format"',
options: [{xlsx: 'Excel', csv: 'Csv', htm: 'Html', json: 'Json'}]
},
{
type: 'button',
label: "Export",
icon: 'ui-icon-arrowthickstop-1-s',
listener: function () {
this.exportData({
url: "<?php echo $this->url( 'export' ) ?>
",
format: $("#export_format").val(),
render: true
});
}
}]
}
};
createColModel = function () {
var colModelArray = [];
var alignReportData;
alignReportData = function () {
alignLeft = function (index) {
colModelArray.push(
{
filter: {
type: 'textbox',
condition: 'begin',
listeners: ['keyup']
},
title: reportHeadings[index],
align: "left"
}
)
};
alignRight = function (index) {
colModelArray.push(
{
filter: {
type: 'textbox',
condition: 'begin',
listeners: ['keyup']
},
title: reportHeadings[index],
align: "right",
format: '#.###,00',
dataType: "float",
summary: {
type: "sum"
}
}
)
};
$.each(dataArray[0], function (index, value) {
if (value === null || value.match(/^\D/)) {
alignLeft(index);
} else {
alignRight(index);
}
});
};
alignReportData();
return colModelArray;
};
reportTable.colModel = createColModel();
reportTable.dataModel = {
data: dataArray
};
};
}
reportTable = {
title: report.description,
editable: false,
maxWidth: '100%',
height: '100%',
flex: {
on: true,
one: true,
all: true
},
showBottom: false,
resizable: true,
filterModel: {
on: true,
header: true,
},
toolbar: {
items: [
{
type: 'select',
label: '',
attr: 'id="export_format"',
options: [{xlsx: 'Excel', csv: 'Csv', htm: 'Html', json: 'Json'}]
},
{
type: 'button',
label: "Export",
icon: 'ui-icon-arrowthickstop-1-s',
listener: function () {
this.exportData({
url: "<?php echo $this->url( 'export' ) ?>
",
format: $("#export_format").val(),
render: true
});
}
}]
}
};
createColModel = function () {
var colModelArray = [];
var alignReportData;
alignReportData = function () {
alignLeft = function (index) {
colModelArray.push(
{
filter: {
type: 'textbox',
condition: 'begin',
listeners: ['keyup']
},
title: reportHeadings[index],
align: "left"
}
)
};
alignRight = function (index) {
colModelArray.push(
{
filter: {
type: 'textbox',
condition: 'begin',
listeners: ['keyup']
},
title: reportHeadings[index],
align: "right",
format: '#.###,00',
dataType: "float",
summary: {
type: "sum"
}
}
)
};
$.each(dataArray[0], function (index, value) {
if (value === null || value.match(/^\D/)) {
alignLeft(index);
} else {
alignRight(index);
}
});
};
alignReportData();
return colModelArray;
};
createGroupModel = function () {
var colModelArray = [];
$.each(dataArray[0], function (index, value) {
if (value === null || value.match(/^\d/)) {
colModelArray.push(
{
on: true,
dataIndx: [],
merge: false,
grandSummary: true,
}
)
}
});
return colModelArray;
};
reportTable.colModel = createColModel();
reportTable.groupModel = createGroupModel();
reportTable.dataModel = {
data: dataArray
};
};
}