Skip to content

Commit

Permalink
Merge pull request #828 from solverat/report_grid_sorting
Browse files Browse the repository at this point in the history
Reports Grid Sorting
  • Loading branch information
dpfaffenbauer authored Feb 20, 2019
2 parents e655198 + bded17b commit ba8495f
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/CoreShop/Bundle/CoreBundle/Report/CategoriesReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public function getReportData(ParameterBag $parameterBag)
$name = !empty($result['categoryName']) ? $result['categoryName'] : $result['categoryKey'];
$data[] = [
'name' => sprintf('%s (Id: %d)', $name, $result['categoryId']),
'categoryName' => $name,
'sales' => $result['sales'],
'profit' => $result['profit'],
'quantityCount' => $result['quantityCount'],
Expand Down
4 changes: 2 additions & 2 deletions src/CoreShop/Bundle/CoreBundle/Report/CustomersReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getReportData(ParameterBag $parameterBag)
$query = "
SELECT SQL_CALC_FOUND_ROWS
customer.oo_id,
customer.email as `name`,
customer.email as `emailAddress`,
SUM(orders.totalNet) as sales,
COUNT(customer.oo_id) as `orderCount`
FROM object_query_$orderClassId AS orders
Expand All @@ -109,7 +109,7 @@ public function getReportData(ParameterBag $parameterBag)
$this->totalRecords = (int) $this->db->fetchColumn('SELECT FOUND_ROWS()');

foreach ($results as &$result) {
$sale['salesFormatted'] = $this->moneyFormatter->format(
$result['salesFormatted'] = $this->moneyFormatter->format(
$result['sales'],
'EUR',
$this->localeContext->getLocaleCode()
Expand Down
15 changes: 8 additions & 7 deletions src/CoreShop/Bundle/CoreBundle/Report/ManufacturerReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,14 @@ public function getReportData(ParameterBag $parameterBag)
foreach ($results as $result) {
$name = !empty($result['manufacturerName']) ? $result['manufacturerName'] : $result['manufacturerKey'];
$data[] = [
'name' => sprintf('%s (Id: %d)', $name, $result['manufacturerId']),
'sales' => $result['sales'],
'profit' => $result['profit'],
'quantityCount' => $result['quantityCount'],
'orderCount' => $result['orderCount'],
'salesFormatted' => $this->moneyFormatter->format($result['sales'], $store->getCurrency()->getIsoCode(), $this->localeService->getLocaleCode()),
'profitFormatted' => $this->moneyFormatter->format($result['profit'], $store->getCurrency()->getIsoCode(), $this->localeService->getLocaleCode())
'name' => sprintf('%s (Id: %d)', $name, $result['manufacturerId']),
'manufacturerName' => $name,
'sales' => $result['sales'],
'profit' => $result['profit'],
'quantityCount' => $result['quantityCount'],
'orderCount' => $result['orderCount'],
'salesFormatted' => $this->moneyFormatter->format($result['sales'], $store->getCurrency()->getIsoCode(), $this->localeService->getLocaleCode()),
'profitFormatted' => $this->moneyFormatter->format($result['profit'], $store->getCurrency()->getIsoCode(), $this->localeService->getLocaleCode())
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ coreshop.report.abstract = Class.create(pimcore.report.abstract, {

getPanel: function () {

var grid;

if (!this.panel) {

var bbar = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ coreshop.report.reports.categories = Class.create(coreshop.report.abstractStore,

getStoreFields: function () {
return [
{name: 'name', type: 'string'},
{name: 'categoryName', type: 'string'},
{name: 'orderCount', type: 'integer'},
{name: 'quantityCount', type: 'integer'},
{name: 'sales', type: 'number'},
{name: 'profit', type: 'number'}
];
Expand All @@ -44,8 +48,11 @@ coreshop.report.reports.categories = Class.create(coreshop.report.abstractStore,
columns: [
{
text: t('name'),
dataIndex: 'name',
flex: 3
dataIndex: 'categoryName',
flex: 3,
renderer: function (value, metadata, record) {
return record.get('name');
}
},
{
text: t('coreshop_report_products_order_count'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ coreshop.report.reports.customers = Class.create(coreshop.report.abstract, {

getStoreFields: function () {
return [
{name: 'emailAddress', type: 'string'},
{name: 'orderCount', type: 'integer'},
{name: 'sales', type: 'number'}
];
},
Expand All @@ -42,8 +44,8 @@ coreshop.report.reports.customers = Class.create(coreshop.report.abstract, {
store: this.getStore(),
columns: [
{
text: t('name'),
dataIndex: 'name',
text: t('email'),
dataIndex: 'emailAddress',
flex: 3
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ coreshop.report.reports.manufacturer = Class.create(coreshop.report.abstractStor

getStoreFields: function () {
return [
{name: 'name', type: 'string'},
{name: 'manufacturerName', type: 'string'},
{name: 'orderCount', type: 'integer'},
{name: 'quantityCount', type: 'integer'},
{name: 'sales', type: 'number'},
{name: 'profit', type: 'number'}
];
Expand All @@ -44,8 +48,11 @@ coreshop.report.reports.manufacturer = Class.create(coreshop.report.abstractStor
columns: [
{
text: t('name'),
dataIndex: 'name',
flex: 3
dataIndex: 'manufacturerName',
flex: 3,
renderer: function (value, metadata, record) {
return record.get('name');
}
},
{
text: t('coreshop_report_products_order_count'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ coreshop.report.reports.products = Class.create(coreshop.report.abstractStore, {

getStoreFields: function () {
return [
{name: 'name', type: 'string'},
{name: 'productName', type: 'string'},
{name: 'orderCount', type: 'integer'},
{name: 'quantityCount', type: 'integer'},
{name: 'sales', type: 'number'},
{name: 'salesPrice', type: 'number'},
{name: 'count', type: 'integer'},
{name: 'profit', type: 'number'}
];
},
Expand Down Expand Up @@ -84,14 +87,14 @@ coreshop.report.reports.products = Class.create(coreshop.report.abstractStore, {
queryMode: 'local',
listeners: {
change: function (combo, value) {
this.panel.down('[name=dings]').setHidden(value !== 'container');
this.panel.down('[name=objectTypeDescription]').setHidden(value !== 'container');
}.bind(this)
}
});

fields.push({
xtype: 'label',
name: 'dings',
name: 'objectTypeDescription',
style: '',
hidden: true,
height: 40,
Expand All @@ -111,8 +114,11 @@ coreshop.report.reports.products = Class.create(coreshop.report.abstractStore, {
columns: [
{
text: t('name'),
dataIndex: 'name',
flex: 3
dataIndex: 'productName',
flex: 3,
renderer: function (value, metadata, record) {
return record.get('name');
}
},
{
text: t('coreshop_report_products_order_count'),
Expand Down

0 comments on commit ba8495f

Please sign in to comment.