You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simple-yewu/frontend/controllers/StatisticsController.php

880 lines
30 KiB

5 years ago
<?php
namespace frontend\controllers;
use common\libs\MyLib;
use common\models\CarT;
use common\models\CarTypeT;
use common\models\CleanTongji;
use common\models\CleanFenpei;
use common\models\FixCarT;
use common\models\GroupT;
use common\models\InsurerCompanyT;
use common\models\OrderT;
use common\models\PhoneDayT;
use common\models\UserT;
use Yii;
use yii\web\Response;
class StatisticsController extends BaseController
{
public $enableCsrfValidation = false;
public $layout = 'blue-main';
5 years ago
public function actionWork() {
$group_items = GroupT::getTree((int)$this->my->group_id);
if($this->my->id == 1 || $this->my->username=='6002')
$group_items = GroupT::getTree();
$company_items = InsurerCompanyT::find()
->all();
return $this->render('work',[
'group_items' => $group_items,
'company_items' => $company_items
]);
}
public function actionWorkJson()
5 years ago
{
5 years ago
Yii::$app->response->format = Response::FORMAT_JSON;
5 years ago
$request = Yii::$app->request;
$date_begin = $request->get('date_begin',date('Y-m-d'));
$date_end = $request->get('date_end',date('Y-m-d'));
$date2_begin = $request->get('date2_begin');
$date2_end = $request->get('date2_end');
$username = $request->get('username');
$group_id = $request->get('group_id');
$company_id = $request->get('company_id');
5 years ago
5 years ago
$group_ids[] = $group_id;
if($group_id > 0) {
$items = GroupT::getTree($group_id);
foreach($items as $group_info) {
$group_ids[] = $group_info->id;
}
}
// 现在的搜索条件
$userSql = '';
if($username != '') {
$userSql = ' username like "'.$username.'" and ';
}
//$userSql .= 'is_locked=0 and is_login=1';
$user_items = $this->my->getChildren($userSql);
if($this->my->username == '6002')
$user_items = $this->my->getChildren($userSql,1);
$user_rows = array();
$sum_total = array();
$sum_total[0] = '';
$sum_total[1] = 0;
$sum_total[2] = 0;
$sum_total[3] = 0;
$sum_total[4] = 0;
$sum_total[5] = 0;
$sum_total[6] = 0;
$sum_total[7] = 0;
foreach($user_items as $user_info) {
if($user_info->is_leave == 1) continue;
if($group_id > 0) {
if(!in_array($user_info->group_id,$group_ids)) {
continue;
}
}
$total[0] = 0;
$total[1] = 0;
$total[2] = 0;
$total[3] = 0;
$total[4] = 0;
$total[5] = 0;
$total[6] = 0;
$total[7] = 0;
$row = array();
$row['id'] = $user_info->id;
$row['username'] = $user_info->username;
$row['truename'] = $user_info->name;
$tmp_query = OrderT::find()
->where('user_id='.$user_info->id.' and status_id>1')
->andWhere('insurance_status=1 or insurance_status=3');
if($date_begin != '') {
5 years ago
$tmp_query->andWhere('submit_date>="'.$date_begin.'"');
5 years ago
}
if($date_end != '') {
5 years ago
$tmp_query->andWhere('submit_date<="'.$date_end.'"');
5 years ago
}
if($date2_begin != '') {
5 years ago
$tmp_query->andWhere('print_date>="'.$date2_begin.'"');
5 years ago
}
if($date2_end != '') {
5 years ago
$tmp_query->andWhere('print_date<="'.$date2_end.'"');
5 years ago
}
if($company_id > 0) {
5 years ago
$tmp_query->andWhere('company_id='.$company_id);
5 years ago
}
foreach($tmp_query->each() as $item) {
$total[0]++;
//提单总数
if ($item->status_id > 0) {
$total[1]++;
$total[2] += $item->total1_clear;//提单总净保费
$total[3] += $item->total2_clear;//交强总净保费
if($item->status_id > 5) {
$total[4] += $item->total1_clear;//商业已收净保费
$total[5] += $item->total2_clear;//商业已收净保费
}
$total[6] += $item->total1_clear + $item->total2_clear;//总签单净保费
}
}
//提单总数
$tmp_query = FixCarT::find()
->where('user_id='.$user_info->id.' and status>0');
if($date_begin != '') {
5 years ago
$tmp_query->andWhere('submit_date>="'.$date_begin.'"');
5 years ago
}
if($date_end != '') {
5 years ago
$tmp_query->andWhere('submit_date<="'.$date_end.'"');
5 years ago
}
if($date2_begin != '') {
5 years ago
$tmp_query->andWhere('submit_date>="'.$date2_begin.'"');
5 years ago
}
if($date2_end != '') {
5 years ago
$tmp_query->andWhere('submit_date<="'.$date2_end.'"');
5 years ago
}
$total[7] = $tmp_query->count();
//通时
$phone_time = '';
$query = PhoneDayT::find()
->where('user_id='.$user_info->id.' and call_date>="'.$date_begin.'" and call_date<="'.$date_end.'"');
$items = $query->all();
$call_time = 0;
foreach($items as $item) {
$call_time += $item->call_time;
}
if($call_time > 0) {
$h = floor($call_time/3600);
$m = floor(($call_time - $h * 3600)/60);
$s = $call_time - $h * 3600 - $m * 60;
$phone_time = $h.':'.$m.':'.$s;
}
$total[0] = $phone_time;
$row['total'] = $total;
$user_rows[] = $row;
$sum_total[1] += $total[1];
$sum_total[2] += $total[2];
$sum_total[3] += $total[3];
$sum_total[4] += $total[4];
$sum_total[5] += $total[5];
$sum_total[6] += $total[6];
$sum_total[7] += $total[7];
}
5 years ago
$data = [];
$data['total'] = count($user_rows);
$data['rows'] = [];
foreach($user_rows as $item) {
$row = $item;
$row['total_0'] = $item['total'][0]!=''?$item['total'][0]:'';
$row['total_7'] = $item['total'][7]>0?$item['total'][7]:'';
$row['total_1'] = $item['total'][1]>0?$item['total'][1]:'';
$row['total_2'] = $item['total'][2]>0?'¥'.number_format($item['total'][2],2):'';
$row['total_3'] = $item['total'][3]>0?'¥'.number_format($item['total'][3],2):'';
$row['total_4'] = $item['total'][4]>0?'¥'.number_format($item['total'][4],2):'';
$row['total_5'] = $item['total'][5]>0?'¥'.number_format($item['total'][5],2):'';
$row['total_6'] = $item['total'][6]>0?'¥'.number_format($item['total'][6],2):'';
$row['op'] = 1;
$data['rows'][] = $row;
}
$row = [];
$row['username'] = '汇总';
$row['total_7'] = $sum_total[7]>0?$sum_total[7]:'';
$row['total_1'] = $sum_total[1]>0?$sum_total[1]:'';
$row['total_2'] = $sum_total[2]>0?'¥'.number_format($sum_total[2],2):'';
$row['total_3'] = $sum_total[3]>0?'¥'.number_format($sum_total[3],2):'';
$row['total_4'] = $sum_total[4]>0?'¥'.number_format($sum_total[4],2):'';
$row['total_5'] = $sum_total[5]>0?'¥'.number_format($sum_total[5],2):'';
$row['total_6'] = $sum_total[6]>0?'¥'.number_format($sum_total[6],2):'';
$row['op'] = 0;
$data['rows'][] = $row;
return $data;
5 years ago
}
5 years ago
5 years ago
public function actionCleanWork()
{
$request = Yii::$app->request;
$date_begin = $request->get('date_begin',date('Y-m-d'));
$date_end = $request->get('date_end',date('Y-m-d'));
$username = $request->get('username');
$group_id = $request->get('group_id');
$company_id = $request->get('company_id');
$group_items = GroupT::getTree((int)$this->my->group_id);
if($this->my->id == 1 || $this->my->username=='6002')
$group_items = GroupT::getTree();
$group_ids[] = $group_id;
if($group_id > 0) {
$items = GroupT::getTree($group_id);
foreach($items as $group_info) {
$group_ids[] = $group_info->id;
}
}
$userSql = '';
if($username != '') {
$userSql = ' username like "'.$username.'" and ';
}
$user_items = $this->my->getChildrenClean($userSql);
if($this->my->username == '6002')
$user_items = $this->my->getChildrenClean($userSql,1);
$user_items[] = $this->my;
5 years ago
5 years ago
$user_rows = array();
$sum_total = array();
$sum_total[0] = 0;
$sum_total[1] = 0;
$sum_total[2] = 0;
foreach($user_items as $user_info) {
if($user_info->is_leave == 1) continue;
if($group_id > 0) {
if(!in_array($user_info->group_id,$group_ids)) {
continue;
}
}
$row = array();
$row['id'] = $user_info->id;
$row['username'] = $user_info->username;
$row['truename'] = $user_info->name;
$tmp_query = CleanTongji::find()
->where('user_id='.$user_info->id);
if($date_begin != '') {
$tmp_query = $tmp_query->andWhere('yuefen>="'.$date_begin.'"');
}
if($date_end != '') {
$tmp_query = $tmp_query->andWhere('yuefen<="'.$date_end.'"');
}
if($company_id > 0) {
$tmp_query = $tmp_query->andWhere('company_id='.$company_id);
}
$total['right_num']=$tmp_query->sum('right_num');
$total['wrong_num']=$tmp_query->sum('wrong_num');
$total['yuyue_num']=$tmp_query->sum('yuyue_num');
$row['total'] = $total;
$user_rows[] = $row;
$sum_total[0] += $total['right_num'];
$sum_total[1] += $total['wrong_num'];
$sum_total[2] += $total['yuyue_num'];
}
$company_items = InsurerCompanyT::find()
->all();
return $this->render('clean-work',[
'user_rows' => $user_rows,
'date_begin' => $date_begin,
'date_end' => $date_end,
'username' => $username,
'sum_total' => $sum_total,
'group_id' => $group_id,
'group_items' => $group_items,
'company_items' => $company_items,
'company_id' => $company_id
]);
}
public function actionCleanWorkZj()
{
$request = Yii::$app->request;
$date_begin = $request->get('date_begin',date('Y-m-d'));
$date_end = $request->get('date_end',date('Y-m-d'));
$query = CleanFenpei::find();
if($date_begin != '') {
$query = $query->andWhere('fenpei_date>="'.$date_begin.'"');
}
if($date_end != '') {
$query = $query->andWhere('fenpei_date<="'.$date_end.'"');
}
5 years ago
$CleanFenpei=$query ->count();
5 years ago
return $this->render('clean-work-zj',[
'CleanFenpei' => $CleanFenpei,
'date_begin' => $date_begin,
'date_end' => $date_end,
]);
}
public function actionFixWork()
{
$request = Yii::$app->request;
$date_begin = $request->get('date_begin',date('Y-m-d'));
$date_end = $request->get('date_end',date('Y-m-d'));
$join_date_begin = $request->get('join_date_begin',date('Y-m-d'));
$join_date_end = $request->get('join_date_end',date('Y-m-d'));
$username = $request->get('username');
$group_id = $request->get('group_id');
$company_id = $request->get('company_id');
$group_items = GroupT::getTree((int)$this->my->group_id);
if($this->my->id == 1 || $this->my->username=='6002')
$group_items = GroupT::getTree();
$group_ids[] = $group_id;
if($group_id > 0) {
$items = GroupT::getTree($group_id);
foreach($items as $group_info) {
$group_ids[] = $group_info->id;
}
}
// 原来的搜索条件
// $userSql = '';
// if($username != '') {
// $userSql = ' username like "'.$username.'"';
// }
// 现在的搜索条件
$userSql = '';
if($username != '') {
$userSql = ' username like "'.$username.'" and ';
}
//$userSql .= 'is_locked=0 and is_login=1';
$user_items = $this->my->getChildren($userSql);
if($this->my->username == '6002')
$user_items = $this->my->getChildren($userSql,1);
$user_items[] = $this->my;
//var_dump($user_items);
$user_rows = array();
$sum_total = array();
$sum_total[0] = '';
$sum_total[1] = 0;
$sum_total[2] = 0;
$sum_total[3] = 0;
$sum_total[4] = 0;
$sum_total[5] = 0;
$sum_total[6] = 0;
$sum_total[7] = 0;
//用户组
foreach($user_items as $user_info) {
if($user_info->is_leave == 1) continue;
if($group_id > 0) {
if(!in_array($user_info->group_id,$group_ids)) {
continue;
}
}
$total[0] = 0;
$total[1] = 0;
$total[2] = 0;
$total[3] = 0;
$total[4] = 0;
$total[5] = 0;
$total[6] = 0;
$total[7] = 0;
$row = array();
$row['id'] = $user_info->id;
$row['username'] = $user_info->username;
$row['truename'] = $user_info->name;
//保单统计
// $tmp_query = OrderT::find()
// ->where('user_id='.$user_info->id.' and status_id>1');
// if($date_begin != '') {
// $tmp_query = $tmp_query->andWhere('submit_date>="'.$date_begin.'"');
// }
// if($date_end != '') {
// $tmp_query = $tmp_query->andWhere('submit_date<="'.$date_end.'"');
// }
//
// if($company_id > 0) {
// $tmp_query = $tmp_query->andWhere('company_id='.$company_id);
// }
//
//// exit;
// foreach($tmp_query->each() as $item) {
// $total[0]++;
// //提单总数
// if ($item->status_id > 0) {
// $total[1]++;
// $total[2] += $item->total1_clear;//提单总净保费
// $total[3] += $item->total2_clear;//交强总净保费
// if($item->status_id > 5) {
// $total[4] += $item->total1_clear;//商业已收净保费
// $total[5] += $item->total2_clear;//商业已收净保费
// }
// $total[6] += $item->total1_clear + $item->total2_clear;//总签单净保费
// }
// }
//提车总数
$tmp_query = FixCarT::find()
->where('user_id='.$user_info->id.' and status>0');
if($date_begin != '') {
$tmp_query = $tmp_query->andWhere('submit_date>="'.$date_begin.'"');
}
if($date_end != '') {
$tmp_query = $tmp_query->andWhere('submit_date<="'.$date_end.'"');
}
if($join_date_begin != '') {
$tmp_query = $tmp_query->andWhere('join_date>="'.$join_date_begin.'"');
}
if($join_date_end != '') {
$tmp_query = $tmp_query->andWhere('join_date<="'.$join_date_end.'"');
}
foreach($tmp_query->each() as $item) {
//提单总数
if ($item->status > 0) {
$total[2] += $item->dingsun_hour_money;//工时费
$total[3] += $item->dingsun_huanjian_money;//配件费
$total[4] += $item->zhuche_money;//定损金额
}
}
$total[7] = $tmp_query->count();
//通时
// $phone_time = '';
// $query = PhoneDayT::find()
// ->where('user_id='.$user_info->id.' and call_date>="'.$date_begin.'" and call_date<="'.$date_end.'"');
//// echo $query->createCommand()->rawSql;
// $items = $query->all();
// $call_time = 0;
// foreach($items as $item) {
// $call_time += $item->call_time;
// }
// if($call_time > 0) {
// $h = floor($call_time/3600);
// $m = floor(($call_time - $h * 3600)/60);
// $s = $call_time - $h * 3600 - $m * 60;
// $phone_time = $h.':'.$m.':'.$s;
// }
$total[0] = 0;
$row['total'] = $total;
$user_rows[] = $row;
// $sum_total[0] += $total[0];
$sum_total[1] += $total[1];
$sum_total[2] += $total[2];
$sum_total[3] += $total[3];
$sum_total[4] += $total[4];
$sum_total[5] += $total[5];
$sum_total[6] += $total[6];
$sum_total[7] += $total[7];
}
$company_items = InsurerCompanyT::find()
->all();
return $this->render('fix-work',[
'user_rows' => $user_rows,
'date_begin' => $date_begin,
'date_end' => $date_end,
'join_date_begin' => $join_date_begin,
'join_date_end' => $join_date_end,
'username' => $username,
'sum_total' => $sum_total,
'group_id' => $group_id,
'group_items' => $group_items,
'company_items' => $company_items,
'company_id' => $company_id
]);
}
5 years ago
public function actionWorkInfo() {
5 years ago
$request = Yii::$app->request;
5 years ago
$user_id = $request->get('user_id');
5 years ago
5 years ago
return $this->render('work-info',[
'user_id' => $user_id
]);
5 years ago
}
5 years ago
public function actionWorkInfoJson()
5 years ago
{
5 years ago
Yii::$app->response->format = Response::FORMAT_JSON;
5 years ago
$request = Yii::$app->request;
$user_id = $request->get('user_id');
$date_begin = $request->get('date_begin');
$date_end = $request->get('date_end');
$date2_begin = $request->get('date2_begin');
$date2_end = $request->get('date2_end');
$username = $request->get('username');
$user_info = UserT::findOne(['id'=>$user_id]);
$total[0] = '';
$total[1] = 0;
$total[2] = 0;
$total[3] = 0;
$total[4] = 0;
$total[5] = 0;
$total[6] = 0;
$total[7] = 0;
$total[8] = 0;
$total[9] = 0;
$total[10] = 0;
//提交单数
$tmp_query = OrderT::find()
5 years ago
->where('user_id='.$user_info->id.' and status_id>1');
5 years ago
if($date_begin != '') {
$tmp_query = $tmp_query->andWhere('submit_date>="'.$date_begin.'"');
}
if($date_end != '') {
$tmp_query = $tmp_query->andWhere('submit_date<="'.$date_end.'"');
}
if($date2_begin != '') {
$tmp_query = $tmp_query->andWhere('print_date>="'.$date2_begin.'"');
}
if($date2_end != '') {
$tmp_query = $tmp_query->andWhere('print_date<="'.$date2_end.'"');
}
5 years ago
echo $tmp_query->createCommand()->rawSql."<br>";
5 years ago
$items = $tmp_query->all();
foreach($items as $item) {
$total[0]++;
//提单总数
if($item->status_id > 1) {
$total[1]++;
$total[2] += $item->total1_clear;//商业总净保费
$total[3] += $item->total1;//商业含税总保费
$total[4] += $item->total2_clear;//交强总净保费
$total[5] += $item->total2;//交强含税总保费
$total[6] += $item->total3;//车船税
$total[7] += $item->total_all;//共计签单
$total[8] += $item->total1_real;//折扣后商业净保费
$total[9] += $item->total1_dis;//减免金额
$total[10] += $item->total_real;//应收
}
}
//通时
$phone_time = '';
$total[0] = $phone_time;
5 years ago
$data = [];
$data['total'] = count($items);
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$row['total1_clear'] = '¥'.$item->total1_clear;
$row['total1_real'] = '¥'.$item->total1_real;
$row['total1_dis'] = '¥'.$item->total1_dis;
$row['total1_percent'] = '¥'.$item->total1_percent;
$row['status_name'] = '¥'.$item->status->name;
$row['op'] = 1;
$data['rows'][] = $row;
}
$row = [];
$row['id'] = '汇总';
$row['total1_clear'] = $total[2]?'¥'.number_format($total[2],2):'';
$row['total1_real'] = $total[8]?'¥'.number_format($total[8],2):'';
$row['total1_dis'] = $total[9]?'¥'.number_format($total[9],2):'';
$row['op'] = 0;
$data['rows'][] = $row;
return $data;
5 years ago
}
5 years ago
5 years ago
public function actionFixWorkInfo()
{
$request = Yii::$app->request;
$user_id = $request->get('user_id');
$date_begin = $request->get('date_begin');
$date_end = $request->get('date_end');
$join_date_begin = $request->get('join_date_begin');
$join_date_end = $request->get('join_date_end');
$username = $request->get('username');
$user_info = UserT::findOne(['id'=>$user_id]);
$total[0] = 0;
$total[1] = 0;
$total[2] = 0;
//提交单数
$tmp_query = FixCarT::find()
->where('user_id='.$user_info->id.' and status>0');
if($date_begin != '') {
$tmp_query = $tmp_query->andWhere('submit_date>="'.$date_begin.'"');
}
if($date_end != '') {
$tmp_query = $tmp_query->andWhere('submit_date<="'.$date_end.'"');
}
if($join_date_begin != '') {
$tmp_query = $tmp_query->andWhere('join_date>="'.$join_date_begin.'"');
}
if($join_date_end != '') {
$tmp_query = $tmp_query->andWhere('join_date<="'.$join_date_end.'"');
}
// echo $tmp_query->createCommand()->rawSql."<br>";
$items = $tmp_query->all();
foreach($items as $item) {
//提单总数
if ($item->status > 0) {
$total[0] += $item->dingsun_hour_money;//工时费
$total[1] += $item->dingsun_huanjian_money;//配件费
$total[2] += $item->zhuche_money;//定损金额
}
}
// foreach($items as $item) {
// $total[0]++;
// //提单总数
// if($item->status_id > 1) {
// $total[1]++;
// $total[2] += $item->total1_clear;//商业总净保费
// $total[3] += $item->total1;//商业含税总保费
// $total[4] += $item->total2_clear;//交强总净保费
// $total[5] += $item->total2;//交强含税总保费
// $total[6] += $item->total3;//车船税
// $total[7] += $item->total_all;//共计签单
// $total[8] += $item->total1_real;//折扣后商业净保费
// $total[9] += $item->total1_dis;//减免金额
// $total[10] += $item->total_real;//应收
// }
// }
//
// //通时
// $phone_time = '';
// $total[0] = $phone_time;
return $this->render('fix-work-info',[
'user_info' => $user_info,
'items' => $items,
'date_begin' => $date_begin,
'date_end' => $date_end,
'join_date_begin' => $join_date_begin,
'join_date_end' => $join_date_end,
'username' => $username,
'total' => $total
]);
}
public function actionNonWork()
{
$request = Yii::$app->request;
$date_begin = $request->get('date_begin',date('Y-m-d'));
$date_end = $request->get('date_end',date('Y-m-d'));
$date2_begin = $request->get('date2_begin');
$date2_end = $request->get('date2_end');
$username = $request->get('username');
$group_id = $request->get('group_id');
$company_id = $request->get('company_id');
$group_items = GroupT::getTree((int)$this->my->group_id);
if($this->my->id == 1 || $this->my->username=='6002')
$group_items = GroupT::getTree();
$group_ids[] = $group_id;
if($group_id > 0) {
$items = GroupT::getTree($group_id);
foreach($items as $group_info) {
$group_ids[] = $group_info->id;
}
}
// 原来的搜索条件
// $userSql = '';
// if($username != '') {
// $userSql = ' username like "'.$username.'"';
// }
// 现在的搜索条件
$userSql = '';
if($username != '') {
$userSql = ' username like "'.$username.'" and ';
}
//$userSql .= 'is_locked=0 and is_login=1';
$user_items = $this->my->getChildren($userSql);
if($this->my->username == '6002')
$user_items = $this->my->getChildren($userSql,1);
$user_items[] = $this->my;
//var_dump($user_items);
$user_rows = array();
$sum_total = array();
$sum_total[0] = '';
$sum_total[1] = 0;
$sum_total[2] = 0;
$sum_total[3] = 0;
$sum_total[4] = 0;
$sum_total[5] = 0;
$sum_total[6] = 0;
$sum_total[7] = 0;
foreach($user_items as $user_info) {
if($user_info->is_leave == 1) continue;
if($group_id > 0) {
if(!in_array($user_info->group_id,$group_ids)) {
continue;
}
}
$total[0] = 0;
$total[1] = 0;
$total[2] = 0;
$total[3] = 0;
$total[4] = 0;
$total[5] = 0;
$total[6] = 0;
$total[7] = 0;
$row = array();
$row['id'] = $user_info->id;
$row['username'] = $user_info->username;
$row['truename'] = $user_info->name;
$tmp_query = OrderT::find()
->where('user_id='.$user_info->id.' and status_id>1')
->andWhere('insurance_status=2');
if($date_begin != '') {
$tmp_query = $tmp_query->andWhere('submit_date>="'.$date_begin.'"');
}
if($date_end != '') {
$tmp_query = $tmp_query->andWhere('submit_date<="'.$date_end.'"');
}
if($date2_begin != '') {
$tmp_query = $tmp_query->andWhere('print_date>="'.$date2_begin.'"');
}
if($date2_end != '') {
$tmp_query = $tmp_query->andWhere('print_date<="'.$date2_end.'"');
}
if($company_id > 0) {
$tmp_query = $tmp_query->andWhere('company_id='.$company_id);
}
// exit;
foreach($tmp_query->each() as $item) {
$total[0]++;
//提单总数
if ($item->status_id > 0) {
$total[1]++;
$total[2] += $item->nona->baofei;//保险费用
$total[3] += $item->non_num;//投保份数
}
}
//通时
$phone_time = '';
$total[0] = $phone_time;
$row['total'] = $total;
$user_rows[] = $row;
// $sum_total[0] += $total[0];
$sum_total[1] += $total[1];
$sum_total[2] += $total[2];
$sum_total[3] += $total[3];
}
$company_items = InsurerCompanyT::find()
->all();
return $this->render('non-work',[
'user_rows' => $user_rows,
'date_begin' => $date_begin,
'date_end' => $date_end,
'date2_begin' => $date2_begin,
'date2_end' => $date2_end,
'username' => $username,
'sum_total' => $sum_total,
'group_id' => $group_id,
'group_items' => $group_items,
'company_items' => $company_items,
'company_id' => $company_id
]);
}
public function actionNonWorkInfo()
{
$request = Yii::$app->request;
$user_id = $request->get('user_id');
$date_begin = $request->get('date_begin');
$date_end = $request->get('date_end');
$date2_begin = $request->get('date2_begin');
$date2_end = $request->get('date2_end');
$username = $request->get('username');
$user_info = UserT::findOne(['id'=>$user_id]);
$total[0] = '';
$total[1] = 0;
$total[2] = 0;
$total[3] = 0;
$total[4] = 0;
$total[5] = 0;
$total[6] = 0;
$total[7] = 0;
$total[8] = 0;
$total[9] = 0;
$total[10] = 0;
//提交单数
$tmp_query = OrderT::find()
->where('user_id='.$user_info->id.' and status_id>1')
->andWhere('insurance_status=2');
if($date_begin != '') {
$tmp_query = $tmp_query->andWhere('submit_date>="'.$date_begin.'"');
}
if($date_end != '') {
$tmp_query = $tmp_query->andWhere('submit_date<="'.$date_end.'"');
}
if($date2_begin != '') {
$tmp_query = $tmp_query->andWhere('print_date>="'.$date2_begin.'"');
}
if($date2_end != '') {
$tmp_query = $tmp_query->andWhere('print_date<="'.$date2_end.'"');
}
// echo $tmp_query->createCommand()->rawSql."<br>";
$items = $tmp_query->all();
foreach($items as $item) {
$total[0]++;
//提单总数
if($item->status_id > 1) {
$total[1]++;
$total[2] += $item->nona->baofei;//保险费用
$total[3] += $item->non_num;//投保份数
}
}
return $this->render('non-work-info',[
'user_info' => $user_info,
'items' => $items,
'date_begin' => $date_begin,
'date_end' => $date_end,
'date2_begin' => $date2_begin,
'date2_end' => $date2_end,
'username' => $username,
'total' => $total
]);
}
5 years ago
}