修复销售单品客户表错误

This commit is contained in:
2021-06-12 04:39:22 +08:00
parent dcddd8e35a
commit dc44127259
6 changed files with 227 additions and 114 deletions
+42 -14
View File
@@ -1,7 +1,7 @@
<div class="panel">
<div class="wrapper-sm b-b b-light">
<div class="text-md">{{$year_id}}度发生交易客户数[{{count((array)$single['customer'])}}]</div>
<div class="text-md">{{$year}}单品客户数({{count((array)$single['customer'])}})</div>
</div>
<div class="wrapper-sm b-b b-light">
@@ -9,22 +9,26 @@
<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>
<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
@include('report/select')
&nbsp;
<select class="form-control input-sm" id='year' name='year' data-toggle="redirect" data-url="{{$query}}">
@if($years)
@foreach($years as $v)
<option value="{{$v}}" @if($select['query']['year']==$v) selected @endif>{{$v}}</option>
@endforeach
@endif
</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)
<option value="{{$v['id']}}" @if($select['query']['category_id'] == $v['id']) selected @endif>{{$v['layer_space']}}{{$v['name']}}</option>
@if($v['layer_level'] == 2)
<option value="{{$v['id']}}" @if($select['query']['category_id'] == $v['id']) selected @endif>{{$v['name']}}</option>
@endif
@endforeach
</select>
@@ -34,27 +38,51 @@
<table class="table table-bordered" id="report_export">
<tr>
<th>品类</th>
<th>单品</th>
<th>产品编码</th>
<th>产品名称</th>
<th>总销售家数</th>
<th></th>
<th>合计</th>
@if($months)
@foreach($months as $k => $v)
<th>{{$v}}</th>
@endforeach
@endif
@if($single['sum'])
@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>
<td align="center" rowspan="2">{{$single['product'][$k]['product_code']}}</td>
<td align="left" rowspan="2"><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" style="vertical-align:middle;color:#999;">销售客户数</td>
<td align="right">{{count((array)$single['all'][$k])}}</td>
@if($months)
@foreach($months as $v2)
<td align="right">
{{:$sum = count((array)$v[$v2])}}
@if($sum > 0) {{$sum}} @else <span style="color:#ccc;">0</span> @endif
@if($sum>0) {{$sum}} @else @endif
</td>
@endforeach
@endif
</tr>
<tr>
<td align="right" style="vertical-align:middle;color:#999;">销售金额</td>
<td align="right" colspan="1">@number(array_sum((array)$single['sum_money'][$k]), 2)</td>
@if($months)
@foreach($months as $v2)
<td align="right">
@if($single['sum_money'][$k][$v2] > 0) @number($single['sum_money'][$k][$v2], 2) @else @endif
</td>
@endforeach
@endif
</tr>
@endforeach
@endif
</table>
</div>
@@ -1,27 +1,25 @@
<div class="panel">
<div class="wrapper b-b b-light">
<div class='h5'>{{$single['cat']}} * ({{$single['name']}} - {{$single['spec']}}) - {{$year}}({{$month}})未进货经销商列表</div>
<div class="wrapper-xs b-b b-light">
<div class='h5'>{{$single['product_name']}} - {{$single['product_spec']}} - {{$year}}{{$month}}无数据的客户列表</div>
</div>
<table class="table">
<table class="table table-bordered">
<tr>
<th width="40">序号</th>
<th width="100">区域</th>
<th width="100">客户圈</th>
<th width="60">序号</th>
<th width="160">销售组</th>
<th width="280">客户名称</th>
<th align="left">单品</th>
<th width="100"></th>
</tr>
@if(count($clients))
@if($customers)
<?php $i = 0; ?>
@foreach($clients as $key => $value)
@foreach($customers 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>
<td align="center">{{$value['region_name']}}</td>
<td align="left">{{$value['customer_id']}}</td>
<td align="left"></td>
</tr>
@endif
<?php $i++; ?>
@@ -33,28 +31,24 @@
<div class="panel">
<div class="wrapper b-b b-light">
<div class='h5'>{{$single['cat']}} * ({{$single['name']}} - {{$single['spec']}}) - {{$year}}度年经销商销售分析</div>
<div class="wrapper-xs b-b b-light">
<div class='h5'>{{$single['product_name']}} - {{$single['product_spec']}} - {{$year}}年客户销售统计</div>
</div>
<table class="table">
<table class="table table-bordered">
<tr>
<th width="40">序号</th>
<th width="100">区域</th>
<th width="100">客户圈</th>
<th width="60">序号</th>
<th width="160">销售组</th>
<th width="280">客户名称</th>
<th align="left">单品</th>
<th width="100">金额</th>
</tr>
<?php $i = 0; ?>
@if(count($single['all']))
@if($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="center">{{$customers[$key]['region_name']}}</td>
<td align="left">{{$customers[$key]['customer_id']}}</td>
<td align="right">{{$value}}</td>
</tr>
<?php $i++; ?>