Commit 369896c2 by 杨树贤

修复统计

parent 32ecbce7
......@@ -167,6 +167,25 @@ class SupplierFilter
}
}
if ((isset($map['proxy_certificate_is_expired']) && $map['proxy_certificate_is_expired'] === "0") || !empty($map['proxy_certificate_is_expired'])) {
$now = time();
$query->whereIn('supplier_id', function ($query) use ($map, $now) {
$query->select('supplier_id')
->from(with(new SupplierAttachmentsModel())->getTable())
->where('field_name', 'proxy_certificate');
if ($map['proxy_certificate_is_expired'] == 1) {
$query->where('validity_end', '>', 0)
->where('validity_end', '<', $now);
} else {
$query->where(function ($subQuery) use ($now) {
$subQuery->where('validity_end', 0)
->orWhere('validity_end', '>=', $now);
});
}
});
}
if (!empty($map['sku_expired_in_days']) && is_numeric($map['sku_expired_in_days'])) {
$query->where('sku_expired_in_days', '>=', $map['sku_expired_in_days']);
}
......@@ -545,10 +564,16 @@ class SupplierFilter
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_num', 0)->where('uploaded_sku', 1)->where('uploaded_sku', 1);
break;
case "yunxin_expired_at_days":
$query->where('stockup_type', 'LIKE', '%5%')->where('sku_expired_in_days', '!=', 0)->where('uploaded_sku', 1);
$query->where('stockup_type', 'LIKE', '%5%')
->where('sku_expired_in_days', '!=', 0)
->where('sku_expired_in_days', '!=', 1000)
->where('uploaded_sku', 1);
break;
case "not_yunxin_expired_at_days":
$query->where('stockup_type', 'NOT LIKE', '%5%')->where('sku_expired_in_days', '!=', 0)->where('uploaded_sku', 1);
$query->where('stockup_type', 'NOT LIKE', '%5%')
->where('sku_expired_in_days', '!=', 0)
->where('sku_expired_in_days', '!=', 1000)
->where('uploaded_sku', 1);
break;
case "no_quality_assurance_agreement_all":
$query->whereNotIn('supplier_id', function ($query) {
......@@ -561,7 +586,8 @@ class SupplierFilter
})->where('uploaded_sku', 1);
break;
case "sku_expired":
$query->where('sku_expired_in_days', '>', 0);
$query->where('sku_expired_in_days', '>', 0)
->where('sku_expired_in_days', '!=', 1000);
break;
}
return $query;
......
......@@ -22,38 +22,38 @@ class SupplierStatisticsService
$total = $this->getStatisticsCount('all');
//待复审
$needReview = $this->getStatisticsCount('need_review');
// //待提审
// $pending = $this->getStatisticsCount('pending');
// //审核中
// $inReview = $this->getStatisticsCount('in_review');
// //通过
// $passed = $this->getStatisticsCount('passed');
// //未通过
// $rejected = $this->getStatisticsCount('rejected');
// //禁用
// $disable = $this->getStatisticsCount('disable');
// //没有数据维护员
// $noPurchaseUid = $this->getStatisticsCount('no_purchase_uid');
// //没有采购
// $noChannelUid = $this->getStatisticsCount('no_channel_uid');
// //存在无效(离职)采购员
// $invalidChannelUid = $this->getStatisticsCount('invalid_channel_uid');
// //存在无效(离职)开发员
// $invalidPurchaseUid = $this->getStatisticsCount('invalid_purchase_uid');
// //需要跟进的
// $toFollowUp = $this->getStatisticsCount('to_follow_up');
// //没有sku的
// $noSku = $this->getStatisticsCount('no_sku');
// //待提审
// $pending = $this->getStatisticsCount('pending');
// //审核中
// $inReview = $this->getStatisticsCount('in_review');
// //通过
// $passed = $this->getStatisticsCount('passed');
// //未通过
// $rejected = $this->getStatisticsCount('rejected');
// //禁用
// $disable = $this->getStatisticsCount('disable');
// //没有数据维护员
// $noPurchaseUid = $this->getStatisticsCount('no_purchase_uid');
// //没有采购
// $noChannelUid = $this->getStatisticsCount('no_channel_uid');
// //存在无效(离职)采购员
// $invalidChannelUid = $this->getStatisticsCount('invalid_channel_uid');
// //存在无效(离职)开发员
// $invalidPurchaseUid = $this->getStatisticsCount('invalid_purchase_uid');
// //需要跟进的
// $toFollowUp = $this->getStatisticsCount('to_follow_up');
// //没有sku的
// $noSku = $this->getStatisticsCount('no_sku');
//拉黑的
$block = $this->getStatisticsCount('block');
// //没有品牌协议附件的
// $noQualityAssuranceAgreement = $this->getStatisticsCount('no_quality_assurance_agreement');
// //有标签的(客户指定供应商)
// $hasTagSupplier = $this->getStatisticsCount('has_supplier_tag');
// //联系人未完善
// $concatNoComplete = $this->getStatisticsCount('contact_no_complete');
// //历史检测异常
// $historyAbnormal = $this->getStatisticsCount('history_abnormal');
// //没有品牌协议附件的
// $noQualityAssuranceAgreement = $this->getStatisticsCount('no_quality_assurance_agreement');
// //有标签的(客户指定供应商)
// $hasTagSupplier = $this->getStatisticsCount('has_supplier_tag');
// //联系人未完善
// $concatNoComplete = $this->getStatisticsCount('contact_no_complete');
// //历史检测异常
// $historyAbnormal = $this->getStatisticsCount('history_abnormal');
//战略供应商(等级为A)
$payTypeTerm = $this->getStatisticsCount('pay_type_term');
//账期供应商
......@@ -99,7 +99,7 @@ class SupplierStatisticsService
//显示默认的数据(有权限逻辑)
$filter = new SupplierFilter();
$model = $model->where('supplier_code', '!=', '');
if ($type=='contact_no_complete') {
if ($type == 'contact_no_complete') {
$subQuery = $filter->defaultFilter($model, $type);
return $subQuery->get()->count();
}
......
......@@ -104,5 +104,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
DataService::initProxyCertificateAgencyBrands(false,0);
DataService::initProxyCertificateAgencyBrands(true,0);
});
......@@ -240,6 +240,10 @@
{!! $statusPresenter->render('is_sku_expire','商品是否过期','',[1=>'是',-1=>'否']) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('proxy_certificate_is_expired','代理证是否过期','',[1=>'是',-1=>'否']) !!}
</div>
<div class="layui-inline">
<label class="layui-form-label">商品过期天数</label>
<div class="layui-input-inline">
<input type="text" name="sku_expired_in_days" placeholder="请输入数字" autocomplete="off" class="layui-input" value="{{request()->get('sku_expired_in_days')}}">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment