Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
addcpm-json
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Александр Чаплыгин
addcpm-json
Commits
29e56390
Commit
29e56390
authored
May 28, 2019
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Формирование таблицы заказов для excel-выгрузки
parent
cdcf726b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
23 deletions
+43
-23
feeds.global.php
src/config/autoload/feeds.global.php
+0
-13
styles-feeds-stat.css
src/public/css/styles-feeds-stat.css
+1
-1
script-feeds-stat-table.js
src/public/js/script-feeds-stat-table.js
+35
-5
script-feeds-stat.js
src/public/js/script-feeds-stat.js
+3
-0
cabinet-feed.phtml
src/templates/app/user/cabinet-feed.phtml
+4
-4
No files found.
src/config/autoload/feeds.global.php
View file @
29e56390
...
@@ -13,13 +13,6 @@ return [
...
@@ -13,13 +13,6 @@ return [
'year'
=>
'год'
,
'year'
=>
'год'
,
],
],
'colors_active_lines'
=>
[
'colors_active_lines'
=>
[
/*
'shows' => '#2CA02C',
'clicks' => '#D62728',
'transactions' => '#1F77B4',
'salemoney' => '#FF7F0E',
'admoney' => '#9467BD',
*/
'Views'
=>
'#2CA02C'
,
'Views'
=>
'#2CA02C'
,
'Clicks'
=>
'#D62728'
,
'Clicks'
=>
'#D62728'
,
'Orders'
=>
'#1F77B4'
,
'Orders'
=>
'#1F77B4'
,
...
@@ -52,12 +45,6 @@ return [
...
@@ -52,12 +45,6 @@ return [
'OrderSum'
=>
'Сумма'
,
'OrderSum'
=>
'Сумма'
,
'AdMoney'
=>
'Комиссия'
'AdMoney'
=>
'Комиссия'
]
]
/*
$cats => [
'localmoney' => 'localmoney',
'usdollarmoney' => 'usdollarmoney'
];
*/
],
],
]
]
]
]
...
...
src/public/css/styles-feeds-stat.css
View file @
29e56390
...
@@ -587,7 +587,7 @@ input[type="checkbox"]
...
@@ -587,7 +587,7 @@ input[type="checkbox"]
#table2excel
#table2excel
{
{
/*display: none;*/
display
:
none
;
}
}
.b-export-xls
.b-export-xls
...
...
src/public/js/script-feeds-stat-table.js
View file @
29e56390
...
@@ -2,8 +2,11 @@ $(document).ready(function(){
...
@@ -2,8 +2,11 @@ $(document).ready(function(){
var
var
$table
=
$
(
'#table-line'
),
$table
=
$
(
'#table-line'
),
$tableToExcel
=
$
(
'#table2excel'
),
$tableContent
=
$
(
'<tbody>'
),
$tableContent
=
$
(
'<tbody>'
),
$tableToExcelContent
=
$
(
'<tbody>'
),
$tableBody
=
$table
.
find
(
'tbody'
).
first
(),
$tableBody
=
$table
.
find
(
'tbody'
).
first
(),
$tableToExcelBody
=
$tableToExcel
.
find
(
'tbody'
).
first
(),
activeLines
=
[],
activeLines
=
[],
currentActiveLine
,
currentActiveLine
,
currencyFields
=
[
'admoney'
,
'salemoney'
,
'usdollarmoney'
,
'localmoney'
,
'AdMoney'
,
'OrderSum'
,
'Price'
],
currencyFields
=
[
'admoney'
,
'salemoney'
,
'usdollarmoney'
,
'localmoney'
,
'AdMoney'
,
'OrderSum'
,
'Price'
],
...
@@ -84,6 +87,7 @@ $(document).ready(function(){
...
@@ -84,6 +87,7 @@ $(document).ready(function(){
{
{
return
dataDate
.
split
(
' '
)[
0
];
return
dataDate
.
split
(
' '
)[
0
];
}
}
function
getHourMinValue
(
dataDate
)
function
getHourMinValue
(
dataDate
)
{
{
var
var
...
@@ -174,7 +178,6 @@ $(document).ready(function(){
...
@@ -174,7 +178,6 @@ $(document).ready(function(){
}
}
$row
=
$
(
'<tr class="transaction-item '
+
trClass
+
'">'
);
$row
=
$
(
'<tr class="transaction-item '
+
trClass
+
'">'
);
$row
.
append
(
$
(
'<td class="status">'
).
append
(
templateOrderStatusContent
({
$row
.
append
(
$
(
'<td class="status">'
).
append
(
templateOrderStatusContent
({
data
:
{
data
:
{
feedId
:
item
[
'ViewID'
][
0
],
feedId
:
item
[
'ViewID'
][
0
],
...
@@ -183,7 +186,6 @@ $(document).ready(function(){
...
@@ -183,7 +186,6 @@ $(document).ready(function(){
approved
:
(
orderStatus
&&
orderStatus
.
approved
)
?
'disabled'
:
''
,
approved
:
(
orderStatus
&&
orderStatus
.
approved
)
?
'disabled'
:
''
,
}
}
})));
})));
$row
.
append
(
$
(
'<td class="OrderID">'
).
append
(
templateOrderIDContent
({
$row
.
append
(
$
(
'<td class="OrderID">'
).
append
(
templateOrderIDContent
({
data
:
{
data
:
{
feedId
:
item
[
'ViewID'
][
0
],
feedId
:
item
[
'ViewID'
][
0
],
...
@@ -192,6 +194,10 @@ $(document).ready(function(){
...
@@ -192,6 +194,10 @@ $(document).ready(function(){
//approved: (orderStatus && orderStatus.approved) ? 'disabled' : '',
//approved: (orderStatus && orderStatus.approved) ? 'disabled' : '',
}
}
})));
})));
$rowExcel
=
$
(
'<tr class="'
+
trClass
+
'">'
);
$rowExcel
.
append
(
$
(
'<td>'
).
html
(
item
[
'period'
]));
}
else
{
}
else
{
$row
=
$
(
'<tr>'
);
$row
=
$
(
'<tr>'
);
$row
.
append
(
$
(
'<td>'
).
html
(
item
[
'period'
]));
$row
.
append
(
$
(
'<td>'
).
html
(
item
[
'period'
]));
...
@@ -206,6 +212,7 @@ $(document).ready(function(){
...
@@ -206,6 +212,7 @@ $(document).ready(function(){
$row
.
append
(
$
(
'<td class="'
+
line
+
'">'
).
append
(
templateTimestampContent
({
$row
.
append
(
$
(
'<td class="'
+
line
+
'">'
).
append
(
templateTimestampContent
({
data
:
{
date
:
getDateValue
(
item
[
line
]),
time
:
getHourMinValue
(
item
[
line
])}
data
:
{
date
:
getDateValue
(
item
[
line
]),
time
:
getHourMinValue
(
item
[
line
])}
})));
})));
$rowExcel
.
append
(
$
(
'<td>'
).
append
(
item
[
line
]));
}
else
if
(
line
==
'ViewID'
)
{
}
else
if
(
line
==
'ViewID'
)
{
$row
.
append
(
$
(
'<td class="'
+
line
+
'">'
).
append
(
templateViewIDContent
({
$row
.
append
(
$
(
'<td class="'
+
line
+
'">'
).
append
(
templateViewIDContent
({
data
:
{
feedId
:
item
[
line
][
0
],
viewId
:
item
[
line
][
1
]}
data
:
{
feedId
:
item
[
line
][
0
],
viewId
:
item
[
line
][
1
]}
...
@@ -213,9 +220,11 @@ $(document).ready(function(){
...
@@ -213,9 +220,11 @@ $(document).ready(function(){
}
else
{
}
else
{
currentActiveLine
=
line
;
currentActiveLine
=
line
;
$row
.
append
(
$
(
'<td class="'
+
line
+
'">'
).
html
(
valueFormat
(
item
[
line
])));
$row
.
append
(
$
(
'<td class="'
+
line
+
'">'
).
html
(
valueFormat
(
item
[
line
])));
$rowExcel
.
append
(
$
(
'<td>'
).
html
(
valueFormat
(
item
[
line
])));
}
}
});
});
$row
.
appendTo
(
$tableContent
);
$row
.
appendTo
(
$tableContent
);
$rowExcel
.
appendTo
(
$tableToExcelContent
);
});
});
// Добавляем строку "Итого" для отчета 'common':
// Добавляем строку "Итого" для отчета 'common':
...
@@ -249,6 +258,9 @@ $(document).ready(function(){
...
@@ -249,6 +258,9 @@ $(document).ready(function(){
$row
.
append
(
$
(
'<td>'
));
$row
.
append
(
$
(
'<td>'
));
$row
.
append
(
$
(
'<td>'
).
html
(
"Всего заказов: "
+
dataPeriod
.
length
));
$row
.
append
(
$
(
'<td>'
).
html
(
"Всего заказов: "
+
dataPeriod
.
length
));
$rowExcel
=
$
(
'<tr>'
);
$rowExcel
.
append
(
$
(
'<td>'
).
html
(
"<b>Всего заказов: "
+
dataPeriod
.
length
+
'</b>'
));
activeLines
.
forEach
(
function
(
item
){
activeLines
.
forEach
(
function
(
item
){
currentActiveLine
=
item
;
currentActiveLine
=
item
;
var
isNotSumValue
=
notFormatFields
.
indexOf
(
currentActiveLine
)
>
-
1
;
var
isNotSumValue
=
notFormatFields
.
indexOf
(
currentActiveLine
)
>
-
1
;
...
@@ -263,18 +275,32 @@ $(document).ready(function(){
...
@@ -263,18 +275,32 @@ $(document).ready(function(){
}
}
$row
.
append
(
$
(
'<td class="'
+
item
+
'">'
).
html
(
valueFormat
(
totalValue
)));
$row
.
append
(
$
(
'<td class="'
+
item
+
'">'
).
html
(
valueFormat
(
totalValue
)));
if
([
'ViewID'
,
'Basket'
].
indexOf
(
currentActiveLine
)
<
0
)
{
$rowExcel
.
append
(
$
(
'<td>'
).
html
(
'<b>'
+
valueFormat
(
totalValue
)
+
'</b>'
));
}
});
});
$row
.
appendTo
(
$tableContent
);
$row
.
appendTo
(
$tableContent
);
$rowExcel
.
appendTo
(
$tableToExcelContent
);
// Добавляем total-строки для статусов заказов:
// Добавляем total-строки для статусов заказов:
ordersStatuses
.
forEach
(
function
(
item
){
ordersStatuses
.
forEach
(
function
(
item
){
$row
=
$
(
'<tr class="total-orders '
+
item
+
'">'
);
$row
=
$
(
'<tr class="total-orders '
+
item
+
'">'
);
$row
.
append
(
$
(
'<td>'
));
$row
.
append
(
$
(
'<td>'
));
$row
.
append
(
$
(
'<td class="count">'
).
html
(
"Заказов: <span></span>"
));
$row
.
append
(
$
(
'<td class="count">'
).
html
(
"Заказов: <span></span>"
));
$rowExcel
=
$
(
'<tr class="total-orders '
+
item
+
'">'
);
$rowExcel
.
append
(
$
(
'<td class="count">'
).
html
(
"<b>Заказов: <span></span>"
));
activeLines
.
forEach
(
function
(
activeLine
){
activeLines
.
forEach
(
function
(
activeLine
){
$row
.
append
(
$
(
'<td class="'
+
activeLine
+
'">'
));
$row
.
append
(
$
(
'<td class="'
+
activeLine
+
'">'
));
if
([
'ViewID'
,
'Basket'
].
indexOf
(
activeLine
)
<
0
)
{
$rowExcel
.
append
(
$
(
'<td class="'
+
activeLine
+
'">'
));
}
});
});
$row
.
appendTo
(
$tableContent
);
$row
.
appendTo
(
$tableContent
);
$rowExcel
.
appendTo
(
$tableToExcelContent
);
});
});
}
}
...
@@ -284,14 +310,13 @@ $(document).ready(function(){
...
@@ -284,14 +310,13 @@ $(document).ready(function(){
$
.
extend
({
$
.
extend
({
TableStat
:
{
TableStat
:
{
Render
:
function
(
dataLineChartStat
)
{
Render
:
function
(
dataLineChartStat
)
{
//console.log('AAA TableStat render: ', dataLineChartStat);
// Формируем список переключателей (категорий) activeLines:
// Формируем список переключателей (категорий) activeLines:
activeLines
=
[];
activeLines
=
[];
$
(
'thead.metric.sortable th b.cat'
,
$table
).
each
(
function
(){
$
(
'thead.metric.sortable th b.cat'
,
$table
).
each
(
function
(){
activeLines
.
push
(
$
(
this
).
attr
(
'id'
));
activeLines
.
push
(
$
(
this
).
attr
(
'id'
));
});
});
//console.log('AAA TableStat render: ', dataLineChartStat);
//console.log('AAA activeLines: ', activeLines);
//console.log('AAA activeLines: ', activeLines);
if
(
dataLineChartStat
.
type
==
'interval'
)
{
if
(
dataLineChartStat
.
type
==
'interval'
)
{
...
@@ -303,6 +328,7 @@ $(document).ready(function(){
...
@@ -303,6 +328,7 @@ $(document).ready(function(){
}
}
$tableBody
.
html
(
''
).
append
(
$tableContent
.
children
());
$tableBody
.
html
(
''
).
append
(
$tableContent
.
children
());
$tableToExcelBody
.
html
(
''
).
append
(
$tableToExcelContent
.
children
());
},
},
// Определяем список категорий, отмеченных галочками в таблице:
// Определяем список категорий, отмеченных галочками в таблице:
CheckedCategories
:
function
()
{
CheckedCategories
:
function
()
{
...
@@ -314,6 +340,7 @@ $(document).ready(function(){
...
@@ -314,6 +340,7 @@ $(document).ready(function(){
});
});
return
listCats
;
return
listCats
;
},
},
// Пересчитываем кол-во заказов по статусам:
OrdersStatusReCalc
:
function
()
{
OrdersStatusReCalc
:
function
()
{
console
.
log
(
'AAA OrdersStatusReCalc'
);
console
.
log
(
'AAA OrdersStatusReCalc'
);
...
@@ -321,9 +348,11 @@ $(document).ready(function(){
...
@@ -321,9 +348,11 @@ $(document).ready(function(){
ordersStatuses
.
forEach
(
function
(
item
){
ordersStatuses
.
forEach
(
function
(
item
){
var
var
$trStatus
=
$
(
'tr.transaction-item.'
+
item
,
$table
),
$trStatus
=
$
(
'tr.transaction-item.'
+
item
,
$table
),
$trTotalStatus
=
$
(
'tr.total-orders.'
+
item
,
$table
);
$trTotalStatus
=
$
(
'tr.total-orders.'
+
item
,
$table
),
$trTotalStatusToExcel
=
$
(
'tr.total-orders.'
+
item
,
$tableToExcel
);
$
(
'td.count span'
,
$trTotalStatus
).
html
(
$trStatus
.
length
);
$
(
'td.count span'
,
$trTotalStatus
).
html
(
$trStatus
.
length
);
$
(
'td.count span'
,
$trTotalStatusToExcel
).
html
(
$trStatus
.
length
);
activeLines
.
forEach
(
function
(
activeLine
){
activeLines
.
forEach
(
function
(
activeLine
){
currentActiveLine
=
activeLine
;
currentActiveLine
=
activeLine
;
...
@@ -335,6 +364,7 @@ $(document).ready(function(){
...
@@ -335,6 +364,7 @@ $(document).ready(function(){
totalValue
+=
parseFloat
(
$
(
'td.'
+
activeLine
,
$this
).
html
().
replace
(
','
,
''
));
totalValue
+=
parseFloat
(
$
(
'td.'
+
activeLine
,
$this
).
html
().
replace
(
','
,
''
));
});
});
$
(
'td.'
+
activeLine
,
$trTotalStatus
).
html
(
valueFormat
(
totalValue
));
$
(
'td.'
+
activeLine
,
$trTotalStatus
).
html
(
valueFormat
(
totalValue
));
$
(
'td.'
+
activeLine
,
$trTotalStatusToExcel
).
html
(
valueFormat
(
totalValue
));
}
}
});
});
...
...
src/public/js/script-feeds-stat.js
View file @
29e56390
...
@@ -278,6 +278,9 @@ $(document).ready(function(){
...
@@ -278,6 +278,9 @@ $(document).ready(function(){
// Выгрузка таблицы в Excel
// Выгрузка таблицы в Excel
$exportExcelButton
.
click
(
function
(){
$exportExcelButton
.
click
(
function
(){
console
.
log
(
'AAA exportExcel'
);
return
false
;
var
$tableToExcel
=
$
(
"#table2excel"
);
var
$tableToExcel
=
$
(
"#table2excel"
);
$tableToExcel
.
table2excel
({
$tableToExcel
.
table2excel
({
exclude
:
".noExl"
,
exclude
:
".noExl"
,
...
...
src/templates/app/user/cabinet-feed.phtml
View file @
29e56390
...
@@ -191,9 +191,11 @@ if (!$error) {
...
@@ -191,9 +191,11 @@ if (!$error) {
<table
id=
"table-line"
class=
"table table-striped admin
<?=
$current_report
?>
all"
data-link=
"
<?=
$data_request_link
?>
"
>
<table
id=
"table-line"
class=
"table table-striped admin
<?=
$current_report
?>
all"
data-link=
"
<?=
$data_request_link
?>
"
>
<thead
class=
"metric sortable"
>
<thead
class=
"metric sortable"
>
<tr>
<tr>
<?php
if
(
$current_report
==
'transactions'
)
:
?>
<th
class=
"status"
>
<th
class=
"status"
>
<b
class=
"not-sorted"
>
Подтвержден
</b>
<b
class=
"not-sorted"
>
Подтвержден
</b>
</th>
</th>
<?php
endif
;
?>
<th
class=
"period"
data-id=
"period"
>
<th
class=
"period"
data-id=
"period"
>
<b
class=
"main-cat selected
<?php
if
(
!
$main_cat
[
'isSorted'
])
:
?>
not-sorted
<?php
endif
;
?>
"
data-cat=
"
<?=
$main_cat
[
'name'
]
?>
"
>
<?=
_t
(
$main_cat
[
'title'
])
?>
</b>
<b
class=
"main-cat selected
<?php
if
(
!
$main_cat
[
'isSorted'
])
:
?>
not-sorted
<?php
endif
;
?>
"
data-cat=
"
<?=
$main_cat
[
'name'
]
?>
"
>
<?=
_t
(
$main_cat
[
'title'
])
?>
</b>
</th>
</th>
...
@@ -230,11 +232,10 @@ if (!$error) {
...
@@ -230,11 +232,10 @@ if (!$error) {
<?php
if
(
$current_report
==
'transactions'
)
:
?>
<?php
if
(
$current_report
==
'transactions'
)
:
?>
<table
id=
"table2excel"
data-content=
"shop-
<?=
$shop_title
?>
"
width=
"100%"
>
<table
id=
"table2excel"
data-content=
"shop-
<?=
$shop_title
?>
"
width=
"100%"
>
<?php
/* ?>
<thead>
<thead class="metric sortable">
<tr>
<tr>
<th>
<th>
<b><?= _t($
report_main_cat[0]
['title'])?></b>
<b>
<?=
_t
(
$
main_cat
[
'title'
])
?>
</b>
</th>
</th>
<?php
foreach
(
$report_cats
as
$name
=>
$title
)
:
?>
<?php
foreach
(
$report_cats
as
$name
=>
$title
)
:
?>
<?php
if
(
$name
==
'Timestamp'
)
:
?>
<?php
if
(
$name
==
'Timestamp'
)
:
?>
...
@@ -249,7 +250,6 @@ if (!$error) {
...
@@ -249,7 +250,6 @@ if (!$error) {
</thead>
</thead>
<tbody>
<tbody>
</tbody>
</tbody>
<?php */
?>
</table>
</table>
<div
class=
"b-export-xls"
>
<div
class=
"b-export-xls"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment