Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bds
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
bds
Commits
60f2be24
Commit
60f2be24
authored
Mar 02, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
问题1
parent
3bde8968
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
608 additions
and
535 deletions
+608
-535
Application/Admin/Controller/GroupStatiController.class.php
+589
-527
Application/Admin/View/GroupStati/sales.html
+18
-7
Application/Admin/View/Public/base.html
+1
-1
No files found.
Application/Admin/Controller/GroupStatiController.class.php
View file @
60f2be24
...
...
@@ -9,593 +9,650 @@
namespace
Admin\Controller
;
import
(
"Org.Util.PHPExcel"
);
class
GroupStatiController
extends
AdminController
{
//销售统计
public
function
sales
(){
$where
=
'time > 0'
;
$time
=
date
(
'Y-m-d'
,
time
());
if
(
isset
(
$_GET
[
'time-start'
])
&&!
isset
(
$_GET
[
'time-end'
])){
$where
=
'`time` > '
.
strtotime
(
$_GET
[
'time-start'
]);
$time
=
$_GET
[
'time-start'
];
}
elseif
(
isset
(
$_GET
[
'time-end'
])
&&!
isset
(
$_GET
[
'time-start'
])){
$where
=
'`time` < '
.
strtotime
(
$_GET
[
'time-end'
]);
$time
=
$_GET
[
'time-end'
];
}
elseif
(
isset
(
$_GET
[
'time-end'
])
&&
isset
(
$_GET
[
'time-start'
])){
//两个时间都查
$where
=
'`time` > '
.
strtotime
(
$_GET
[
'time-start'
])
.
' and `time` < '
.
strtotime
(
$_GET
[
'time-end'
]);
$time
=
$_GET
[
'time-start'
]
.
' / '
.
$_GET
[
'time-end'
];
}
$order
=
M
(
'order'
);
$list
=
$order
->
where
(
$where
)
->
field
(
'id,time'
)
->
select
();
if
(
$list
){
$list2
=
array
();
//申明一个空数组
foreach
(
$list
as
$key
=>
$v
){
//把时间进行分组
$d
=
date
(
'Y-m-d'
,
$v
[
'time'
]);
$list2
[
$d
][]
=
$v
;
}
$order_goods
=
M
(
'order_goods'
);
foreach
(
$list2
as
$key
=>
$vo
){
//循环天数
foreach
(
$vo
as
$k
=>
$v
){
$info
=
$order_goods
->
where
(
'order_id='
.
$v
[
'id'
]
.
' and group_id='
.
$this
->
group_id
)
->
field
(
'sum(s_price) s_price,sum(z_price) z_price,sum(cou_price) cou_price'
)
->
find
();
if
(
$info
[
's_price'
]){
$list2
[
$key
][
$k
][
's_price'
]
=
$info
[
's_price'
];
$list2
[
$key
][
$k
][
'z_price'
]
=
$info
[
'z_price'
];
$list2
[
$key
][
$k
][
'cou_price'
]
=
$info
[
'cou_price'
];
}
else
{
unset
(
$list2
[
$key
][
$k
]);
}
}
}
foreach
(
$list2
as
$key
=>
$vo
){
if
(
$list2
[
$key
]){
$list_count
=
count
(
$list2
[
$key
]);
$list2
[
$key
][
'sum'
]
=
$list_count
;
//统计当天多少条
foreach
(
$vo
as
$k
=>
$v
){
$list2
[
$key
][
'time'
]
=
$key
;
$list2
[
$key
][
'z_price'
]
+=
$v
[
'z_price'
];
$list2
[
$key
][
'cou_price'
]
+=
$v
[
'cou_price'
];
$list2
[
$key
][
's_price'
]
+=
$v
[
's_price'
];
unset
(
$list2
[
$key
][
$k
]);
}
}
else
{
unset
(
$list2
[
$key
]);
}
}
//剔除掉没有数据的天数
$rows
=
array
();
foreach
(
$list2
as
$key
=>
$v
){
$rows
[
'sum'
]
+=
$v
[
'sum'
];
$rows
[
'z_price'
]
+=
$v
[
'z_price'
];
$rows
[
'cou_price'
]
+=
$v
[
'cou_price'
];
$rows
[
's_price'
]
+=
$v
[
's_price'
];
}
}
$rows
[
'list'
]
=
$list2
;
$this
->
meta_title
=
'销售统计'
;
$this
->
assign
(
'rows'
,
$rows
)
->
assign
(
'time'
,
$time
);
$this
->
display
();
}
public
function
sales
()
{
// todo 有毒的代码 放弃治疗
// $list=$order->where($where)->field('id,time')->order('id desc')->limit(100)->select();
// if($list){
// $list2=array();//申明一个空数组
// foreach($list as $key=>$v){//把时间进行分组
// $d=date('Y-m-d',$v['time']);
// $list2[$d][]=$v;
// }
//
// $order_goods=M('order_goods');
// foreach($list2 as $key=>$vo){//循环天数
// foreach($vo as $k=>$v){
// $info=$order_goods->where('order_id='.$v['id'].' and group_id='.$this->group_id)
// ->field('sum(s_price) s_price,sum(z_price) z_price,sum(cou_price) cou_price')
// ->find();
// if($info['s_price']){
// $list2[$key][$k]['s_price']=$info['s_price'];
// $list2[$key][$k]['z_price']=$info['z_price'];
// $list2[$key][$k]['cou_price']=$info['cou_price'];
// }else{
// unset($list2[$key][$k]);
// }
// }
// }
// foreach($list2 as $key=>$vo){
// if($list2[$key]){
// $list_count=count($list2[$key]);
// $list2[$key]['sum']=$list_count;//统计当天多少条
// foreach($vo as $k=>$v){
// $list2[$key]['time']=$key;
// $list2[$key]['z_price']+=$v['z_price'];
// $list2[$key]['cou_price']+=$v['cou_price'];
// $list2[$key]['s_price']+=$v['s_price'];
// unset($list2[$key][$k]);
// }
// }else{
// unset($list2[$key]);
// }
// }//剔除掉没有数据的天数
// $rows=array();
// foreach($list2 as $key=>$v){
// $rows['sum']+=$v['sum'];
// $rows['z_price']+=$v['z_price'];
// $rows['cou_price']+=$v['cou_price'];
// $rows['s_price']+=$v['s_price'];
// }
// }
$order
=
M
(
'order'
);
if
(
isset
(
$_GET
[
'time-start'
])
&&
!
isset
(
$_GET
[
'time-end'
]))
{
$time
=
'o.time > '
.
strtotime
(
$_GET
[
'time-start'
]);
$date
=
$_GET
[
'time-start'
];
}
elseif
(
isset
(
$_GET
[
'time-end'
])
&&
!
isset
(
$_GET
[
'time-start'
]))
{
$time
=
'o.time < '
.
strtotime
(
$_GET
[
'time-end'
]);
$date
=
$_GET
[
'time-end'
];
}
elseif
(
isset
(
$_GET
[
'time-end'
])
&&
isset
(
$_GET
[
'time-start'
]))
{
//两个时间都查
$time
=
'o.time between '
.
strtotime
(
$_GET
[
'time-start'
])
.
' and '
.
strtotime
(
$_GET
[
'time-end'
]);
$date
=
$_GET
[
'time-start'
]
.
' / '
.
$_GET
[
'time-end'
];
}
else
{
$date
=
date
(
'Y-m-d'
,
time
());
$time
=
'o.time between '
.
strtotime
(
$date
)
.
' and '
.
strtotime
(
$date
.
' 23:59:59'
);
}
$sql
=
"SELECT FROM_UNIXTIME(o.time, '%Y-%m-%d') as t,
COUNT(o.id) as sum,
IFNULL(sum(a.send_price), 0) as send_price,
IFNULL(sum(a.give_price), 0) as give_price,
IFNULL(sum(case when o.status = 2 then (o.s_price - o.dis_price) end), 0) as rollback_price,
IFNULL(sum(a.complete_price), 0) as complete_price,
IFNULL(sum(o.s_price), 0) as s_price,
IFNULL(sum(o.y_price), 0) as y_price,
IFNULL(sum(o.z_price), 0) as z_price
FROM yi_order as o
left join (SELECT sum(case when og.status = 2 then og.s_price end) as send_price,
sum(case when og.status = 3 then og.s_price end) as give_price,
sum(case when og.status = 4 then og.s_price end) as complete_price,
og.order_id,
og.group_id
FROM yi_order_goods as og
GROUP BY og.order_id) as a
on a.order_id = o.id
WHERE a.group_id =
{
$this
->
group_id
}
and
{
$time
}
GROUP BY t
ORDER BY t desc"
;
$rows
=
[];
$list
=
$order
->
query
(
$sql
);
array_walk_recursive
(
$list
,
function
(
$item
,
$key
)
use
(
&
$rows
){
if
(
$key
==
't'
)
{
return
;
}
$rows
[
$key
]
=
isset
(
$rows
[
$key
])
?
$item
+
$rows
[
$key
]
:
$item
;
});
// foreach ($list as $v) {
// $rows['sum'] += $v['sum'];
// $rows['send_price'] += $v['send_price'];
// $rows['give_price'] += $v['give_price'];
// $rows['rollback_price'] += $v['rollback_price'];
// $rows['complete_price'] += $v['complete_price'];
// $rows['s_price'] += $v['s_price'];
// $rows['y_price'] += $v['y_price'];
// $rows['z_price'] += $v['z_price'];
// }
$rows
[
'list'
]
=
$list
;
$this
->
meta_title
=
'销售统计'
;
$this
->
assign
(
'rows'
,
$rows
)
->
assign
(
'time'
,
$date
);
$this
->
display
();
}
//成本统计
public
function
cost
(){
$order
=
M
(
'order'
);
$time
=
date
(
'Y-m-d'
,
time
());
$where
[
'yi_order.time'
]
=
array
(
'GT'
,
0
);
$where
[
'group_id'
]
=
$this
->
group_id
;
if
(
isset
(
$_GET
[
'time-start'
])
&&!
isset
(
$_GET
[
'time-end'
])){
$where
[
'yi_order.time'
]
=
array
(
'GT'
,
strtotime
(
$_GET
[
'time-start'
]));
//查询开始时间
$time
=
$_GET
[
'time-start'
];
}
elseif
(
isset
(
$_GET
[
'time-end'
])
&&!
isset
(
$_GET
[
'time-start'
])){
$where
[
'yi_order.time'
]
=
array
(
'LT'
,
strtotime
(
$_GET
[
'time-end'
]));
//查询结束时间
$time
=
$_GET
[
'time-end'
];
}
elseif
(
isset
(
$_GET
[
'time-end'
])
&&
isset
(
$_GET
[
'time-start'
])){
//两个时间都查
$where
[
'yi_order.time'
]
=
array
(
array
(
'GT'
,
strtotime
(
$_GET
[
'time-start'
])),
array
(
'LT'
,
strtotime
(
$_GET
[
'time-end'
])));
$time
=
$_GET
[
'time-start'
]
.
' / '
.
$_GET
[
'time-end'
];
public
function
cost
()
{
$order
=
M
(
'order'
);
$time
=
date
(
'Y-m-d'
,
time
());
$where
[
'yi_order.time'
]
=
[
'GT'
,
0
];
$where
[
'group_id'
]
=
$this
->
group_id
;
if
(
isset
(
$_GET
[
'time-start'
])
&&
!
isset
(
$_GET
[
'time-end'
]))
{
$where
[
'yi_order.time'
]
=
[
'GT'
,
strtotime
(
$_GET
[
'time-start'
])];
//查询开始时间
$time
=
$_GET
[
'time-start'
];
}
elseif
(
isset
(
$_GET
[
'time-end'
])
&&
!
isset
(
$_GET
[
'time-start'
]))
{
$where
[
'yi_order.time'
]
=
[
'LT'
,
strtotime
(
$_GET
[
'time-end'
])];
//查询结束时间
$time
=
$_GET
[
'time-end'
];
}
elseif
(
isset
(
$_GET
[
'time-end'
])
&&
isset
(
$_GET
[
'time-start'
]))
{
//两个时间都查
$where
[
'yi_order.time'
]
=
[[
'GT'
,
strtotime
(
$_GET
[
'time-start'
])],
[
'LT'
,
strtotime
(
$_GET
[
'time-end'
])]];
$time
=
$_GET
[
'time-start'
]
.
' / '
.
$_GET
[
'time-end'
];
}
$count
=
$order
->
field
(
'yi_goods.id'
)
$count
=
$order
->
field
(
'yi_goods.id'
)
->
where
(
$where
)
->
group
(
'goods_id'
)
->
join
(
'yi_order_goods og on yi_order.id=og.order_id'
)
->
join
(
'yi_goods on og.goods_id=yi_goods.id'
)
->
select
();
$count
=
count
(
$count
);
$page
=
new
\Think\Page
(
$count
,
10
);
$show
=
$page
->
show
();
//分页显示输出
$list
=
$order
->
field
(
'title,z_img,goods_model,order_num,goods_id,sum(g_sum) g_sum,sum(cou_sum) cou_sum,g_price'
)
$count
=
count
(
$count
);
$page
=
new
\Think\Page
(
$count
,
10
);
$show
=
$page
->
show
();
//分页显示输出
$list
=
$order
->
field
(
'title,z_img,goods_model,order_num,goods_id,sum(g_sum) g_sum,sum(cou_sum) cou_sum,g_price'
)
->
where
(
$where
)
->
group
(
'goods_id'
)
->
join
(
'yi_order_goods og on yi_order.id=og.order_id'
)
->
join
(
'yi_goods on og.goods_id=yi_goods.id'
)
->
limit
(
$page
->
firstRow
.
','
.
$page
->
listRows
)
->
limit
(
$page
->
firstRow
.
','
.
$page
->
listRows
)
->
select
();
if
(
$list
)
{
//计算所有商品
$rows
[
'list'
]
=
$list
;
foreach
(
$list
as
$key
=>
$v
)
{
$rows
[
'g_sum'
]
+=
$v
[
'g_sum'
];
$rows
[
'cou_sum'
]
+=
$v
[
'cou_sum'
];
if
(
$list
)
{
//计算所有商品
$rows
[
'list'
]
=
$list
;
foreach
(
$list
as
$key
=>
$v
)
{
$rows
[
'g_sum'
]
+=
$v
[
'g_sum'
];
$rows
[
'cou_sum'
]
+=
$v
[
'cou_sum'
];
}
}
$this
->
meta_title
=
'成本统计'
;
$this
->
assign
(
'rows'
,
$rows
)
->
assign
(
'page'
,
$show
)
//发送分页
->
assign
(
'count'
,
$count
);
$this
->
assign
(
'time'
,
$time
);
$this
->
meta_title
=
'成本统计'
;
$this
->
assign
(
'rows'
,
$rows
)
->
assign
(
'page'
,
$show
)
//发送分页
->
assign
(
'count'
,
$count
);
$this
->
assign
(
'time'
,
$time
);
$this
->
display
();
}
//商品统计
public
function
goods
(){
$goods
=
M
(
'goods'
);
$logo
=
M
(
'logo'
);
//循环查询品牌
$gPrice
=
M
(
'gPrice'
);
//循环查询城市
$authGroup
=
M
(
'authGroup'
);
//循环查询分仓
$goods_group
=
M
(
'goodsGroup'
);
//查询分仓商品
$order_goods
=
M
(
'orderGoods'
);
//查询销量
public
function
goods
()
{
$goods
=
M
(
'goods'
);
$logo
=
M
(
'logo'
);
//循环查询品牌
$gPrice
=
M
(
'gPrice'
);
//循环查询城市
$authGroup
=
M
(
'authGroup'
);
//循环查询分仓
$goods_group
=
M
(
'goodsGroup'
);
//查询分仓商品
$order_goods
=
M
(
'orderGoods'
);
//查询销量
//查询该分仓信息:所属城市
$group_info
=
$authGroup
->
where
(
'id='
.
$this
->
group_id
)
->
field
(
'group_city'
)
->
find
();
$group_info
=
$authGroup
->
where
(
'id='
.
$this
->
group_id
)
->
field
(
'group_city'
)
->
find
();
//商品标题和型号查询
if
(
isset
(
$_GET
[
'title'
]))
{
if
(
isset
(
$_GET
[
'title'
]))
{
if
(
preg_match
(
"/[
\x7f
-
\xff
]/"
,
$_GET
[
'title'
]))
{
//判断是否含有中文
$where_goods
[
'yi_goods.title'
]
=
array
(
'like'
,
'%'
.
$_GET
[
'title'
]
.
'%'
)
;
}
else
{
$where_goods
[
'goods_model'
]
=
array
(
'like'
,
'%'
.
$_GET
[
'title'
]
.
'%'
)
;
$where_goods
[
'yi_goods.title'
]
=
[
'like'
,
'%'
.
$_GET
[
'title'
]
.
'%'
]
;
}
else
{
$where_goods
[
'goods_model'
]
=
[
'like'
,
'%'
.
$_GET
[
'title'
]
.
'%'
]
;
}
}
else
{
$where_goods
[
'goods_model'
]
=
array
(
'like'
,
'%%'
)
;
}
else
{
$where_goods
[
'goods_model'
]
=
[
'like'
,
'%%'
]
;
}
//商品品牌赛选
if
(
isset
(
$_GET
[
'logo'
]))
{
$where_logo
[
'title'
]
=
array
(
'like'
,
'%'
.
$_GET
[
'logo'
]
.
'%'
)
;
$logo_like
=
$logo
->
where
(
$where_logo
)
->
field
(
'id'
)
->
find
();
if
(
$logo_like
)
{
$where_goods
[
'logo'
]
=
$logo_like
[
'id'
];
}
else
{
$where_goods
[
'logo'
]
=
'a'
;
if
(
isset
(
$_GET
[
'logo'
]))
{
$where_logo
[
'title'
]
=
[
'like'
,
'%'
.
$_GET
[
'logo'
]
.
'%'
]
;
$logo_like
=
$logo
->
where
(
$where_logo
)
->
field
(
'id'
)
->
find
();
if
(
$logo_like
)
{
$where_goods
[
'logo'
]
=
$logo_like
[
'id'
];
}
else
{
$where_goods
[
'logo'
]
=
'a'
;
}
}
$where_goods
[
'group_id'
]
=
$this
->
group_id
;
//查询对应分仓的商品
$count
=
$goods
->
where
(
$where_goods
)
$where_goods
[
'group_id'
]
=
$this
->
group_id
;
//查询对应分仓的商品
$count
=
$goods
->
where
(
$where_goods
)
->
join
(
'yi_sort s1 on yi_goods.sort1=s1.id'
)
->
join
(
'yi_sort s2 on yi_goods.sort2=s2.id'
)
->
join
(
'yi_sort s3 on yi_goods.sort3=s3.id'
)
->
join
(
'yi_goods_group on yi_goods.id=yi_goods_group.goods_id'
)
->
count
();
$page
=
new
\Think\Page
(
$count
,
10
);
$show
=
$page
->
show
();
//分页显示输出
$list
=
$goods
->
where
(
$where_goods
)
$page
=
new
\Think\Page
(
$count
,
10
);
$show
=
$page
->
show
();
//分页显示输出
$list
=
$goods
->
where
(
$where_goods
)
->
field
(
'yi_goods.id,yi_goods.title,goods_model,logo,stan,unit,s1.sort_name s1_name,s2.sort_name s2_name,s3.sort_name s3_name'
)
->
join
(
'yi_sort s1 on yi_goods.sort1=s1.id'
)
->
join
(
'yi_sort s2 on yi_goods.sort2=s2.id'
)
->
join
(
'yi_sort s3 on yi_goods.sort3=s3.id'
)
->
join
(
'yi_goods_group on yi_goods.id=yi_goods_group.goods_id'
)
->
limit
(
$page
->
firstRow
.
','
.
$page
->
listRows
)
->
limit
(
$page
->
firstRow
.
','
.
$page
->
listRows
)
->
select
();
foreach
(
$list
as
$key
=>
$v
)
{
$list
[
$key
][
'r_repe'
]
=
0
;
//初始化入库总数量
$list
[
$key
][
'j_repe'
]
=
0
;
//初始化进货价
$list
[
$key
][
'z_price'
]
=
0
;
//初始化入库总金额
$list
[
$key
][
'g_sum'
]
=
0
;
//初始化销售商品总数量
foreach
(
$list
as
$key
=>
$v
)
{
$list
[
$key
][
'r_repe'
]
=
0
;
//初始化入库总数量
$list
[
$key
][
'j_repe'
]
=
0
;
//初始化进货价
$list
[
$key
][
'z_price'
]
=
0
;
//初始化入库总金额
$list
[
$key
][
'g_sum'
]
=
0
;
//初始化销售商品总数量
//循环查询品牌
$logoS
=
$logo
->
where
(
'id='
.
$v
[
'logo'
])
->
field
(
'title'
)
->
find
();
$list
[
$key
][
'logo'
]
=
$logoS
[
'title'
];
$logoS
=
$logo
->
where
(
'id='
.
$v
[
'logo'
])
->
field
(
'title'
)
->
find
();
$list
[
$key
][
'logo'
]
=
$logoS
[
'title'
];
//循环查询城市
$where_city
[
'goods_id'
]
=
$v
[
'id'
];
$where_city
[
'city_id'
]
=
$group_info
[
'group_city'
];
//只查询该城市的分仓
$cityS
=
$gPrice
->
where
(
$where_city
)
->
field
(
'city_id,city_name'
)
->
join
(
'yi_dredge on yi_g_price.city_id=yi_dredge.id'
)
->
select
();
$list
[
$key
][
'city_num'
]
=
2
;
//初始化合并行
$where_city
[
'goods_id'
]
=
$v
[
'id'
];
$where_city
[
'city_id'
]
=
$group_info
[
'group_city'
];
//只查询该城市的分仓
$cityS
=
$gPrice
->
where
(
$where_city
)
->
field
(
'city_id,city_name'
)
->
join
(
'yi_dredge on yi_g_price.city_id=yi_dredge.id'
)
->
select
();
$list
[
$key
][
'city_num'
]
=
2
;
//初始化合并行
//循环查询分仓
foreach
(
$cityS
as
$city_key
=>
$city_v
)
{
$where
[
'id'
]
=
$this
->
group_id
;
//只查询该分仓信息
$where
[
'group_city'
]
=
$city_v
[
'city_id'
];
$where
[
'title'
]
=
array
(
array
(
'NEQ'
,
'平台管理员'
),
array
(
'like'
,
'%'
.
$_GET
[
'group'
]
.
'%'
),
'and'
)
;
//剔除平台管理员分组
$groupS
=
$authGroup
->
where
(
$where
)
->
field
(
'id,title'
)
->
select
();
foreach
(
$cityS
as
$city_key
=>
$city_v
)
{
$where
[
'id'
]
=
$this
->
group_id
;
//只查询该分仓信息
$where
[
'group_city'
]
=
$city_v
[
'city_id'
];
$where
[
'title'
]
=
[[
'NEQ'
,
'平台管理员'
],
[
'like'
,
'%'
.
$_GET
[
'group'
]
.
'%'
],
'and'
]
;
//剔除平台管理员分组
$groupS
=
$authGroup
->
where
(
$where
)
->
field
(
'id,title'
)
->
select
();
//查询分仓商品信息
foreach
(
$groupS
as
$groupS_key
=>
$groupS_v
)
{
$where2
[
'goods_id'
]
=
$v
[
'id'
];
//商品id
$where2
[
'group_id'
]
=
$groupS_v
[
'id'
];
//分仓id
foreach
(
$groupS
as
$groupS_key
=>
$groupS_v
)
{
$where2
[
'goods_id'
]
=
$v
[
'id'
];
//商品id
$where2
[
'group_id'
]
=
$groupS_v
[
'id'
];
//分仓id
//入库
$goods_group_info
=
$goods_group
->
where
(
$where2
)
->
field
(
'r_repe,j_price,repertory'
)
->
find
();
if
(
$goods_group_info
)
{
$goods_group_info
=
$goods_group
->
where
(
$where2
)
->
field
(
'r_repe,j_price,repertory'
)
->
find
();
if
(
$goods_group_info
)
{
//入库
$groupS
[
$groupS_key
][
'r_repe'
]
=
$goods_group_info
[
'r_repe'
];
//赋值入库数量
$groupS
[
$groupS_key
][
'j_price'
]
=
$goods_group_info
[
'j_price'
];
//赋值进货价
$groupS
[
$groupS_key
][
'z_price'
]
=
$goods_group_info
[
'r_repe'
]
*
$goods_group_info
[
'j_price'
];
//总金额
$groupS
[
$groupS_key
][
'r_repe'
]
=
$goods_group_info
[
'r_repe'
];
//赋值入库数量
$groupS
[
$groupS_key
][
'j_price'
]
=
$goods_group_info
[
'j_price'
];
//赋值进货价
$groupS
[
$groupS_key
][
'z_price'
]
=
$goods_group_info
[
'r_repe'
]
*
$goods_group_info
[
'j_price'
];
//总金额
//结存
$groupS
[
$groupS_key
][
'repertory'
]
=
$goods_group_info
[
'repertory'
];
//赋值剩余数量
$groupS
[
$groupS_key
][
'j_z_price'
]
=
$goods_group_info
[
'repertory'
]
*
$goods_group_info
[
'j_price'
];
//总金额
$groupS
[
$groupS_key
][
'repertory'
]
=
$goods_group_info
[
'repertory'
];
//赋值剩余数量
$groupS
[
$groupS_key
][
'j_z_price'
]
=
$goods_group_info
[
'repertory'
]
*
$goods_group_info
[
'j_price'
];
//总金额
//入库
$list
[
$key
][
'r_repe'
]
+=
$goods_group_info
[
'r_repe'
];
//计算入库总数量
$list
[
$key
][
'z_price'
]
+=
$groupS
[
$groupS_key
][
'z_price'
];
//计算总进货价
$list
[
$key
][
'r_repe'
]
+=
$goods_group_info
[
'r_repe'
];
//计算入库总数量
$list
[
$key
][
'z_price'
]
+=
$groupS
[
$groupS_key
][
'z_price'
];
//计算总进货价
//结存
$list
[
$key
][
'repertory'
]
+=
$goods_group_info
[
'repertory'
];
//计算总剩余数量
$list
[
$key
][
'j_z_price'
]
+=
$groupS
[
$groupS_key
][
'j_z_price'
];
//计算总进货价
}
else
{
$groupS
[
$groupS_key
][
'r_repe'
]
=
0
;
$groupS
[
$groupS_key
][
'j_price'
]
=
0
;
$groupS
[
$groupS_key
][
'z_price'
]
=
0
;
$list
[
$key
][
'repertory'
]
+=
$goods_group_info
[
'repertory'
];
//计算总剩余数量
$list
[
$key
][
'j_z_price'
]
+=
$groupS
[
$groupS_key
][
'j_z_price'
];
//计算总进货价
}
else
{
$groupS
[
$groupS_key
][
'r_repe'
]
=
0
;
$groupS
[
$groupS_key
][
'j_price'
]
=
0
;
$groupS
[
$groupS_key
][
'z_price'
]
=
0
;
}
//销量
$order_goods_info
=
$order_goods
->
where
(
$where2
)
->
field
(
'sum(g_sum) g_sum,g_price,sum(z_price) z_price'
)
->
find
();
if
(
$order_goods_info
)
{
$groupS
[
$groupS_key
][
'g_sum'
]
=
$order_goods_info
[
'g_sum'
];
//赋值销售数量
$groupS
[
$groupS_key
][
'g_price'
]
=
$order_goods_info
[
'g_price'
];
//赋值销售单价
$groupS
[
$groupS_key
][
'x_z_price'
]
=
$order_goods_info
[
'g_sum'
]
*
$order_goods_info
[
'g_price'
];
//总金额
$list
[
$key
][
'g_sum'
]
+=
$order_goods_info
[
'g_sum'
];
//计算销量商品数量
$list
[
$key
][
'x_z_price'
]
+=
$groupS
[
$groupS_key
][
'x_z_price'
];
//计算总进货价
}
else
{
$groupS
[
$groupS_key
][
'g_sum'
]
=
0
;
$groupS
[
$groupS_key
][
'g_price'
]
=
0
;
$groupS
[
$groupS_key
][
'z_price'
]
=
0
;
$order_goods_info
=
$order_goods
->
where
(
$where2
)
->
field
(
'sum(g_sum) g_sum,g_price,sum(z_price) z_price'
)
->
find
();
if
(
$order_goods_info
)
{
$groupS
[
$groupS_key
][
'g_sum'
]
=
$order_goods_info
[
'g_sum'
];
//赋值销售数量
$groupS
[
$groupS_key
][
'g_price'
]
=
$order_goods_info
[
'g_price'
];
//赋值销售单价
$groupS
[
$groupS_key
][
'x_z_price'
]
=
$order_goods_info
[
'g_sum'
]
*
$order_goods_info
[
'g_price'
];
//总金额
$list
[
$key
][
'g_sum'
]
+=
$order_goods_info
[
'g_sum'
];
//计算销量商品数量
$list
[
$key
][
'x_z_price'
]
+=
$groupS
[
$groupS_key
][
'x_z_price'
];
//计算总进货价
}
else
{
$groupS
[
$groupS_key
][
'g_sum'
]
=
0
;
$groupS
[
$groupS_key
][
'g_price'
]
=
0
;
$groupS
[
$groupS_key
][
'z_price'
]
=
0
;
}
//毛利
$groupS
[
$groupS_key
][
'maoLi'
]
=
(
$order_goods_info
[
'g_price'
]
-
$goods_group_info
[
'j_price'
])
*
$order_goods_info
[
'g_sum'
];
//计算毛利
$list
[
$key
][
'maoLi'
]
+=
$groupS
[
$groupS_key
][
'maoLi'
];
$groupS
[
$groupS_key
][
'maoLi'
]
=
(
$order_goods_info
[
'g_price'
]
-
$goods_group_info
[
'j_price'
])
*
$order_goods_info
[
'g_sum'
];
//计算毛利
$list
[
$key
][
'maoLi'
]
+=
$groupS
[
$groupS_key
][
'maoLi'
];
}
$cityS
[
$city_key
][
'group'
]
=
$groupS
;
$cityS
[
$city_key
][
'group_num'
]
=
count
(
$groupS
)
+
1
;
$list
[
$key
][
'city_num'
]
+=
count
(
$groupS
);
//计算前面需要合并多少行
$cityS
[
$city_key
][
'group'
]
=
$groupS
;
$cityS
[
$city_key
][
'group_num'
]
=
count
(
$groupS
)
+
1
;
$list
[
$key
][
'city_num'
]
+=
count
(
$groupS
);
//计算前面需要合并多少行
$list
[
$key
][
'city_num'
]
++
;
}
$list
[
$key
][
'city'
]
=
$cityS
;
$list
[
$key
][
'city'
]
=
$cityS
;
}
$this
->
meta_title
=
'商品统计'
;
$this
->
assign
(
'list'
,
$list
)
->
assign
(
'page'
,
$show
)
//发送分页
->
assign
(
'count'
,
$count
);
$this
->
meta_title
=
'商品统计'
;
$this
->
assign
(
'list'
,
$list
)
->
assign
(
'page'
,
$show
)
//发送分页
->
assign
(
'count'
,
$count
);
$this
->
display
();
}
//库存记录
public
function
repe
(){
$where
[
'group_id'
]
=
$this
->
group_id
;
$goods_group
=
M
(
'goodsGroup'
);
if
(
$_GET
[
'title'
]){
$where
[
'title'
]
=
array
(
'like'
,
'%'
.
I
(
'title'
)
.
'%'
);}
if
(
$_GET
[
'time-start'
]
&&
$_GET
[
'time-end'
]){
public
function
repe
()
{
$where
[
'group_id'
]
=
$this
->
group_id
;
$goods_group
=
M
(
'goodsGroup'
);
if
(
$_GET
[
'title'
])
{
$where
[
'title'
]
=
[
'like'
,
'%'
.
I
(
'title'
)
.
'%'
];
}
if
(
$_GET
[
'time-start'
]
&&
$_GET
[
'time-end'
])
{
//存在开始结束时间
$where_r
[
'time'
]
=
array
(
array
(
'EGT'
,
strtotime
(
I
(
'time-start'
))),
array
(
'ELT'
,
strtotime
(
I
(
'time-end'
))),
'and'
)
;
}
elseif
(
$_GET
[
'time-start'
]
&&!
$_GET
[
'time-end'
])
{
$where_r
[
'time'
]
=
[[
'EGT'
,
strtotime
(
I
(
'time-start'
))],
[
'ELT'
,
strtotime
(
I
(
'time-end'
))],
'and'
]
;
}
elseif
(
$_GET
[
'time-start'
]
&&
!
$_GET
[
'time-end'
])
{
//只存在开始时间
$where_r
[
'time'
]
=
array
(
'EGT'
,
strtotime
(
I
(
'time-start'
)))
;
}
elseif
(
!
$_GET
[
'time-start'
]
&&
$_GET
[
'time-end'
])
{
$where_r
[
'time'
]
=
[
'EGT'
,
strtotime
(
I
(
'time-start'
))]
;
}
elseif
(
!
$_GET
[
'time-start'
]
&&
$_GET
[
'time-end'
])
{
//只存在结束时间
$where_r
[
'time'
]
=
array
(
'ELT'
,
strtotime
(
I
(
'time-end'
)))
;
$where_r
[
'time'
]
=
[
'ELT'
,
strtotime
(
I
(
'time-end'
))]
;
}
$count
=
$goods_group
->
where
(
$where
)
->
join
(
'yi_goods on yi_goods_group.goods_id=yi_goods.id'
)
->
count
();
$page
=
new
\Think\Page
(
$count
,
10
);
$show
=
$page
->
show
();
$count
=
$goods_group
->
where
(
$where
)
->
join
(
'yi_goods on yi_goods_group.goods_id=yi_goods.id'
)
->
count
();
$page
=
new
\Think\Page
(
$count
,
10
);
$show
=
$page
->
show
();
//查询该分仓商品数据
$goods_list
=
$goods_group
->
where
(
$where
)
->
field
(
'id,title'
)
$goods_list
=
$goods_group
->
where
(
$where
)
->
field
(
'id,title'
)
->
join
(
'yi_goods on yi_goods_group.goods_id=yi_goods.id'
)
->
limit
(
$page
->
firstRow
.
','
.
$page
->
listRows
)
->
limit
(
$page
->
firstRow
.
','
.
$page
->
listRows
)
->
select
();
//查询该商品库存录入记录
$repe
=
M
(
'rRepe'
);
$where_r
[
'group_id'
]
=
$this
->
group_id
;
foreach
(
$goods_list
as
$key
=>
$v
)
{
$where_r
[
'goods_id'
]
=
$v
[
'id'
];
$rows
=
$repe
->
where
(
$where_r
)
->
field
(
'goods_num,goods_price,type,supplier,user_name,time'
)
->
select
();
$goods_list
[
$key
][
're'
]
=
$rows
;
if
(
count
(
$rows
))
{
$goods_list
[
$key
][
'num'
]
=
count
(
$rows
)
+
1
;
}
else
{
$goods_list
[
$key
][
'num'
]
=
2
;
//查询该商品库存录入记录
$repe
=
M
(
'rRepe'
);
$where_r
[
'group_id'
]
=
$this
->
group_id
;
foreach
(
$goods_list
as
$key
=>
$v
)
{
$where_r
[
'goods_id'
]
=
$v
[
'id'
];
$rows
=
$repe
->
where
(
$where_r
)
->
field
(
'goods_num,goods_price,type,supplier,user_name,time'
)
->
select
();
$goods_list
[
$key
][
're'
]
=
$rows
;
if
(
count
(
$rows
))
{
$goods_list
[
$key
][
'num'
]
=
count
(
$rows
)
+
1
;
}
else
{
$goods_list
[
$key
][
'num'
]
=
2
;
}
}
$this
->
meta_title
=
'库存记录'
;
$this
->
assign
(
'count'
,
$count
);
$this
->
assign
(
'page'
,
$show
);
$this
->
assign
(
'list'
,
$goods_list
);
$this
->
meta_title
=
'库存记录'
;
$this
->
assign
(
'count'
,
$count
);
$this
->
assign
(
'page'
,
$show
);
$this
->
assign
(
'list'
,
$goods_list
);
$this
->
display
();
}
//销售统计导出
public
function
SalesExcel
(){
$order
=
M
(
'order'
);
$where
[
'time'
]
=
array
(
'GT'
,
0
);
if
(
$_GET
[
'time_start'
]
!=
'undefined'
&&
$_GET
[
'time_end'
]
==
'undefined'
){
$where
[
'time'
]
=
array
(
'GT'
,
strtotime
(
$_GET
[
'time_start'
]));
//查询开始时间
}
elseif
(
$_GET
[
'time_end'
]
!=
'undefined'
&&
$_GET
[
'time_start'
]
==
'undefined'
){
$where
[
'time'
]
=
array
(
'LT'
,
strtotime
(
$_GET
[
'time_end'
]));
//查询结束时间
}
elseif
(
$_GET
[
'time_end'
]
!=
'undefined'
&&
$_GET
[
'time_start'
]
!=
'undefined'
){
//两个时间都查
$where
[
'time'
]
=
array
(
array
(
'GT'
,
strtotime
(
$_GET
[
'time_start'
])),
array
(
'LT'
,
strtotime
(
$_GET
[
'time_end'
])));
public
function
SalesExcel
()
{
$order
=
M
(
'order'
);
$where
[
'time'
]
=
[
'GT'
,
0
];
if
(
$_GET
[
'time_start'
]
!=
'undefined'
&&
$_GET
[
'time_end'
]
==
'undefined'
)
{
$where
[
'time'
]
=
[
'GT'
,
strtotime
(
$_GET
[
'time_start'
])];
//查询开始时间
}
elseif
(
$_GET
[
'time_end'
]
!=
'undefined'
&&
$_GET
[
'time_start'
]
==
'undefined'
)
{
$where
[
'time'
]
=
[
'LT'
,
strtotime
(
$_GET
[
'time_end'
])];
//查询结束时间
}
elseif
(
$_GET
[
'time_end'
]
!=
'undefined'
&&
$_GET
[
'time_start'
]
!=
'undefined'
)
{
//两个时间都查
$where
[
'time'
]
=
[[
'GT'
,
strtotime
(
$_GET
[
'time_start'
])],
[
'LT'
,
strtotime
(
$_GET
[
'time_end'
])]];
}
$list
=
$order
->
where
(
$where
)
->
field
(
'id,time'
)
->
select
();
if
(
$list
)
{
$list2
=
array
()
;
//申明一个空数组
foreach
(
$list
as
$key
=>
$v
)
{
//把时间进行分组
$d
=
date
(
'Y-m-d'
,
$v
[
'time'
]);
$list2
[
$d
][]
=
$v
;
$list
=
$order
->
where
(
$where
)
->
field
(
'id,time'
)
->
select
();
if
(
$list
)
{
$list2
=
[]
;
//申明一个空数组
foreach
(
$list
as
$key
=>
$v
)
{
//把时间进行分组
$d
=
date
(
'Y-m-d'
,
$v
[
'time'
]);
$list2
[
$d
][]
=
$v
;
}
$order_goods
=
M
(
'order_goods'
);
foreach
(
$list2
as
$key
=>
$vo
)
{
//循环天数
foreach
(
$vo
as
$k
=>
$v
)
{
$info
=
$order_goods
->
where
(
'order_id='
.
$v
[
'id'
]
.
' and group_id='
.
$this
->
group_id
)
$order_goods
=
M
(
'order_goods'
);
foreach
(
$list2
as
$key
=>
$vo
)
{
//循环天数
foreach
(
$vo
as
$k
=>
$v
)
{
$info
=
$order_goods
->
where
(
'order_id='
.
$v
[
'id'
]
.
' and group_id='
.
$this
->
group_id
)
->
field
(
'sum(s_price) s_price,sum(z_price) z_price,sum(cou_price) cou_price'
)
->
find
();
if
(
$info
[
's_price'
])
{
$list2
[
$key
][
$k
][
's_price'
]
=
$info
[
's_price'
];
$list2
[
$key
][
$k
][
'z_price'
]
=
$info
[
'z_price'
];
$list2
[
$key
][
$k
][
'cou_price'
]
=
$info
[
'cou_price'
];
}
else
{
if
(
$info
[
's_price'
])
{
$list2
[
$key
][
$k
][
's_price'
]
=
$info
[
's_price'
];
$list2
[
$key
][
$k
][
'z_price'
]
=
$info
[
'z_price'
];
$list2
[
$key
][
$k
][
'cou_price'
]
=
$info
[
'cou_price'
];
}
else
{
unset
(
$list2
[
$key
][
$k
]);
}
}
}
foreach
(
$list2
as
$key
=>
$vo
)
{
if
(
$list2
[
$key
])
{
$list_count
=
count
(
$list2
[
$key
]);
$list2
[
$key
][
'sum'
]
=
$list_count
;
//统计当天多少条
foreach
(
$vo
as
$k
=>
$v
)
{
$list2
[
$key
][
'time'
]
=
$key
;
$list2
[
$key
][
'z_price'
]
+=
$v
[
'z_price'
];
$list2
[
$key
][
'cou_price'
]
+=
$v
[
'cou_price'
];
$list2
[
$key
][
's_price'
]
+=
$v
[
's_price'
];
foreach
(
$list2
as
$key
=>
$vo
)
{
if
(
$list2
[
$key
])
{
$list_count
=
count
(
$list2
[
$key
]);
$list2
[
$key
][
'sum'
]
=
$list_count
;
//统计当天多少条
foreach
(
$vo
as
$k
=>
$v
)
{
$list2
[
$key
][
'time'
]
=
$key
;
$list2
[
$key
][
'z_price'
]
+=
$v
[
'z_price'
];
$list2
[
$key
][
'cou_price'
]
+=
$v
[
'cou_price'
];
$list2
[
$key
][
's_price'
]
+=
$v
[
's_price'
];
unset
(
$list2
[
$key
][
$k
]);
}
}
else
{
}
else
{
unset
(
$list2
[
$key
]);
}
}
//剔除掉没有数据的天数
$rows
=
array
()
;
foreach
(
$list2
as
$key
=>
$v
)
{
$rows
[
'sum'
]
+=
$v
[
'sum'
];
$rows
[
'z_price'
]
+=
$v
[
'z_price'
];
$rows
[
'cou_price'
]
+=
$v
[
'cou_price'
];
$rows
[
's_price'
]
+=
$v
[
's_price'
];
$rows
=
[]
;
foreach
(
$list2
as
$key
=>
$v
)
{
$rows
[
'sum'
]
+=
$v
[
'sum'
];
$rows
[
'z_price'
]
+=
$v
[
'z_price'
];
$rows
[
'cou_price'
]
+=
$v
[
'cou_price'
];
$rows
[
's_price'
]
+=
$v
[
's_price'
];
}
}
$rows
[
'list'
]
=
$list2
;
$rows
[
'list'
]
=
$list2
;
$objPHPExcel
=
new
\PHPExcel
();
$objPHPExcel
=
new
\PHPExcel
();
// $objPHPExcel->createSheet();//创建新的内置表;
$objPHPExcel
->
setActiveSheetIndex
(
0
);
//设置活动sheet
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
//获得当前活动sheet市
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
//获得当前活动sheet市
$objSheet
->
setTitle
(
'销售统计'
);
$objSheet
->
setCellValue
(
'A1'
,
'销售日期'
);
$objSheet
->
setCellValue
(
'B1'
,
'订单数量'
);
$objSheet
->
setCellValue
(
'C1'
,
'商品总价'
);
$objSheet
->
setCellValue
(
'D1'
,
'优惠金额'
);
$objSheet
->
setCellValue
(
'E1'
,
'实际金额'
);
$i
=
2
;
foreach
(
$list2
as
$key
=>
$v
)
{
$objSheet
->
setCellValue
(
'A'
.
$i
,
$v
[
'time'
]);
$objSheet
->
setCellValue
(
'B'
.
$i
,
$v
[
'sum'
]);
$objSheet
->
setCellValue
(
'C'
.
$i
,
$v
[
'z_price'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$v
[
'cou_price'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$v
[
's_price'
]);
$objSheet
->
setCellValue
(
'A1'
,
'销售日期'
);
$objSheet
->
setCellValue
(
'B1'
,
'订单数量'
);
$objSheet
->
setCellValue
(
'C1'
,
'商品总价'
);
$objSheet
->
setCellValue
(
'D1'
,
'优惠金额'
);
$objSheet
->
setCellValue
(
'E1'
,
'实际金额'
);
$i
=
2
;
foreach
(
$list2
as
$key
=>
$v
)
{
$objSheet
->
setCellValue
(
'A'
.
$i
,
$v
[
'time'
]);
$objSheet
->
setCellValue
(
'B'
.
$i
,
$v
[
'sum'
]);
$objSheet
->
setCellValue
(
'C'
.
$i
,
$v
[
'z_price'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$v
[
'cou_price'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$v
[
's_price'
]);
$i
++
;
}
// $objSheet->mergeCells('A'.$i.':G'.$i);//合并单元格
$objSheet
->
setCellValue
(
'A'
.
$i
,
'合计'
);
$objSheet
->
setCellValue
(
'B'
.
$i
,
$rows
[
'sum'
]);
$objSheet
->
setCellValue
(
'C'
.
$i
,
$rows
[
'z_price'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$rows
[
'cou_price'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$rows
[
's_price'
]);
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
//生成excel文件
$objSheet
->
setCellValue
(
'A'
.
$i
,
'合计'
);
$objSheet
->
setCellValue
(
'B'
.
$i
,
$rows
[
'sum'
]);
$objSheet
->
setCellValue
(
'C'
.
$i
,
$rows
[
'z_price'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$rows
[
'cou_price'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$rows
[
's_price'
]);
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
//生成excel文件
// $objWriter->save('./Public/Excel/Sales/'.date('Y-m-d',time()).'-'.substr(time(),'-4').'.xls');
$this
->
out
(
'销售统计'
.
date
(
'Y-m-d'
,
time
())
.
'-'
.
substr
(
time
(),
'-4'
));
//调用输出浏览器
$this
->
out
(
'销售统计'
.
date
(
'Y-m-d'
,
time
())
.
'-'
.
substr
(
time
(),
'-4'
));
//调用输出浏览器
$objWriter
->
save
(
'php://output'
);
//保存
}
//成本统计导出
public
function
CostExcel
(){
$order
=
M
(
'order'
);
$where
[
'yi_order.time'
]
=
array
(
'GT'
,
0
);
$time
=
date
(
'Y-m-d'
,
time
());
$where
[
'group_id'
]
=
$this
->
group_id
;
if
(
$_GET
[
'time_start'
]
!=
'undefined'
&&
$_GET
[
'time_end'
]
==
'undefined'
){
$where
[
'yi_order.time'
]
=
array
(
'GT'
,
strtotime
(
$_GET
[
'time_start'
]));
//查询开始时间
$time
=
$_GET
[
'time_start'
];
}
elseif
(
$_GET
[
'time_end'
]
!=
'undefined'
&&
$_GET
[
'time_start'
]
==
'undefined'
){
$where
[
'yi_order.time'
]
=
array
(
'LT'
,
strtotime
(
$_GET
[
'time_end'
]));
//查询结束时间
$time
=
$_GET
[
'time_end'
];
}
elseif
(
$_GET
[
'time_end'
]
!=
'undefined'
&&
$_GET
[
'time_start'
]
!=
'undefined'
){
//两个时间都查
$where
[
'yi_order.time'
]
=
array
(
array
(
'GT'
,
strtotime
(
$_GET
[
'time_start'
])),
array
(
'LT'
,
strtotime
(
$_GET
[
'time_end'
])));
$time
=
$_GET
[
'time_start'
]
/
$_GET
[
'time_end'
];
public
function
CostExcel
()
{
$order
=
M
(
'order'
);
$where
[
'yi_order.time'
]
=
[
'GT'
,
0
];
$time
=
date
(
'Y-m-d'
,
time
());
$where
[
'group_id'
]
=
$this
->
group_id
;
if
(
$_GET
[
'time_start'
]
!=
'undefined'
&&
$_GET
[
'time_end'
]
==
'undefined'
)
{
$where
[
'yi_order.time'
]
=
[
'GT'
,
strtotime
(
$_GET
[
'time_start'
])];
//查询开始时间
$time
=
$_GET
[
'time_start'
];
}
elseif
(
$_GET
[
'time_end'
]
!=
'undefined'
&&
$_GET
[
'time_start'
]
==
'undefined'
)
{
$where
[
'yi_order.time'
]
=
[
'LT'
,
strtotime
(
$_GET
[
'time_end'
])];
//查询结束时间
$time
=
$_GET
[
'time_end'
];
}
elseif
(
$_GET
[
'time_end'
]
!=
'undefined'
&&
$_GET
[
'time_start'
]
!=
'undefined'
)
{
//两个时间都查
$where
[
'yi_order.time'
]
=
[[
'GT'
,
strtotime
(
$_GET
[
'time_start'
])],
[
'LT'
,
strtotime
(
$_GET
[
'time_end'
])]];
$time
=
$_GET
[
'time_start'
]
/
$_GET
[
'time_end'
];
}
$list
=
$order
->
field
(
'title,goods_model,order_num,goods_id,sum(g_sum) g_sum,sum(cou_sum) cou_sum,g_price'
)
$list
=
$order
->
field
(
'title,goods_model,order_num,goods_id,sum(g_sum) g_sum,sum(cou_sum) cou_sum,g_price'
)
->
where
(
$where
)
->
group
(
'goods_id'
)
->
join
(
'yi_order_goods og on yi_order.id=og.order_id'
)
->
join
(
'yi_goods on og.goods_id=yi_goods.id'
)
->
select
();
if
(
$list
)
{
//计算所有商品
$rows
[
'list'
]
=
$list
;
foreach
(
$list
as
$key
=>
$v
)
{
$rows
[
'g_sum'
]
+=
$v
[
'g_sum'
];
$rows
[
'cou_sum'
]
+=
$v
[
'cou_sum'
];
if
(
$list
)
{
//计算所有商品
$rows
[
'list'
]
=
$list
;
foreach
(
$list
as
$key
=>
$v
)
{
$rows
[
'g_sum'
]
+=
$v
[
'g_sum'
];
$rows
[
'cou_sum'
]
+=
$v
[
'cou_sum'
];
}
}
$objPHPExcel
=
new
\PHPExcel
();
$objPHPExcel
=
new
\PHPExcel
();
$objPHPExcel
->
setActiveSheetIndex
(
0
);
//设置活动sheet
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
//获得当前活动sheet市
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
//获得当前活动sheet市
$objSheet
->
setTitle
(
'成本统计'
);
$objSheet
->
setCellValue
(
'A1'
,
'商品名称'
);
$objSheet
->
setCellValue
(
'B1'
,
'商品型号'
);
$objSheet
->
setCellValue
(
'C1'
,
'单品价格'
);
$objSheet
->
setCellValue
(
'D1'
,
'商品销量'
);
$objSheet
->
setCellValue
(
'E1'
,
'赠送数量'
);
$i
=
2
;
foreach
(
$list
as
$key
=>
$v
)
{
$objSheet
->
setCellValue
(
'A'
.
$i
,
msubstr
(
$v
[
'title'
],
0
,
10
));
$objSheet
->
setCellValue
(
'B'
.
$i
,
$v
[
'goods_model'
]);
$objSheet
->
setCellValue
(
'C'
.
$i
,
$v
[
'g_price'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$v
[
'g_sum'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$v
[
'cou_sum'
]);
$objSheet
->
setCellValue
(
'A1'
,
'商品名称'
);
$objSheet
->
setCellValue
(
'B1'
,
'商品型号'
);
$objSheet
->
setCellValue
(
'C1'
,
'单品价格'
);
$objSheet
->
setCellValue
(
'D1'
,
'商品销量'
);
$objSheet
->
setCellValue
(
'E1'
,
'赠送数量'
);
$i
=
2
;
foreach
(
$list
as
$key
=>
$v
)
{
$objSheet
->
setCellValue
(
'A'
.
$i
,
msubstr
(
$v
[
'title'
],
0
,
10
));
$objSheet
->
setCellValue
(
'B'
.
$i
,
$v
[
'goods_model'
]);
$objSheet
->
setCellValue
(
'C'
.
$i
,
$v
[
'g_price'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$v
[
'g_sum'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$v
[
'cou_sum'
]);
$i
++
;
}
$objSheet
->
setCellValue
(
'A'
.
$i
,
'统计时间:'
.
$time
);
$objSheet
->
setCellValue
(
'C'
.
$i
,
'合计:'
);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$rows
[
'g_sum'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$rows
[
'cou_sum'
]);
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
//生成excel文件
$this
->
out
(
'成本统计'
.
date
(
'Y-m-d'
,
time
())
.
'-'
.
substr
(
time
(),
'-4'
));
//调用输出浏览器
$objSheet
->
setCellValue
(
'A'
.
$i
,
'统计时间:'
.
$time
);
$objSheet
->
setCellValue
(
'C'
.
$i
,
'合计:'
);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$rows
[
'g_sum'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$rows
[
'cou_sum'
]);
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
//生成excel文件
$this
->
out
(
'成本统计'
.
date
(
'Y-m-d'
,
time
())
.
'-'
.
substr
(
time
(),
'-4'
));
//调用输出浏览器
$objWriter
->
save
(
'php://output'
);
//保存
}
//商品统计导出
public
function
GoodsExcel
(){
$goods
=
M
(
'goods'
);
$logo
=
M
(
'logo'
);
//循环查询品牌
$gPrice
=
M
(
'gPrice'
);
//循环查询城市
$authGroup
=
M
(
'authGroup'
);
//循环查询分仓
$goods_group
=
M
(
'goodsGroup'
);
//查询分仓商品
$order_goods
=
M
(
'orderGoods'
);
//查询销量
public
function
GoodsExcel
()
{
$goods
=
M
(
'goods'
);
$logo
=
M
(
'logo'
);
//循环查询品牌
$gPrice
=
M
(
'gPrice'
);
//循环查询城市
$authGroup
=
M
(
'authGroup'
);
//循环查询分仓
$goods_group
=
M
(
'goodsGroup'
);
//查询分仓商品
$order_goods
=
M
(
'orderGoods'
);
//查询销量
//查询该分仓信息:所属城市
$group_info
=
$authGroup
->
where
(
'id='
.
$this
->
group_id
)
->
field
(
'group_city'
)
->
find
();
$group_info
=
$authGroup
->
where
(
'id='
.
$this
->
group_id
)
->
field
(
'group_city'
)
->
find
();
//商品标题和型号查询
if
(
isset
(
$_GET
[
'title'
]))
{
if
(
isset
(
$_GET
[
'title'
]))
{
if
(
preg_match
(
"/[
\x7f
-
\xff
]/"
,
$_GET
[
'title'
]))
{
//判断是否含有中文
$where_goods
[
'yi_goods.title'
]
=
array
(
'like'
,
'%'
.
$_GET
[
'title'
]
.
'%'
)
;
}
else
{
$where_goods
[
'goods_model'
]
=
array
(
'like'
,
'%'
.
$_GET
[
'title'
]
.
'%'
)
;
$where_goods
[
'yi_goods.title'
]
=
[
'like'
,
'%'
.
$_GET
[
'title'
]
.
'%'
]
;
}
else
{
$where_goods
[
'goods_model'
]
=
[
'like'
,
'%'
.
$_GET
[
'title'
]
.
'%'
]
;
}
}
else
{
$where_goods
[
'goods_model'
]
=
array
(
'like'
,
'%%'
)
;
}
else
{
$where_goods
[
'goods_model'
]
=
[
'like'
,
'%%'
]
;
}
//商品品牌筛选
if
(
isset
(
$_GET
[
'logo'
]))
{
$where_logo
[
'title'
]
=
array
(
'like'
,
'%'
.
$_GET
[
'logo'
]
.
'%'
)
;
$logo_like
=
$logo
->
where
(
$where_logo
)
->
field
(
'id'
)
->
find
();
if
(
$logo_like
)
{
$where_goods
[
'logo'
]
=
$logo_like
[
'id'
];
}
else
{
$where_goods
[
'logo'
]
=
'a'
;
if
(
isset
(
$_GET
[
'logo'
]))
{
$where_logo
[
'title'
]
=
[
'like'
,
'%'
.
$_GET
[
'logo'
]
.
'%'
]
;
$logo_like
=
$logo
->
where
(
$where_logo
)
->
field
(
'id'
)
->
find
();
if
(
$logo_like
)
{
$where_goods
[
'logo'
]
=
$logo_like
[
'id'
];
}
else
{
$where_goods
[
'logo'
]
=
'a'
;
}
}
$where_goods
[
'group_id'
]
=
$this
->
group_id
;
//查询对应分仓的商品
$list
=
$goods
->
where
(
$where_goods
)
$where_goods
[
'group_id'
]
=
$this
->
group_id
;
//查询对应分仓的商品
$list
=
$goods
->
where
(
$where_goods
)
->
field
(
'yi_goods.id,yi_goods.title,goods_model,logo,stan,unit,s1.sort_name s1_name,s2.sort_name s2_name,s3.sort_name s3_name'
)
->
join
(
'yi_sort s1 on yi_goods.sort1=s1.id'
)
->
join
(
'yi_sort s2 on yi_goods.sort2=s2.id'
)
->
join
(
'yi_sort s3 on yi_goods.sort3=s3.id'
)
->
join
(
'yi_goods_group on yi_goods.id=yi_goods_group.goods_id'
)
->
select
();
foreach
(
$list
as
$key
=>
$v
)
{
$list
[
$key
][
'r_repe'
]
=
0
;
//初始化入库总数量
$list
[
$key
][
'j_repe'
]
=
0
;
//初始化进货价
$list
[
$key
][
'z_price'
]
=
0
;
//初始化入库总金额
$list
[
$key
][
'g_sum'
]
=
0
;
//初始化销售商品总数量
foreach
(
$list
as
$key
=>
$v
)
{
$list
[
$key
][
'r_repe'
]
=
0
;
//初始化入库总数量
$list
[
$key
][
'j_repe'
]
=
0
;
//初始化进货价
$list
[
$key
][
'z_price'
]
=
0
;
//初始化入库总金额
$list
[
$key
][
'g_sum'
]
=
0
;
//初始化销售商品总数量
//循环查询品牌
$logoS
=
$logo
->
where
(
'id='
.
$v
[
'logo'
])
->
field
(
'title'
)
->
find
();
$list
[
$key
][
'logo'
]
=
$logoS
[
'title'
];
$logoS
=
$logo
->
where
(
'id='
.
$v
[
'logo'
])
->
field
(
'title'
)
->
find
();
$list
[
$key
][
'logo'
]
=
$logoS
[
'title'
];
//循环查询城市
$where_city
[
'goods_id'
]
=
$v
[
'id'
];
$where_city
[
'city_id'
]
=
$group_info
[
'group_city'
];
//只查询该城市的分仓
if
(
isset
(
$_GET
[
'city'
])){
$where_city
[
'city_name'
]
=
array
(
'like'
,
'%'
.
$_GET
[
'city'
]
.
'%'
);}
$cityS
=
$gPrice
->
where
(
$where_city
)
->
field
(
'city_id,city_name'
)
->
join
(
'yi_dredge on yi_g_price.city_id=yi_dredge.id'
)
->
select
();
$list
[
$key
][
'city_num'
]
=
2
;
//初始化合并行
$where_city
[
'goods_id'
]
=
$v
[
'id'
];
$where_city
[
'city_id'
]
=
$group_info
[
'group_city'
];
//只查询该城市的分仓
if
(
isset
(
$_GET
[
'city'
]))
{
$where_city
[
'city_name'
]
=
[
'like'
,
'%'
.
$_GET
[
'city'
]
.
'%'
];
}
$cityS
=
$gPrice
->
where
(
$where_city
)
->
field
(
'city_id,city_name'
)
->
join
(
'yi_dredge on yi_g_price.city_id=yi_dredge.id'
)
->
select
();
$list
[
$key
][
'city_num'
]
=
2
;
//初始化合并行
//循环查询分仓
foreach
(
$cityS
as
$city_key
=>
$city_v
)
{
$where
[
'id'
]
=
$this
->
group_id
;
//只查询该分仓信息
$where
[
'group_city'
]
=
$city_v
[
'city_id'
];
$where
[
'title'
]
=
array
(
array
(
'NEQ'
,
'平台管理员'
),
array
(
'like'
,
'%'
.
$_GET
[
'group'
]
.
'%'
),
'and'
)
;
//剔除平台管理员分组
$groupS
=
$authGroup
->
where
(
$where
)
->
field
(
'id,title'
)
->
select
();
foreach
(
$cityS
as
$city_key
=>
$city_v
)
{
$where
[
'id'
]
=
$this
->
group_id
;
//只查询该分仓信息
$where
[
'group_city'
]
=
$city_v
[
'city_id'
];
$where
[
'title'
]
=
[[
'NEQ'
,
'平台管理员'
],
[
'like'
,
'%'
.
$_GET
[
'group'
]
.
'%'
],
'and'
]
;
//剔除平台管理员分组
$groupS
=
$authGroup
->
where
(
$where
)
->
field
(
'id,title'
)
->
select
();
//查询分仓商品信息
foreach
(
$groupS
as
$groupS_key
=>
$groupS_v
)
{
$where2
[
'goods_id'
]
=
$v
[
'id'
];
//商品id
$where2
[
'group_id'
]
=
$groupS_v
[
'id'
];
//分仓id
foreach
(
$groupS
as
$groupS_key
=>
$groupS_v
)
{
$where2
[
'goods_id'
]
=
$v
[
'id'
];
//商品id
$where2
[
'group_id'
]
=
$groupS_v
[
'id'
];
//分仓id
//入库
$goods_group_info
=
$goods_group
->
where
(
$where2
)
->
field
(
'r_repe,j_price,repertory'
)
->
find
();
if
(
$goods_group_info
)
{
$goods_group_info
=
$goods_group
->
where
(
$where2
)
->
field
(
'r_repe,j_price,repertory'
)
->
find
();
if
(
$goods_group_info
)
{
//入库
$groupS
[
$groupS_key
][
'r_repe'
]
=
$goods_group_info
[
'r_repe'
];
//赋值入库数量
$groupS
[
$groupS_key
][
'j_price'
]
=
$goods_group_info
[
'j_price'
];
//赋值进货价
$groupS
[
$groupS_key
][
'z_price'
]
=
$goods_group_info
[
'r_repe'
]
*
$goods_group_info
[
'j_price'
];
//总金额
$groupS
[
$groupS_key
][
'r_repe'
]
=
$goods_group_info
[
'r_repe'
];
//赋值入库数量
$groupS
[
$groupS_key
][
'j_price'
]
=
$goods_group_info
[
'j_price'
];
//赋值进货价
$groupS
[
$groupS_key
][
'z_price'
]
=
$goods_group_info
[
'r_repe'
]
*
$goods_group_info
[
'j_price'
];
//总金额
//结存
$groupS
[
$groupS_key
][
'repertory'
]
=
$goods_group_info
[
'repertory'
];
//赋值剩余数量
$groupS
[
$groupS_key
][
'j_z_price'
]
=
$goods_group_info
[
'repertory'
]
*
$goods_group_info
[
'j_price'
];
//总金额
$groupS
[
$groupS_key
][
'repertory'
]
=
$goods_group_info
[
'repertory'
];
//赋值剩余数量
$groupS
[
$groupS_key
][
'j_z_price'
]
=
$goods_group_info
[
'repertory'
]
*
$goods_group_info
[
'j_price'
];
//总金额
//入库
$list
[
$key
][
'r_repe'
]
+=
$goods_group_info
[
'r_repe'
];
//计算入库总数量
$list
[
$key
][
'z_price'
]
+=
$groupS
[
$groupS_key
][
'z_price'
];
//计算总进货价
$list
[
$key
][
'r_repe'
]
+=
$goods_group_info
[
'r_repe'
];
//计算入库总数量
$list
[
$key
][
'z_price'
]
+=
$groupS
[
$groupS_key
][
'z_price'
];
//计算总进货价
//结存
$list
[
$key
][
'repertory'
]
+=
$goods_group_info
[
'repertory'
];
//计算总剩余数量
$list
[
$key
][
'j_z_price'
]
+=
$groupS
[
$groupS_key
][
'j_z_price'
];
//计算总进货价
}
else
{
$groupS
[
$groupS_key
][
'r_repe'
]
=
0
;
$groupS
[
$groupS_key
][
'j_price'
]
=
0
;
$groupS
[
$groupS_key
][
'z_price'
]
=
0
;
$list
[
$key
][
'repertory'
]
+=
$goods_group_info
[
'repertory'
];
//计算总剩余数量
$list
[
$key
][
'j_z_price'
]
+=
$groupS
[
$groupS_key
][
'j_z_price'
];
//计算总进货价
}
else
{
$groupS
[
$groupS_key
][
'r_repe'
]
=
0
;
$groupS
[
$groupS_key
][
'j_price'
]
=
0
;
$groupS
[
$groupS_key
][
'z_price'
]
=
0
;
}
//销量
$order_goods_info
=
$order_goods
->
where
(
$where2
)
->
field
(
'sum(g_sum) g_sum,g_price,sum(z_price) z_price'
)
->
find
();
if
(
$order_goods_info
)
{
$groupS
[
$groupS_key
][
'g_sum'
]
=
$order_goods_info
[
'g_sum'
];
//赋值销售数量
$groupS
[
$groupS_key
][
'g_price'
]
=
$order_goods_info
[
'g_price'
];
//赋值销售单价
$groupS
[
$groupS_key
][
'x_z_price'
]
=
$order_goods_info
[
'g_sum'
]
*
$order_goods_info
[
'g_price'
];
//总金额
$list
[
$key
][
'g_sum'
]
+=
$order_goods_info
[
'g_sum'
];
//计算销量商品数量
$list
[
$key
][
'x_z_price'
]
+=
$groupS
[
$groupS_key
][
'x_z_price'
];
//计算总进货价
}
else
{
$groupS
[
$groupS_key
][
'g_sum'
]
=
0
;
$groupS
[
$groupS_key
][
'g_price'
]
=
0
;
$groupS
[
$groupS_key
][
'z_price'
]
=
0
;
$order_goods_info
=
$order_goods
->
where
(
$where2
)
->
field
(
'sum(g_sum) g_sum,g_price,sum(z_price) z_price'
)
->
find
();
if
(
$order_goods_info
)
{
$groupS
[
$groupS_key
][
'g_sum'
]
=
$order_goods_info
[
'g_sum'
];
//赋值销售数量
$groupS
[
$groupS_key
][
'g_price'
]
=
$order_goods_info
[
'g_price'
];
//赋值销售单价
$groupS
[
$groupS_key
][
'x_z_price'
]
=
$order_goods_info
[
'g_sum'
]
*
$order_goods_info
[
'g_price'
];
//总金额
$list
[
$key
][
'g_sum'
]
+=
$order_goods_info
[
'g_sum'
];
//计算销量商品数量
$list
[
$key
][
'x_z_price'
]
+=
$groupS
[
$groupS_key
][
'x_z_price'
];
//计算总进货价
}
else
{
$groupS
[
$groupS_key
][
'g_sum'
]
=
0
;
$groupS
[
$groupS_key
][
'g_price'
]
=
0
;
$groupS
[
$groupS_key
][
'z_price'
]
=
0
;
}
//毛利
$groupS
[
$groupS_key
][
'maoLi'
]
=
(
$order_goods_info
[
'g_price'
]
-
$goods_group_info
[
'j_price'
])
*
$order_goods_info
[
'g_sum'
];
//计算毛利
$list
[
$key
][
'maoLi'
]
+=
$groupS
[
$groupS_key
][
'maoLi'
];
$groupS
[
$groupS_key
][
'maoLi'
]
=
(
$order_goods_info
[
'g_price'
]
-
$goods_group_info
[
'j_price'
])
*
$order_goods_info
[
'g_sum'
];
//计算毛利
$list
[
$key
][
'maoLi'
]
+=
$groupS
[
$groupS_key
][
'maoLi'
];
}
$cityS
[
$city_key
][
'group'
]
=
$groupS
;
$cityS
[
$city_key
][
'group_num'
]
=
count
(
$groupS
)
+
1
;
$list
[
$key
][
'city_num'
]
+=
count
(
$groupS
);
//计算前面需要合并多少行
$cityS
[
$city_key
][
'group'
]
=
$groupS
;
$cityS
[
$city_key
][
'group_num'
]
=
count
(
$groupS
)
+
1
;
$list
[
$key
][
'city_num'
]
+=
count
(
$groupS
);
//计算前面需要合并多少行
$list
[
$key
][
'city_num'
]
++
;
}
$list
[
$key
][
'city'
]
=
$cityS
;
$list
[
$key
][
'city'
]
=
$cityS
;
}
$objPHPExcel
=
new
\PHPExcel
();
$objPHPExcel
=
new
\PHPExcel
();
$objPHPExcel
->
setActiveSheetIndex
(
0
);
//设置活动sheet
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
//获得当前活动sheet市
$objSheet
->
getDefaultStyle
()
->
getAlignment
()
->
setHorizontal
(
\PHPExcel_Style_Alignment
::
HORIZONTAL_CENTER
)
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
//获得当前活动sheet市
$objSheet
->
getDefaultStyle
()
->
getAlignment
()
->
setHorizontal
(
\PHPExcel_Style_Alignment
::
HORIZONTAL_CENTER
)
->
setVertical
(
\PHPExcel_Style_Alignment
::
VERTICAL_CENTER
);
//设置文字居中
$objSheet
->
getDefaultStyle
()
->
getAlignment
()
->
setWrapText
(
true
);
//设置自动换行
$objSheet
->
setTitle
(
'商品统计'
);
//导航栏
$objSheet
->
setCellValue
(
'A1'
,
'商品'
);
$objSheet
->
setCellValue
(
'A1'
,
'商品'
);
$objSheet
->
mergeCells
(
'A1:A2'
);
//合并单元格
$objSheet
->
setCellValue
(
'B1'
,
'编号'
);
$objSheet
->
setCellValue
(
'B1'
,
'编号'
);
$objSheet
->
mergeCells
(
'B1:B2'
);
//合并单元格
$objSheet
->
setCellValue
(
'C1'
,
'品牌'
);
$objSheet
->
setCellValue
(
'C1'
,
'品牌'
);
$objSheet
->
mergeCells
(
'C1:C2'
);
//合并单元格
$objSheet
->
setCellValue
(
'D1'
,
'属性'
);
$objSheet
->
setCellValue
(
'D1'
,
'属性'
);
$objSheet
->
mergeCells
(
'D1:D2'
);
//合并单元格
$objSheet
->
setCellValue
(
'E1'
,
'单位'
);
$objSheet
->
setCellValue
(
'E1'
,
'单位'
);
$objSheet
->
mergeCells
(
'E1:E2'
);
//合并单元格
$objSheet
->
setCellValue
(
'F1'
,
'商品分类'
);
$objSheet
->
setCellValue
(
'F1'
,
'商品分类'
);
$objSheet
->
mergeCells
(
'F1:F2'
);
//合并单元格
$objSheet
->
setCellValue
(
'G1'
,
'城市'
);
$objSheet
->
setCellValue
(
'G1'
,
'城市'
);
$objSheet
->
mergeCells
(
'G1:G2'
);
//合并单元格
$objSheet
->
setCellValue
(
'H1'
,
'分仓'
);
$objSheet
->
setCellValue
(
'H1'
,
'分仓'
);
$objSheet
->
mergeCells
(
'H1:H2'
);
//合并单元格
$objSheet
->
setCellValue
(
'I1'
,
'入库'
);
//入库
$objSheet
->
setCellValue
(
'I1'
,
'入库'
);
//入库
$objSheet
->
mergeCells
(
'I1:K1'
);
//合并单元格
$objSheet
->
setCellValue
(
'I2'
,
'数量'
);
$objSheet
->
setCellValue
(
'J2'
,
'单价'
);
$objSheet
->
setCellValue
(
'K2'
,
'单价'
);
$objSheet
->
setCellValue
(
'L1'
,
'销售'
);
//销售
$objSheet
->
setCellValue
(
'I2'
,
'数量'
);
$objSheet
->
setCellValue
(
'J2'
,
'单价'
);
$objSheet
->
setCellValue
(
'K2'
,
'单价'
);
$objSheet
->
setCellValue
(
'L1'
,
'销售'
);
//销售
$objSheet
->
mergeCells
(
'L1:N1'
);
//合并单元格
$objSheet
->
setCellValue
(
'L2'
,
'数量'
);
$objSheet
->
setCellValue
(
'M2'
,
'单价'
);
$objSheet
->
setCellValue
(
'N2'
,
'单价'
);
$objSheet
->
setCellValue
(
'O1'
,
'结存'
);
//结存
$objSheet
->
setCellValue
(
'L2'
,
'数量'
);
$objSheet
->
setCellValue
(
'M2'
,
'单价'
);
$objSheet
->
setCellValue
(
'N2'
,
'单价'
);
$objSheet
->
setCellValue
(
'O1'
,
'结存'
);
//结存
$objSheet
->
mergeCells
(
'O1:Q1'
);
//合并单元格
$objSheet
->
setCellValue
(
'O2'
,
'数量'
);
$objSheet
->
setCellValue
(
'P2'
,
'单价'
);
$objSheet
->
setCellValue
(
'Q2'
,
'单价'
);
$objSheet
->
setCellValue
(
'R1'
,
'毛利'
);
//结存
$objSheet
->
setCellValue
(
'O2'
,
'数量'
);
$objSheet
->
setCellValue
(
'P2'
,
'单价'
);
$objSheet
->
setCellValue
(
'Q2'
,
'单价'
);
$objSheet
->
setCellValue
(
'R1'
,
'毛利'
);
//结存
$objSheet
->
mergeCells
(
'R1:R2'
);
//合并单元格
$objSheet
->
getColumnDimension
(
'A'
)
->
setWidth
(
20
);
//设置单元格宽度
$objSheet
->
getColumnDimension
(
'D'
)
->
setWidth
(
10
);
...
...
@@ -603,163 +660,169 @@ class GroupStatiController extends AdminController
$objSheet
->
getColumnDimension
(
'G'
)
->
setWidth
(
20
);
$objSheet
->
getColumnDimension
(
'H'
)
->
setWidth
(
20
);
//内容
$i
=
3
;
//设置初始从3行开始
foreach
(
$list
as
$key
=>
$v
)
{
$i
=
3
;
//设置初始从3行开始
foreach
(
$list
as
$key
=>
$v
)
{
//填充商品数据
$objSheet
->
setCellValue
(
'A'
.
$i
,
$v
[
'title'
]);
$objSheet
->
setCellValue
(
'B'
.
$i
,
empty
(
$v
[
'goods_model'
])
?
'空'
:
$v
[
'goods_model'
]);
$objSheet
->
setCellValue
(
'C'
.
$i
,
empty
(
$v
[
'logo'
])
?
'空'
:
$v
[
'logo'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
empty
(
$v
[
'stan'
])
?
'空'
:
$v
[
'stan'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
empty
(
$v
[
'unit'
])
?
'空'
:
$v
[
'unit'
]);
$objSheet
->
setCellValue
(
'F'
.
$i
,
$v
[
's1_name'
]
.
'-'
.
$v
[
's2_name'
]
.
'-'
.
$v
[
's3_name'
]);
$objSheet
->
setCellValue
(
'A'
.
$i
,
$v
[
'title'
]);
$objSheet
->
setCellValue
(
'B'
.
$i
,
empty
(
$v
[
'goods_model'
])
?
'空'
:
$v
[
'goods_model'
]);
$objSheet
->
setCellValue
(
'C'
.
$i
,
empty
(
$v
[
'logo'
])
?
'空'
:
$v
[
'logo'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
empty
(
$v
[
'stan'
])
?
'空'
:
$v
[
'stan'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
empty
(
$v
[
'unit'
])
?
'空'
:
$v
[
'unit'
]);
$objSheet
->
setCellValue
(
'F'
.
$i
,
$v
[
's1_name'
]
.
'-'
.
$v
[
's2_name'
]
.
'-'
.
$v
[
's3_name'
]);
//循环城市
$group_num_z
=
0
;
foreach
(
$v
[
'city'
]
as
$city_key
=>
$city_v
)
{
$group_num
=
0
;
foreach
(
$city_v
[
'group'
]
as
$group_key
=>
$group_v
)
{
$group_num_z
=
0
;
foreach
(
$v
[
'city'
]
as
$city_key
=>
$city_v
)
{
$group_num
=
0
;
foreach
(
$city_v
[
'group'
]
as
$group_key
=>
$group_v
)
{
$group_num
++
;
//计算分仓数量
}
$group_num_z
+=
$group_num
;
$group_num_z
+=
$group_num
;
//分仓大于1 的进行合并行
if
(
$group_num_z
>
1
)
{
if
(
$group_num_z
==
$group_num
)
{
$objSheet
->
mergeCells
(
'G'
.
$i
.
':G'
.
(
$i
+
(
$group_num
-
1
)));
}
else
{
$objSheet
->
mergeCells
(
'G'
.
(
$i
+
(
$group_num_z
-
$group_num
))
.
':G'
.
(
$i
+
(
$group_num_z
-
1
)));
if
(
$group_num_z
>
1
)
{
if
(
$group_num_z
==
$group_num
)
{
$objSheet
->
mergeCells
(
'G'
.
$i
.
':G'
.
(
$i
+
(
$group_num
-
1
)));
}
else
{
$objSheet
->
mergeCells
(
'G'
.
(
$i
+
(
$group_num_z
-
$group_num
))
.
':G'
.
(
$i
+
(
$group_num_z
-
1
)));
}
}
}
//计算商品需合并多少行
if
(
$group_num_z
>
0
)
{
$objSheet
->
mergeCells
(
'A'
.
$i
.
':A'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'B'
.
$i
.
':B'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'C'
.
$i
.
':C'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'D'
.
$i
.
':D'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'E'
.
$i
.
':E'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'F'
.
$i
.
':F'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'G'
.
$i
.
':G'
.
(
$i
+
$group_num_z
));
if
(
$group_num_z
>
0
)
{
$objSheet
->
mergeCells
(
'A'
.
$i
.
':A'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'B'
.
$i
.
':B'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'C'
.
$i
.
':C'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'D'
.
$i
.
':D'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'E'
.
$i
.
':E'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'F'
.
$i
.
':F'
.
(
$i
+
$group_num_z
));
$objSheet
->
mergeCells
(
'G'
.
$i
.
':G'
.
(
$i
+
$group_num_z
));
}
foreach
(
$v
[
'city'
]
as
$city_key
=>
$city_v
)
{
foreach
(
$v
[
'city'
]
as
$city_key
=>
$city_v
)
{
//循环填充城市
$objSheet
->
setCellValue
(
'G'
.
$i
,
$city_v
[
'city_name'
]);
$objSheet
->
setCellValue
(
'G'
.
$i
,
$city_v
[
'city_name'
]);
//循环填充仓库
foreach
(
$city_v
[
'group'
]
as
$group_key
=>
$group_v
)
{
$objSheet
->
setCellValue
(
'H'
.
$i
,
$group_v
[
'title'
]);
$objSheet
->
setCellValue
(
'I'
.
$i
,
$group_v
[
'r_repe'
]);
$objSheet
->
setCellValue
(
'J'
.
$i
,
$group_v
[
'j_price'
]);
$objSheet
->
setCellValue
(
'K'
.
$i
,
$group_v
[
'z_price'
]);
$objSheet
->
setCellValue
(
'L'
.
$i
,
$group_v
[
'g_sum'
]);
$objSheet
->
setCellValue
(
'M'
.
$i
,
$group_v
[
'g_price'
]);
$objSheet
->
setCellValue
(
'N'
.
$i
,
$group_v
[
'x_z_price'
]);
$objSheet
->
setCellValue
(
'O'
.
$i
,
$group_v
[
'repertory'
]);
$objSheet
->
setCellValue
(
'P'
.
$i
,
$group_v
[
'j_price'
]);
$objSheet
->
setCellValue
(
'Q'
.
$i
,
$group_v
[
'j_z_price'
]);
$objSheet
->
setCellValue
(
'R'
.
$i
,
$group_v
[
'maoLi'
]);
foreach
(
$city_v
[
'group'
]
as
$group_key
=>
$group_v
)
{
$objSheet
->
setCellValue
(
'H'
.
$i
,
$group_v
[
'title'
]);
$objSheet
->
setCellValue
(
'I'
.
$i
,
$group_v
[
'r_repe'
]);
$objSheet
->
setCellValue
(
'J'
.
$i
,
$group_v
[
'j_price'
]);
$objSheet
->
setCellValue
(
'K'
.
$i
,
$group_v
[
'z_price'
]);
$objSheet
->
setCellValue
(
'L'
.
$i
,
$group_v
[
'g_sum'
]);
$objSheet
->
setCellValue
(
'M'
.
$i
,
$group_v
[
'g_price'
]);
$objSheet
->
setCellValue
(
'N'
.
$i
,
$group_v
[
'x_z_price'
]);
$objSheet
->
setCellValue
(
'O'
.
$i
,
$group_v
[
'repertory'
]);
$objSheet
->
setCellValue
(
'P'
.
$i
,
$group_v
[
'j_price'
]);
$objSheet
->
setCellValue
(
'Q'
.
$i
,
$group_v
[
'j_z_price'
]);
$objSheet
->
setCellValue
(
'R'
.
$i
,
$group_v
[
'maoLi'
]);
$i
++
;
}
}
$objSheet
->
setCellValue
(
'H'
.
$i
,
'总计'
);
// $objSheet->mergeCells('G'.$i.':H'.$i);
$objSheet
->
setCellValue
(
'I'
.
$i
,
$v
[
'r_repe'
]);
$objSheet
->
setCellValue
(
'J'
.
$i
,
' '
);
$objSheet
->
setCellValue
(
'K'
.
$i
,
$v
[
'z_price'
]);
$objSheet
->
setCellValue
(
'L'
.
$i
,
$v
[
'g_sum'
]);
$objSheet
->
setCellValue
(
'M'
.
$i
,
' '
);
$objSheet
->
setCellValue
(
'N'
.
$i
,
$v
[
'x_z_price'
]);
$objSheet
->
setCellValue
(
'O'
.
$i
,
$v
[
'repertory'
]);
$objSheet
->
setCellValue
(
'P'
.
$i
,
' '
);
$objSheet
->
setCellValue
(
'Q'
.
$i
,
$v
[
'j_z_price'
]);
$objSheet
->
setCellValue
(
'R'
.
$i
,
$v
[
'maoLi'
]);
$objSheet
->
setCellValue
(
'H'
.
$i
,
'总计'
);
// $objSheet->mergeCells('G'.$i.':H'.$i);
$objSheet
->
setCellValue
(
'I'
.
$i
,
$v
[
'r_repe'
]);
$objSheet
->
setCellValue
(
'J'
.
$i
,
' '
);
$objSheet
->
setCellValue
(
'K'
.
$i
,
$v
[
'z_price'
]);
$objSheet
->
setCellValue
(
'L'
.
$i
,
$v
[
'g_sum'
]);
$objSheet
->
setCellValue
(
'M'
.
$i
,
' '
);
$objSheet
->
setCellValue
(
'N'
.
$i
,
$v
[
'x_z_price'
]);
$objSheet
->
setCellValue
(
'O'
.
$i
,
$v
[
'repertory'
]);
$objSheet
->
setCellValue
(
'P'
.
$i
,
' '
);
$objSheet
->
setCellValue
(
'Q'
.
$i
,
$v
[
'j_z_price'
]);
$objSheet
->
setCellValue
(
'R'
.
$i
,
$v
[
'maoLi'
]);
$i
++
;
$objSheet
->
mergeCells
(
'A'
.
$i
.
':R'
.
$i
);
$objSheet
->
mergeCells
(
'A'
.
$i
.
':R'
.
$i
);
$i
++
;
}
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
//生成excel文件
$this
->
out
(
'商品统计'
.
date
(
'Y-m-d'
,
time
())
.
'-'
.
substr
(
time
(),
'-4'
));
//调用输出浏览器
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
//生成excel文件
$this
->
out
(
'商品统计'
.
date
(
'Y-m-d'
,
time
())
.
'-'
.
substr
(
time
(),
'-4'
));
//调用输出浏览器
$objWriter
->
save
(
'php://output'
);
//保存
}
//库存记录导出
public
function
RepeExcel
(){
$where
[
'group_id'
]
=
$this
->
group_id
;
$goods_group
=
M
(
'goodsGroup'
);
if
(
$_GET
[
'title'
]){
$where
[
'title'
]
=
array
(
'like'
,
'%'
.
I
(
'title'
)
.
'%'
);}
if
(
$_GET
[
'time-start'
]
&&
$_GET
[
'time-end'
]){
public
function
RepeExcel
()
{
$where
[
'group_id'
]
=
$this
->
group_id
;
$goods_group
=
M
(
'goodsGroup'
);
if
(
$_GET
[
'title'
])
{
$where
[
'title'
]
=
[
'like'
,
'%'
.
I
(
'title'
)
.
'%'
];
}
if
(
$_GET
[
'time-start'
]
&&
$_GET
[
'time-end'
])
{
//存在开始结束时间
$where_r
[
'time'
]
=
array
(
array
(
'EGT'
,
strtotime
(
I
(
'time-start'
))),
array
(
'ELT'
,
strtotime
(
I
(
'time-end'
))),
'and'
)
;
}
elseif
(
$_GET
[
'time-start'
]
&&!
$_GET
[
'time-end'
])
{
$where_r
[
'time'
]
=
[[
'EGT'
,
strtotime
(
I
(
'time-start'
))],
[
'ELT'
,
strtotime
(
I
(
'time-end'
))],
'and'
]
;
}
elseif
(
$_GET
[
'time-start'
]
&&
!
$_GET
[
'time-end'
])
{
//只存在开始时间
$where_r
[
'time'
]
=
array
(
'EGT'
,
strtotime
(
I
(
'time-start'
)))
;
}
elseif
(
!
$_GET
[
'time-start'
]
&&
$_GET
[
'time-end'
])
{
$where_r
[
'time'
]
=
[
'EGT'
,
strtotime
(
I
(
'time-start'
))]
;
}
elseif
(
!
$_GET
[
'time-start'
]
&&
$_GET
[
'time-end'
])
{
//只存在结束时间
$where_r
[
'time'
]
=
array
(
'ELT'
,
strtotime
(
I
(
'time-end'
)))
;
$where_r
[
'time'
]
=
[
'ELT'
,
strtotime
(
I
(
'time-end'
))]
;
}
//查询该分仓商品数据
$list
=
$goods_group
->
where
(
$where
)
->
field
(
'id,title'
)
->
join
(
'yi_goods on yi_goods_group.goods_id=yi_goods.id'
)
->
select
();
$list
=
$goods_group
->
where
(
$where
)
->
field
(
'id,title'
)
->
join
(
'yi_goods on yi_goods_group.goods_id=yi_goods.id'
)
->
select
();
//查询该商品库存录入记录
$repe
=
M
(
'rRepe'
);
$where_r
[
'group_id'
]
=
$this
->
group_id
;
foreach
(
$list
as
$key
=>
$v
)
{
$where_r
[
'goods_id'
]
=
$v
[
'id'
];
$rows
=
$repe
->
where
(
$where_r
)
->
field
(
'goods_num,goods_price,type,supplier,user_name,time'
)
->
select
();
$list
[
$key
][
're'
]
=
$rows
;
$list
[
$key
][
'num'
]
=
count
(
$rows
);
$repe
=
M
(
'rRepe'
);
$where_r
[
'group_id'
]
=
$this
->
group_id
;
foreach
(
$list
as
$key
=>
$v
)
{
$where_r
[
'goods_id'
]
=
$v
[
'id'
];
$rows
=
$repe
->
where
(
$where_r
)
->
field
(
'goods_num,goods_price,type,supplier,user_name,time'
)
->
select
();
$list
[
$key
][
're'
]
=
$rows
;
$list
[
$key
][
'num'
]
=
count
(
$rows
);
}
$objPHPExcel
=
new
\PHPExcel
();
$objPHPExcel
=
new
\PHPExcel
();
$objPHPExcel
->
setActiveSheetIndex
(
0
);
//设置活动sheet
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
//获得当前活动sheet市
$objSheet
->
getDefaultStyle
()
->
getAlignment
()
->
setHorizontal
(
\PHPExcel_Style_Alignment
::
HORIZONTAL_CENTER
)
$objSheet
=
$objPHPExcel
->
getActiveSheet
();
//获得当前活动sheet市
$objSheet
->
getDefaultStyle
()
->
getAlignment
()
->
setHorizontal
(
\PHPExcel_Style_Alignment
::
HORIZONTAL_CENTER
)
->
setVertical
(
\PHPExcel_Style_Alignment
::
VERTICAL_CENTER
);
//设置文字居中
$objSheet
->
getDefaultStyle
()
->
getAlignment
()
->
setWrapText
(
true
);
//设置自动换行
$objSheet
->
setTitle
(
'库存录入记录'
);
//导航栏
$objSheet
->
setCellValue
(
'A1'
,
'商品'
);
$objSheet
->
setCellValue
(
'B1'
,
'数量'
);
$objSheet
->
setCellValue
(
'C1'
,
'价格'
);
$objSheet
->
setCellValue
(
'D1'
,
'供应商'
);
$objSheet
->
setCellValue
(
'E1'
,
'操作人'
);
$objSheet
->
setCellValue
(
'F1'
,
'操作时间'
);
$objSheet
->
setCellValue
(
'A1'
,
'商品'
);
$objSheet
->
setCellValue
(
'B1'
,
'数量'
);
$objSheet
->
setCellValue
(
'C1'
,
'价格'
);
$objSheet
->
setCellValue
(
'D1'
,
'供应商'
);
$objSheet
->
setCellValue
(
'E1'
,
'操作人'
);
$objSheet
->
setCellValue
(
'F1'
,
'操作时间'
);
$objSheet
->
getColumnDimension
(
'A'
)
->
setWidth
(
30
);
$objSheet
->
getColumnDimension
(
'F'
)
->
setWidth
(
20
);
//内容
$i
=
2
;
//设置初始从3行开始
foreach
(
$list
as
$key
=>
$v
)
{
$objSheet
->
setCellValue
(
'A'
.
$i
,
$v
[
'title'
]);
if
(
$v
[
'num'
])
{
$objSheet
->
mergeCells
(
'A'
.
$i
.
':A'
.
(
$i
+
$v
[
'num'
]
-
1
));
foreach
(
$v
[
're'
]
as
$k
=>
$v0
)
{
if
(
$v0
[
'type'
]
==
1
)
{
$num
=
'+'
.
$v0
[
'goods_num'
];
}
else
{
$num
=
'-'
.
$v0
[
'goods_num'
];
$i
=
2
;
//设置初始从3行开始
foreach
(
$list
as
$key
=>
$v
)
{
$objSheet
->
setCellValue
(
'A'
.
$i
,
$v
[
'title'
]);
if
(
$v
[
'num'
])
{
$objSheet
->
mergeCells
(
'A'
.
$i
.
':A'
.
(
$i
+
$v
[
'num'
]
-
1
));
foreach
(
$v
[
're'
]
as
$k
=>
$v0
)
{
if
(
$v0
[
'type'
]
==
1
)
{
$num
=
'+'
.
$v0
[
'goods_num'
];
}
else
{
$num
=
'-'
.
$v0
[
'goods_num'
];
}
$objSheet
->
setCellValue
(
'B'
.
$i
,
$num
);
$objSheet
->
setCellValue
(
'C'
.
$i
,
$v0
[
'goods_price'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$v0
[
'supplier'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$v0
[
'user_name'
]);
$time
=
date
(
'Y-m-d H:i'
,
$v0
[
'time'
]);
$objSheet
->
setCellValue
(
'F'
.
$i
,
$time
);
$objSheet
->
setCellValue
(
'B'
.
$i
,
$num
);
$objSheet
->
setCellValue
(
'C'
.
$i
,
$v0
[
'goods_price'
]);
$objSheet
->
setCellValue
(
'D'
.
$i
,
$v0
[
'supplier'
]);
$objSheet
->
setCellValue
(
'E'
.
$i
,
$v0
[
'user_name'
]);
$time
=
date
(
'Y-m-d H:i'
,
$v0
[
'time'
]);
$objSheet
->
setCellValue
(
'F'
.
$i
,
$time
);
$i
++
;
}
}
else
{
$objSheet
->
setCellValue
(
'B'
.
$i
,
'~~~暂无记录'
);
$objSheet
->
mergeCells
(
'B'
.
$i
.
':F'
.
$i
);
}
else
{
$objSheet
->
setCellValue
(
'B'
.
$i
,
'~~~暂无记录'
);
$objSheet
->
mergeCells
(
'B'
.
$i
.
':F'
.
$i
);
$i
++
;
}
}
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
//生成excel文件
$this
->
out
(
'库存录入记录'
.
date
(
'Y-m-d'
,
time
())
.
'-'
.
substr
(
time
(),
'-4'
));
//调用输出浏览器
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
//生成excel文件
$this
->
out
(
'库存录入记录'
.
date
(
'Y-m-d'
,
time
())
.
'-'
.
substr
(
time
(),
'-4'
));
//调用输出浏览器
$objWriter
->
save
(
'php://output'
);
//保存
}
//输出到浏览器
private
function
out
(
$name
){
private
function
out
(
$name
)
{
header
(
'Content-Type: application/vnd.ms-excel'
);
header
(
'Content-Disposition: attachment;filename="'
.
$name
.
'.xls"'
);
header
(
'Content-Disposition: attachment;filename="'
.
$name
.
'.xls"'
);
header
(
'Cache-Control: max-age=0'
);
}
}
\ No newline at end of file
}
Application/Admin/View/GroupStati/sales.html
View file @
60f2be24
...
...
@@ -33,27 +33,39 @@
<th
class=
""
>
销售日期
</th>
<th
class=
""
>
订单条数
</th>
<th
class=
""
>
商品总价
</th>
<th
class=
""
>
优惠金额
</th>
<th
class=
""
>
实际金额
</th>
<th
class=
""
>
待发货
</th>
<th
class=
""
>
待收货
</th>
<th
class=
""
>
退换货
</th>
<th
class=
""
>
已完成
</th>
<th
class=
""
>
销售总额
</th>
<th
class=
""
>
赠送金额
</th>
</tr>
</thead>
<tbody>
<notempty
name=
"rows.list"
>
<volist
name=
"rows.list"
id=
"vo"
>
<tr>
<td>
{$vo.t
ime
}
</td>
<td>
{$vo.t}
</td>
<td>
{$vo.sum}(条)
</td>
<td>
{$vo.z_price} ¥
</td>
<td>
{$vo.cou_price} ¥
</td>
<td>
{$vo.send_price} ¥
</td>
<td>
{$vo.give_price} ¥
</td>
<td>
{$vo.rollback_price} ¥
</td>
<td>
{$vo.complete_price} ¥
</td>
<td>
{$vo.s_price} ¥
</td>
<td>
{$vo.y_price} ¥
</td>
</tr>
</volist>
<tr
style=
"background: #bce8f1;"
>
<td>
合计:
</td>
<td>
{$rows.sum}(条)
</td>
<td>
{$rows.z_price} ¥
</td>
<td>
{$rows.cou_price} ¥
</td>
<td>
{$rows.send_price} ¥
</td>
<td>
{$rows.give_price} ¥
</td>
<td>
{$rows.rollback_price} ¥
</td>
<td>
{$rows.complete_price} ¥
</td>
<td>
{$rows.s_price} ¥
</td>
<td>
{$rows.y_price} ¥
</td>
</tr>
<else/>
<td
colspan=
"9"
class=
"text-center"
>
aOh! 暂时还没有内容!
</td>
...
...
@@ -126,4 +138,4 @@
}
</script>
</block>
\ No newline at end of file
</block>
Application/Admin/View/Public/base.html
View file @
60f2be24
...
...
@@ -121,7 +121,7 @@
if
(
data
>
0
){
$
(
'#order'
).
show
();
playSound
();
$
(
'#order'
).
html
(
"<a href='
http://yhctvip.com
/Admin/GroupOrder/index.html'>亲!您有新订单,请尽快处理。("
+
data
+
")</a>"
);
$
(
'#order'
).
html
(
"<a href='/Admin/GroupOrder/index.html'>亲!您有新订单,请尽快处理。("
+
data
+
")</a>"
);
}
else
{
$
(
'#order'
).
hide
();
}
...
...
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