完善工作量统计功能开发

dev
曾超新 5 years ago
parent b2c0272b18
commit 698b6d8f3e
  1. 347
      frontend/controllers/StatisticsController.php
  2. 133
      frontend/views/statistics/work-info.php
  3. 255
      frontend/views/statistics/work.php
  4. 129
      frontend/views/user/edit.php

@ -21,8 +21,21 @@ class StatisticsController extends BaseController
public $enableCsrfValidation = false;
public $layout = 'blue-main';
public function actionWork()
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()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$date_begin = $request->get('date_begin',date('Y-m-d'));
$date_end = $request->get('date_end',date('Y-m-d'));
@ -31,9 +44,7 @@ class StatisticsController extends BaseController
$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);
@ -42,12 +53,6 @@ class StatisticsController extends BaseController
}
}
// 原来的搜索条件
// $userSql = '';
// if($username != '') {
// $userSql = ' username like "'.$username.'"';
// }
// 现在的搜索条件
$userSql = '';
if($username != '') {
@ -58,8 +63,6 @@ class StatisticsController extends BaseController
$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] = '';
@ -95,22 +98,21 @@ class StatisticsController extends BaseController
->where('user_id='.$user_info->id.' and status_id>1')
->andWhere('insurance_status=1 or insurance_status=3');
if($date_begin != '') {
$tmp_query = $tmp_query->andWhere('submit_date>="'.$date_begin.'"');
$tmp_query->andWhere('submit_date>="'.$date_begin.'"');
}
if($date_end != '') {
$tmp_query = $tmp_query->andWhere('submit_date<="'.$date_end.'"');
$tmp_query->andWhere('submit_date<="'.$date_end.'"');
}
if($date2_begin != '') {
$tmp_query = $tmp_query->andWhere('print_date>="'.$date2_begin.'"');
$tmp_query->andWhere('print_date>="'.$date2_begin.'"');
}
if($date2_end != '') {
$tmp_query = $tmp_query->andWhere('print_date<="'.$date2_end.'"');
$tmp_query->andWhere('print_date<="'.$date2_end.'"');
}
if($company_id > 0) {
$tmp_query = $tmp_query->andWhere('company_id='.$company_id);
$tmp_query->andWhere('company_id='.$company_id);
}
// exit;
foreach($tmp_query->each() as $item) {
$total[0]++;
//提单总数
@ -129,16 +131,16 @@ class StatisticsController extends BaseController
$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.'"');
$tmp_query->andWhere('submit_date>="'.$date_begin.'"');
}
if($date_end != '') {
$tmp_query = $tmp_query->andWhere('submit_date<="'.$date_end.'"');
$tmp_query->andWhere('submit_date<="'.$date_end.'"');
}
if($date2_begin != '') {
$tmp_query = $tmp_query->andWhere('submit_date>="'.$date2_begin.'"');
$tmp_query->andWhere('submit_date>="'.$date2_begin.'"');
}
if($date2_end != '') {
$tmp_query = $tmp_query->andWhere('submit_date<="'.$date2_end.'"');
$tmp_query->andWhere('submit_date<="'.$date2_end.'"');
}
$total[7] = $tmp_query->count();
@ -146,7 +148,6 @@ class StatisticsController extends BaseController
$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) {
@ -163,7 +164,6 @@ class StatisticsController extends BaseController
$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];
@ -173,23 +173,37 @@ class StatisticsController extends BaseController
$sum_total[7] += $total[7];
}
$company_items = InsurerCompanyT::find()
->all();
return $this->render('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
]);
$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;
}
public function actionCleanWork()
{
$request = Yii::$app->request;
@ -210,7 +224,6 @@ class StatisticsController extends BaseController
}
}
// 现在的搜索条件
$userSql = '';
if($username != '') {
$userSql = ' username like "'.$username.'" and ';
@ -221,7 +234,7 @@ class StatisticsController extends BaseController
if($this->my->username == '6002')
$user_items = $this->my->getChildrenClean($userSql,1);
$user_items[] = $this->my;
//var_dump($user_items);
$user_rows = array();
$sum_total = array();
$sum_total[0] = 0;
@ -255,21 +268,6 @@ class StatisticsController extends BaseController
$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;//总签单净保费
// }
// }
$total['right_num']=$tmp_query->sum('right_num');
$total['wrong_num']=$tmp_query->sum('wrong_num');
$total['yuyue_num']=$tmp_query->sum('yuyue_num');
@ -285,11 +283,6 @@ class StatisticsController extends BaseController
$sum_total[1] += $total['wrong_num'];
$sum_total[2] += $total['yuyue_num'];
// $sum_total[3] += $total[3];
// $sum_total[4] += $total[4];
// $sum_total[5] += $total[5];
// $sum_total[6] += $total[6];
}
$company_items = InsurerCompanyT::find()
@ -510,198 +503,17 @@ class StatisticsController extends BaseController
'company_id' => $company_id
]);
}
public function actionWorkOutput()
{
$objectPHPExcel = new \PHPExcel();
$index = 1;
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$index,'工号');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$index,'真实姓名');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$index,'通时');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('D'.$index,'提车总数');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('E'.$index,'提单总数');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('F'.$index,'商业总净保费');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('G'.$index,'交强总净保费');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('H'.$index,'商业已收净保费');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('I'.$index,'交强已收净保费');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('J'.$index,'总签单净保费');
public function actionWorkInfo() {
$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'] = trim($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($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);
}
$index++;
// 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;//总签单净保费
}
}
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$index,$row['username']);
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$index,$row['truename']);
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('E'.$index,$total[1]>0?$total[1]:'');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('F'.$index,$total[2]>0?'¥'.number_format($total[2],2):'');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('G'.$index,$total[3]>0?'¥'.number_format($total[3],2):'');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('H'.$index,$total[4]>0?'¥'.number_format($total[4],2):'');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('I'.$index,$total[5]>0?'¥'.number_format($total[5],2):'');
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('J'.$index,$total[6]>0?'¥'.number_format($total[6],2):'');
//提单总数
$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($date2_begin != '') {
$tmp_query = $tmp_query->andWhere('submit_date>="'.$date2_begin.'"');
}
if($date2_end != '') {
$tmp_query = $tmp_query->andWhere('submit_date<="'.$date2_end.'"');
}
$total[7] = $tmp_query->count();
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('D'.$index,$total[7]>0?$total[7]:'');
//通时
$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] = $phone_time;
$objectPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$index,$total[0]!=''?$total[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];
}
header('Content-Type: application/vnd.ms-excel;charset=utf-8');
header('Content-Disposition:attachment;filename="'.date("YmjHis").'.xls"');
header('Cache-Control: max-age=0');
$objWriter = \PHPExcel_IOFactory::createWriter($objectPHPExcel, 'Excel5');
$objWriter->save('php://output');
$user_id = $request->get('user_id');
return $this->render('work-info',[
'user_id' => $user_id
]);
}
public function actionWorkInfo()
public function actionWorkInfoJson()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$user_id = $request->get('user_id');
$date_begin = $request->get('date_begin');
@ -726,8 +538,7 @@ class StatisticsController extends BaseController
//提交单数
$tmp_query = OrderT::find()
->where('user_id='.$user_info->id.' and status_id>1')
->andWhere('insurance_status=1 or insurance_status=3');
->where('user_id='.$user_info->id.' and status_id>1');
if($date_begin != '') {
$tmp_query = $tmp_query->andWhere('submit_date>="'.$date_begin.'"');
}
@ -763,17 +574,29 @@ class StatisticsController extends BaseController
$phone_time = '';
$total[0] = $phone_time;
return $this->render('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
]);
$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;
}
public function actionFixWorkInfo()
{
$request = Yii::$app->request;

@ -1,65 +1,80 @@
<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
$(function(){
$("#back-btn").click(function(){
window.location.href = "/statistics/work?date_begin=<?=$date_begin?>&date_end=<?=$date_end?>&date2_begin=<?=$date2_begin?>&date2_end=<?=$date2_end?>&username=<?=$username?>";
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="car_man">车主</th>
<th data-field="car_no">车牌号</th>
<th data-field="total1_clear">商业总净保费</th>
<th data-field="total1_real">折扣后商业净保费</th>
<th data-field="total1_dis">减免金额</th>
<th data-field="total1_percent">商业折扣率</th>
<th data-field="status_name">状态</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/assets/js/plugins/layer/laydate/laydate.js"></script>
<script>
var o = {};
function opFormatter(value, row, index) {
var opStr = [];
if(row.op == 1) {
opStr.push('<a href="javascript:void(0);" onclick="view(' + row.id + ')">');
opStr.push('<i class="fa fa-file-o" title="查看"></i>');
opStr.push('</a>');
}
return opStr.join(' ');
}
function view(id) {
window.open('/insurer/info?id=' + id);
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/statistics/work-info-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
o['user_id'] = '<?=$user_id?>';
o['offset'] = params['offset'];
o['limit'] = params['limit'];
return o;
}
});
return false;
}
$(function() {
search();
});
</script>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<form id="searchForm">
<tr>
<td class="td_bg">
<input type="button" class="act_btn" id="back-btn" name="back-btn" value="返回">
提单日期: <?=$date_begin?><?=$date_end?>
正本日期: <?=$date2_begin?><?=$date2_end?>
</td>
</tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<tr>
<td width="50" align="center" class="bg_tr" nowrap>车主</td>
<td width="60" align="center" class="bg_tr" nowrap>车牌号</td>
<td align="center" class="bg_tr" nowrap>商业总净保费</td>
<td align="center" class="bg_tr" nowrap>折扣后商业净保费</td>
<td align="center" class="bg_tr" nowrap>减免金额</td>
<td align="center" class="bg_tr" nowrap>商业折扣率</td>
<td align="center" class="bg_tr" nowrap>状态</td>
<td align="center" class="bg_tr" nowrap>详情</td>
</tr>
<?php
foreach($items as $item) {
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="left" class="td_bg" nowrap><?=$item->car_man?></td>
<td align="left" class="td_bg" nowrap><?=$item->car_no?></td>
<td align="center" class="td_bg" nowrap><?='¥'.$item->total1_clear?></td>
<td align="center" class="td_bg" nowrap><?='¥'.$item->total1_real?></td>
<td align="center" class="td_bg" nowrap><?='¥'.$item->total1_dis?></td>
<td align="center" class="td_bg" nowrap><?=$item->total1_percent?></td>
<td align="center" class="td_bg" nowrap><?=$item->status->name?></td>
<td align="center" class="td_bg" nowrap>
[<a href="/insurer/info?id=<?=$item->id?>" target="_blank">详情</a>]
</td>
</tr>
<?php
}
?>
<tr>
<td width="50" align="center" class="bg_tr" nowrap>汇总</td>
<td width="60" align="center" class="bg_tr" nowrap></td>
<td align="center" class="bg_tr" nowrap><?=$total[2]?'¥'.number_format($total[2],2):''?></td>
<td align="center" class="bg_tr" nowrap><?=$total[8]?'¥'.number_format($total[8],2):''?></td>
<td align="center" class="bg_tr" nowrap><?=$total[9]?'¥'.number_format($total[9],2):''?></td>
<td align="center" class="bg_tr" nowrap></td>
<td align="center" class="bg_tr" nowrap></td>
<td align="center" class="bg_tr" nowrap></td>
</tr>
</table>
<?php $this->endBlock(); ?>

@ -1,108 +1,161 @@
<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
$(function(){
$("#search-btn").click(function(){
$('#page').val(0);
var params = $('#searchForm').serialize();
window.location.href = "/statistics/work?" + params;
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>工作量统计</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" id="searchFrm" class="form-inline" onsubmit="return search();">
<div class="form-group" style="margin-bottom: 8px;">
<label for="datepicker1">提单日期</label>
<div class="input-group" id="datepicker1">
<input type="text" class="input-sm form-control" id="date_begin" name="date_begin" value="" autocomplete="off" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" id="date_end" name="date_end" value="" autocomplete="off" />
</div>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="datepicker2">正本日期</label>
<div class="input-group" id="datepicker2">
<input type="text" class="input-sm form-control" id="date2_begin" name="date2_begin" value="" autocomplete="off" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" id="date2_end" name="date2_end" value="" autocomplete="off" />
</div>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="username">工号</label>
<input type="text" id="username" name="username" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="group_id">级别</label>
<select name="group_id" id="group_id" class="form-control">
<option value="0">全部</option>
<?php
foreach($group_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $group_id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="company_id">保险公司</label>
<select name="company_id" id="company_id" class="form-control">
<option value="0">全部</option>
<?php
foreach($company_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $company_id)
echo ' selected ';
echo '">'.$item->name.'</option>';
}
?>
</select>
</div>
<button type="submit" class="btn btn-primary mb-8">搜索</button>
</form>
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th data-field="username">工号</th>
<th data-field="truename">真实姓名</th>
<th data-field="total_7">提车总数</th>
<th data-field="total_1">提单总数</th>
<th data-field="total_2">商业总净保费</th>
<th data-field="total_3">交强总净保费</th>
<th data-field="total_4">商业已收净保费</th>
<th data-field="total_5">交强已收净保费</th>
<th data-field="total_6">总签单净保费</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/assets/js/plugins/layer/laydate/laydate.js"></script>
<script>
var o = {};
function opFormatter(value, row, index) {
var opStr = [];
if(row.op == 1) {
opStr.push('<a href="javascript:void(0);" onclick="view(' + row.id + ')">');
opStr.push('<i class="fa fa-file-o" title="查看"></i>');
opStr.push('</a>');
}
return opStr.join(' ');
}
function view(id) {
var title = '查看详情';
layer_show(title, '/statistics/work-info?user_id=' + id);
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
o = {};
var params = $("#searchFrm").serializeArray();
$.each(params, function(index) {
o[this['name']] = this['value'];
});
//导出
$("#output-btn").click(function(){
$('#page').val(0);
var params = $('#searchForm').serialize();
window.location.href = "/statistics/work-output?" + params;
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/statistics/work-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
o['offset'] = params['offset'];
o['limit'] = params['limit'];
return o;
}
});
return false;
}
$(function() {
search();
laydate({
elem:'#date_begin',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#date2_begin',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#date_end',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#date2_end',
format: 'YYYY-MM-DD',
istime: true
});
});
</script>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<form id="searchForm">
<tr>
<td class="td_bg">
提单日期:从<input name="date_begin" type="text" value="<?=$date_begin?>" style="width:100px;" onclick="WdatePicker()"><input name="date_end" type="text" value="<?=$date_end?>" style="width:100px;" onclick="WdatePicker()">截止
正本日期:从<input name="date2_begin" type="text" value="<?=$date2_begin?>" style="width:100px;" onclick="WdatePicker()"><input name="date2_end" type="text" value="<?=$date2_end?>" style="width:100px;" onclick="WdatePicker()">截止
工号:<input name="username" type="text" value="<?=$username?>">
级别:<select name="group_id">
<option value="0">全部</option>
<?php
foreach($group_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $group_id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
<select name="company_id">
<option value="0">全部</option>
<?php
foreach($company_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $company_id)
echo ' selected ';
echo '">'.$item->name.'</option>';
}
?>
</select>
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
<input type="button" class="act_btn" id="output-btn" name="output-btn" value="导出">
<a href="/statistics/work?date_begin=<?=date('Y-m-d')?>&date_end=<?=date('Y-m-d')?>">当天</a>&nbsp;&nbsp;
<a href="/statistics/work?date_begin=<?=date('Y-m-d',strtotime("-7 day"))?>&date_end=<?=date('Y-m-d')?>">7天</a>&nbsp;&nbsp;
<a href="/statistics/work?date_begin=<?=date('Y-m-d',strtotime("-1 month"))?>&date_end=<?=date('Y-m-d')?>">1个月</a>&nbsp;&nbsp;
<a href="/statistics/work?date_begin=<?=date('Y-m-d',strtotime("-3 month"))?>&date_end=<?=date('Y-m-d')?>">3个月</a>&nbsp;&nbsp;
</td>
</tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<tr>
<td width="50" align="center" class="bg_tr" nowrap>工号</td>
<td width="60" align="center" class="bg_tr" nowrap>真实姓名</td>
<td width="80" align="center" class="bg_tr" nowrap>通时</td>
<td align="center" class="bg_tr" nowrap>提车总数</td>
<td align="center" class="bg_tr" nowrap>提单总数</td>
<td align="center" class="bg_tr" nowrap>商业总净保费</td>
<td align="center" class="bg_tr" nowrap>交强总净保费</td>
<td align="center" class="bg_tr" nowrap>商业已收净保费</td>
<td align="center" class="bg_tr" nowrap>交强已收净保费</td>
<td align="center" class="bg_tr" nowrap>总签单净保费</td>
<td align="center" class="bg_tr" nowrap>详情</td>
</tr>
<?php
foreach($user_rows as $row) {
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg" nowrap><?=$row['username']?></td>
<td align="center" class="td_bg" nowrap><?=$row['truename']?></td>
<td align="center" class="td_bg" nowrap><?=$row['total'][0]!=''?$row['total'][0]:''?></td>
<td align="center" class="td_bg" nowrap><?=$row['total'][7]>0?$row['total'][7]:''?></td>
<td align="center" class="td_bg" nowrap><?=$row['total'][1]>0?$row['total'][1]:''?></td>
<td align="center" class="td_bg" nowrap><?=$row['total'][2]>0?'¥'.number_format($row['total'][2],2):''?></td>
<td align="center" class="td_bg" nowrap><?=$row['total'][3]>0?'¥'.number_format($row['total'][3],2):''?></td>
<td align="center" class="td_bg" nowrap><?=$row['total'][4]>0?'¥'.number_format($row['total'][4],2):''?></td>
<td align="center" class="td_bg" nowrap><?=$row['total'][5]>0?'¥'.number_format($row['total'][5],2):''?></td>
<td align="center" class="td_bg" nowrap><?=$row['total'][6]>0?'¥'.number_format($row['total'][6],2):''?></td>
<td align="center" class="td_bg" nowrap>[<a href="/statistics/work-info?user_id=<?=$row['id']?>&date_begin=<?=$date_begin?>&date_end=<?=$date_end?>&date2_begin=<?=$date2_begin?>&date2_end=<?=$date2_end?>&username=<?=$username?>">详情</a>]</td>
</tr>
<?php
}
?>
<tr>
<td width="50" align="center" class="bg_tr" nowrap>汇总</td>
<td width="60" align="center" class="bg_tr" nowrap></td>
<td width="60" align="center" class="bg_tr" nowrap></td>
<td align="center" class="bg_tr" nowrap><?=$sum_total[7]?$sum_total[7]:''?></td>
<td align="center" class="bg_tr" nowrap><?=$sum_total[1]?$sum_total[1]:''?></td>
<td align="center" class="bg_tr" nowrap><?=$sum_total[2]?'¥'.number_format($sum_total[2],2):''?></td>
<td align="center" class="bg_tr" nowrap><?=$sum_total[3]?'¥'.number_format($sum_total[3],2):''?></td>
<td align="center" class="bg_tr" nowrap><?=$sum_total[4]?'¥'.number_format($sum_total[4],2):''?></td>
<td align="center" class="bg_tr" nowrap><?=$sum_total[5]?'¥'.number_format($sum_total[5],2):''?></td>
<td align="center" class="bg_tr" nowrap><?=$sum_total[6]?'¥'.number_format($sum_total[6],2):''?></td>
<td align="center" class="bg_tr" nowrap></td>
</tr>
</table>
<?php $this->endBlock(); ?>

@ -19,26 +19,26 @@ use \common\libs\MyLib;
<div id="tab-1" class="tab-pane active">
<div class="panel-body">
<div class="form-group">
<label class="col-md-1 control-label">工号</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">工号</label>
<div class="col-sm-3">
<input type="text" name="username" value="<?=$info->username?>" class="form-control">
</div>
<label class="col-md-1 control-label">登录密码</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">登录密码</label>
<div class="col-sm-3">
<input type="text" name="password" value="" class="form-control">
</div>
<label class="col-md-1 control-label">姓名</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">姓名</label>
<div class="col-sm-3">
<input type="text" name="name" value="<?=$info->name?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">联系电话</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">联系电话</label>
<div class="col-sm-3">
<input type="text" name="phone" value="<?=$info->phone?>" class="form-control">
</div>
<label class="col-md-1 control-label">所属岗位</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">所属岗位</label>
<div class="col-sm-3">
<select name="group_id" class="form-control">
<option value="0">&nbsp;</option>
<?php
@ -51,8 +51,8 @@ use \common\libs\MyLib;
?>
</select>
</div>
<label class="col-md-1 control-label">角色</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">角色</label>
<div class="col-sm-3">
<select name="role_id" class="form-control">
<?php
foreach($role_items as $role) {
@ -66,22 +66,22 @@ use \common\libs\MyLib;
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">允许登录</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">允许登录</label>
<div class="col-sm-3">
<div class="checkbox checkbox-inline">
<input type="checkbox" id="is_login" name="is_login" value="1" <?=$info->is_login==1?'checked':''?>>
<label for="is_login"></label>
</div>
</div>
<label class="col-md-1 control-label">外网登陆</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">外网登陆</label>
<div class="col-sm-3">
<div class="checkbox checkbox-inline">
<input type="checkbox" id="is_outer" name="is_outer" value="1" <?=$info->is_outer==1?'checked':''?>>
<label for="is_outer"> 允许 </label>
</div>
</div>
<label class="col-md-1 control-label">是否离职</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">是否离职</label>
<div class="col-sm-3">
<div class="checkbox checkbox-inline">
<input type="checkbox" id="is_leave" name="is_leave" value="1" <?=$info->is_leave==1?'checked':''?>>
<label for="is_leave"></label>
@ -93,56 +93,48 @@ use \common\libs\MyLib;
<div id="tab-2" class="tab-pane">
<div class="panel-body">
<div class="form-group">
<label class="col-md-1 control-label">入职日期</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">入职日期</label>
<div class="col-sm-3">
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" name="enter_date" class="form-control" value="<?=$info->enter_date?>">
<input type="text" name="enter_date" class="form-control" value="<?=$info->enter_date?>" autocomplete="off">
</div>
</div>
<label class="col-md-1 control-label">转正时间</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">转正时间</label>
<div class="col-sm-3">
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" name="job_date" class="form-control" value="<?=$info->job_date?>">
<input type="text" name="job_date" class="form-control" value="<?=$info->job_date?>" autocomplete="off">
</div>
</div>
<label class="col-md-1 control-label">调整工资</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">调整工资</label>
<div class="col-sm-3">
<input type="text" name="ext_pay" value="<?=$info->ext_pay?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">总工资</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">总工资</label>
<div class="col-sm-3">
<label class="form-control-static"><span id="total_pay">0.00</span></label>
</div>
<label class="col-md-1 control-label">试用工资(%)</label>
<div class="col-md-3">
<input type="text" name="try_rate" value="<?=$info->try_rate?>" class="form-control">
<label class="col-sm-1 control-label">试用工资</label>
<div class="col-sm-3">
<div class="input-group">
<input type="text" name="try_rate" value="<?=$info->try_rate?>" class="form-control">
<div class="input-group-addon">%</div>
</div>
</div>
<label class="col-md-1 control-label">试用工资</label>
<div class="col-md-3">
<input type="text" name="try_pay" value="<?=$info->try_pay?>" class="form-control">
<label class="col-sm-1 control-label">试用工资</label>
<div class="col-sm-3">
<div class="input-group">
<input type="text" name="try_pay" value="<?=$info->try_pay?>" class="form-control">
<div class="input-group-addon"></div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">工作制</label>
<div class="col-md-3">
<select name="worktype_id" class="form-control">
<option value="0">请选择</option>
<?php
foreach($worktypes as $worktype) {
echo '<option value="'.$worktype->id.'"';
if($info->worktype_id == $worktype->id)
echo ' selected ';
echo '>'.$worktype->name.'</option>';
}
?>
</select>
</div>
<label class="col-md-1 control-label">是否双休</label>
<div class="col-md-3">
<label class="col-sm-1 control-label">是否双休</label>
<div class="col-sm-3">
<div class="checkbox checkbox-inline">
<input type="checkbox" id="is_double" name="is_double" value="1" <?=$info->is_double==1?'checked':''?>>
<label for="is_double"></label>
@ -197,7 +189,7 @@ use \common\libs\MyLib;
->all();
foreach ($child_menus as $child_menu) {
echo '<label class="i-checks">';
echo '<input class="sub_checkbox" type="checkbox" name="menus[]" value="'.$child_menu->id.'"';
echo '<input class="three_checkbox" type="checkbox" name="menus[]" value="'.$child_menu->id.'"';
if($info->getMenus()->where('id='.$child_menu->id)->count() > 0)
echo ' checked ';
echo '>' . $child_menu->name;
@ -221,7 +213,7 @@ use \common\libs\MyLib;
</div>
<div>
<div class="row" style="margin-top: 8px;">
<div class="col-md-5 col-md-offset-5">
<div class="col-sm-5 col-sm-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong><?=$info ? '保 存':'添 加'?></strong>
</button>
@ -269,10 +261,41 @@ use \common\libs\MyLib;
$(subs[i]).prop('checked', '');
}
}
var threes = $(this).parent().parent().next().find('.three_checkbox');
for(var i = 0; i < threes.length; i++) {
if(checked) {
$(threes[i]).prop('checked', 'checked');
} else {
$(threes[i]).prop('checked', '');
}
}
});
$('.sub_checkbox').click(function() {
var checked = $(this).prop('checked');
var subs = $(this).parent().parent().parent().parent().parent().parent().prev().find('.parent_checkbox');
var parents = $(this).parent().parent().parent().parent().parent().parent().prev().find('.parent_checkbox');
for(var i = 0; i < parents.length; i++) {
if(checked) {
$(parents[i]).prop('checked', 'checked');
}
}
var threes = $(this).parent().parent().next().find('.three_checkbox');
for(var i = 0; i < threes.length; i++) {
if(checked) {
$(threes[i]).prop('checked', 'checked');
} else {
$(threes[i]).prop('checked', '');
}
}
});
$('.three_checkbox').click(function() {
var checked = $(this).prop('checked');
var parents = $(this).parent().parent().parent().parent().parent().parent().prev().find('.parent_checkbox');
for(var i = 0; i < parents.length; i++) {
if(checked) {
$(parents[i]).prop('checked', 'checked');
}
}
var subs = $(this).parent().parent().prev().find('.sub_checkbox');
for(var i = 0; i < subs.length; i++) {
if(checked) {
$(subs[i]).prop('checked', 'checked');

Loading…
Cancel
Save