创建版本

This commit is contained in:
2021-02-22 12:17:00 +08:00
commit af555f49c3
2332 changed files with 369202 additions and 0 deletions
@@ -0,0 +1,187 @@
<div class="panel">
<div class="wrapper-sm b-b b-light">
<form class="form-inline" id="myquery" name="myquery" action="{{url()}}" method="get">
<div class="pull-right">
<a class="btn btn-default btn-sm" onclick="LocalTableExport('report_category', '品类销售');"><i class="fa fa-mail-forward"></i> 导出</a>
</div>
@if(Auth::user()->role->code != 'c001')
@include('report/select')
@endif
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i> 搜索</button>
</form>
</div>
<script src="{{$asset_url}}/vendor/highcharts/highcharts.min.js" type="text/javascript"></script>
<script type="text/javascript">
var data = {{$json}};
$(function() {
Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function(color) {
return {
radialGradient: {cx:0.9,cy:0.9,r: 0.9},
stops: [
[0, color],
[1, Highcharts.Color(color).brighten(-0.1).get('rgb')] // darken
]
};
});
$.each(data.pie,function(year)
{
var piediv = "<div id='container_pie_"+year+"' style='height:300px;'></div>";
var columndiv = "<div id='container_column_"+year+"' style='height:300px;'></div>";
$('#container_pie').append(piediv);
$('#container_column').append(columndiv);
pie(year);
column(year);
});
});
function pie(year)
{
$('#container_pie_'+year).highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: year+'年品类构成分析(金额)'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.y}¥</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
}
}
},
series: [{
type: 'pie',
name: '金额',
data: data.pie[year]
}]
});
}
function column(year)
{
$('#container_column_'+year).highcharts({
chart: {
type: 'column'
},
title: {
text: year+'年品类销售额柱体分析(金额)'
},
xAxis: {
categories: data.column.categories
},
yAxis: {
allowDecimals: false,
min: 0,
title: {
text: '类别'
}
},
tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>'+
this.series.name +': '+ this.y +'<br/>'+
'合计: '+ this.point.stackTotal;
}
},
plotOptions: {
column: {
stacking: 'normal'
}
},
series:data.column.series[year]
});
}
</script>
<table class="table table-bordered" id="report_category">
<tr>
<th align="center" style="width:100px;">品类编码</th>
<th align="left">品类名称</th>
<th align="right">本年度销售累计金额</th>
<th align="right">去年同期销售累计金额</th>
<th align="right">去年同期占比(%)</th>
</tr>
@foreach($product_categorys as $k => $category)
@if($category['level'] > 1 && $category['level'] < 10)
<?php $v = $percentData[$now_year][$k]; ?>
@if($product_categorys[$k]['code'])
<tr>
<td align="center">
{{$product_categorys[$k]['code']}}
</td>
<td align="left">
@if($product_categorys[$k]['level'] > 2)
&nbsp;&nbsp;&nbsp;&nbsp;
@endif
{{$product_categorys[$k]['name']}}
</td>
<td align="right">
@if($select['role'] == 'client')
{{number_format($v / $percentData['sum'][$now_year] * 100, 2)}}%
@else
{{number_format($v, 2)}}
@endif
</td>
<td align="right">
@if($select['role'] == 'client')
{{number_format($percentData[$last_year][$k] / $percentData['sum'][$last_year] * 100, 2)}}%
@else
{{number_format($percentData[$last_year][$k], 2)}}
@endif
</td>
<td align="right">
@if($percentage[$k] > 0)
{{$percentage[$k]}}%
@else
0%
@endif
</td>
</tr>
@endif
@endif
@endforeach
<tr>
<td align="left"></td>
<td align="left">同期年度累计金额</td>
<td align="right">{{number_format($percentData['sum'][$now_year],2)}}</td>
<td align="right">{{number_format($percentData['sum'][$last_year],2)}}</td>
<td align="right">{{number_format($percentage['total'],2)}}%</td>
</tr>
</table>
</div>
<div class="panel">
<table class="table">
<tr>
<td id="container_pie"></td>
</tr>
</table>
</div>
<div class="panel">
<table class="table">
<tr>
<td id="container_column"></td>
</tr>
</table>
</div>
+133
View File
@@ -0,0 +1,133 @@
<div class="panel">
<div class="wrapper-sm">
<form class="form-inline" id="myquery" name="myquery" action="{{url()}}" method="get">
<div class="pull-right">
<a class="btn btn-default btn-sm" onclick="LocalTableExport('report_export', '地区品类销售');"><i class="fa fa-mail-forward"></i> 导出</a>
</div>
@if(Auth::user()->role->code != 'c001')
@include('report/select')
@endif
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i> 筛选</button>
</form>
</div>
<div class="table-responsive">
<table class="table table-bordered" id="report_export">
<tr>
<th style="white-space:nowrap">
销售团队
</th>
@foreach($categorys as $k => $v)
@if($v['parent_id'] == 226)
<th nowrap="true">{{$v['name']}}</th>
@endif
@endforeach
<th>总销售额</th>
<th>促销费比</th>
<th>消费促销</th>
<th>渠道促销</th>
<th>经销促销</th>
</tr>
@foreach($now_year_single['money'] as $key => $value)
<tr>
<td rowspan="3" align="center" style="white-space:nowrap;vertical-align:middle;">
{{$regions[$key]}}
<a class="option" href="{{url('citydata')}}?circle_id={{$key}}&year={{$now_year}}">
[月销]
</a>
</td>
@foreach($categorys as $k => $v)
@if($v['parent_id'] == 226)
<td align="right">
{{(int)$value[$k]}}
</td>
@endif
@endforeach
<td style="vertical-align:middle;" align="right">{{$now_year_single['totalcost'][$key]}}</td>
<td rowspan="3" style="vertical-align:middle;" align="center">
@if($promotions['all'][$key])
{{:$c = ($promotions['all'][$key]/$now_year_single['totalcost'][$key])}}
{{number_format($c*100, 2)}}%
@else
0.00%
@endif
</td>
{{:$ps = $promotions[$key]}}
<td rowspan="3" style="vertical-align:middle;" align="right">
{{$ps[1] > 0 ? $ps[1] : 0}}
</td>
<td rowspan="3" style="vertical-align:middle;" align="right">
{{$ps[2] > 0 ? $ps[2] : 0}}
</td>
<td rowspan="3" style="vertical-align:middle;" align="right">
{{$ps[3] > 0 ? $ps[3] : 0}}
</td>
</tr>
<tr>
@foreach($categorys as $category_id => $category)
@if($category['parent_id'] == 226)
<td align="right" title="去年同期增长率" nowrap="true">
<?php $scale = $oldscale[$key][$category_id]; ?>
@if($scale == 0)
去年无
@elseif($scale > 0)
<span style="color:green">{{number_format($scale * 100, 2)}}%</span>
@else
<span style="color:red">{{number_format($scale * 100, 2)}}%</span>
@endif
</td>
@endif
@endforeach
<?php
$_year = $now_year_single['totalcost'][$key] - $old_year_single['totalcost'][$key];
if ($old_year_single['totalcost'][$key]) {
$_total = number_format($_year / $old_year_single['totalcost'][$key] * 100, 2);
} else {
$_total = 0;
}
?>
<td style="vertical-align:middle;" align="right">
@if($_total > 0)
{{$_total}}%
@else
<span style="color:red">{{$_total}}%</span>
@endif
</td>
</tr>
<tr>
@foreach($categorys as $k => $v)
@if($v['parent_id'] == 226)
<td align="right" title="占区域该品类百分比">
@if($value[$v['id']] > 0)
{{number_format(($value[$v['id']] / $now_year_single['cat'][$v['id']]) * 100, 2)}}%
@endif
</td>
@endif
@endforeach
<td style="vertical-align:middle;" align="right"></td>
</tr>
@endforeach
</table>
</div>
</div>
@@ -0,0 +1,77 @@
<div class="panel">
<table class="table">
<tr>
<td><div class='title'>{{$year}} ({{$circle['name']}}) 客户圈月份销售分析</div></td>
</tr>
</table>
</div>
<div class="panel">
<table class="table table-bordered">
<tr>
<th>月份</th>
@if(count($categorys)) @foreach($categorys as $k => $v)
<th>{{$k}}</th>
@endforeach @endif
<th>总销售额</th>
<th>促销费比</th>
<th>消费促销</th>
<th>渠道促销</th>
<th>经销促销</th>
@if(count($single['money'])) @foreach($single['money'] as $key => $value)
<tr>
<td rowspan="2" width="40" align="center" style="vertical-align:middle;color:#66CC00;font-weight:bold;background:#FFFFE9">{{$key}}</td>
@if(count($categorys)) @foreach($categorys as $k => $v)
<td align="right">
{{$value[$v] > 0 ? $value[$v] : 0}}
</td>
@endforeach @endif
<td rowspan="2" align="right" style="vertical-align:middle;color:#666;background:#FFFFE9">{{$single['cat'][$key]}}</td>
<td rowspan="2" style="vertical-align:middle;" align="right">
@if($single['cat'][$key])
{{:$c = ($promotions['month1'][$key]/$single['cat'][$key])}}
{{number_format($c*100, 2)}}%
@else
0.00%
@endif
</td>
{{:$promotion = $promotions['month'][$key]}}
<td rowspan="2" style="vertical-align:middle;" align="right">
{{$promotion[1] > 0 ? $promotion[1] : 0}}
</td>
<td rowspan="2" style="vertical-align:middle;" align="right">
{{$promotion[2] > 0 ? $promotion[2] : 0}}
</td>
<td rowspan="2" style="vertical-align:middle;" align="right">
{{$promotion[3] > 0 ? $promotion[3] : 0}}
</td>
</tr>
<tr>
@if(count($categorys)) @foreach($categorys as $k => $v)
<td align="right">
{{:$pl = $value[$v]/$single['cat'][$key]}}
{{$_pl = number_format($pl*100, 2)}}%
</td>
@endforeach @endif
</tr>
@endforeach @endif
</table>
</div>
@@ -0,0 +1,63 @@
<div class="panel">
<div class="wrapper-sm b-b b-light">
<div class="text-md">{{$year_id}}年度发生交易客户数[{{count((array)$single['customer'])}}]</div>
</div>
<div class="wrapper-sm b-b b-light">
<form class="form-inline" id="myquery" name="myquery" action="{{url()}}" method="get">
<div class="pull-right">
<a class="btn btn-default btn-sm" onclick="LocalTableExport('report_export', '客户单品交易');"><i class="fa fa-mail-forward"></i> 导出</a>
</div>
@if(Auth::user()->role->code != 'c001')
@include('report/select')
&nbsp;
@endif
<select class="form-control input-sm" id='year' name='year' data-toggle="redirect" data-url="{{$query}}">
@foreach($years as $v)
<option value="{{$v}}" @if($select['query']['year']==$v) selected @endif>{{$v}}</option>
@endforeach
</select>
&nbsp;
<select class="form-control input-sm" id='category_id' name='category_id' data-toggle="redirect" data-url="{{$query}}">
<option value="0">全部品类</option>
@foreach($categorys as $k => $v)
@if($v['layer_level'] == 1)
<option value="{{$v['id']}}" @if($select['query']['category_id'] == $v['id']) selected @endif>{{$v['name']}}</option>
@endif
@endforeach
</select>
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i> 搜索</button>
</form>
</div>
<table class="table table-bordered" id="report_export">
<tr>
<th>品类</th>
<th>单品</th>
<th>总销售家数</th>
@foreach($months as $k => $v)
<th>{{$v}}</th>
@endforeach
@foreach($single['sum'] as $k => $v)
<tr>
<td align="center">{{$single['category'][$k]}}</td>
<td align="left"><a href="{{url('clientdata')}}?aspect_id={{$select['select']['aspect_id']}}&region_id={{$select['select']['region_id']}}&circle_id={{$select['select']['circle_id']}}&client_id={{$select['select']['client_id']}}&product_id={{$k}}&year={{$year}}">[]</a> {{$single['product'][$k]['product_name']}} - {{$single['product'][$k]['product_spec']}}</td>
<td align="right">{{sizeof($single['all'][$k])}}</td>
@foreach($months as $v2)
<td align="right">
{{:$sum = sizeof($v[$v2])}}
@if($sum>0) {{$sum}} @else <span style="color:#ccc;">0</span> @endif
</td>
@endforeach
</tr>
@endforeach
</table>
</div>
@@ -0,0 +1,65 @@
<div class="panel">
<div class="wrapper b-b b-light">
<div class='h5'>{{$single['cat']}} * ({{$single['name']}} - {{$single['spec']}}) - {{$year}}年度({{$month}})未进货经销商列表</div>
</div>
<table class="table">
<tr>
<th width="40">序号</th>
<th width="100">区域</th>
<th width="100">客户圈</th>
<th width="280">客户名称</th>
<th align="left">单品</th>
</tr>
@if(count($clients))
<?php $i = 0; ?>
@foreach($clients as $key => $value)
@if(empty($notpurchase[$key]))
<tr>
<td align="center">{{$i + 1}}</td>
<td align="center">{{$value['area']}}</td>
<td align="center">{{$value['circle_name']}}</td>
<td align="left">{{$value['client_id']}}</td>
<td align="left">{{$single['name']}} - {{$single['spec']}}</td>
</tr>
@endif
<?php $i++; ?>
@endforeach
@endif
</table>
</div>
<div class="panel">
<div class="wrapper b-b b-light">
<div class='h5'>{{$single['cat']}} * ({{$single['name']}} - {{$single['spec']}}) - {{$year}}度年经销商销售分析</div>
</div>
<table class="table">
<tr>
<th width="40">序号</th>
<th width="100">区域</th>
<th width="100">客户圈</th>
<th width="280">客户名称</th>
<th align="left">单品</th>
<th width="100">金额</th>
</tr>
<?php $i = 0; ?>
@if(count($single['all']))
@foreach($single['all'] as $key => $value)
<tr>
<td align="center">{{$i + 1}}</td>
<td align="center">{{$clients[$key]['area']}}</td>
<td align="center">{{$clients[$key]['circle_name']}}</td>
<td align="left">{{$clients[$key]['client_id']}}</td>
<td align="left">{{$single['name']}} - {{$single['spec']}}</td>
<td align="right">{{$value}}</td>
</tr>
<?php $i++; ?>
@endforeach
@endif
</table>
</div>
+128
View File
@@ -0,0 +1,128 @@
<div class="panel">
<div class="wrapper-sm b-b b-light">
<form class="form-inline" id="myquery" name="myquery" action="{{url()}}" method="get">
@if(Auth::user()->role->code != 'c001')
@include('report/select')
@endif
<select class="form-control input-sm" id='category_id' name='category_id' data-toggle="redirect" data-url="{{$query}}">
@foreach($product_categorys as $k => $v)
<option value="{{$v['id']}}" @if($select['query']['category_id'] == $v['id']) selected @endif>{{$v['layer_space']}}{{$v['name']}}</option>
@endforeach
</select>
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i> 筛选</button>
</form>
</div>
<script src="{{$asset_url}}/vendor/highcharts/highcharts.min.js" type="text/javascript"></script>
<script type="text/javascript">
var data = {{$json}};
$(function () {
$('#container').highcharts({
title: {
text: '历史年度销售分析',
x: -20 //center
},
subtitle: {
text: 'Historical Annual Sales Analysis',
x: -20
},
xAxis: {
categories: data.categories
},
yAxis: {
title: {
text: '销售汇总'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '¥'
},
legend: {
//layout: 'vertical',
//align: 'right',
//verticalAlign: 'middle',
//borderWidth: 0,
useHTML:true,
labelFormatter: function() {
return this.name + '<br/><span style="font-size:10px;color:#666666;">合计: '+ data.total[this.name] +'¥</span>';
//return '<div class="' + this.name + '-arrow"></div><span style="font-family: \'Advent Pro\', sans-serif; font-size:16px">' + this.name +'</span><br/><span style="font-size:10px; color:#ababaa">(合计: 12345)</span>';
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
//enableMouseTracking: false
}
},
total: data.total,
series: data.series
});
});
</script>
<table class="table">
<tr>
<td>
<div id="container" style="height:320px"></div>
</td>
</tr>
</table>
</div>
@if(Auth::user()->role->code != 'c001')
<div class="panel">
<table class="table">
<tr height="24">
<th align="center">本年促销计算费比(占比)</th>
<th align="center">消费促销(金额)</th>
<th align="center">渠道促销(金额)</th>
<th align="center">经营促销(金额)</th>
<th align="center">本年批复促销已兑现金额</th>
</tr>
<tr height="24">
<td align="center">{{$assess}}</td>
<td align="center">{{number_format($promotion['cat'][1],2)}}</td>
<td align="center">{{number_format($promotion['cat'][2],2)}}</td>
<td align="center">{{number_format($promotion['cat'][3],2)}}</td>
<td align="center">{{number_format($promotion_honor, 2)}}</td>
</tr>
</table>
</div>
<!--
<div class="panel">
<table class="table">
<tr height="24">
@foreach($product_categorys as $category)
@if($category['parent_id'] == 0)
<th align="center">{{$category['name']}}</th>
@endif
@endforeach
</tr>
<tr height="24">
@foreach($product_categorys as $category)
@if($category['parent_id']==0)
<td align="center">{{$cat_salesdata_ret[$category['id']]}}</td>
@endif
@endforeach
</tr>
</table>
</div>
-->
@endif
@@ -0,0 +1,52 @@
<div class="panel">
<div class="wrapper-sm b-b b-light">
<form class="form-inline" id="myquery" name="myquery" action="{{url()}}" method="get">
<div class="pull-right">
<a class="btn btn-default btn-sm" onclick="LocalTableExport('report_newclient', '本年新客户');"><i class="fa fa-mail-forward"></i> 导出</a>
</div>
@if(Auth::user()->role->code != 'c001')
@include('report/select')
@endif
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i> 筛选</button>
</form>
</div>
<table class="table table-bordered" id="report_newclient">
<tr>
<th align="center" width="100">序号</th>
<th align="center">客户编码</th>
<th align="left">客户名称</th>
<th align="center" width="120">客户类型</th>
<th align="center" width="120">发货金额</th>
</tr>
<?php $total_sum_money = 0; $i = 1; ?>
@foreach($list[$nowYear] as $k => $v)
<?php
$customer = $customers[$k];
$money_sum = $list[$nowYear][$k];
?>
@if(empty($list[$lastYear][$k]))
<tr>
<td align="center">{{$i}}</td>
<td align="center">{{$customer['customer_code']}}</td>
<td align="left">{{$customer['customer_name']}}</td>
<td align="center">{{$customer_type[$customer['grade_id']]['name']}}</td>
<td align="right">@number($money_sum, 2)</td>
</tr>
<?php $total_sum_money += $money_sum; $i++; ?>
@endif
@endforeach
<tr>
<th align="center">合计</th>
<th align="left"></th>
<th align="left"></th>
<th align="center"></th>
<th align="right">@number($total_sum_money, 2)</th>
</tr>
</table>
</div>
@@ -0,0 +1,28 @@
<div class="panel">
<table class="table">
<tr>
<th>步骤</th>
<th>开始时间</th>
<th>结束时间</th>
<th>促销对象</th>
<th>促销目标</th>
<th>促销类别</th>
<th>促销单品</th>
<th>促销方法</th>
<th>我司支持方式</th>
<th>兑现凭据</th>
<th>预估费用</th>
<th>实际兑现费用</th>
@foreach($promotions as $key => $value)
<tr>
@foreach($value as $k => $v)
<td align="left">{{$v}}</td>
@endforeach
</tr>
@endforeach
</table>
</div>
@@ -0,0 +1,315 @@
<style>
.red_text td,
.red_text td span { color:red; }
</style>
<div class="panel">
<div class="wrapper-sm b-b b-light">
<div title="今天是本年第{{$days}}天" class="text-md">{{$now_year}}年经销商销售排行</div>
</div>
<div class="wrapper-sm b-b b-light">
<form class="form-inline" id="myquery" name="myquery" action="{{url()}}" method="get">
<div class="pull-right">
<a class="btn btn-default btn-sm" onclick="LocalTableExport('report_ranking', '销售排名');"><i class="fa fa-mail-forward"></i> 导出</a>
</div>
@if(Auth::user()->role->code != 'c001')
@include('report/select')
&nbsp;
@endif
客户
<input class="form-control input-sm" value="{{$select['query']['customer_name']}}" name="customer_name">
<select class="form-control input-sm" id='tag' name='tag' data-toggle="redirect" data-url="{{$query}}">
<option value="city_id" @if($select['query']['tag']=='city_id') selected @endif>城市模式</option>
<option value="customer_id" @if($select['query']['tag']=='customer_id') selected @endif>客户模式</option>
</select>
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i> 搜索</button>
</form>
</div>
<table class="table table-bordered" id="report_ranking">
<tr>
<th width="80">排行</th>
@if($select['query']['tag'] == 'customer_id')
<th style="white-space:nowrap;">销售团队</th>
<th style="white-space:nowrap;">负责人</th>
@endif
@if($select['query']['tag']=='city_id')
<th align="center" style="white-space:nowrap;">省份</th>
<th align="center" style="white-space:nowrap;">城市</th>
@else
<th align="center" style="white-space:nowrap;">客户编码</th>
<th align="center" style="white-space:nowrap;">客户名称</th>
<th align="center" style="white-space:nowrap;">销售等级</th>
@endif
</th>
<th style="white-space:nowrap;">比去年同期增长率</th>
<th style="white-space:nowrap;">比去年同期增长额</th>
<th style="white-space:nowrap;">总销售额</th>
<th style="white-space:nowrap;">销售额占区域比</th>
<th style="white-space:nowrap;">增长额总销售贡献比</th>
<th style="white-space:nowrap;">增长贡献率</th>
@foreach($categorys['name'] as $category)
<th align="center" style="white-space:nowrap;">{{$category['name']}}</th>
@endforeach
<?php
$this_year_data = $single[$now_year];
if ($this_year_data) {
arsort($this_year_data);
}
$last_year_data = $single[$last_year];
$i = 0;
$total = [];
$growth = [
// 今年比去年同期增加额求和
'a' => [],
// 今年比去年同期增加额正数求和
'b' => [],
// 今年比去年同期增加额负数求和
'c' => []
];
foreach((array)$this_year_data as $k => $v) {
$res = $v - $last_year_data[$k];
$growth['a'][$k] += $res;
// 正数求和
if($res > 0) {
$growth['b'][$k] += $res;
}
// 负数求和
if($res < 0) {
$growth['c'][$k] += $res;
}
}
$this_year_sum = array_sum((array)$this_year_data);
$last_year_sum = array_sum((array)$last_year_data);
$growth_a = array_sum($growth['a']);
$growth_b = array_sum($growth['b']);
$growth_c = array_sum($growth['c']);
?>
@foreach($this_year_data as $k => $v)
<?php
$i++;
$total['all'] += $this_year_data[$k];
?>
<tr class="@if(($v - $last_year_data[$k]) < 0) red_text @endif">
<td align="center">{{$i}}</td>
@if($select['query']['tag'] == 'customer_id')
<td align="center">{{$regions[$single['info'][$k]['region_id']]['name']}}</td>
<td align="center">{{get_user($regions[$single['info'][$k]['region_id']]['owner_user_id'], 'name')}}</td>
@endif
@if($select['query']['tag'] == 'city_id')
<td align="center">
{{$single['info'][$k]['province_name']}}
</td>
<td align="center">
{{$single['info'][$k]['city_name']}}
</td>
@else
<td align="center">
{{$single['info'][$k]['customer_code']}}
</td>
<td align="left">
<!-- 客户类型 -->
<?php
$post = $single['info'][$k]['grade_id'];
// 今年合计
$now_year_money = $this_year_data[$k];
$grade = $now_year_money / $days;
$post_type = '';
if ($post == 1) {
if ($grade > 32877) {
$post_type = '军';
} elseif ($grade > 16438) {
$post_type = '师';
} elseif ($grade > 6575) {
$post_type = '旅';
} elseif ($grade > 3288) {
$post_type = '团';
} elseif ($grade > 1643) {
$post_type = '营';
} elseif ($grade > 657) {
$post_type = '连';
} else {
$post_type = '问题';
}
} else if($post == 2) {
if ($grade > 3288) {
$post_type = '大队';
} elseif ($grade > 1643) {
$post_type = '中队';
} elseif ($grade > 657) {
$post_type = '小队';
} elseif ($grade > 328) {
$post_type = '分队';
} else {
$post_type = '问题';
}
}
?>
{{$single['info'][$k]['customer_name']}}
</td>
<td align="center">
{{$post_type}}
</td>
@endif
<td align="right" title="去年累计: {{(int)$last_year_data[$k]}} - 今年累计: {{(int)$this_year_data[$k]}}">
@if($last_year_data[$k] > 0)
<span @if(($v / $last_year_data[$k] - 1) < 0) style="color:red;" @endif>
<?php
$last_year_pre = number_format(($v / $last_year_data[$k] - 1) * 100, 2);
?>
{{$last_year_pre}}%
</span>
@else
去年同期无
@endif
</td>
<td align="right" title="去年累计: {{(int)$last_year_data[$k]}} - 今年累计: {{(int)$this_year_data[$k]}}">
<span @if($growth['a'][$k] < 0) style="color:red;" @endif>
{{number_format($growth['a'][$k], 2)}}
</span>
</td>
<td align="right">{{number_format($this_year_data[$k], 2)}}</td>
<td align="center">{{number_format(($v / array_sum($this_year_data) * 100), 2)}}%</td>
<td align="center">{{number_format(($growth['a'][$k] / array_sum($this_year_data) * 100), 2)}}%</td>
<td align="center">
<?php
if ($growth['a'][$k] > 0) {
echo number_format(($growth['a'][$k] / $growth_b) * 100, 2);
} else {
echo '-'.number_format(($growth['a'][$k] / $growth_c) * 100, 2);
}
?>%
</td>
<?php $category_money = $categorys['money'][$now_year][$k]; ?>
@foreach($categorys['name'] as $category)
<td align="right">{{number_format($category_money[$category['id']],2)}}</td>
<?php $total[$category['id']] += $category_money[$category['id']]; ?>
@endforeach
</tr>
@endforeach
<tr>
<th align="center">净值合计</th>
<th align="center"></th>
@if($select['query']['tag'] == 'customer_id')
<th align="center"></th>
<th align="center"></th>
<th align="center"></th>
@endif
<th align="center"></th>
<th align="right">
<?php
$v2 = $this_year_sum - $last_year_sum;
if ($last_year_sum > 0) {
$pre = number_format(($v2 / $last_year_sum) * 100, 2);
}
?>
<span @if($pre < 0) style="color:red;" @endif>{{$pre}}%</span>
</th>
<th align="right">
{{number_format($growth_a, 2)}}
</th>
<th align="right">{{number_format($total['all'], 2)}}</th>
<th align="center"></th>
<th align="center"></th>
<th align="center"></th>
@foreach($categorys['name'] as $category)
<th align="right">{{number_format($total[$category['id']],2)}}</th>
@endforeach
</tr>
<tr>
<th align="center">增长合计</th>
<th align="center"></th>
@if($select['query']['tag'] == 'customer_id')
<th align="center"></th>
<th align="center"></th>
<th align="center"></th>
@endif
<th align="center"></th>
<th align="right">
<?php
if ($last_year_sum > 0) {
$pre = number_format(($growth_b / $last_year_sum) * 100, 2);
}
?>
<span @if($pre < 0) style="color:red;" @endif>{{$pre}}%</span>
</th>
<th align="right">
{{number_format($growth_b, 2)}}
</th>
<th align="center"></th>
<th align="right"></th>
<th align="center"></th>
<th align="center"></th>
@foreach($categorys['name'] as $category)
<th align="right"></th>
@endforeach
</tr>
<tr>
<th align="center">下降合计</th>
<th align="center"></th>
@if($select['query']['tag'] == 'customer_id')
<th align="center"></th>
<th align="center"></th>
<th align="center"></th>
@endif
<th align="center"></th>
<th align="right">
<?php
if ($last_year_sum > 0) {
$pre = number_format(($growth_c / $last_year_sum) * 100, 2);
}
?>
<span @if($pre < 0) style="color:red;" @endif>{{$pre}}%</span>
</th>
<th align="right">
{{number_format($growth_c, 2)}}
</th>
<th align="center"></th>
<th align="center"></th>
<th align="center"></th>
<th align="right"></th>
@foreach($categorys['name'] as $category)
<th align="right"></th>
@endforeach
</tr>
</table>
</div>
@@ -0,0 +1,45 @@
<div class="panel">
<div class="wrapper b-b b-light">
@if(Auth::user()->role->name != 'client')
<form class="form-inline" id="myquery" name="myquery" action="{{url()}}" method="get">
@include('data/select')
<div class="form-group">
&nbsp;年份<input type="text" id="year" name="year" onclick="datePicker({dateFmt:'yyyy'});" value="{{$select['select']['year']}}" class="form-control input-sm">
</div>
<button type="submit" class="btn btn-default btn-sm">过滤</button>
</form>
@endif
</div>
<table class="table">
<tr>
<th align="left">客户名称</th>
<th align="center">客户代码</th>
@for($i=1; $i <= 12; $i++)
<th align="right">{{$i}}()</th>
@endfor
<th align="right">合计()</th>
</tr>
@foreach($rows as $row)
<tr>
<td align="left">{{$row['customer_name']}}</td>
<td align="center">{{$row['customer_code']}}</td>
@for($i=1; $i <= 12; $i++)
<td align="right">
<div style="color:green;" title="月任务">@number($row['task'][$i] * 10000)</div>
<div title="客户回款金额">@number($row['money'][$i])</div>
</td>
@endfor
<td align="right">
<div style="color:green;" title="月任务">@number(array_sum($row['task']) * 10000)</div>
<div>@number(array_sum($row['money']))</div>
</td>
</tr>
@endforeach
</table>
</div>
@@ -0,0 +1,56 @@
<select class="form-control input-sm" id='region1_id' name='region1_id' data-toggle="redirect" data-url="{{$query}}">
<option value="0">大区</option>
@if(count($select['region1']))
@foreach($select['region1'] as $k => $v)
<option value="{{$v['id']}}" @if($select['query']['region1_id']==$v['id']) selected @endif>{{$v['name']}}</option>
@endforeach
@endif
</select>
<select class="form-control input-sm" id='region2_id' name='region2_id' data-toggle="redirect" data-url="{{$query}}">
<option value="0">省区</option>
@if(count($select['region2']))
@foreach($select['region2'] as $k => $v)
<option value="{{$v['id']}}" @if($select['query']['region2_id']==$v['id']) selected @endif>{{$v['name']}}</option>
@endforeach
@endif
</select>
<select class="form-control input-sm" id='region3_id' name='region3_id' data-toggle="redirect" data-url="{{$query}}">
<option value="0">区域</option>
@if(count($select['region3']))
@foreach($select['region3'] as $k => $v)
<option value="{{$v['id']}}" @if($select['query']['region3_id']==$v['id']) selected @endif>{{$v['name']}}</option>
@endforeach
@endif
</select>
<select class="form-control input-sm" id='customer_id' name='customer_id' data-toggle="redirect" data-url="{{$query}}">
<option value="0">客户</option>
@if(count($select['customer']))
@foreach($select['customer'] as $k => $v)
<option value="{{$v['id']}}" @if($v['status'] == 0) style="color:#f00;" @endif @if($select['query']['customer_id'] == $v['id']) selected @endif>{{$v['customer_name']}}</option>
@endforeach
@endif
</select>
@if(isset($select['query']['customer_type']))
<select class="form-control input-sm" id='customer_type' name='customer_type' data-toggle="redirect" data-url="{{$query}}">
<option value="0">客户类型</option>
@if(count($customer_type))
@foreach($customer_type as $k => $v)
<option value="{{$v['id']}}" @if($select['query']['customer_type'] == $v['id']) selected @endif>{{$v['name']}}</option>
@endforeach
@endif
</select>
@endif
@if($select['query']['date1'])
&nbsp;
日期
<input class="form-control input-sm" data-toggle="date" value="{{$select['query']['date1']}}" size="13" name="date1" id="date1">
@endif
@if($select['query']['date2'])
-
<input class="form-control input-sm" data-toggle="date" value="{{$select['query']['date2']}}" size="13" name="date2" id="date2">
@endif
@@ -0,0 +1,90 @@
<div class="panel">
<div class="wrapper-sm b-b">
<div class="text-md">{{$select['select']['year']}}年单品销售排名(占比)</div>
</div>
<div class="wrapper-sm b-b">
<form class="form-inline" id="myquery" name="myquery" action="{{url()}}" method="get">
<div class="pull-right">
<a class="btn btn-default btn-sm" onclick="LocalTableExport('report_single', '单品销售排名');"><i class="fa fa-mail-forward"></i> 导出</a>
</div>
@if(Auth::user()->role->code != 'c001')
@include('report/select')
&nbsp;
@endif
<select class="form-control input-sm" id='category_id' name='category_id' data-toggle="redirect" rel="{{$query}}">
@foreach($categorys as $k => $v)
@if($v['layer_level'] == 1)
<option value="{{$v['id']}}" @if($select['select']['category_id'] == $v['id']) selected @endif>{{$v['name']}}</option>
@endif
@endforeach
</select>
&nbsp;年份
<input type="text" id="year" name="year" onclick="datePicker({dateFmt:'yyyy'});" value="{{$select['select']['year']}}" class="form-control input-sm">
<button type="submit" class="btn btn-default btn-sm">筛选</button>
</form>
</div>
{{:$months = range(1,12)}}
@foreach($single['year'] as $year => $total)
{{:arsort($total['money'])}}
<table class="table table-bordered" id="report_single">
<tr>
<th align="center">产品名称</th>
@if(count($months))
@foreach($months as $month)
<th align="center">
{{$month}}
</th>
@endforeach
@endif
<th align="center">合计</th>
</tr>
@foreach($total['money'] as $key => $product)
{{:$total = array_sum((array)$product)}}
<tr>
<td>
{{$single['name'][$key]}} - {{$single['spec'][$key]}}
</td>
@foreach($months as $month)
<td align="right">
<div title="金额">{{(int)$single['money'][$year][$key][$month]}}</div>
<div title="件数">{{(int)$single['amount'][$year][$key][$month]}}</div>
<div style="color:green;" title="该单品本月/本年的占比">
@if($single['money'][$year][$key][$month] > 0)
{{number_format(($single['money'][$year][$key][$month]/$total)*100,2)}}%
@endif
</div>
</td>
@endforeach
<th align="right">
<div title="金额">{{$total}}</div>
<div title="件数">{{(int)array_sum($single['amount'][$year][$key])}}</div>
<div style="color:red;" title="本年单品/品类的占比">
@if($total > 0)
{{number_format(($total/$single['money2'][$year])*100,2)}}%
@endif
</div>
</th>
</tr>
@endforeach
</table>
@endforeach
</div>
@@ -0,0 +1,42 @@
<div class="panel">
<div class="wrapper-sm b-b b-light">
<form class="form-inline" id="myquery" name="myquery" action="{{url()}}" method="get">
<div class="pull-right">
<a class="btn btn-default btn-sm" onclick="LocalTableExport('report_export', '三个月未进货客户');"><i class="fa fa-mail-forward"></i> 导出</a>
</div>
@if(Auth::user()->role->code != 'c001')
@include('report/select')
@endif
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i> 搜索</button>
</form>
</div>
<table class="table" id="report_export">
<tr>
<th align="center" width="60">序号</th>
<th align="left" width="100">客户编码</th>
<th align="left">客户名称</th>
<th align="center" width="100">客户类型</th>
<th align="right" width="200">去年金额</th>
<th align="right" width="200">今年金额</th>
</tr>
<?php $n = 1; ?>
@if(count($rows))
@foreach($rows as $row)
<tr>
<td align="center">{{$n}}</td>
<td align="center">{{$row['code']}}</td>
<td align="left">{{$row['name']}}</td>
<td align="center">{{$customer_type[$row['type_id']]['name']}}</td>
<td align="right">@number($data[$year1][$row['id']], 2)</td>
<td align="right">@number($data[$year2][$row['id']], 2)</td>
</tr>
<?php $n++; ?>
@endforeach
@endif
</table>
</div>