Merge branch 'dev' into wanfang

dev
曾超新 5 years ago
commit 51fe000a89
  1. 2
      common/libs/MyLib.php
  2. 276
      frontend/controllers/FinanceController.php
  3. 3
      frontend/controllers/FixCarController.php
  4. 44
      frontend/controllers/InsurerController.php
  5. 2
      frontend/views/car/info-track.php
  6. 16
      frontend/views/finance/budian-list.php
  7. 14
      frontend/views/finance/chuna-gongzi-list.php
  8. 14
      frontend/views/finance/gongzi-all-list.php
  9. 14
      frontend/views/finance/pay2-list.php
  10. 14
      frontend/views/finance/receipt-lirun.php
  11. 18
      frontend/views/finance/receipt.php
  12. 14
      frontend/views/finance/ticheng-jisuan.php
  13. 14
      frontend/views/insurer/finance-mng.php

@ -214,7 +214,7 @@ class MyLib {
} }
} }
static public function zhifufs($cx){ static public function zhifufs($cx){
$cn = '未知';
if($cx==1) { if($cx==1) {
$cn='上门收费'; $cn='上门收费';
}elseif($cx==2){ }elseif($cx==2){

@ -214,14 +214,21 @@ class FinanceController extends \frontend\controllers\UserBaseController
foreach($items as $item) { foreach($items as $item) {
$row = $item->toArray(); $row = $item->toArray();
$row['group'] = $item->user && $item->user->group ? $item->user->group->name : ''; $row['group'] = $item->user && $item->user->group ? $item->user->group->name : '';
$row['company_name'] = $item->order->company2->name; $row['company_name'] = $item->order && $item->order->company2 ? $item->order->company2->name : 0;
$row['username'] = $item->user ? $item->user->showName : ''; $row['username'] = $item->user ? $item->user->getShowName() : 0;
$row['submit_date'] = $item->order->submit_date; $row['submit_date'] = $item->order ? $item->order->submit_date : '';
$row['print_date'] = $item->order->print_date; $row['print_date'] = $item->order ? $item->order->print_date : '';
$row['total_real'] = round($item->total_clear_real + $item->total_tax_real,2); $row['total_real'] = round($item->total_clear_real + $item->total_tax_real,2);
$data['rows'][] = $row; $data['rows'][] = $row;
} }
$data['rows'][] = array(
['商业保总额', $sum_total],
['商业净保总额', $sum_total_clear],
['回款总额', $sum_r_total],
['回款差额', $sum_total_dis]
);
return $data; return $data;
} }
public function actionReceiptImport() { public function actionReceiptImport() {
@ -5147,12 +5154,20 @@ class FinanceController extends \frontend\controllers\UserBaseController
$row['is_leave'] = $item->is_leave ? '已离职':''; $row['is_leave'] = $item->is_leave ? '已离职':'';
$pay_info = $item->getPay($pay_date); $pay_info = $item->getPay($pay_date);
$row['status_name'] = $pay_info ? $pay_info->getStatus($pay_info->status_id) : ''; $row['status_name'] = $pay_info ? $pay_info->getStatus($pay_info->status_id) : '';
$row['real_pay'] = $pay_info->base_real_pay; $row['real_pay'] = $pay_info ? $pay_info->base_real_pay : '';
$row['should_pay'] = $pay_info->ticheng_real_pay; $row['should_pay'] = $pay_info ? $pay_info->ticheng_real_pay : '';
$row['is_show'] = ($pay_info->renshi_status_id > 0 && $pay_info->chuna_status_id > 0 && $pay_info->status_id != 7 && $pay_info->status_id != 8) ? 1 : 0; $row['is_show'] = $pay_info && ($pay_info->renshi_status_id > 0 && $pay_info->chuna_status_id > 0 && $pay_info->status_id != 7 && $pay_info->status_id != 8) ? 1 : 0;
$data['rows'][] = $row; $data['rows'][] = $row;
} }
$pay_chexian = PayT::find()
->where("pay_date='{$pay_date}'")
->sum('ticheng_real_pay');
$data['rows'][] = array(
['提成工资总额', number_format($pay_chexian,2)],
);
return $data; return $data;
} }
@ -6543,6 +6558,7 @@ class FinanceController extends \frontend\controllers\UserBaseController
$query->andWhere('order_t.print_date<="' . $end_date . '"'); $query->andWhere('order_t.print_date<="' . $end_date . '"');
} }
$total = $query->count(); $total = $query->count();
$sum_total1_clear = $query->sum('total1_clear');
$query->offset($offset)->limit($limit); $query->offset($offset)->limit($limit);
$items = $query->all(); $items = $query->all();
@ -6561,6 +6577,10 @@ class FinanceController extends \frontend\controllers\UserBaseController
$data['rows'][] = $row; $data['rows'][] = $row;
} }
$data['rows'][] = array(
['商业净保总额', number_format($sum_total1_clear,2)],
);
return $data; return $data;
} }
@ -6718,18 +6738,14 @@ class FinanceController extends \frontend\controllers\UserBaseController
$group_ids = []; $group_ids = [];
if($group_id > 0) { if($group_id > 0) {
$items = GroupT::getTree($group_id); $items = GroupT::getTree($group_id);
$group_ids[] = $group_id; $group_ids[] = $group_id;
foreach($items as $group_info) { foreach($items as $group_info) {
$group_ids[] = $group_info->id; $group_ids[] = $group_info->id;
} }
} }
$query = CaiwuT::find() $query = CaiwuT::find()
->leftJoin(OrderT::tableName(), "order_t.id=caiwu_t.order_id") ->leftJoin(OrderT::tableName(), "order_t.id=caiwu_t.order_id")
->where('order_t.status_id>1') ->where('order_t.status_id>1');
->orderBy('order_t.print_date DESC');
if($user_names != '' && $user_names != 'null'){ if($user_names != '' && $user_names != 'null'){
$user_arr = explode(',',$user_names); $user_arr = explode(',',$user_names);
$user_ids = []; $user_ids = [];
@ -6738,40 +6754,33 @@ class FinanceController extends \frontend\controllers\UserBaseController
if($user) if($user)
$user_ids[] = $user->id; $user_ids[] = $user->id;
} }
$query->andWhere(['in','caiwu_t.user_id',$user_ids]); $query->andWhere(['in','caiwu_t.user_id',$user_ids]);
} }
if( $company_id > 0) { if( $company_id > 0) {
$query->andWhere('order_t.company2_id='.$company_id); $query->andWhere('order_t.company2_id='.$company_id);
} }
if( $car_no != '') { if( $car_no != '') {
$query->andWhere('order_t.car_no="'.$car_no.'"'); $query->andWhere('order_t.car_no="'.$car_no.'"');
} }
if($car_no_type == 1){ if($car_no_type == 1){
$query->andWhere('caiwu_t.car_no like "' . '京' . '%"'); $query->andWhere('caiwu_t.car_no like "' . '京' . '%"');
}elseif($car_no_type == 2){ }elseif($car_no_type == 2){
$query->andWhere('caiwu_t.car_no not like "' . '京' . '%"'); $query->andWhere('caiwu_t.car_no not like "' . '京' . '%"');
} }
if($begin_totalclear != ''){ if($begin_totalclear != ''){
$query->andWhere('caiwu_t.total_clear >=' . $begin_totalclear); $query->andWhere('caiwu_t.total_clear >=' . $begin_totalclear);
} }
if($end_totalclear != ''){ if($end_totalclear != ''){
$query->andWhere('caiwu_t.total_clear <=' . $end_totalclear); $query->andWhere('caiwu_t.total_clear <=' . $end_totalclear);
} }
if ($begin_date != "") { if ($begin_date != "") {
$query->andWhere('order_t.print_date>="' . $begin_date . '"'); $query->andWhere('order_t.print_date>="' . $begin_date . '"');
} }
if ($end_date != "") { if ($end_date != "") {
$query->andWhere('order_t.print_date<="' . $end_date . '"'); $query->andWhere('order_t.print_date<="' . $end_date . '"');
} }
$user_items = $this->my->getChildren(''); $user_items = $this->my->getChildren('');
$user_items[] = $this->my; $user_items[] = $this->my;
$row = array(); $row = array();
foreach($user_items as $user_info) { foreach($user_items as $user_info) {
if ($group_id > 0) { if ($group_id > 0) {
@ -6781,58 +6790,46 @@ class FinanceController extends \frontend\controllers\UserBaseController
} }
$row[] = $user_info->id; $row[] = $user_info->id;
} }
//加上级别筛选 //加上级别筛选
if($group_id > 0){ if($group_id > 0){
$query->andWhere(['in','caiwu_t.user_id',$row]); $query->andWhere(['in','caiwu_t.user_id',$row]);
} }
$query1 = clone $query;
if($insurer_type ==1){ if($insurer_type ==1){
$query->andWhere('caiwu_t.insurer_type=1'); $query->andWhere('caiwu_t.insurer_type=1');
} }
$query1 = clone $query;
$sums = $query1
$items = $query->all(); ->leftJoin(OrderCaiwuT::tableName(), "order_t.id=order_caiwu_t.order_id")
->select([
$total2_clear_all = $query1->andWhere('caiwu_t.insurer_type=2')->sum('total_clear'); 'sum_total1_clear' => 'sum(order_t.total1_clear)',
'sum_total2_clear' => 'sum(order_t.total2_clear)',
$yewu_ticheng_all = 0; 'sum_yeji_ticheng' => 'sum(order_caiwu_t.yeji_ticheng)',
$total1_clear_all = 0; 'sum_ticheng_money' => 'sum(order_caiwu_t.ticheng_money)',
$yeji_ticheng_all = 0; 'sum_yuangong_money' => 'sum(order_caiwu_t.yuangong_money)',
$ticheng_money_all = 0; 'sum_yewu_ticheng' => 'sum(order_caiwu_t.yewu_ticheng)',
$lipin_all = 0; ])->asArray()->one();
$liquan_all = 0; $query2 = clone $query;
$yuangong_money_all = 0; $gift_sum = $query2
foreach($items as $index => $item) { ->leftJoin(OrderGiftT::tableName(), "order_gift_t.order_id=caiwu_t.order_id")
$order_caiwu_info = $item->orderCaiwu; ->leftJoin(GiftT::tableName(), "gift_t.id=order_gift_t.gift_id")
$order_info = $item->order; ->andWhere('order_gift_t.gift_type=1 && order_gift_t.is_free=2')
->sum('gift_t.price');
$total1_clear_all += $item->total_clear; $query2 = clone $query;
$yewu_ticheng_all += $order_caiwu_info ? $order_caiwu_info->yewu_ticheng : 0; $voucher_sum = $query2
$yeji_ticheng_all += $order_caiwu_info ? $order_caiwu_info->yeji_ticheng : 0; ->leftJoin(OrderGiftT::tableName(), "order_gift_t.order_id=caiwu_t.order_id")
$ticheng_money_all += $order_info ? $order_info->ticheng_money : 0; ->leftJoin(GiftT::tableName(), "gift_t.id=order_gift_t.gift_id")
$lipin_all += $order_info ? $order_info->getGiftPrice(1,1) : 0; ->andWhere('order_gift_t.gift_type=2 && order_gift_t.is_free=2')
$liquan_all += $order_info ? $order_info->getGiftPrice(1,2) : 0; ->sum('gift_t.price');
$yuangong_money = 0;
if($order_info){
$yuangong_money = $order_info->yuangong_money>0?$order_info->yuangong_money:0;
}
$yuangong_money_all += $yuangong_money;
}
// echo $query->createCommand()->rawSql;exit;
$total = $query->count(); $total = $query->count();
$query=$query->offset($offset)->limit($limit);
$query->offset($offset)->limit($limit); $items = $query->orderBy('order_t.print_date DESC')->all();
$items = $query->all();
$data = []; $data = [];
$data['total'] = $total; $data['total'] = $total;
$data['rows'] = []; $data['rows'] = [];
foreach($items as $item) { foreach($items as $item) {
$row = $item->toArray(); $row = $item->toArray();
$row['company_name'] = $item->order->company2->name; $row['company_name'] = $item->order->company2?$item->order->company2->name:'';
$row['print_date'] = $item->order->print_date; $row['print_date'] = $item->order->print_date;
$row['yeji_rate'] = $item->orderCaiwu->yeji_rate; $row['yeji_rate'] = $item->orderCaiwu->yeji_rate;
$row['yeji_ticheng'] = $item->orderCaiwu->yeji_ticheng; $row['yeji_ticheng'] = $item->orderCaiwu->yeji_ticheng;
@ -6843,17 +6840,17 @@ class FinanceController extends \frontend\controllers\UserBaseController
$row['yuangong_money'] = $item->order->yuangong_money; $row['yuangong_money'] = $item->order->yuangong_money;
$row['yewu_ticheng'] = $item->orderCaiwu->yewu_ticheng; $row['yewu_ticheng'] = $item->orderCaiwu->yewu_ticheng;
if($item->order->car->op2_id > 0) { if($item->order->car->op2_id > 0) {
$row['op_user'] = $item->order->car->op2->showName; $row['op_user'] = $item->order->car->op2?$item->order->car->op2->showName:'';
$row['op_user1'] = $item->order->car->op1->showName; $row['op_user1'] = $item->order->car->op1?$item->order->car->op1->showName:'';
} else { } else {
$row['op_user'] = $item->order->car->op1->showName; $row['op_user'] = $item->order->car->op1?$item->order->car->op1->showName:'';
$row['op_user1'] = ''; $row['op_user1'] = '';
} }
$row['first_xinbao_ticheng'] = $item->orderCaiwu->first_xinbao_ticheng; $row['first_xinbao_ticheng'] = $item->orderCaiwu->first_xinbao_ticheng;
$row['hebao_ticheng'] = $item->orderCaiwu->hebao_ticheng; $row['hebao_ticheng'] = $item->orderCaiwu->hebao_ticheng;
$row['op1_user'] = $item->order->op1->showName; $row['op1_user'] = $item->order->op1?$item->order->op1->showName:'';
$row['zhengben_ticheng'] = $item->orderCaiwu->zhengben_ticheng; $row['zhengben_ticheng'] = $item->orderCaiwu->zhengben_ticheng;
$row['op2_user'] = $item->order->op2->showName; $row['op2_user'] = $item->order->op2?$item->order->op2->showName:'';
$row['dz_ticheng1'] = $item->orderCaiwu->dz_ticheng1; $row['dz_ticheng1'] = $item->orderCaiwu->dz_ticheng1;
$row['dz_names1'] = $item->orderCaiwu->dz_names1; $row['dz_names1'] = $item->orderCaiwu->dz_names1;
$row['dz_ticheng2'] = $item->orderCaiwu->dz_ticheng2; $row['dz_ticheng2'] = $item->orderCaiwu->dz_ticheng2;
@ -6866,6 +6863,16 @@ class FinanceController extends \frontend\controllers\UserBaseController
$row['dz_names5'] = $item->orderCaiwu->dz_names5; $row['dz_names5'] = $item->orderCaiwu->dz_names5;
$data['rows'][] = $row; $data['rows'][] = $row;
} }
$data['rows'][] = array(
['保费总额', number_format($sums['sum_total1_clear'] + $sums['sum_total2_clear'],2)],
['商业净保总额', number_format($sums['sum_total1_clear'],2)],
['基本提成合计', number_format($sums['sum_yeji_ticheng'],2)],
['加点提成合计', number_format($sums['sum_ticheng_money'],2)],
['自费礼品合计', number_format($gift_sum,2)],
['自费礼券合计', number_format($voucher_sum,2)],
['自费减免合计', number_format($sums['sum_yuangong_money'],2)],
['提成合计', number_format($sums['sum_yewu_ticheng'],2)]
);
return $data; return $data;
} }
@ -7379,6 +7386,9 @@ class FinanceController extends \frontend\controllers\UserBaseController
$query = $query->offset($offset)->limit($limit); $query = $query->offset($offset)->limit($limit);
$items = $query->all(); $items = $query->all();
$pay_chexian = PayOrderUserT::find()
->where("pay_date='{$pay_date}'")
->sum('real_pay');
$data = []; $data = [];
$data['total'] = $total; $data['total'] = $total;
@ -7394,6 +7404,10 @@ class FinanceController extends \frontend\controllers\UserBaseController
$data['rows'][] = $row; $data['rows'][] = $row;
} }
$data['rows'][] = array(
['提成工资总额', number_format($pay_chexian,2)],
);
return $data; return $data;
} }
/** /**
@ -7585,7 +7599,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
$limit = $request->get('limit', 10); $limit = $request->get('limit', 10);
$user_id = $this->my->id; $user_id = $this->my->id;
// var_dump($user_id);
$query = UserT::find() $query = UserT::find()
->leftJoin('pay_t','pay_t.user_id=user_t.id') ->leftJoin('pay_t','pay_t.user_id=user_t.id')
->where('group_id>0 and is_delete=0'); ->where('group_id>0 and is_delete=0');
@ -7626,8 +7639,17 @@ class FinanceController extends \frontend\controllers\UserBaseController
$data['rows'][] = $row; $data['rows'][] = $row;
} }
$pay_chexian = PayT::find()
->where("pay_date='{$pay_date}'")
->sum('ticheng_real_pay');
$data['rows'][] = array(
['提成工资总额', number_format($pay_chexian,2)],
);
return $data; return $data;
} }
/** /**
* 出纳工资-详情 * 出纳工资-详情
* @return string * @return string
@ -7790,14 +7812,9 @@ class FinanceController extends \frontend\controllers\UserBaseController
$zbname = $request->get('zbname'); $zbname = $request->get('zbname');
//级别 //级别
$group_id = $request->get('group_id'); $group_id = $request->get('group_id');
$group_items = GroupT::getTree((int)$this->my->group_id);
if($this->my->id == 1)
$group_items = GroupT::getTree();
$group_ids[] = $group_id; $group_ids[] = $group_id;
if($group_id > 0) { if($group_id > 0) {
$items = GroupT::getTree($group_id); $items = GroupT::getTree($group_id);
foreach($items as $group_info) { foreach($items as $group_info) {
$group_ids[] = $group_info->id; $group_ids[] = $group_info->id;
} }
@ -7806,70 +7823,33 @@ class FinanceController extends \frontend\controllers\UserBaseController
$query = CaiwuT::find() $query = CaiwuT::find()
->leftJoin(OrderT::tableName(), "order_t.id=caiwu_t.order_id") ->leftJoin(OrderT::tableName(), "order_t.id=caiwu_t.order_id")
->where('order_t.status_id>1'); ->where('order_t.status_id>1');
switch ($sort_key) {
case 'total':
$sort = 'caiwu_t.total ';
break;
case 'total_clear':
$sort = 'caiwu_t.total_clear ';
break;
case 'total_rate':
$sort = 'caiwu_t.total_rate ';
break;
case 'print_date'://默认按照print_date排序
default:
$sort = 'order_t.print_date ';
break;
}
switch ($sort_value) {
case 'ASC':
$sort .= 'ASC';
break;
case 'DESC':
default:
$sort .= 'DESC';
break;
}
$query->orderBy($sort);
if( $insurer_type != 0) { if( $insurer_type != 0) {
$query->andWhere('caiwu_t.insurer_type='.$insurer_type); $query->andWhere('caiwu_t.insurer_type='.$insurer_type);
} }
if( $company_id > 0) { if( $company_id > 0) {
$query->andWhere('order_t.company2_id='.$company_id); $query->andWhere('order_t.company2_id='.$company_id);
} }
if ($username != "") { if ($username != "") {
// $userdata = UserT::findOne(['username'=>$username]);
$userdata = UserT::find()->where('username="'.$username.'"')->andwhere('is_leave=0')->one(); $userdata = UserT::find()->where('username="'.$username.'"')->andwhere('is_leave=0')->one();
if($userdata){ if($userdata){
$query->andWhere('caiwu_t.user_id = ' . $userdata->id . ''); $query->andWhere('caiwu_t.user_id = ' . $userdata->id . '');
} }
} }
if ($hebaoname != "") { if ($hebaoname != "") {
// $userdata = UserT::findOne(['username'=>$username]);
$userdata = UserT::find()->where('username="'.$hebaoname.'"')->andwhere('is_leave=0')->one(); $userdata = UserT::find()->where('username="'.$hebaoname.'"')->andwhere('is_leave=0')->one();
if($userdata){ if($userdata){
$query->andWhere('order_t.op1_id = ' . $userdata->id . ''); $query->andWhere('order_t.op1_id = ' . $userdata->id . '');
} }
} }
if ($zbname != "") { if ($zbname != "") {
// $userdata = UserT::findOne(['username'=>$username]);
$userdata = UserT::find()->where('username="'.$zbname.'"')->andwhere('is_leave=0')->one(); $userdata = UserT::find()->where('username="'.$zbname.'"')->andwhere('is_leave=0')->one();
if($userdata){ if($userdata){
$query->andWhere('order_t.op2_id = ' . $userdata->id . ''); $query->andWhere('order_t.op2_id = ' . $userdata->id . '');
} }
} }
if ($car_no != "") { if ($car_no != "") {
$query->andWhere('caiwu_t.car_no like "%' . $car_no . '%"'); $query->andWhere('caiwu_t.car_no like "%' . $car_no . '%"');
} }
if ($insurer_no != "") { if ($insurer_no != "") {
$query->andWhere('caiwu_t.insurer_no like "' . $insurer_no . '%"'); $query->andWhere('caiwu_t.insurer_no like "' . $insurer_no . '%"');
} }
@ -7899,10 +7879,8 @@ class FinanceController extends \frontend\controllers\UserBaseController
//找出$group_id 有多少在职的user_ids //找出$group_id 有多少在职的user_ids
// 现在的搜索条件 // 现在的搜索条件
$userSql = ''; $userSql = '';
$user_items = $this->my->getChildren($userSql); $user_items = $this->my->getChildren($userSql);
$user_items[] = $this->my; $user_items[] = $this->my;
$row = array(); $row = array();
foreach($user_items as $user_info) { foreach($user_items as $user_info) {
if ($group_id > 0) { if ($group_id > 0) {
@ -7910,36 +7888,71 @@ class FinanceController extends \frontend\controllers\UserBaseController
continue; continue;
} }
} }
$row[] = $user_info->id; $row[] = $user_info->id;
} }
//加上级别筛选 //加上级别筛选
if($group_id > 0){ if($group_id > 0){
$query->andWhere(['in','caiwu_t.user_id',$row]); $query->andWhere(['in','caiwu_t.user_id',$row]);
} }
$query1 = clone $query;
$item1s = $query1->all();
// echo $query->createCommand()->rawSql;
$total = $query->count(); $total = $query->count();
$sum_r_total = $query->sum('r_total'); $query1 = clone $query;
//商业净保费综合 $sums = $query1->select([
$sum_total_clear = $query->sum('total_clear'); //是错误的 'sum_total1' => 'sum(order_t.total1)',
'sum_r_total' => 'sum(caiwu_t.r_total)',
//商业总保费 'sum_total1_clear' => 'sum(order_t.total1_clear)',
$sum_total = $query->sum('total'); 'sum_budian' => 'sum(order_t.yuangong_money)',
'sum_r_budian' => 'sum(ifnull(caiwu_t.budian_rate,0)*total_clear/100)',
'sum_total1_dis' => 'sum(order_t.total1_dis)',
])->asArray()->one();
$query2 = clone $query;
$gift_sum = $query2
->leftJoin(OrderGiftT::tableName(), "order_gift_t.order_id=caiwu_t.order_id")
->leftJoin(GiftT::tableName(), "gift_t.id=order_gift_t.gift_id")
->andWhere('caiwu_t.insurer_type=1')
->andWhere('order_gift_t.gift_type=1 && order_gift_t.is_free=2')
->sum('gift_t.price');
$query2 = clone $query;
$voucher_sum = $query2
->leftJoin(OrderGiftT::tableName(), "order_gift_t.order_id=caiwu_t.order_id")
->leftJoin(GiftT::tableName(), "gift_t.id=order_gift_t.gift_id")
->andWhere('caiwu_t.insurer_type=1')
->andWhere('order_gift_t.gift_type=2 && order_gift_t.is_free=2')
->sum('gift_t.price');
$query2 = clone $query;
$gongzi_sum = $query2
->leftJoin(PayOrderUserT::tableName(), "pay_order_user_t.order_id=caiwu_t.order_id")
->andWhere('caiwu_t.insurer_type=1')
->sum('pay_order_user_t.real_pay');
$sum_total_dis = $query->sum('total_dis'); switch ($sort_key) {
case 'total':
$sort = 'caiwu_t.total ';
break;
case 'total_clear':
$sort = 'caiwu_t.total_clear ';
break;
case 'total_rate':
$sort = 'caiwu_t.total_rate ';
break;
case 'print_date'://默认按照print_date排序
default:
$sort = 'order_t.print_date ';
break;
}
switch ($sort_value) {
case 'ASC':
$sort .= 'ASC';
break;
case 'DESC':
default:
$sort .= 'DESC';
break;
}
$query = $query->offset($offset)->limit($limit); $query = $query->orderBy($sort)->offset($offset)->limit($limit);
$items = $query->all(); $items = $query->all();
// var_dump($items);
$data = []; $data = [];
$data['total'] = $total; $data['total'] = $total;
$data['rows'] = []; $data['rows'] = [];
@ -7972,8 +7985,19 @@ class FinanceController extends \frontend\controllers\UserBaseController
$data['rows'][] = $row; $data['rows'][] = $row;
} }
return $data; $data['rows'][] = array(
['商业保总额', number_format($sums['sum_total1'],2)],
['商业净保总额', number_format($sums['sum_total1_clear'],2)],
['回款总额', number_format($sums['sum_r_total'],2)],
['补点总额', number_format($sums['sum_budian'],2)],
['回款补点总额', number_format($sums['sum_r_budian'],2)],
['减免总额', number_format($sums['sum_total1_dis'],2)],
['礼品礼券自费总额', number_format($gift_sum + $voucher_sum,2)],
['工资总额', number_format($gongzi_sum,2)],
['利润总额', number_format($sums['sum_total1_clear'] + $sums['sum_budian'] - $sums['sum_total1_dis'] - $gongzi_sum - $gift_sum - $voucher_sum,2)],
);
return $data;
} }
public function actionGongziAllReturnSave() public function actionGongziAllReturnSave()

@ -207,9 +207,6 @@ class FixCarController extends BaseController
$info->displacement_id = $car_info->displacement_id; $info->displacement_id = $car_info->displacement_id;
$info->car_year = $car_info->car_year; $info->car_year = $car_info->car_year;
$info->status = $status; $info->status = $status;
// var_dump($car_info->car_year);
// var_dump($info->car_year);
// die;
} }
if($car_id == 0) { if($car_id == 0) {
$car_id = $info->car_id; $car_id = $info->car_id;

@ -1126,17 +1126,14 @@ class InsurerController extends BaseController
if($group_id > 0) { if($group_id > 0) {
$items = GroupT::getTree($group_id); $items = GroupT::getTree($group_id);
foreach($items as $group_info) { foreach($items as $group_info) {
$group_ids[] = $group_info->id; $group_ids[] = $group_info->id;
} }
} }
$query = OrderT::find() $query = OrderT::find()
->leftJoin('order_caiwu_t','order_caiwu_t.order_id=order_t.id') ->leftJoin('order_caiwu_t','order_caiwu_t.order_id=order_t.id')
->where('order_caiwu_t.status_id>0') ->where('order_caiwu_t.status_id>0');
->orderBy('order_t.print_date asc');
if($car_man != '') { if($car_man != '') {
$query->andWhere('id_man="'.$car_man.'"'); $query->andWhere('id_man="'.$car_man.'"');
} }
@ -1199,9 +1196,7 @@ class InsurerController extends BaseController
continue; continue;
} }
} }
$row[] = $user_info->id; $row[] = $user_info->id;
} }
//加上级别筛选 //加上级别筛选
@ -1209,8 +1204,15 @@ class InsurerController extends BaseController
$query = $query->andWhere(['in','order_t.user_id',$row]); $query = $query->andWhere(['in','order_t.user_id',$row]);
} }
$total = $query->count(); $total = $query->count();
$query1 = clone $query;
$query = $query->offset($offset)->limit($limit); $sums = $query1->select([
'sum_total1' => 'sum(order_t.total1)',
'sum_total1_clear' => 'sum(order_t.total1_clear)',
'sum_yuangong_money' => 'sum(order_t.yuangong_money)',
'sum_non_total1_dis' => 'sum(order_t.non_total1_dis)',
'sum_total1_dis' => 'sum(order_t.total1_dis)',
])->asArray()->one();
$query = $query->orderBy('order_t.print_date asc')->offset($offset)->limit($limit);
$items = $query->all(); $items = $query->all();
$data = []; $data = [];
@ -1218,18 +1220,26 @@ class InsurerController extends BaseController
$data['rows'] = []; $data['rows'] = [];
foreach($items as $item) { foreach($items as $item) {
$row = $item->toArray(); $row = $item->toArray();
$row['company_name'] = $item->company2->name; $row['company_name'] = $item->company2 ? $item->company2->name : '';
$row['path'] = ($item->user && $item->user->group) ? $item->user->group->getPath():''; $row['path'] = ($item->user && $item->user->group) ? $item->user->group->getPath() : '';
$row['user_name'] = $item->user?$item->user->getShowName():''; $row['user_name'] = $item->user ? $item->user->getShowName() : '';
$row['total_user_real'] = number_format($item->total1_dis + $item->yuangong_money,2); $row['total_user_real'] = number_format($item->total1_dis + $item->yuangong_money, 2);
$row['transfer_date'] = $item->caiwu->transfer_date; $row['transfer_date'] = $item->caiwu->transfer_date;
$row['caiwu_status_name'] = $item->caiwu->caiwuStatus->name; $row['caiwu_status_name'] = $item->caiwu && $item->caiwu->caiwuStatus ? $item->caiwu->caiwuStatus->name : '';
$row['shoufei_name'] = MyLib::zhifufs($item->shoufei_id); $row['shoufei_name'] = MyLib::zhifufs($item->shoufei_id);
$row['status_name'] = $item->caiwu->status->name; $row['status_name'] = $item->caiwu && $item->caiwu->status ? $item->caiwu->status->name : '';
$row['lock_man'] = $item->caiwu->lock?$item->caiwu->lock->getShowName():''; $row['lock_man'] = $item->caiwu->lock?$item->caiwu->lock->getShowName():'';
$data['rows'][] = $row; $data['rows'][] = $row;
} }
$data['rows'][] = array(
['商业保总额', number_format($sums['sum_total1'],2)],
['商业净保总额', number_format($sums['sum_total1_clear'],2)],
['业务自付', number_format($sums['sum_yuangong_money'],2)],
['公司代付非车险', number_format($sums['sum_non_total1_dis'],2)],
['公司返金额', number_format($sums['sum_total1_dis'],2)],
['实返现金额', number_format($sums['sum_yuangong_money'] + $sums['sum_total1_dis'],2)]
);
return $data; return $data;
} }
@ -3658,13 +3668,13 @@ class InsurerController extends BaseController
['quality' => 100]);//生成缩略图的质量 ['quality' => 100]);//生成缩略图的质量
//图片打水印 //图片打水印
$bianhao = '券号:' . $bianhao; $bianhao = '券号:' . $bianhao;
\yii\imagine\Image::text($liquanSrc, $bianhao, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [325, 85], ['color' => 'ffffff', 'size' => 14]) \yii\imagine\Image::text($liquanSrc, $bianhao, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [27, 25], ['color' => '000000', 'size' => 14])
->save(Yii::getAlias($imgstr)); ->save(Yii::getAlias($imgstr));
\yii\imagine\Image::text($imgstr, $car_no, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [900, 400], ['color' => 'ffffff', 'size' => 16]) \yii\imagine\Image::text($imgstr, $car_no, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [425, 222], ['color' => '000000', 'size' => 16])
->save(Yii::getAlias($imgstr)); ->save(Yii::getAlias($imgstr));
$panduan = \yii\imagine\Image::text($imgstr, $endDate, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [850, 440], ['color' => 'ffffff', 'size' => 16]) $panduan = \yii\imagine\Image::text($imgstr, $endDate, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [425, 245], ['color' => '000000', 'size' => 16])
->save(Yii::getAlias($imgstr)); ->save(Yii::getAlias($imgstr));
} }

@ -39,7 +39,7 @@ use \common\libs\MyLib;
<th class="bg-warning" nowrap>车架号</th> <th class="bg-warning" nowrap>车架号</th>
<td><?=$car_info->car_frame_no?></td> <td><?=$car_info->car_frame_no?></td>
<th class="bg-warning" nowrap>车辆使用性质</th> <th class="bg-warning" nowrap>车辆使用性质</th>
<td><?=$car_info->carUse->name?></td> <td><?=$car_info->carUse?$car_info->carUse->name:''?></td>
</tr> </tr>
<tr> <tr>
<th class="bg-warning">车主</th> <th class="bg-warning">车主</th>

@ -40,8 +40,6 @@ use \common\libs\MyLib;
<?php <?php
foreach($company_items as $item) { foreach($company_items as $item) {
echo '<option value="'.$item->id.'"'; echo '<option value="'.$item->id.'"';
if($item->id == $company_id)
echo ' selected ';
echo '>'.$item->name.'</option>'; echo '>'.$item->name.'</option>';
} }
?> ?>
@ -126,6 +124,20 @@ use \common\libs\MyLib;
o['offset'] = params['offset']; o['offset'] = params['offset'];
o['limit'] = params['limit']; o['limit'] = params['limit'];
return o; return o;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="18" class="text-left">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +
'<span class="font-bold">'+ d[1] +'</span>' +
'</div>'
});
html += '</td></tr></tfoot>';
$('#listTable').find('tfoot').remove();
$('#listTable').append(html);
return res;
} }
}); });
return false; return false;

@ -125,6 +125,20 @@ use \common\libs\MyLib;
o['offset'] = params['offset']; o['offset'] = params['offset'];
o['limit'] = params['limit']; o['limit'] = params['limit'];
return o; return o;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="8" class="">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +
'<span class="font-bold">'+ d[1] +'</span>' +
'</div>'
});
html += '</td></tr></tfoot>';
$('#listTable').find('tfoot').remove();
$('#listTable').append(html);
return res;
} }
}); });
return false; return false;

@ -128,6 +128,20 @@ use \common\libs\MyLib;
o['offset'] = params['offset']; o['offset'] = params['offset'];
o['limit'] = params['limit']; o['limit'] = params['limit'];
return o; return o;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="8" class="">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +
'<span class="font-bold">'+ d[1] +'</span>' +
'</div>'
});
html += '</td></tr></tfoot>';
$('#listTable').find('tfoot').remove();
$('#listTable').append(html);
return res;
} }
}); });
return false; return false;

@ -128,6 +128,20 @@ use \common\libs\MyLib;
o['offset'] = params['offset']; o['offset'] = params['offset'];
o['limit'] = params['limit']; o['limit'] = params['limit'];
return o; return o;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="8" class="">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +
'<span class="font-bold">'+ d[1] +'</span>' +
'</div>'
});
html += '</td></tr></tfoot>';
$('#listTable').find('tfoot').remove();
$('#listTable').append(html);
return res;
} }
}); });
return false; return false;

@ -145,6 +145,20 @@ use \common\libs\MyLib;
o['offset'] = params['offset']; o['offset'] = params['offset'];
o['limit'] = params['limit']; o['limit'] = params['limit'];
return o; return o;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="22" class="">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +
'<span class="font-bold">'+ d[1] +'</span>' +
'</div>'
});
html += '</td></tr></tfoot>';
$('#listTable').find('tfoot').remove();
$('#listTable').append(html);
return res;
} }
}); });
return false; return false;

@ -23,8 +23,8 @@ use \common\libs\MyLib;
<div class="form-group" style="margin-bottom: 8px;"> <div class="form-group" style="margin-bottom: 8px;">
<label for="name">匹配程度</label> <label for="name">匹配程度</label>
<select name="status" class="form-control"> <select name="status" class="form-control">
<option value=0>全部</option> <option value=0 selected>全部</option>
<option value=1 selected>未匹配</option> <option value=1>未匹配</option>
<option value=2 >已完成</option> <option value=2 >已完成</option>
<option value=3 >匹配差额</option> <option value=3 >匹配差额</option>
</select> </select>
@ -145,6 +145,20 @@ use \common\libs\MyLib;
o['offset'] = params['offset']; o['offset'] = params['offset'];
o['limit'] = params['limit']; o['limit'] = params['limit'];
return o; return o;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="18" class="text-center">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +
'<span class="font-bold">'+ d[1] +'</span>' +
'</div>'
});
html += '</td></tr></tfoot>';
$('#listTable').find('tfoot').remove();
$('#listTable').append(html);
return res;
} }
}); });
return false; return false;

@ -209,6 +209,20 @@ use \common\libs\MyLib;
o['offset'] = params['offset']; o['offset'] = params['offset'];
o['limit'] = params['limit']; o['limit'] = params['limit'];
return o; return o;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="33" class="">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +
'<span class="font-bold">'+ d[1] +'</span>' +
'</div>'
});
html += '</td></tr></tfoot>';
$('#listTable').find('tfoot').remove();
$('#listTable').append(html);
return res;
} }
}); });
return false; return false;

@ -123,6 +123,20 @@ use \common\libs\MyLib;
o['limit'] = params['limit']; o['limit'] = params['limit'];
o['offset'] = params['offset']; o['offset'] = params['offset'];
return o; return o;
},
responseHandler: function (res) {
var totals = res.rows.pop();
var html = '<tfoot><tr><td colspan="18" class="text-center">';
$.each(totals,function (i,d) {
html += '<div class="layui-show-md-inline-block m-r-lg m-l-lg">' +
'<span>'+ d[0] +':</span>' +
'<span class="font-bold">'+ d[1] +'</span>' +
'</div>'
});
html += '</td></tr></tfoot>';
$('#listTable').find('tfoot').remove();
$('#listTable').append(html);
return res;
} }
}); });
return false; return false;

Loading…
Cancel
Save