|
|
@ -30,6 +30,7 @@ use common\models\GiftType3T; |
|
|
|
use common\models\GroupT; |
|
|
|
use common\models\GroupT; |
|
|
|
use common\models\Gz2T; |
|
|
|
use common\models\Gz2T; |
|
|
|
use common\models\GzT; |
|
|
|
use common\models\GzT; |
|
|
|
|
|
|
|
use common\models\InsurerCompany2T; |
|
|
|
use common\models\InsurerCompanyT; |
|
|
|
use common\models\InsurerCompanyT; |
|
|
|
use common\models\InsurerTypeT; |
|
|
|
use common\models\InsurerTypeT; |
|
|
|
use common\models\OrderCaiwuT; |
|
|
|
use common\models\OrderCaiwuT; |
|
|
@ -6538,7 +6539,10 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function actionBudianList() { |
|
|
|
public function actionBudianList() { |
|
|
|
return $this->render('budian-list'); |
|
|
|
$company_items = InsurerCompany2T::find()->all(); |
|
|
|
|
|
|
|
return $this->render('budian-list',[ |
|
|
|
|
|
|
|
'company_items' => $company_items |
|
|
|
|
|
|
|
]); |
|
|
|
} |
|
|
|
} |
|
|
|
public function actionBudianListJson() |
|
|
|
public function actionBudianListJson() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -6552,29 +6556,18 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
$company_id = $request->get('company_id'); |
|
|
|
$company_id = $request->get('company_id'); |
|
|
|
$insurer_type = $request->get('insurer_type'); |
|
|
|
$insurer_type = $request->get('insurer_type'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$budian_rate = $request->get('budian_rate'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$offset = $request->get('offset',0); |
|
|
|
$offset = $request->get('offset',0); |
|
|
|
$limit = $request->get('limit', 10); |
|
|
|
$limit = $request->get('limit', 10); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$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") |
|
|
|
->orderBy('order_t.print_date DESC'); |
|
|
|
->orderBy('order_t.print_date DESC'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.company_id='.$company_id); |
|
|
|
$query->andWhere('order_t.company2_id='.$company_id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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){ |
|
|
@ -6588,17 +6581,12 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
$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 . '"'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$total1_clear_all = $query->sum('total_clear'); |
|
|
|
|
|
|
|
$total_money_all = $query->sum('budian_money'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$total = $query->count(); |
|
|
|
$total = $query->count(); |
|
|
|
|
|
|
|
|
|
|
|
$query->offset($offset)->limit($limit); |
|
|
|
$query->offset($offset)->limit($limit); |
|
|
@ -6609,6 +6597,11 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
$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['print_date'] = $item->order->print_date; |
|
|
|
|
|
|
|
$row['insurer_type'] = '商业'; |
|
|
|
|
|
|
|
if($item->insurer_type != 1) |
|
|
|
|
|
|
|
$row['insurer_type'] = '交强'; |
|
|
|
$row['user'] = $item->user?$item->user->getShowName():''; |
|
|
|
$row['user'] = $item->user?$item->user->getShowName():''; |
|
|
|
$data['rows'][] = $row; |
|
|
|
$data['rows'][] = $row; |
|
|
|
} |
|
|
|
} |
|
|
@ -6625,84 +6618,65 @@ class FinanceController extends \frontend\controllers\UserBaseController |
|
|
|
$result['success'] = false; |
|
|
|
$result['success'] = false; |
|
|
|
$result['msg'] = '操作失败'; |
|
|
|
$result['msg'] = '操作失败'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$begin_date = $request->get('begin_date',date('Y-m-d')); |
|
|
|
$begin_date = $request->get('begin_date'); |
|
|
|
$end_date = $request->get('end_date',date('Y-m-d')); |
|
|
|
$end_date = $request->get('end_date'); |
|
|
|
|
|
|
|
$user_names = $request->get('user_names'); |
|
|
|
|
|
|
|
$begin_totalclear = $request->get('begin_totalclear'); |
|
|
|
$begin_totalclear = $request->get('begin_totalclear'); |
|
|
|
$end_totalclear = $request->get('end_totalclear'); |
|
|
|
$end_totalclear = $request->get('end_totalclear'); |
|
|
|
$car_no_type = $request->get('car_no_type'); |
|
|
|
$car_no_type = $request->get('car_no_type'); |
|
|
|
$company_id = $request->get('company_id'); |
|
|
|
$company_id = $request->get('company_id'); |
|
|
|
$insurer_type = $request->get('insurer_type'); |
|
|
|
$insurer_type = $request->get('insurer_type'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$budian_rate = $request->get('budian_rate'); |
|
|
|
$budian_rate = $request->get('budian_rate'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$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('caiwu_t.insurer_type=1') |
|
|
|
|
|
|
|
->orderBy('order_t.print_date DESC'); |
|
|
|
->orderBy('order_t.print_date DESC'); |
|
|
|
|
|
|
|
|
|
|
|
if( $insurer_type > 0) { |
|
|
|
if( $insurer_type > 0) { |
|
|
|
$query = $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 = $query->andWhere('order_t.company_id='.$company_id); |
|
|
|
$query->andWhere('order_t.company2_id='.$company_id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($car_no_type == 1){ |
|
|
|
if($car_no_type == 1){ |
|
|
|
$query = $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 = $query->andWhere('caiwu_t.car_no not like "' . '京' . '%"'); |
|
|
|
$query->andWhere('caiwu_t.car_no not like "' . '京' . '%"'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($begin_totalclear != ''){ |
|
|
|
if($begin_totalclear != ''){ |
|
|
|
$query = $query->andWhere('caiwu_t.total_clear >=' . $begin_totalclear); |
|
|
|
$query->andWhere('caiwu_t.total_clear >=' . $begin_totalclear); |
|
|
|
} |
|
|
|
} |
|
|
|
if($end_totalclear != ''){ |
|
|
|
if($end_totalclear != ''){ |
|
|
|
$query = $query->andWhere('caiwu_t.total_clear <=' . $end_totalclear); |
|
|
|
$query->andWhere('caiwu_t.total_clear <=' . $end_totalclear); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($begin_date != "") { |
|
|
|
if ($begin_date != "") { |
|
|
|
$query = $query->andWhere('order_t.print_date>="' . $begin_date . '"'); |
|
|
|
$query->andWhere('order_t.print_date>="' . $begin_date . '"'); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($end_date != "") { |
|
|
|
if ($end_date != "") { |
|
|
|
$query = $query->andWhere('order_t.print_date<="' . $end_date . '"'); |
|
|
|
$query->andWhere('order_t.print_date<="' . $end_date . '"'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$items = $query->all(); |
|
|
|
$items = $query->all(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tran = OrderCaiwuT::getDb()->beginTransaction(); |
|
|
|
$tran = OrderCaiwuT::getDb()->beginTransaction(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
foreach ($items as $item){ |
|
|
|
foreach ($items as $item){ |
|
|
|
// $order_caiwu_info = $item->orderCaiwu; |
|
|
|
|
|
|
|
// $order_info = $item->order; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($budian_rate != '') { |
|
|
|
if($budian_rate != '') { |
|
|
|
$item->budian_rate = $budian_rate; |
|
|
|
$item->budian_rate = $budian_rate; |
|
|
|
$item->budian_money = $item->total_clear * $budian_rate / 100; |
|
|
|
$item->budian_money = $item->total_clear * $budian_rate / 100; |
|
|
|
} |
|
|
|
} |
|
|
|
$item->save(); |
|
|
|
if(!$item->save()) { |
|
|
|
|
|
|
|
throw new \Exception(print_r($item->getErrors(), true)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$tran->commit(); |
|
|
|
$result['success'] = true; |
|
|
|
$result['success'] = true; |
|
|
|
$result['msg'] = '保存成功'; |
|
|
|
$result['msg'] = '保存成功'; |
|
|
|
$tran->commit(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch(\Exception $e) { |
|
|
|
} catch(\Exception $e) { |
|
|
|
$tran->rollBack(); |
|
|
|
$tran->rollBack(); |
|
|
|
throw $e; |
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|