diff --git a/common/models/CarT.php b/common/models/CarT.php
index 3dbef78..da67053 100644
--- a/common/models/CarT.php
+++ b/common/models/CarT.php
@@ -183,65 +183,6 @@ class CarT extends \common\models\Base
}
-// public function getLocation()
-// {
-// $name = '';
-// switch($this->location) {
-// case 1:
-// $name = 'A库';
-// break;
-// case 2:
-// $carb=CarBT::findOne(['id'=>$this->id]);
-// if($carb->back==1){
-// $name = 'B库(新保处理无效库)';
-// }else{
-// $name = 'B库';
-// }
-// break;
-// case 3:
-// $name = 'C库';
-// break;
-// case 4:
-// $name = 'D库';
-// $card=CarDT::findOne(['id'=>$this->id]);
-// if($card->back==1){
-// $name = 'D库(续保处理无效库)';
-// }else{
-// $name = 'D库';
-// }
-// break;
-// case 5:
-// $name = '无效库';
-// break;
-// case 6:
-// $name = 'E库';
-// break;
-// case 7:
-// $name = 'F库';
-// break;
-// case 8:
-// $name = 'F1新保四大公司无效库';
-// break;
-// case 9:
-// $name = 'F2新保其他小公司无效库';
-// break;
-// case 10:
-// $name = 'F3新保正常无效库';
-// break;
-// case 11:
-// $name = 'F4续保四大公司无效库';
-// break;
-// case 12:
-// $name = 'F5续保其他小公司无效库';
-// break;
-// case 13:
-// $name = 'F6续保正常无效库';
-// break;
-// default:
-// $name = '';
-// }
-// return $name;
-// }
public function getLocation()
{
$name = '';
@@ -331,4 +272,14 @@ class CarT extends \common\models\Base
return $this->hasOne(CarFT::className(),['id'=>'id']);
return null;
}
+
+ public function getOp1()
+ {
+ return $this->hasOne(UserT::className(),['id'=>'op1_id']);
+ }
+
+ public function getOp2()
+ {
+ return $this->hasOne(UserT::className(),['id'=>'op2_id']);
+ }
}
diff --git a/common/models/OrderT.php b/common/models/OrderT.php
index 2358986..dce21ae 100644
--- a/common/models/OrderT.php
+++ b/common/models/OrderT.php
@@ -349,7 +349,7 @@ class OrderT extends \common\models\Base
public function getUsers()
{
- return $this->hasMany(OrderUserT::class,['order_id'=>'id']);
+ return $this->hasMany(OrderUserT::className(),['order_id'=>'id']);
}
/**
diff --git a/frontend/controllers/BusinessOrderController.php b/frontend/controllers/BusinessOrderController.php
index 44eb27d..119aa09 100644
--- a/frontend/controllers/BusinessOrderController.php
+++ b/frontend/controllers/BusinessOrderController.php
@@ -208,7 +208,7 @@ class BusinessOrderController extends FixCarBaseController
if ('' !== $car_no) $query = $query->andWhere(['like', 'car_no', $car_no]);
if ($status >= 0) $query = $query->andWhere('status = \'' . $status.'\'');
if ('' !== $id_man) $query = $query->andWhere(['like', 'id_man', $id_man]);
- if ('' !== $id_phone) $query = $query->andWhere(['like', 'id_phone', $id_phone]);
+ if ('' !== $id_phone) $query = $query->andWhere(['like', 'id_man_phone', $id_phone]);
if ('' !== $link_man) $query = $query->andWhere(['like', 'link_man', $link_man]);
if ('' !== $link_phone) $query = $query->andWhere(['like', 'link_phone', $link_phone]);
if ('' !== $start_time && '' !== $end_time) $query = $query->andWhere('created_at >= \'' . $start_time . '\' AND created_at <=\'' . $end_time . '\'');
@@ -245,7 +245,7 @@ class BusinessOrderController extends FixCarBaseController
if ('' !== $car_no) $query = $query->joinWith('fix')->andWhere(['like', 'fix_car_t.car_no', $car_no]);
if ('' !== $status) $query = $query->joinWith('fix')->andWhere('fix_car_t.status = ' . $status);
if ('' !== $id_man) $query = $query->joinWith('fix')->andWhere(['like', 'fix_car_t.id_man', $id_man]);
- if ('' !== $id_phone) $query = $query->joinWith('fix')->andWhere(['like', 'fix_car_t.id_phone', $id_phone]);
+ if ('' !== $id_phone) $query = $query->joinWith('fix')->andWhere(['like', 'fix_car_t.id_man_phone', $id_phone]);
if ('' !== $link_man) $query = $query->joinWith('fix')->andWhere(['like', 'fix_car_t.link_man', $link_man]);
if ('' !== $link_phone) $query = $query->joinWith('fix')->andWhere(['like', 'fix_car_t.link_phone', $link_phone]);
if ('' !== $start_time && '' !== $end_time) $query = $query->joinWith('fix')->andWhere('fix_car_t.created_at >= \'' . $start_time . '\' AND fix_car_t.created_at <=\'' . $end_time . '\'');
@@ -385,9 +385,9 @@ class BusinessOrderController extends FixCarBaseController
$info->engine_no = $car_info->engine_no;
$info->car_frame_no = $car_info->car_frame_no;
$info->id_man = $car_info->id_man;
- $info->id_phone = $car_info->phone;
+ $info->id_man_phone = $car_info->car_man_phone;
$info->link_man = $car_info->car_man;
- $info->link_phone = $car_info->phone;
+ $info->link_man_phone = $car_info->car_man_phone;
$info->company = $car_info->company;
$info->brand_id = $car_info->brand_id;
$info->series_id = $car_info->series_id;
diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php
index dbad272..ad56f0c 100644
--- a/frontend/controllers/CarController.php
+++ b/frontend/controllers/CarController.php
@@ -151,171 +151,6 @@ class CarController extends BaseController
$objWriter = \PHPExcel_IOFactory::createWriter($objectPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
- //查找平移数据问题
- public function actionPingyi()
- {
- //SELECT * FROM `car_log_t` WHERE `remark` = '从3005(饶丽云) 平移车辆给 3011(柳明芳·)' and `op_time` <'1541548800' and `op_man` ='0002(魏媛)' and `op_time` >'1533081600' ORDER BY `op_time` asc
-// ['like', 'name', 'tester']
-// ['remark'=>'从3005(饶丽云) 平移车辆给 3011(柳明芳·)'])
- $datas=CarLogT::find()->where(['like', 'remark', '平移车辆'])
- ->andWhere(['<', 'op_time', '1541548800'])
- ->andWhere(['>', 'op_time', '1533081600'])
- ->andWhere(['op_man' =>'0002(魏媛)']);
-// ->limit(29);
-//
- $bnum=0;
- $enum=0;
- $enum1=0;
- $enum9=0;
-// echo '
';
- foreach($datas->each(29) as $b_info) {
-//// print_r($b_info->car_id);
-
-// print_r($b_info->remark);
-// echo '
';
- $car= CarT::findOne(['id'=>$b_info->car_id]);
- //开始头字母
- $bestr=substr($b_info->remark,3,1);
- $bestr4=substr($b_info->remark,3,4);
-// var_dump($bestr4);
-// die;
- //分配的工号
- $endstr=substr($b_info->remark,35);
-// echo '
';
-// var_dump($bestr);
-// echo '
';
-// var_dump($endstr);
-// echo '
';
- if($bestr==3){
- continue;
-// $car->op_user3=$endstr;
-// $this->addLog($car->id,'补全平移数据问题',1);
- $bnum++;
- }elseif($bestr==1){
- continue;
-// $car->op_user1=$endstr;
-// $this->addLog($car->id,'补全平移数据问题',1);
- $enum++;
- }elseif($bestr==2){
-// if($bestr4==2057){
-// $car->op_user1=$endstr;
-// }else{
-// continue;
-// }
- continue;
- $enum1++;
- }elseif($bestr==9){
-// continue;
- $car->op_user3=$endstr;
- $this->addLog($car->id,'补全平移数据问题',1);
- $enum9++;
- }else{
- continue;
- }
-
-//
- $car->save();
-//// print_r($car);
-//
- }
- var_dump($bnum);
- echo '
';
- var_dump($enum);
- echo '
';
- var_dump($enum1);
- echo '
';
- var_dump($enum9);
-
-
-// echo $datas->createCommand()->rawSql;
-// $datas->all();
-// var_dump($datas) ;
-// $$datas->all();
-// var_dump($datas);
- return $this->renderPartial('index');
-
- }
- //查找重复的数据
- public function actionChongf()
- {
- //select car_no,count(*) as count from car_t group by car_no having count>1
- $num=0;
- $cnum=0;
- $xnum=0;
-
- $query=CarT::find()->select('car_no,count(*) count,id,location,hiddenes')->groupBy('car_no')->having(['>' ,'count',1])
- ->where('location=3');
-// aa($query);
- $data=$query->all();
- foreach($data as $vs){
- $carlogNum=CarLogT::find()->where(['car_id'=>$vs->id])
-// ->andWhere(['remark'=> '从F库分配到C库'])
- ->andWhere(['or', 'remark="从A库分配到C库"', 'remark="从B库分配到C库"', 'remark="从E库分配到C库"', 'remark="从F库分配到C库"', 'remark="从无效库分配到C库"'])
- ->count();
- if($carlogNum==1){
-// dd($info);
- $dear= CarT::findOne(['id'=>$vs->id]);
- $dear->hiddenes=1;
-// $sa=$info->id();
- if($dear->save()){
- $num++;
- }
-// echo $info->car_no;
-
- }else{
-// $xnum++;
- continue;
-//
- }
- }
-
-// foreach($query->each(10) as $info) {
-//// $carlogNum=CarLogT::find()->where(['car_id'=>$info->id])->count();
-//// if($carlogNum>=1){
-//// continue;
-//// }else{
-//// $num++;
-//// }
-//
-//// if($info->location==3){
-//// $cnum++;
-//// }else{
-//// continue;
-//// }
-//// ['or', 'id=1', 'id=2']
-// $carlogNum=CarLogT::find()->where(['car_id'=>$info->id])
-//// ->andWhere(['remark'=> '从F库分配到C库'])
-// ->andWhere(['or', 'remark="从A库分配到C库"', 'remark="从B库分配到C库"', 'remark="从E库分配到C库"', 'remark="从F库分配到C库"', 'remark="从无效库分配到C库"'])
-// ->count();
-// if($carlogNum==1){
-//// dd($info);
-// $info->hiddenes=1;
-//// $sa=$info->save();
-// if($info->save()){
-// $num++;
-// }
-//// echo $info->car_no;
-//
-// }else{
-//// $xnum++;
-// continue;
-////
-// }
-//
-//
-//
-//
-//
-// }
-// $data= $query->count();
-//
-// aa($query);
-// var_dump($data);
- echo $num;
- echo '
';
-// echo $xnum;
-// echo $cnum;
- }
public function actionJsonData()
{
Yii::$app->response->format = Response::FORMAT_JSON;
@@ -701,14 +536,6 @@ class CarController extends BaseController
$insurer_company2_items = InsurerCompany2T::find()->all();
$pay_type_items = PayTypeT::find()->all();
$car_use_items = CarUseT::find()->all();
- $car_type_items = CarTypeT::find()->all();
- $brand_items = BrandT::find()->all();
- $series_items = SeriesT::find()
- ->where('brand_id='.intval($car_info->brand_id))
- ->all();
- $displacement_items = DisplacementT::find()
- ->where('series_id='.intval($car_info->series_id))
- ->all();
$direction_items = DirectionT::find()
->all();
$range_items = RangeT::find()
@@ -748,10 +575,6 @@ class CarController extends BaseController
'list' => $list,
'pay_type_items' => $pay_type_items,
'car_use_items' => $car_use_items,
- 'car_type_items' => $car_type_items,
- 'brand_items' => $brand_items,
- 'series_items' => $series_items,
- 'displacement_items' => $displacement_items,
'direction_items' => $direction_items,
'range_items' => $range_items,
'city_items' => $city_items,
diff --git a/frontend/controllers/DatabaseController.php b/frontend/controllers/DatabaseController.php
index 23a3587..dedd311 100644
--- a/frontend/controllers/DatabaseController.php
+++ b/frontend/controllers/DatabaseController.php
@@ -163,7 +163,7 @@ class DatabaseController extends BaseController
$query->andWhere('car_man like "'.$car_man.'"');
}
if($phone != '') {
- $query->andWhere('phone like "'.$phone.'"');
+ $query->andWhere('car_man_phone=:phone or id_man_phone=:phone',[':phone'=>$phone]);
}
if($car_no != '') {
$query->andWhere('car_no like "'.$car_no.'%"');
@@ -284,6 +284,7 @@ class DatabaseController extends BaseController
$car_info = CarT::findOne(['id'=>$id]);
if($car_info->location == 1) {
$car_info->location = 2;
+ $car_info->xubao_num = 0;
if(!$car_info->save(false)) {
throw new Exception(print_r($car_info->getFirstErrors(),true));
}
@@ -331,6 +332,7 @@ class DatabaseController extends BaseController
foreach($query->each(1000) as $car_info) {
if($car_info->location == 1) {
$car_info->location = 2;
+ $car_info->xubao_num = 0;
if(!$car_info->save(false)) {
throw new Exception(print_r($car_info->getFirstErrors(),true));
}
@@ -380,6 +382,7 @@ class DatabaseController extends BaseController
$car_info = CarT::findOne(['id'=>$id]);
if($car_info->location == 1) {
$car_info->location = 3;
+ $car_info->xubao_num = 1;
if(!$car_info->save(false)) {
throw new Exception(print_r($car_info->getFirstErrors(),true));
}
@@ -639,13 +642,13 @@ class DatabaseController extends BaseController
$order_row->car_frame_no = $b_info->car->car_frame_no;
$order_row->car_man = $b_info->car->car_man;
$order_row->car_man_number = $b_info->car->car_man_number;
- $order_row->car_man_phone = $b_info->car->phone;
+ $order_row->car_man_phone = $b_info->car->car_man_phone;
$order_row->user_id = $user_id;
$order_row->status_id = 1;
$order_row->id_man = $b_info->car->car_man;
$order_row->id_man_number = $b_info->car->id_number;
$order_row->link_man = $b_info->car->car_man;
- $order_row->link_man_phone = $b_info->car->phone;
+ $order_row->link_man_phone = $b_info->car->car_man_phone;
$order_row->link_man_number = $b_info->car->id_number;
if(!$order_row->save()) {
throw new \Exception(print_r($order_row->getErrors(),true));
@@ -819,7 +822,7 @@ class DatabaseController extends BaseController
$order_row->status_id = 1;
$order_row->id_man = $b_info->car->car_man;
$order_row->link_man = $b_info->car->car_man;
- $order_row->link_man_phone = $b_info->car->phone;
+ $order_row->link_man_phone = $b_info->car->car_man_phone;
$order_row->link_man_number = $b_info->car->id_number;
$order_row->return_status_id = 0;
$order_row->return_remark = '';
@@ -1206,13 +1209,13 @@ class DatabaseController extends BaseController
$order_row->car_frame_no = $c_info->car->car_frame_no;
$order_row->car_man = $c_info->car->car_man;
$order_row->car_man_number = $c_info->car->car_man_number;
- $order_row->car_man_phone = $c_info->car->phone;
+ $order_row->car_man_phone = $c_info->car->car_man_phone;
$order_row->user_id = $user_id;
$order_row->status_id = 1;
$order_row->id_man = $c_info->car->car_man;
$order_row->id_man_number = $c_info->car->id_number;
$order_row->link_man = $c_info->car->car_man;
- $order_row->link_man_phone = $c_info->car->phone;
+ $order_row->link_man_phone = $c_info->car->car_man_phone;
$order_row->link_man_number = $c_info->car->id_number;
if(!$order_row->save()) {
throw new \Exception(print_r($order_row->getErrors(),true));
@@ -1380,13 +1383,13 @@ class DatabaseController extends BaseController
$order_row->car_frame_no = $c_info->car->car_frame_no;
$order_row->car_man = $c_info->car->car_man;
$order_row->car_man_number = $c_info->car->car_man_number;
- $order_row->car_man_phone = $c_info->car->phone;
+ $order_row->car_man_phone = $c_info->car->car_man_phone;
$order_row->user_id = $c_info->user_id;
$order_row->status_id = 1;
$order_row->id_man = $c_info->car->car_man;
$order_row->id_man_number = $c_info->car->id_number;
$order_row->link_man = $c_info->car->car_man;
- $order_row->link_man_phone = $c_info->car->phone;
+ $order_row->link_man_phone = $c_info->car->car_man_phone;
$order_row->link_man_number = $c_info->car->id_number;
if(!$order_row->save()) {
throw new \Exception(print_r($order_row->getErrors(),true));
@@ -1881,13 +1884,13 @@ class DatabaseController extends BaseController
$order_row->car_frame_no = $d_info->car->car_frame_no;
$order_row->car_man = $d_info->car->car_man;
$order_row->car_man_number = $d_info->car->car_man_number;
- $order_row->car_man_phone = $d_info->car->phone;
+ $order_row->car_man_phone = $d_info->car->car_man_phone;
$order_row->user_id = $user_id;
$order_row->status_id = 1;
$order_row->id_man = $d_info->car->car_man;
$order_row->id_man_number = $d_info->car->id_number;
$order_row->link_man = $d_info->car->car_man;
- $order_row->link_man_phone = $d_info->car->phone;
+ $order_row->link_man_phone = $d_info->car->car_man_phone;
$order_row->link_man_number = $d_info->car->id_number;
if(!$order_row->save()) {
throw new \Exception(print_r($order_row->getErrors(),true));
@@ -2052,13 +2055,13 @@ class DatabaseController extends BaseController
$order_row->car_frame_no = $d_info->car->car_frame_no;
$order_row->car_man = $d_info->car->car_man;
$order_row->car_man_number = $d_info->car->car_man_number;
- $order_row->car_man_phone = $d_info->car->phone;
+ $order_row->car_man_phone = $d_info->car->car_man_phone;
$order_row->user_id = $d_info->user_id;
$order_row->status_id = 1;
$order_row->id_man = $d_info->car->car_man;
$order_row->id_man_number = $d_info->car->id_number;
$order_row->link_man = $d_info->car->car_man;
- $order_row->link_man_phone = $d_info->car->phone;
+ $order_row->link_man_phone = $d_info->car->car_man_phone;
$order_row->link_man_number = $d_info->car->id_number;
if(!$order_row->save()) {
throw new \Exception(print_r($order_row->getErrors(),true));
@@ -2189,7 +2192,7 @@ class DatabaseController extends BaseController
}
return $result;
}
- //钩选C库到无效库
+ //钩选D库到无效库
public function actionDInvalid()
{
Yii::$app->response->format = Response::FORMAT_JSON;
@@ -2386,45 +2389,7 @@ class DatabaseController extends BaseController
}
return $data;
}
-
- public function actionKufangIndex()
- {
- $request = Yii::$app->request;
- $page = $request->get('page',1);
- $op = $request->get('op',1);
-
- $data = $this->getAQuery($request);
- $query = $data['query'];
- $params = $data['params'];
- $params['page'] = $page;
-
- if($op==0) {
- $query = $query->andWhere('car_t.id=-1');
- }
-// echo $query->createCommand()->rawSql;
-
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
-
- $params['items'] = $items;
- $params['page_info'] = $page_info;
- $params['invalid_items'] = $invalid_items;
-// $params['month'] = CarT::MONTH;
-// $params['days'] = CarT::DAYS;
-
-
- return $this->render('kufang-index',$params);
- }
-
- public function actionAClean()
+ public function actionInvalidA()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
@@ -2433,5278 +2398,72 @@ class DatabaseController extends BaseController
$result['msg'] = '操作失败';
if($request->isPost) {
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
+ $ids = explode(',',$request->post('ids'));
$tran = CarT::getDb()->beginTransaction();
try {
foreach($ids as $id) {
$car_info = CarT::findOne(['id'=>$id]);
- if($car_info->location == 1) {
- if($car_info->qiyong==2){
- continue;
- }
- $car_info->location = 14;
- $car_info->save();
-
- $c_info = CleanT::findOne(['id'=>$car_info->id]);
- if(!$c_info) {
- $c_info = new CleanT();
- $c_info->id = $car_info->id;
- $c_info->user_id = 0;
-// $c_info->save();
- if($c_info->save()){
- $fenpei= new CleanFenpei();
- $fenpei->user_id=$this->my->id;
- $fenpei->fenpei_num=1;
- $fenpei->fenpei_date=date('Y-m-d');
- $fenpei->save();
-
- }
-
- }
- $this->addLog($car_info->id,'从A库分配到清洗库',1);
+ $car_info->location = 1;
+ if(!$car_info->save()) {
+ throw new \Exception(print_r($car_info->getErrors(), true));
}
- }
+ CarInvalidT::deleteAll('id='.$id);
+ AppointmentHistoryT::deleteAll('car_id='.$id);
+ $this->addLog($car_info->id,'从无效数据中恢复数据',1);
+ }
$result['success'] = true;
$result['msg'] = '操作成功';
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
- echo $e->getMessage();
+ $result['msg'] = $e->getMessage();
}
}
return $result;
}
-
- public function actionRightMoveB()
+ public function actionInvalidAllA()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '操作失败';
- $flag = 0;
- if($request->isPost) {
-// $unsel_lib = $request->post('unsel_lib',0);
-// $has_phone = $request->post('has_phone');
- $data = $this->getRightQuery($request);
- $query = $data;
+ if($request->isPost) {
+ $invalid_id = $request->post('invalid_id');
-// if($unsel_lib == 0) {
-// $result['msg'] = '请先选择未分配选项';
-// return $result;
-// }
-// if($has_phone != 1) {
-// $result['msg'] = '请先选择有电话号码选项';
+// if($invalid_id == 0) {
+// $result['msg'] = '请先选择无效理由';
// return $result;
// }
+ $data = $this->getInvalidQuery($request);
+ $query = $data['query'];
+
$tran = CarT::getDb()->beginTransaction();
try {
foreach($query->each(1000) as $item) {
$car_info = $item->car;
- if($car_info->location == 15) {
- $car_info->location = 2;
- $car_info->save();
-
- $b_info = CarBT::findOne(['id'=>$car_info->id]);
- if(!$b_info) {
- $b_info = new CarBT();
- $b_info->id = $car_info->id;
- $b_info->user_id = 0;
- $b_info->save();
-
- $this->addLog($car_info->id,'批量从清洗库分配到B库',1);
- }
- }
- $item->delete();
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- public function actionRightB()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
- if($car_info->location == 15) {
- $car_info->location = 2;
- $car_info->save();
- RightT::deleteAll(['id'=>$car_info->id]);
- $b_info = CarBT::findOne(['id'=>$car_info->id]);
- if(!$b_info) {
- $b_info = new CarBT();
- $b_info->id = $car_info->id;
- $b_info->user_id = 0;
- $b_info->save();
- }
- $this->addLog($car_info->id,'从数据准确库分配到B库',1);
- }
- }
-
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionBC()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
- $car_info->location = 3;
- $car_info->save();
-
- CarBT::deleteAll(['id'=>$car_info->id]);
-
- $c_info = new CarCT();
- $c_info->id = $car_info->id;
- $c_info->user_id = 0;
- $c_info->save();
-
- $this->addLog($car_info->id,'从B库分配到C库',1);
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
-
-
- public function actionCA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
$car_info->location = 1;
- $car_info->is_track = 0;
- $car_info->save();
-
- CarCT::deleteAll(['id'=>$car_info->id]);
-
- $this->addLog($car_info->id,'从C库收回到A库',1);
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- /**
- ***********************************
- * E库到A库
- * 功能
- * @author liukangle
- *********************************
- */
- public function actionEA()
- {
-
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
-
- $e_info = CarET::findOne(['id'=>$id]);
-
- if($e_info->user_id > 0) {
- $result['msg'] = '被分配的不可恢复到A库';
- return $result;
+ if(!$car_info->save()) {
+ throw new \Exception(print_r($car_info->getErrors(), true));
}
-
- $car_info = CarT::findOne(['id'=>$id]);
- $car_info->location = 1;
- $car_info->save();
-
- CarET::deleteAll(['id'=>$car_info->id]);
-
- $this->addLog($car_info->id,'从E库恢复到A库',1);
+ AppointmentHistoryT::deleteAll('car_id='.$item->id);
+ $item->delete();
+ $this->addLog($item->id,'从无效数据中恢复数据',1);
}
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionED()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
-
- $e_info = CarET::findOne(['id'=>$id]);
-
- if($e_info->user_id > 0) {
- $result['msg'] = '被分配的不可移动到D库';
- return $result;
- }
- $car_info = CarT::findOne(['id'=>$id]);
- $car_info->location = 4;
- $car_info->save();
-
- CarET::deleteAll(['id'=>$car_info->id]);
-
- $c_info = new CarDT();
- $c_info->id = $car_info->id;
- $c_info->user_id = 0;
- $c_info->save();
-
- $this->addLog($car_info->id,'从E库分配到D库',1);
- }
$result['success'] = true;
$result['msg'] = '操作成功';
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
- echo $e->getMessage();
+ $result['msg'] = $e->getMessage();
}
}
return $result;
}
-
- public function actionDC()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
- $car_info->location = 3;
- $car_info->save();
-
- CarDT::deleteAll(['id'=>$car_info->id]);
-
- $c_info = new CarCT();
- $c_info->id = $car_info->id;
- $c_info->user_id = 0;
- $c_info->save();
-
- $this->addLog($car_info->id,'从D库分配到C库',1);
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionAE()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
- //开启事务
- $tran = CarET::getDb()->beginTransaction();
- try {
- //对id数组进行便利,改变其在A库中的字段位置
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
- if($car_info->location == 1){
- if($car_info->qiyong==2){
- continue;
- }
- $car_info->location = 6;
- $car_info->save();
-
- //在E库中新加一条记录
- $e_info = CarET::findOne(['id'=>$car_info->id]);
- if(!$e_info){
- $e_info = new CarET();
- $e_info->id = $car_info->id;
- $e_info->user_id = 0;
- $e_info->save();
- }
- $this->addLog($car_info->id,'从A库分配到E库',1);
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionInvalidA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = explode(',',$request->post('ids'));
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
- $car_info->location = 1;
- if(!$car_info->save()) {
- throw new \Exception(print_r($car_info->getErrors(), true));
- }
-
- CarInvalidT::deleteAll('id='.$id);
- AppointmentHistoryT::deleteAll('car_id='.$id);
- $this->addLog($car_info->id,'从无效数据中恢复数据',1);
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- $result['msg'] = $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionInvalidAllA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $invalid_id = $request->post('invalid_id');
-
-// if($invalid_id == 0) {
-// $result['msg'] = '请先选择无效理由';
-// return $result;
-// }
- $data = $this->getInvalidQuery($request);
- $query = $data['query'];
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(1000) as $item) {
- $car_info = $item->car;
- $car_info->location = 1;
- if(!$car_info->save()) {
- throw new \Exception(print_r($car_info->getErrors(), true));
- }
- AppointmentHistoryT::deleteAll('car_id='.$item->id);
- $item->delete();
- $this->addLog($item->id,'从无效数据中恢复数据',1);
- }
-
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- $result['msg'] = $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionInvalid1A()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
- $car_info->location = 1;
- $car_info->save();
-
- CarF3T::deleteAll('id='.$id);
-
- $this->addLog($car_info->id,'从F3无效数据中恢复数据',1);
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionInvalid1AllA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $invalid_id = $request->post('invalid_id');
-
- if($invalid_id == 0) {
- $result['msg'] = '请先选择无效理由';
- return $result;
- }
- $data = $this->getInvalidQuery1($request);
- $query = $data['query'];
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(1000) as $item) {
- $car_info = $item->car;
- $car_info->location = 1;
- $car_info->save();
-
- $item->delete();
- $this->addLog($item->id,'从F3无效数据中恢复数据',1);
- }
-
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- public function actionInvalid2A()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
- $car_info->location = 1;
- $car_info->save();
-
- CarF6T::deleteAll('id='.$id);
-
- $this->addLog($car_info->id,'从F6无效数据中恢复数据',1);
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionInvalid3A()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
- $car_bt=CarBT::findOne(['id'=>$id]);
- $invalid_id=$car_bt->iv_d;
- if($invalid_id == 57 || $invalid_id == 58 || $invalid_id == 59 || $invalid_id ==60 || $invalid_id ==61) {
- if($invalid_id == 61){
- CarF2T::deleteAll('id='.$car_info->id);
- $c_info = new CarF2T();
- $c_info->id = $car_info->id;
- $c_info->user_id = 0;
- $c_info->save();
- $car_info->location = 9;
- $car_info->company = '其他小保险公司';
-
- }elseif($invalid_id == 57 || $invalid_id == 58 || $invalid_id == 59 || $invalid_id ==60){
-
- CarF1T::deleteAll('id='.$car_info->id);
- $c_info = new CarF1T();
- $c_info->id = $car_info->id;
- $c_info->user_id = 0;
-
- switch($invalid_id) {
- case 57:
- $car_info->company = '人保';
- break;
- case 58:
- $car_info->company = '平安';
- break;
- case 59:
- $car_info->company = '太平洋';
- break;
- case 60:
- $car_info->company = '国寿财';
- break;
- default:
- $car_info->company = '';
- }
- $c_info->save();
- $car_info->location = 8;
- }
-
-// $car_info->company = $ac3;
- $car_info->save();
- CarBT::deleteAll(['id'=>$car_info->id]);
-
-
- //删除预约
- AppointmentT::deleteAll('car_id='.$car_info->id);
- AppointmentHistoryT::deleteAll('car_id='.$car_info->id);
-
- //删除保单
- $orders = OrderT::find()
- ->where('car_id='.$car_info->id.' and status_id<2')
- ->all();
- foreach($orders as $order_info) {
- OrderUserT::deleteAll('order_id='.$order_info->id);
- $order_info->delete();
- }
- $orders = OrderT::find()
- ->where('car_id='.$car_info->id.' and status_id>1')
- ->all();
- foreach($orders as $order_info) {
- $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'status'=>0]);
- if($order_user_info) {
- $order_user_info->status = 3;
- $order_user_info->save();
- }
- }
- if($invalid_id == 61){
-
- $this->addLog($car_info->id,'新保销售预约时,已在新保其他小公司,进入F2库',1);
- }elseif($invalid_id == 57 || $invalid_id == 58 || $invalid_id == 59 || $invalid_id ==60){
-
- $this->addLog($car_info->id,'新保销售预约时,已在新保四大公司,进入F1库',1);
- }
-
-
-
- } else {
-
-
-
-//dd($invalid_id);
- $car_info->location = 10;
- $car_info->save();
- CarF3T::deleteAll('id='.$car_info->id);
- $invalid_info = new CarF3T();
- $invalid_info->id = $car_info->id;
- $invalid_info->invalid_id = $invalid_id;
- $invalid_info->user_id = $this->my->id;
- $invalid_info->save();
-
- CarBT::deleteAll(['id'=>$car_info->id]);
- CarCT::deleteAll(['id'=>$car_info->id]);
- CarDT::deleteAll(['id'=>$car_info->id]);
-
- //删除预约
- AppointmentT::deleteAll('car_id='.$car_info->id);
-
- //删除保单
- $orders = OrderT::find()
- ->where('car_id='.$car_info->id.' and status_id<2')
- ->all();
- foreach($orders as $order_info) {
- OrderUserT::deleteAll('order_id='.$order_info->id);
- $order_info->delete();
- }
- $orders = OrderT::find()
- ->where('car_id='.$car_info->id.' and status_id>1')
- ->all();
- foreach($orders as $order_info) {
- $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'status'=>0]);
- if($order_user_info) {
- $order_user_info->status = 3;
- $order_user_info->save();
- }
- }
-
- $this->addLog($car_info->id,'无效车辆数据:'.$invalid_info->invalid->name,1);
-
- }
-
-
-
-
-
-
-
-
-
- $car_info->location = 1;
- $car_info->save();
-
- CarF6T::deleteAll('id='.$id);
-
- $this->addLog($car_info->id,'从F6无效数据中恢复数据',1);
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionInvalid2AllA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $invalid_id = $request->post('invalid_id');
-
- if($invalid_id == 0) {
- $result['msg'] = '请先选择无效理由';
- return $result;
- }
- $data = $this->getInvalidQuery2($request);
- $query = $data['query'];
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(1000) as $item) {
- $car_info = $item->car;
- $car_info->location = 1;
- $car_info->save();
-
- $item->delete();
- $this->addLog($item->id,'从F6无效数据中恢复数据',1);
- }
-
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
-
- public function actionMistake()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
-
- $car_id = $request->post('car_id');
- $invalid_id = $request->post('invalid_id',0);
-
-
- $tran = CarT::getDb()->beginTransaction();
- try {
-
- $car_info = CarT::findOne(['id'=>$car_id]);
-// dd($car_info);
-
- $clean_info=CleanT::findOne(['id'=>$car_id]);
-
- if($invalid_id==70 || $invalid_id==71){
- $car_info->location=1;
- $car_info->qiyong=2;
- $car_info->save();
- $this->addLog($car_info->id,'进入A库永不启用',1);
- }else{
- $car_info->location = 16;
- CarMistakeT::deleteAll('id='.$car_info->id);
- $invalid_info = new CarMistakeT();
- $invalid_info->id = $car_info->id;
- $invalid_info->invalid_id = $invalid_id;
- $invalid_info->user_id = $this->my->id;
- if($clean_info->repeat==1){
- $invalid_info->judge = 1;
- }else{
- $invalid_info->judge = 2;
- }
- $invalid_info->user_id = $this->my->id;
- $invalid_info->save();
- $car_info->save();
- $this->addLog($car_info->id,'不准确车辆数据:'.$invalid_info->invalid->name,1);
- }
- CarBT::deleteAll(['id'=>$car_info->id]);
- CarCT::deleteAll(['id'=>$car_info->id]);
- CarDT::deleteAll(['id'=>$car_info->id]);
- CarET::deleteAll(['id'=>$car_info->id]);
- CleanT::deleteAll(['id'=>$car_info->id]);
- $cleantj= new CleanTongji();
- $cleantj->user_id=$this->my->id;
- $cleantj->wrong_num=1;
- $cleantj->yuefen=date('Y-m-d');
- $cleantj->car_id=$car_info->id;
- $cleantj->car_no=$car_info->car_no;
- $cleantj->save();
-
- //删除预约
- FiltrationT::deleteAll('car_id='.$car_info->id);
-
-
-
-
-
-
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- public function actionZhongjiXuanze()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
-
- $car_id = $request->post('car_id');
- $invalid_id = $request->post('invalid_id',0);
-
-
- $tran = CarT::getDb()->beginTransaction();
- try {
-
- $car_info = CarT::findOne(['id'=>$car_id]);
-// dd($car_info);
-
- $clean_info=CleanT::findOne(['id'=>$car_id]);
-
- if($invalid_id==76){//准确数据
-
- $car_info->location = 15;
- $car_info->clean_right = 1;
- $car_info->clean_num =$car_info->clean_num+1;
-
- $car_info->save();
-
- $c_info = RightT::findOne(['id' => $car_info->id]);
- if (!$c_info) {
- $c_info = new RightT();
- $c_info->id = $car_info->id;
- if($clean_info->repeat==1){
- $c_info->judge = 1;
- }else{
- $c_info->judge = 2;
- }
- $c_info->user_id = 0;
- $c_info->caozuo_id = $this->my->id;
- $c_info->save();
-
- }
- CleanT::deleteAll(['id' => $car_info->id]);
- $cleantj= new CleanTongji();
- $cleantj->user_id=$this->my->id;
- $cleantj->right_num=1;
- $cleantj->yuefen=date('Y-m-d');
- $cleantj->car_id=$car_info->id;
- $cleantj->car_no=$car_info->car_no;
- $cleantj->save();
-
- $this->addLog($car_info->id, '从清洗库分配到数据准确库成功', 1);
-
- }elseif($invalid_id>63 && $invalid_id<69){ //预约
-
- if($clean_info){
- $clean_info->yuyue=2;
- $clean_info->lingqu_status=2;
- $clean_info->save();
- }
- $cleantj_info=CleanTongji::find()->where(['car_id'=>$car_id])->andWhere(['user_id'=>$this->my->id])->one();
- if(!$cleantj_info){
- $cleantj_info=new CleanTongji();
- $cleantj_info->user_id=$this->my->id;
- $cleantj_info->yuyue_num=1;
- $cleantj_info->yuefen=date('Y-m-d');
- $cleantj_info->car_id=$car_id;
- $cleantj_info->car_no=$car_info->car_no;
- $cleantj_info->save();
- $this->addLog($car_info->id, '预约成功', 1);
- }
-
-
- $in_info= InvalidT::findOne(['id'=>$invalid_id]);
- $row = FiltrationT::find()
- ->where('car_id='.$car_id)
- ->one();
- if(empty($row)) {
- $row = new FiltrationT();
- $row->user_id = $this->my->id;
- }
- $old_user_id = 0;
- if($row->user_id != $this->my->id)
- $old_user_id = $row->user_id;
- $row->car_id = $car_id;
- $row->user_id = $this->my->id;
- $row->pdate = date("Y-m-d",strtotime("+1 day"));
- $row->ptime = '09:00';
- $row->ptype = 0;
- $row->remark =$in_info->name ;
- $row->business_group_id = 0;
- $row->yuyue_num = $row->yuyue_num+1;
- $row->is_first = 0;
- $row->save();
-
-
-
- $log_txt = '';
- if($old_user_id > 0) {
- $log_txt = '旧业务员是:'.$old_user_id.' ';
- }
- $this->addLog($car_id,$log_txt.'预约客户到'. date("Y-m-d",strtotime("+1 day")).' 09:00 预约内容为:'.$in_info->name,1);
-
- if($row && $row->yuyue_num==4){ //进入无效库
- $car_info->location = 16;
- CarMistakeT::deleteAll('id='.$car_info->id);
- $invalid_info = new CarMistakeT();
- $invalid_info->id = $car_info->id;
- $invalid_info->invalid_id = $invalid_id;
- $invalid_info->user_id = $this->my->id;
- if($clean_info->repeat==1){
- $invalid_info->judge = 1;
- }else{
- $invalid_info->judge = 2;
- }
- $invalid_info->user_id = $this->my->id;
- $invalid_info->save();
- $car_info->save();
- $this->addLog($car_info->id,'不准确车辆数据:'.$invalid_info->invalid->name,1);
- CarBT::deleteAll(['id'=>$car_info->id]);
- CarCT::deleteAll(['id'=>$car_info->id]);
- CarDT::deleteAll(['id'=>$car_info->id]);
- CarET::deleteAll(['id'=>$car_info->id]);
- CleanT::deleteAll(['id'=>$car_info->id]);
- $cleantj= new CleanTongji();
- $cleantj->user_id=$this->my->id;
- $cleantj->wrong_num=1;
- $cleantj->yuefen=date('Y-m-d');
- $cleantj->car_id=$car_info->id;
- $cleantj->car_no=$car_info->car_no;
- $cleantj->save();
-
- //删除预约
- FiltrationT::deleteAll('car_id='.$car_info->id);
- }
-
-
- }elseif($invalid_id>68 && $invalid_id<76){ //不准确
- $car_info->location = 16;
- CarMistakeT::deleteAll('id='.$car_info->id);
- $invalid_info = new CarMistakeT();
- $invalid_info->id = $car_info->id;
- $invalid_info->invalid_id = $invalid_id;
- $invalid_info->user_id = $this->my->id;
- if($clean_info->repeat==1){
- $invalid_info->judge = 1;
- }else{
- $invalid_info->judge = 2;
- }
- $invalid_info->user_id = $this->my->id;
- $invalid_info->save();
- $car_info->save();
- $this->addLog($car_info->id,'不准确车辆数据:'.$invalid_info->invalid->name,1);
- CarBT::deleteAll(['id'=>$car_info->id]);
- CarCT::deleteAll(['id'=>$car_info->id]);
- CarDT::deleteAll(['id'=>$car_info->id]);
- CarET::deleteAll(['id'=>$car_info->id]);
- CleanT::deleteAll(['id'=>$car_info->id]);
- $cleantj= new CleanTongji();
- $cleantj->user_id=$this->my->id;
- $cleantj->wrong_num=1;
- $cleantj->yuefen=date('Y-m-d');
- $cleantj->car_id=$car_info->id;
- $cleantj->car_no=$car_info->car_no;
- $cleantj->save();
-
- //删除预约
- FiltrationT::deleteAll('car_id='.$car_info->id);
- }
-
-
-
-
-
-
-
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- private function getMistakeQuery($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $register_begin = $request->post('register_begin');
- $register_end = $request->post('register_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $invalid_id = $request->post('invalid_id');
- $username = $request->post('username');
- $user1 = $request->post('user1');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $judge = $request->post('judge');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $invalid_id = $request->get('invalid_id');
- $username = $request->get('username');
- $user1 = $request->get('user1');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $judge = $request->get('judge');
- }
- $params = array();
- $params['car_man'] = $car_man;
- $params['phone'] = $phone;
- $params['car_no'] = $car_no;
- $params['register_begin'] = $register_begin;
- $params['register_end'] = $register_end;
- $params['insurer1_begin'] = $insurer1_begin;
- $params['insurer1_end'] = $insurer1_end;
- $params['invalid_id'] = $invalid_id;
- $params['username'] = $username;
- $params['user1'] = $user1;
- $params['sort_key'] = $sort_key;
- $params['sort_value'] = $sort_value;
- $params['judge'] = $judge;
-
- $query = CarMistakeT::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_mistake_t`.`id`');
-
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man="'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone="'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no="'.$car_no.'"');
- }
- if($register_begin != '') {
- $query = $query->andWhere('car_t.register_date>="'.$register_begin.'"');
- }
- if($register_end != '') {
- $query = $query->andWhere('car_t.register_date<="'.$register_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($invalid_id > 0) {
- $query = $query->andWhere('car_mistake_t.invalid_id='.$invalid_id);
- }
- if($judge > 0) {
- $query = $query->andWhere(['judge'=>$judge]);
- }
- if($user1 != '') {
- $query = $query->andWhere('car_t.op_user1 like "'.$user1.'%"');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_mistake_t.user_id='.$user_info->id);
- }
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.',car_mistake_t.id '.$sort_value);
-// echo $query->createCommand()->rawSql;
- return ['query'=>$query,'params'=>$params];
- }
- public function actionMistakeIndex()
- {
- $request = Yii::$app->request;
- $page = $request->get('page',1);
- $op = $request->get('op',1);
- $data = $this->getMistakeQuery($request);
- $query = $data['query'];
- $params = $data['params'];
- $params['page'] = $page;
- if($op==0) {
- $query = $query->andWhere('car_mistake_t.id=-1');
- }
-// echo $query->createCommand()->rawSql;
-
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTreeClean(2);
-
- $params['items'] = $items;
- $params['page_info'] = $page_info;
- $params['invalid_items'] = $invalid_items;
-
- return $this->render('mistake-index',$params);
- }
- public function actionMistakeOutput()
- {
- $request = Yii::$app->request;
- $page = $request->get('page', 1);
-
-
- $data = $this->getMistakeQuery($request);
- $query = $data['query'];
- $params = $data['params'];
- $params['page'] = $page;
-
-
-
-// var_dump($group_ids);
-
- if ($page < 1) $page = 1;
- $items = $query->all();
-
-
-
-
-
-
-
-
-
-
- $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,'保险日期');
-
-
-
-
- foreach($query->each() as $item) {
- $index++;
- $car_info = $item->car;
-
-
-
- $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$index,$car_info->car_no);
- $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$index,$car_info->car_frame_no);
- $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$index,$car_info->engine_no);
- $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('D'.$index,$car_info->id_number);
- $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('E'.$index,$car_info->id_man);
- $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('F'.$index,$car_info->register_date);
- $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('G'.$index,$car_info->insurer1_date);
-// ;
- }
-
- 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');
- foreach($query->each() as $item) {
- $item->delete();
- }
-
-
- }
- public function actionInvalid()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
- $invalid_id = $request->post('invalid_id',0);
-
- if($invalid_id == 0) {
- $result['msg'] = '请先选择无效理由';
- return $result;
- }
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $car_info = CarT::findOne(['id'=>$id]);
- $car_info->location = 5;
- $car_info->save();
-
- CarInvalidT::deleteAll('id='.$car_info->id);
- $invalid_info = new CarInvalidT();
- $invalid_info->id = $car_info->id;
- $invalid_info->invalid_id = $invalid_id;
- $invalid_info->user_id = $this->my->id;
- $invalid_info->save();
-
- CarBT::deleteAll(['id'=>$car_info->id]);
- CarCT::deleteAll(['id'=>$car_info->id]);
- CarDT::deleteAll(['id'=>$car_info->id]);
- CarET::deleteAll(['id'=>$car_info->id]);
-
- //删除预约
- AppointmentT::deleteAll('car_id='.$car_info->id);
-
- //删除操作人员
- $orders = OrderT::find()
- ->where('car_id='.$car_info->id.' and status_id<2')
- ->all();
- foreach($orders as $order_info) {
- OrderUserT::deleteAll('order_id='.$order_info->id);
- //删除保单
- $order_info->delete();
- }
-
- $this->addLog($car_info->id,'无效车辆数据:'.$invalid_info->invalid->name,1);
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- public function actionAMoveB()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
- $flag = 0;
- if($request->isPost) {
- $unsel_lib = $request->post('unsel_lib',0);
- $has_phone = $request->post('has_phone');
- $data = $this->getAQuery($request);
- $query = $data['query'];
-
- if($unsel_lib == 0) {
- $result['msg'] = '请先选择未分配选项';
- return $result;
- }
- if($has_phone != 1) {
- $result['msg'] = '请先选择有电话号码选项';
- return $result;
- }
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(1000) as $car_info) {
- if($car_info->location == 1) {
- if($car_info->qiyong==2){
- continue;
- }
- $car_info->location = 2;
- $car_info->save();
-
- $b_info = CarBT::findOne(['id'=>$car_info->id]);
- if(!$b_info) {
- $b_info = new CarBT();
- $b_info->id = $car_info->id;
- $b_info->user_id = 0;
- $b_info->save();
-
- $this->addLog($car_info->id,'从A库分配到B库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- public function actionAMoveE()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
- $flag = 0;
- if($request->isPost) {
- $unsel_lib = $request->post('unsel_lib',0);
- $has_phone = $request->post('has_phone');
- $data = $this->getAQuery($request);
- $query = $data['query'];
-
- if($unsel_lib == 0) {
- $result['msg'] = '请先选择未分配选项';
- return $result;
- }
- if($has_phone != 1) {
- $result['msg'] = '请先选择有电话号码选项';
- return $result;
- }
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(1000) as $car_info) {
- if($car_info->location == 1) {
- if($car_info->qiyong==2){
- continue;
- }
- $car_info->location = 6;
- $car_info->save();
-
- $b_info = CarET::findOne(['id'=>$car_info->id]);
- if(!$b_info) {
- $b_info = new CarET();
- $b_info->id = $car_info->id;
- $b_info->user_id = 0;
- $b_info->save();
-
- $this->addLog($car_info->id,'从A库分配到E库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- public function actionAMoveClean()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
- $flag = 0;
- if($request->isPost) {
- $unsel_lib = $request->post('unsel_lib',0);
- $has_phone = $request->post('has_phone');
- $data = $this->getAQuery($request);
- $query = $data['query'];
-
- if($unsel_lib == 0) {
- $result['msg'] = '请先选择未分配选项';
- return $result;
- }
- if($has_phone != 1) {
- $result['msg'] = '请先选择有电话号码选项';
- return $result;
- }
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(1000) as $car_info) {
- if($car_info->location == 1) {
- if($car_info->qiyong==2){
- continue;
- }
- $car_info->location =14;
- $car_info->save();
-
- $b_info = CleanT::findOne(['id'=>$car_info->id]);
- if(!$b_info) {
- $b_info = new CleanT();
- $b_info->id = $car_info->id;
- $b_info->user_id = 0;
-
- if($b_info->save()){
- $fenpei= new CleanFenpei();
- $fenpei->user_id=$this->my->id;
- $fenpei->fenpei_num=1;
- $fenpei->fenpei_date=date('Y-m-d');
- $fenpei->save();
- }
-
- $this->addLog($car_info->id,'从A库分配到清洗库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
-
- private function getBQuery1($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $register_begin = $request->post('register_begin');
- $register_end = $request->post('register_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_date');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_date1');
- $insurer1_day1 = $request->post('insurer1_day1');
- $username = $request->post('username');
- $status = $request->post('status');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $company = $request->post('company');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_date');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_date1');
- $insurer1_day1 = $request->get('insurer1_day1');
- $username = $request->get('username');
- $status = $request->get('status');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $company = $request->get('company');
- }
- $query = CarBT::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_b_t`.`id`')
- ->andWhere('car_b_t.back =1');
-
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- if($car_no == '非京'){
- $query = $query->andWhere('car_no not like "京%"');
- }else{
- $query = $query->andWhere('car_no like "'.$car_no.'%"');
- }
- }
- if($register_begin != '') {
- $query = $query->andWhere('car_t.register_date>="'.$register_begin.'"');
- }
- if($register_end != '') {
- $query = $query->andWhere('car_t.register_date<="'.$register_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($insurer1_month != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
- }
- if($insurer1_day != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
- }
- if($insurer1_month1 != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
- }
- if($insurer1_day1 != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
- }
- if($status == 1) {
- $query = $query->andWhere('car_b_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('car_b_t.user_id>0');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_b_t.user_id='.$user_info->id);
- }
- }
- if($company != '') {
- $query = $query->andWhere('company like "'.$company.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', car_b_t.id '.$sort_value);
-// echo $query->createCommand()->rawSql;
-// exit;
- return $query;
- }
- //数据准确库
- private function getRightQuery($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $register_begin = $request->post('register_begin');
- $register_end = $request->post('register_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_date');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_date1');
- $insurer1_day1 = $request->post('insurer1_day1');
- $username = $request->post('username');
- $status = $request->post('status');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $company = $request->post('company');
- $judge = $request->post('judge');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_date');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_date1');
- $insurer1_day1 = $request->get('insurer1_day1');
- $username = $request->get('username');
- $status = $request->get('status');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $company = $request->get('company');
- $judge = $request->get('judge');
- }
- $query = RightT::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`right_t`.`id`');
-
-
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- if($car_no == '非京'){
- $query = $query->andWhere('car_no not like "京%"');
- }else{
- $query = $query->andWhere('car_no like "'.$car_no.'%"');
- }
- }
- if($register_begin != '') {
- $query = $query->andWhere('car_t.register_date>="'.$register_begin.'"');
- }
- if($register_end != '') {
- $query = $query->andWhere('car_t.register_date<="'.$register_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($insurer1_month != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
- }
- if($insurer1_day != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
- }
- if($insurer1_month1 != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
- }
- if($insurer1_day1 != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
- }
- if($status == 1) {
- $query = $query->andWhere('right_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('right_t.user_id>0');
- }
- if($judge > 0) {
- $query = $query->andWhere(['judge'=>$judge]);
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_b_t.user_id='.$user_info->id);
- }
- }
- if($company != '') {
- $query = $query->andWhere('company like "'.$company.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', right_t.id '.$sort_value);
-// dd(32);
-// echo $query->createCommand()->rawSql;
-// exit;
- return $query;
- }
- public function actionRightIndex()
- {
- $request = Yii::$app->request;
- $page = $request->get('page',1);
- $op = $request->get('op',1);
-
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_date');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_date1');
- $insurer1_day1 = $request->get('insurer1_day1');
- $username = $request->get('username');
- $status = $request->get('status',1);
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $user_id = $request->get('user_id');
- $company = $request->get('company');
- $judge = $request->get('judge');
-
- $query = $this->getRightQuery($request);
- if($op==0) {
- $query = $query->andWhere('right_t.id=-1');
- }
-// echo $query->createCommand()->rawSql;
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
-
- $monthes= CarT::MONTH;
- $days= CarT::DAYS;
-
- return $this->render('right-index',[
- 'items' => $items,
- 'monthes' => $monthes,
- 'days' => $days,
- 'page_info' => $page_info,
- 'page' => $page,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'register_begin' => $register_begin,
- 'register_end' => $register_end,
- 'insurer1_begin' => $insurer1_begin,
- 'insurer1_end' => $insurer1_end,
- 'insurer1_month' =>$insurer1_month,
- 'insurer1_day' =>$insurer1_day,
- 'insurer1_month1' =>$insurer1_month1,
- 'insurer1_day1' =>$insurer1_day1,
- 'invalid_items' => $invalid_items,
- 'user_items' => $user_items,
- 'user_id' => $user_id,
- 'status' => $status,
- 'judge' => $judge,
- 'username' => $username,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'company' => $company,
- ]);
- }
- public function actionAjaxAReturn()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result['success'] = false;
- $result['msg'] = '操作失败';
- $id = $request->post('id',0);
- //没有任务
-// ->andWhere(['repeat'=>1])
-
- //echo $id;die;
-// dd($id);
- $tran = CarT::getDb()->beginTransaction();
- try {
- $car_info = CarT::findOne($id);
-// $car_info->location = 14;
-
-
- $c_info = CleanT::findOne(['id'=>$car_info->id]);
- if($c_info) {
- $c_info->user_id = 0;
- $c_info->save();
- }
-
-// FiltrationT
- //删除预约拨打
- FiltrationT::deleteAll('car_id='.$c_info->id);
-
- $clean_info= CleanTongji::find()
- ->where('car_id='.$c_info->id)
- ->where('yuyue_num=1')
- ->all();
- foreach($clean_info as $cl_vl){
- $cl_vl->delete();
- }
- $this->addLog($car_info->id,'恢复一条数据成功',1);
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
-
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
-
- }
-
-
-
- return $result;
- }
- public function actionAjaxAData()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $result['success'] = false;
- $result['msg'] = '领取失败';
- //没有任务
-// ->andWhere(['repeat'=>1])
- $total_ids= CleanT::find()->where('user_id=0')->column();
-
-// $total_ids = OrderT::find()->andWhere('status_id=2 and hb_status=0 and lock_id=0 and (op1_id=0 or op1_id is NULL) ')->column();
- $count = count($total_ids);
- if($count<1){
- $result['msg'] = '没有任务';
- return $result;
- }
-// dd($total_ids);
- $i = rand(0,$count-1);
- $id = $total_ids[$i];
- //echo $id;die;
- $tran = CarT::getDb()->beginTransaction();
- try {
- $car_info = CarT::findOne($id);
-// $car_info->location = 14;
- if($car_info->save()){
-
- //取出上一条判断状态
- $clean_count= CleanT::find()
- ->where(['user_id'=>$this->my->id])
- ->andWhere(['lingqu_status'=>1])
- ->count();
- $clean_count=(int)$clean_count;
- if($clean_count>0){
- $result['msg'] = '上一条数据未处理不能领取任务';
- return $result;
-
- }
- $c_info = CleanT::findOne(['id'=>$car_info->id]);
- if(!$c_info) {
- $c_info = new CleanT();
- $c_info->id = $car_info->id;
- $c_info->user_id = $this->my->id;
- }else{
- $c_info->user_id = $this->my->id;
- }
- $c_info->now_time=new Expression('NOW()');
- $c_info->save();
-// FiltrationT
- //添加到预约拨打
- $filt=FiltrationT::findOne(['car_id'=>$c_info->id]);
- if($filt){
- $filt->user_id = $this->my->id;
- $filt->delete_status=1;
- $filt->save();
-
- }else{
- $row = new FiltrationT();
- $row->car_id = $c_info->id;
- $row->user_id = $this->my->id;
- $row->pdate = date('Y-m-d');
- $row->ptime = '09:00';
- $row->remark = '首次分配';
- $row->is_first = 1;
- $row->xdate = date('Y-m-d');
- $row->xtime = '09:00';
- $row->xbao = 2;
- $row->save();
- }
-// FiltrationT::deleteAll('car_id='.$c_info->id);
-
- $this->addLog($car_info->id,'从A库领取一条数据成功',1);
- $result['success'] = true;
- $result['msg'] = '领取成功';
- }
- $tran->commit();
-
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
-
- }
-
-
-
- return $result;
- }
-
- public function actionAjaxADataNext()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $result['success'] = false;
- $result['msg'] = '领取失败';
- //没有任务
-// ->andWhere(['repeat'=>1])
- $total_ids= CleanT::find()->where('user_id=0')->column();
-
-// $total_ids = OrderT::find()->andWhere('status_id=2 and hb_status=0 and lock_id=0 and (op1_id=0 or op1_id is NULL) ')->column();
- $count = count($total_ids);
- if($count<1){
- $result['msg'] = '没有任务';
- return $result;
- }
-
- $i = rand(0,$count-1);
- $id = $total_ids[$i];
- //echo $id;die;
- $tran = CarT::getDb()->beginTransaction();
- try {
- $car_info = CarT::findOne($id);
-// $car_info->location = 14;
- $clean_count= CleanT::find()
- ->where(['user_id'=>$this->my->id])
- ->andWhere(['lingqu_status'=>1])
- ->count();
- $clean_count=(int)$clean_count;
- if($clean_count>0){
- $result['msg'] = '有未处理的数据不能自动进入下一条';
- return $result;
-
- }
- if($car_info->save()){
-
- $c_info = CleanT::findOne(['id'=>$car_info->id]);
- if(!$c_info) {
- $c_info = new CleanT();
- $c_info->id = $car_info->id;
- $c_info->user_id = $this->my->id;
- }else{
- $c_info->user_id = $this->my->id;
- }
- $c_info->now_time=new Expression('NOW()');
- $c_info->save();
-// FiltrationT
- //添加到预约拨打
-// FiltrationT::deleteAll('car_id='.$c_info->id);
-// $row = new FiltrationT();
-// $row->car_id = $c_info->id;
-// $row->user_id = $this->my->id;
-// $row->pdate = date('Y-m-d');
-// $row->ptime = '09:00';
-// $row->remark = '首次分配';
-// $row->is_first = 1;
-// $row->xdate = date('Y-m-d');
-// $row->xtime = '09:00';
-// $row->xbao = 2;
-// $row->save();
-
- $filt=FiltrationT::findOne(['car_id'=>$c_info->id]);
- if($filt){
- $filt->user_id = $this->my->id;
- $filt->delete_status=1;
- $filt->save();
-
- }else{
- $row = new FiltrationT();
- $row->car_id = $c_info->id;
- $row->user_id = $this->my->id;
- $row->pdate = date('Y-m-d');
- $row->ptime = '09:00';
- $row->remark = '首次分配';
- $row->is_first = 1;
- $row->xdate = date('Y-m-d');
- $row->xtime = '09:00';
- $row->xbao = 2;
- $row->save();
- }
- $this->addLog($car_info->id,'从A库领取一条数据成功',1);
- $result['success'] = true;
- $result['data'] = $car_info->id;
- $result['msg'] = '领取成功';
- }
- $tran->commit();
-
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
-
- }
-
-
-
- return $result;
- }
- public function actionCleanToRight()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $result['success'] = false;
- $result['msg'] = '领取失败';
- $request = Yii::$app->request;
- $id=$request->post('car_id');
-// dd($id);
- $tran = CarT::getDb()->beginTransaction();
- try {
- if ($request->isPost) {
-
- $car_info = CarT::findOne($id);
- $car_info->location = 15;
- $car_info->save();
- $clean_info=CleanT::findOne(['id'=>$id]);
- $c_info = RightT::findOne(['id' => $car_info->id]);
- if (!$c_info) {
- $c_info = new RightT();
- $c_info->id = $car_info->id;
- if($clean_info->repeat==1){
- $c_info->judge = 1;
- }else{
- $c_info->judge = 2;
- }
- $c_info->user_id = 0;
- $c_info->caozuo_id = $this->my->id;
- $c_info->save();
-
- }
-
- CleanT::deleteAll(['id' => $car_info->id]);
- $cleantj= new CleanTongji();
- $cleantj->user_id=$this->my->id;
- $cleantj->right_num=1;
- $cleantj->yuefen=date('Y-m-d');
- $cleantj->car_id=$car_info->id;
- $cleantj->car_no=$car_info->car_no;
- $cleantj->save();
-
-
- $this->addLog($car_info->id, '从清洗库分配到数据准确库成功', 1);
- $result['success'] = true;
- $result['msg'] = '分配成功';
-
- $tran->commit();
- }
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
-
- }
-
-
- return $result;
- }
- private function getcleanQuery($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $register_begin = $request->post('register_begin');
- $register_end = $request->post('register_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_date');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_date1');
- $insurer1_day1 = $request->post('insurer1_day1');
- $username = $request->post('username');
- $status = $request->post('status');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $company = $request->post('company');
- $repeat = $request->post('repeat');
- $yuyue = $request->post('yuyue');
-
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_date');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_date1');
- $insurer1_day1 = $request->get('insurer1_day1');
- $username = $request->get('username');
- $status = $request->get('status');
- $repeat = $request->get('repeat');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $company = $request->get('company');
- $yuyue = $request->get('yuyue');
- }
- $query = CleanT::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`clean_t`.`id`');
-
-
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- if($car_no == '非京'){
- $query = $query->andWhere('car_no not like "京%"');
- }else{
- $query = $query->andWhere('car_no like "'.$car_no.'%"');
- }
- }
- if($register_begin != '') {
- $query = $query->andWhere('car_t.register_date>="'.$register_begin.'"');
- }
- if($register_end != '') {
- $query = $query->andWhere('car_t.register_date<="'.$register_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
-
-// if($insurer1_month != '') {
-// $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
-// }
-// if($insurer1_day != '') {
-// $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
-// }
-// if($insurer1_month1 != '') {
-// $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
-// }
-// if($insurer1_day1 != '') {
-// $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
-// }
-
-
- if($status == 1) {
- $query = $query->andWhere('clean_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('clean_t.user_id>0');
- }
- $query = $query->andWhere(['yuyue'=>1]);
-// if($yuyue>0){
-// $query = $query->andWhere(['yuyue'=>$yuyue]);
-// }
- if($repeat>0){
- $query = $query->andWhere(['repeat'=>$repeat]);
- }
-// if($username != '') {
-// $user_info = UserT::findOne(['username'=>$username]);
-// if($user_info) {
-// $query = $query->andWhere('clean_t.user_id='.$user_info->id);
-// }
-// }
- if($username == '') {
- $user_ids = $this->getChildrenUserIDs();
- $query = $query->andWhere(['in','clean_t.user_id',$user_ids]);
- }
- if($company != '') {
- $query = $query->andWhere('company like "'.$company.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', clean_t.id '.$sort_value);
- echo $query->createCommand()->rawSql;
-// exit;
- return $query;
- }
- public function actionCleanIndex()
- {
- $request = Yii::$app->request;
- $page = $request->get('page',1);
- $op = $request->get('op',1);
-
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_date');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_date1');
- $insurer1_day1 = $request->get('insurer1_day1');
- $username = $request->get('username');
- $status = $request->get('status',2);
- $repeat = $request->get('repeat',1);
- $yuyue = $request->get('yuyue',1);
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $user_id = $request->get('user_id');
- $company = $request->get('company');
-
- $query = $this->getcleanQuery($request);
- if($op==0) {
- $query = $query->andWhere('clean_t.id=-1');
- }
-// echo $query->createCommand()->rawSql;
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
-
- $monthes= CarT::MONTH;
- $days= CarT::DAYS;
- $carAcount=CleanT::find()->where('user_id=0')->count();
-
- return $this->render('clean-index',[
- 'items' => $items,
- 'monthes' => $monthes,
- 'days' => $days,
- 'page_info' => $page_info,
- 'page' => $page,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'register_begin' => $register_begin,
- 'register_end' => $register_end,
- 'insurer1_begin' => $insurer1_begin,
- 'insurer1_end' => $insurer1_end,
- 'insurer1_month' =>$insurer1_month,
- 'insurer1_day' =>$insurer1_day,
- 'insurer1_month1' =>$insurer1_month1,
- 'insurer1_day1' =>$insurer1_day1,
- 'invalid_items' => $invalid_items,
- 'user_items' => $user_items,
- 'user_id' => $user_id,
- 'status' => $status,
- 'repeat' => $repeat,
- 'yuyue' => $yuyue,
- 'username' => $username,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'company' => $company,
- 'carAcount' => $carAcount,
- ]);
- }
-
- public function actionBAllAssign1()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $status = $request->post('status');
- if($status != 1) {
- $result['msg'] = '请先选择分配状态!';
- return $result;
- }
- $assign_users = explode(',',$request->post('assign_users'));
- $assign_count = $request->post('assign_count',0);
- $assign_user_ids = array();
- foreach($assign_users as $assign_user) {
- $user_info = UserT::findOne(['username'=>$assign_user,'is_delete'=>0]);
- if($user_info)
- $assign_user_ids[] = $user_info->id;
- }
- if(count($assign_user_ids) == 0) {
- $result['msg'] = '请输入业务员工号,以英文逗号间隔';
- return $result;
- }
- if($assign_count == 0) {
- $result['msg'] = '请输入每个业务员分配记录数';
- return $result;
- }
-
- $query = $this->getBQuery1($request);
-// echo $query->createCommand()->rawSql;
-// echo $query->count();
-// exit;
- $tran = CarT::getDb()->beginTransaction();
- try {
- $page = 0;
- $total_pages = count($assign_user_ids);
- $index = 0;
- foreach($query->each(100) as $b_info) {
- if($index >= ($page+1) * $assign_count) $page += 1;
- if($page == $total_pages) break;
- if($b_info->user_id > 0) continue;
- $b_info->user_id = $assign_user_ids[$page];
- $b_info->save();
-
- $car_info = $b_info->car;
- $car_info->op_user1 = $b_info->user->getShowName();
- $car_info->save();
-
- //添加保单
- $order_row = new OrderT();
- $order_row->car_id = $b_info->id;
- $order_row->car_no = $b_info->car->car_no;
- $order_row->engine_no = $b_info->car->engine_no;
- $order_row->car_frame_no = $b_info->car->car_frame_no;
- $order_row->car_man = $b_info->car->car_man;
- $order_row->user_id = $b_info->user_id;
- $order_row->status_id = 1;
- $order_row->id_man = $b_info->car->car_man;
- $order_row->link_man = $b_info->car->car_man;
- $order_row->link_phone = $b_info->car->phone;
- $order_row->return_status_id = 0;
- $order_row->return_remark = '';
- $order_row->save();
-
- //添加预约
- AppointmentT::deleteAll('car_id='.$b_info->id);
- $row = new AppointmentT();
- $row->car_id = $b_info->id;
- $row->user_id = $b_info->user_id;
- $row->pdate = date('Y-m-d');
- $row->ptime = '09:00';
- $row->remark = '首次分配';
- $row->is_first = 1;
- $row->xdate = date('Y-m-d');
- $row->xtime = '09:00';
- $row->xbao = 2;
- $row->save();
-
- //添加历史预约
- $h_row = new AppointmentHistoryT();
- $h_row->car_id = $b_info->id;
- $h_row->user_id = $b_info->user_id;
- $h_row->pdate = date('Y-m-d');
- $h_row->ptime = '09:00';
- $h_row->remark = '首次分配';
- $h_row->xdate = date('Y-m-d');
- $h_row->xtime = '09:00';
- $h_row->xbao = 2;
- $h_row->save();
-
- $this->addLog($b_info->id,'从B库的数据管理分支分配数据给业务员:'.$b_info->user->getShowName(),1);
- $index++;
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionBReturnAllWuxiao()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
-
-
- $status = $request->post('status');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $invalid_id = $request->post('invalid_id');
-
- if($status!=1){
- $result['msg'] = '请选择未分配状态';
- return $result;
- }
-
-
- $query = CarBT::find()
- ->leftJoin('car_t','`car_t`.`id`=`car_b_t`.`id`')
- ->andWhere('car_b_t.back=1');
-
- if($status == 1) {
- $query = $query->andWhere('car_b_t.user_id=0');
- }
- if($invalid_id >0) {
- $query = $query->andWhere('car_b_t.iv_d="'.$invalid_id.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
-
-
-
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(1000) as $item) {
- $car_info = $item->car;
- $car_info->location = 5;
- $car_info->save();
-
-// FiltrationT
- //删除预约拨打
-// FiltrationT::deleteAll('car_id='.$c_info->id);
- CarInvalidT::deleteAll('id='.$car_info->id);
- InvalidNew::deleteAll('car_id='.$car_info->id);
-
-
- $invalid_info = new CarInvalidT();
- $invalid_info->id = $car_info->id;
- $invalid_info->invalid_id = $item->iv_d;
- $invalid_info->user_id = $this->my->id;
- $invalid_info->save();
-
-
- $this->addLog($item->id,'从B库新保数据处理批量收回到无效库',1);
- $item->delete();
- }
-
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- public function actionCleanReturnA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选需要操作的车辆';
- return $result;
- }
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $b_info = CleanT::findOne(['id'=>$id]);
- //删除预约
- FiltrationT::deleteAll('car_id='.$b_info->id);
- $car_info = $b_info->car;
- $car_info->location = 1;
- $car_info->save();
- $this->addLog($b_info->id,'从清洗库回收数据到A库',1);
- $b_info->delete();
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionCleanReturnAllA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
-
- $yuyue = $request->post('yuyue');
- $status = $request->post('status');
- $register_begin = $request->post('register_begin');
- $register_end = $request->post('register_end');
-
- if($yuyue!=1 || $status!=1){
- $result['msg'] = '请选择未预约状态或未分配状态';
- return $result;
- }
-
-
- $query = CleanT::find()
- ->leftJoin('car_t','`car_t`.`id`=`clean_t`.`id`')
- ->andWhere(['yuyue'=>$yuyue])
- ->andWhere('clean_t.user_id=0');
- if($register_begin != '') {
- $query = $query->andWhere('car_t.register_date>="'.$register_begin.'"');
- }
- if($register_end != '') {
- $query = $query->andWhere('car_t.register_date<="'.$register_end.'"');
- }
-
-
-
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(1000) as $item) {
- $car_info = $item->car;
- $car_info->location = 1;
- $car_info->save();
- $item->delete();
-// FiltrationT
- //删除预约拨打
-// FiltrationT::deleteAll('car_id='.$c_info->id);
- $this->addLog($item->id,'从清洗库数据未领取的任务收回到A库',1);
- }
-
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
-
- private function getEQuery($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $print_begin = $request->post('print_begin');
- $print_end = $request->post('print_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $status = $request->post('status');
- $username = $request->post('username');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $old_user = $request->post('old_user');
- $company = $request->post('company');
- $register_begin = $request->post('register_begin');
- $register_end = $request->post('register_end');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $old_user = $request->get('old_user');
- $company = $request->get('company');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- }
- $query = CarET::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_e_t`.`id`');
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
- }
- if($print_begin != '') {
- $query = $query->andWhere('car_t.print_date>="'.$print_begin.'"');
- }
- if($print_end != '') {
- $query = $query->andWhere('car_t.print_date<="'.$print_end.'"');
- }
- if($register_begin != '') {
- $query = $query->andWhere('register_date>="'.$register_begin.'"');
- }
- if($register_end != '') {
- $query = $query->andWhere('register_date<="'.$register_end.'"');
- }
-
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($status == 1) {
- $query = $query->andWhere('car_e_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('car_e_t.user_id>0');
- }
- if($username != '') {
-// $user_info = UserT::findOne(['username'=>$username]);
-// $query = $query->andWhere('op_user1 like "'.$user1.'%"');
- $user_info = UserT::find()->where('username like"'.$username.'%"')->all();
-// $user_ids='';
- $user_ids = array();
- if($user_info){
- foreach($user_info as $v){
-// $user_ids.="'".$v->id."'".',';
-// var_dump($v->id);
- $user_ids[] = $v->username.'('.$v->name.')';
- }
- }
-
-// var_dump($user_ids);
-//
-// $srrs=trim($user_ids,',');
-// var_dump($srrs);
-// var_dump('car_e_t.user_id in ('.$srrs.')');
- if($user_info) {
- $query = $query->andWhere(['in','car_t.op_user1',$user_ids]);
- }
- }
-// $query = $query->andWhere(['in','car_t.op_user1',$user_ids]);
- if($old_user != '') {
- $query = $query->andWhere('car_t.old_user="'.$old_user.'"');
- }
- if($company != '') {
- $query = $query->andWhere('company="'.$company.'"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', car_e_t.id '.$sort_value);
- return $query;
- }
-
- private function getAdCleanQuery($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $register_begin = $request->post('register_begin');
- $register_end = $request->post('register_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_date');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_date1');
- $insurer1_day1 = $request->post('insurer1_day1');
- $username = $request->post('username');
- $status = $request->post('status');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $company = $request->post('company');
- $repeat = $request->post('repeat');
- $yuyue = $request->post('yuyue');
-
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_date');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_date1');
- $insurer1_day1 = $request->get('insurer1_day1');
- $username = $request->get('username');
- $status = $request->get('status');
- $repeat = $request->get('repeat');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $company = $request->get('company');
- $yuyue = $request->get('yuyue');
- }
- $query = CleanT::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`clean_t`.`id`');
-
-
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- if($car_no == '非京'){
- $query = $query->andWhere('car_no not like "京%"');
- }else{
- $query = $query->andWhere('car_no like "'.$car_no.'%"');
- }
- }
- if($register_begin != '') {
- $query = $query->andWhere('car_t.register_date>="'.$register_begin.'"');
- }
- if($register_end != '') {
- $query = $query->andWhere('car_t.register_date<="'.$register_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
-
-// if($insurer1_month != '') {
-// $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
-// }
-// if($insurer1_day != '') {
-// $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
-// }
-// if($insurer1_month1 != '') {
-// $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
-// }
-// if($insurer1_day1 != '') {
-// $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
-// }
-
-
-
-
-
- if($repeat>0){
- $query = $query->andWhere(['repeat'=>$repeat]);
- }
-// if($username != '') {
-// $user_info = UserT::findOne(['username'=>$username]);
-// if($user_info) {
-// $query = $query->andWhere('clean_t.user_id='.$user_info->id);
-// }
-// }
-
- if($yuyue>0){
- $query = $query->andWhere(['yuyue'=>$yuyue]);
- }
-
- //采用这个
- if($status==1){ //未分配
- $query = $query->andWhere('clean_t.user_id=0');
- }
- if($status==2){
- $query = $query->andWhere('clean_t.user_id>0'); //已分配
- if($username == '') {
- $user_ids = $this->getChildrenUserIDs();
- $query = $query->andWhere(['in','clean_t.user_id',$user_ids]);
- }
- }
-
-
-
- //
-// $query = $query->andWhere('clean_t.user_id= 0');
- if($company != '') {
- $query = $query->andWhere('company like "'.$company.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', clean_t.id '.$sort_value);
-// echo $query->createCommand()->rawSql;
-// exit;
- return $query;
- }
- public function actionAdCleanIndex()
- {
- $request = Yii::$app->request;
- $page = $request->get('page',1);
- $op = $request->get('op',1);
-
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_date');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_date1');
- $insurer1_day1 = $request->get('insurer1_day1');
- $username = $request->get('username');
- $status = $request->get('status',1);
- $repeat = $request->get('repeat',1);
- $yuyue = $request->get('yuyue',1);
-// echo $yuyue;
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $user_id = $request->get('user_id');
-// dd($user_id);
- $company = $request->get('company');
-
- $query = $this->getAdCleanQuery($request);
- if($op==0) {
- $query = $query->andWhere('clean_t.id=-1');
- }
-// echo $query->createCommand()->rawSql;
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
-
- $monthes= CarT::MONTH;
- $days= CarT::DAYS;
- $carAcount=CleanT::find()->where('user_id=0')->count();
-// $cfor=CleanT::find();
-// foreach($cfor->each(1) as $c){
-//
-// $c->now_time=new Expression('NOW()');
-// $c->save();
-//
-// }
- $role_id=$this->my->role_id;
- return $this->render('ad-clean-index',[
- 'items' => $items,
- 'monthes' => $monthes,
- 'days' => $days,
- 'page_info' => $page_info,
- 'page' => $page,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'register_begin' => $register_begin,
- 'register_end' => $register_end,
- 'insurer1_begin' => $insurer1_begin,
- 'insurer1_end' => $insurer1_end,
- 'insurer1_month' =>$insurer1_month,
- 'insurer1_day' =>$insurer1_day,
- 'insurer1_month1' =>$insurer1_month1,
- 'insurer1_day1' =>$insurer1_day1,
- 'invalid_items' => $invalid_items,
- 'user_items' => $user_items,
- 'user_id' => $user_id,
- 'status' => $status,
- 'repeat' => $repeat,
- 'yuyue' => $yuyue,
- 'username' => $username,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'company' => $company,
- 'role_id' => $role_id,
- 'carAcount' => $carAcount,
- ]);
- }
-
- public function actionEIndex()
- {
-
- $request = Yii::$app->request;
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $engine_no = $request->get('engine_no');
- $car_frame_no = $request->get('car_frame_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $user_id = $request->get('user_id');
- $page = $request->get('page',1);
- $op = $request->get('op',1);
- $company = $request->get('company');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $query = $this->getEQuery($request);
-
- if($op==0) {
- $query = $query->andWhere('car_e_t.id=-1');
- }
-// echo $query->createCommand()->rawSql;
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
-
- return $this->render('e-index',[
- 'items' => $items,
- 'page_info' => $page_info,
- 'page' => $page,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'engine_no' => $engine_no,
- 'car_frame_no' => $car_frame_no,
- 'print_begin' => $print_begin,
- 'print_end' => $print_end,
- 'register_begin' => $register_begin,
- 'register_end' => $register_end,
- 'insurer1_begin' => $insurer1_begin,
- 'insurer1_end' => $insurer1_end,
- 'invalid_items' => $invalid_items,
- 'user_items' => $user_items,
- 'status' => $status,
- 'username' => $username,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'user_id' => $user_id,
- 'company' => $company
- ]);
- }
-
-
- public function actionEAllAssign()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $status = $request->post('status');
- if($status != 1) {
- $result['msg'] = '请先选择分配状态!';
- return $result;
- }
- $assign_users = explode(',',$request->post('assign_users'));
- $assign_count = $request->post('assign_count',0);
- $assign_user_ids = array();
- foreach($assign_users as $assign_user) {
- $user_info = UserT::findOne(['username'=>$assign_user]);
- if($user_info)
- $assign_user_ids[] = $user_info->id;
- }
- if(count($assign_user_ids) == 0) {
- $result['msg'] = '请输入业务员工号,以英文逗号间隔';
- return $result;
- }
- if($assign_count == 0) {
- $result['msg'] = '请输入每个业务员分配记录数';
- return $result;
- }
-
- $query = $this->getEQuery($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- $page = 0;
- $total_pages = count($assign_user_ids);
- $index = 0;
- foreach($query->each(100) as $c_info) {
- if($index >= ($page+1) * $assign_count) $page += 1;
- if($page == $total_pages) break;
- if($c_info->user_id > 0) continue;
- $c_info->user_id = $assign_user_ids[$page];
- $c_info->save();
-
- $car_info = $c_info->car;
- $car_info->op_user2 = $c_info->user->getShowName();
- $car_info->save();
-
- //添加预约
- AppointmentT::deleteAll('car_id='.$c_info->id);
- $row = new AppointmentT();
- $row->car_id = $c_info->id;
- $row->user_id = $c_info->user_id;
- $row->pdate = date('Y-m-d');
- $row->ptime = '09:00';
- $row->remark = '首次分配';
- $row->is_first = 1;
- $row->save();
-
- //添加历史预约
- $h_row = new AppointmentHistoryT();
- $h_row->car_id = $c_info->id;
- $h_row->user_id = $c_info->user_id;
- $h_row->pdate = date('Y-m-d');
- $h_row->ptime = '09:00';
- $h_row->remark = '首次分配';
- $h_row->save();
-
- $this->addLog($c_info->id,'从E库分配数据给业务员:'.$c_info->user->getShowName(),1);
- $index++;
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionCMoveD()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $status = $request->post('status');
- if($status != 1) {
- $result['msg'] = '请先选择分配状态!';
- return $result;
- }
- $query = $this->getCQuery($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 3) {
- $car_info->location = 4;
- $car_info->save();
-
- CarCT::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarDT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarDT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从C库分配到D库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionEMoveD()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $status = $request->post('status');
- if($status != 1) {
- $result['msg'] = '请先选择分配状态!';
- return $result;
- }
- $query = $this->getEQuery($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 6) {
- $car_info->location = 4;
- $car_info->save();
-
- CarET::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarDT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarDT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从E库分配到D库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionFMoveD()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
-// echo 333;
-// die;
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getFQuery($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 7) {
- $car_info->location = 4;
- $car_info->save();
-
- CarFT::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarDT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarDT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从F库分配到D库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionFMoveA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getFQuery($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 7) {
- $car_info->location = 1;
- $car_info->save();
-
- CarFT::deleteAll(['id'=>$car_info->id]);
- $this->addLog($car_info->id,'从F库分配到A库',1);
-// $d_info = CarDT::findOne(['id'=>$car_info->id]);
-// if(!$d_info) {
-// $d_info = new CarDT();
-// $d_info->id = $car_info->id;
-// $d_info->user_id = 0;
-// $d_info->save();
-//
-//
-// }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionF1MoveB()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
-// echo 333;
-// die;
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getF1Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 8) {
- $car_info->location = 2;
- $car_info->save();
-
- CarF1T::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarBT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarBT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从F1库分配到B库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF1MoveA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getF1Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 8) {
- $car_info->location = 1;
- $car_info->save();
-
- CarF1T::deleteAll(['id'=>$car_info->id]);
- $this->addLog($car_info->id,'从F1库分配到A库',1);
-// $d_info = CarDT::findOne(['id'=>$car_info->id]);
-// if(!$d_info) {
-// $d_info = new CarDT();
-// $d_info->id = $car_info->id;
-// $d_info->user_id = 0;
-// $d_info->save();
-//
-//
-// }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF1B()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $status = $request->post('status');
- if($status != 1) {
- $result['msg'] = '请先选择分配状态!';
- return $result;
- }
- $query = $this->getF1Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 8) {
- $car_info->location = 2;
- $car_info->save();
-
- CarF1T::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarBT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarBT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从F1库分配到B库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionF2MoveD()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
-// echo 333;
-// die;
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getF2Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 9) {
- $car_info->location = 2;
- $car_info->save();
-
- CarF2T::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarBT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarBT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从F2库分配到B库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF2MoveA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getF2Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- dd($car_info->location);
- if($car_info->location == 8) {
- $car_info->location = 1;
- $car_info->save();
- dd(32);
- CarF2T::deleteAll(['id'=>$car_info->id]);
- $this->addLog($car_info->id,'从F2库分配到A库',1);
-// $d_info = CarDT::findOne(['id'=>$car_info->id]);
-// if(!$d_info) {
-// $d_info = new CarDT();
-// $d_info->id = $car_info->id;
-// $d_info->user_id = 0;
-// $d_info->save();
-//
-//
-// }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF2B()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $status = $request->post('status');
- if($status != 1) {
- $result['msg'] = '请先选择分配状态!';
- return $result;
- }
- $query = $this->getF2Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 9) {
- $car_info->location = 2;
- $car_info->save();
-
- CarF2T::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarBT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarBT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从F2库分配到B库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF4MoveD()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
-// echo 333;
-// die;
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getF4Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 11) {
- $car_info->location = 4;
- $car_info->save();
-
- CarF4T::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarDT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarDT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从F4库分配到D库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF4MoveA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getF4Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 11) {
- $car_info->location = 1;
- $car_info->save();
-
- CarF4T::deleteAll(['id'=>$car_info->id]);
- $this->addLog($car_info->id,'从F4库分配到A库',1);
-// $d_info = CarDT::findOne(['id'=>$car_info->id]);
-// if(!$d_info) {
-// $d_info = new CarDT();
-// $d_info->id = $car_info->id;
-// $d_info->user_id = 0;
-// $d_info->save();
-//
-//
-// }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF4D()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $status = $request->post('status');
- if($status != 1) {
- $result['msg'] = '请先选择分配状态!';
- return $result;
- }
- $query = $this->getF4Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 11) {
- $car_info->location = 4;
- $car_info->save();
-
- CarF4T::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarDT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarDT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从F4库分配到D库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF5MoveD()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
-// echo 333;
-// die;
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getF4Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 12) {
- $car_info->location = 4;
- $car_info->save();
-
- CarF5T::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarDT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarDT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从F5库分配到D库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF5MoveA()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
-
- $ids = $request->post('ids',array());
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $query = $this->getF4Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 12) {
- $car_info->location = 1;
- $car_info->save();
-
- CarF5T::deleteAll(['id'=>$car_info->id]);
- $this->addLog($car_info->id,'从F5库分配到A库',1);
-// $d_info = CarDT::findOne(['id'=>$car_info->id]);
-// if(!$d_info) {
-// $d_info = new CarDT();
-// $d_info->id = $car_info->id;
-// $d_info->user_id = 0;
-// $d_info->save();
-//
-//
-// }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- public function actionF5D()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $status = $request->post('status');
- if($status != 1) {
- $result['msg'] = '请先选择分配状态!';
- return $result;
- }
- $query = $this->getF4Query($request);
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($query->each(100) as $c_info) {
- $car_info = CarT::findOne(['id'=>$c_info->id]);
- if($car_info->location == 12) {
- $car_info->location = 4;
- $car_info->save();
-
- CarF5T::deleteAll(['id'=>$car_info->id]);
-
- $d_info = CarDT::findOne(['id'=>$car_info->id]);
- if(!$d_info) {
- $d_info = new CarDT();
- $d_info->id = $car_info->id;
- $d_info->user_id = 0;
- $d_info->save();
-
- $this->addLog($car_info->id,'从F5库分配到D库',1);
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- /**
- * E库分配
- * @return array
- */
- public function actionEAssign()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
- $user_id = $request->post('user_id',0);
-
- if($user_id == 0) {
- $result['msg'] = '请先选择分配给哪个业务员';
- return $result;
- }
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $c_info = CarET::findOne(['id'=>$id]);
-
- if($c_info->user_id > 0) {
- $result['msg'] = '该车辆已经被分配';
- return $result;
- }
- $c_info->user_id = $user_id;
- $c_info->save();
-
- $car_info = $c_info->car;
- $car_info->op_user2 = $c_info->user->getShowName();
- $car_info->save();
-
- //添加预约
- AppointmentT::deleteAll('car_id='.$c_info->id);
- $row = new AppointmentT();
- $row->car_id = $c_info->id;
- $row->user_id = $user_id;
- $row->pdate = date('Y-m-d');
- $row->ptime = '09:00';
- $row->remark = '首次分配';
- $row->is_first = 1;
- $row->save();
-
- //添加历史预约
- $h_row = new AppointmentHistoryT();
- $h_row->car_id = $c_info->id;
- $h_row->user_id = $user_id;
- $h_row->pdate = date('Y-m-d');
- $h_row->ptime = '09:00';
- $h_row->remark = '首次分配';
- $h_row->save();
-
- $this->addLog($c_info->id,'从E库分配跟踪数据到业务员:'.$c_info->user->getShowName(),1);
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- public function actionEReturn()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
-
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $c_info = CarET::findOne(['id'=>$id]);
- if($c_info->user_id > 0)
- $this->addLog($c_info->id,'从业务员:'.$c_info->user->getShowName().'回收跟踪数据',1);
- //删除预约
- AppointmentT::deleteAll('user_id='.$c_info->user_id.' and car_id='.$c_info->id);
-
- $car_info = $c_info->car;
- $car_info->user_id = 0;
- $car_info->save();
-
- $c_info->user_id = 0;
- $c_info->save();
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
- //F库
- private function getFQuery($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $print_begin = $request->post('print_begin');
- $print_end = $request->post('print_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_month');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_month1');
- $insurer1_day1 = $request->post('insurer1_day1');
-
- $status = $request->post('status');
- $username = $request->post('username');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $old_user = $request->post('old_user');
- $company = $request->post('company');
- $user1 = $request->post('user1');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $old_user = $request->get('old_user');
- $company = $request->get('company');
- $user1 = $request->get('user1');
- }
- $query = CarFT::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_f_t`.`id`');
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
- }
- if($print_begin != '') {
- $query = $query->andWhere('car_t.print_date>="'.$print_begin.'"');
- }
- if($print_end != '') {
- $query = $query->andWhere('car_t.print_date<="'.$print_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($insurer1_month != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
- }
- if($insurer1_day != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
- }
- if($insurer1_month1 != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
- }
- if($insurer1_day1 != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
- }
-
- if($status == 1) {
- $query = $query->andWhere('car_f_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('car_f_t.user_id>0');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_f_t.user_id='.$user_info->id);
- }
- }
- if($old_user != '') {
- $query = $query->andWhere('car_t.old_user="'.$old_user.'"');
- }
- if($company != '') {
- $query = $query->andWhere('company like"'.$company.'%"');
- }
- if($user1 != '') {
- $query = $query->andWhere('op_user1 like "'.$user1.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', car_f_t.id '.$sort_value);
- //echo $query->createCommand()->rawSql;
- return $query;
- }
- public function actionFIndex()
- {
- $request = Yii::$app->request;
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $engine_no = $request->get('engine_no');
- $car_frame_no = $request->get('car_frame_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
-
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $user_id = $request->get('user_id');
- $page = $request->get('page',1);
- $op = $request->get('op',1);
- $company = $request->get('company');
- $user1 = $request->get('user1');
-
- $query = $this->getFQuery($request);
- if($op==0) {
- $query = $query->andWhere('car_f_t.id=-1');
- }
- //echo $query->createCommand()->rawSql;
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
- $monthes= CarT::MONTH;
- $days= CarT::DAYS;
- return $this->render('f-index',[
- 'items' => $items,
- 'monthes' => $monthes,
- 'days' => $days,
- 'page_info' => $page_info,
- 'page' => $page,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'engine_no' => $engine_no,
- 'car_frame_no' => $car_frame_no,
- 'print_begin' => $print_begin,
- 'print_end' => $print_end,
- 'insurer1_begin' => $insurer1_begin,
- 'insurer1_end' => $insurer1_end,
- 'insurer1_month' =>$insurer1_month,
- 'insurer1_day' =>$insurer1_day,
- 'insurer1_month1' =>$insurer1_month1,
- 'insurer1_day1' =>$insurer1_day1,
- 'invalid_items' => $invalid_items,
- 'user_items' => $user_items,
- 'status' => $status,
- 'username' => $username,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'user_id' => $user_id,
- 'company' => $company,
- 'user1' => $user1
- ]);
- }
- private function getF1Query($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $print_begin = $request->post('print_begin');
- $print_end = $request->post('print_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_month');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_month1');
- $insurer1_day1 = $request->post('insurer1_day1');
-
- $status = $request->post('status');
- $username = $request->post('username');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $old_user = $request->post('old_user');
- $company = $request->post('company');
- $user1 = $request->post('user1');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $old_user = $request->get('old_user');
- $company = $request->get('company');
- $user1 = $request->get('user1');
- }
- $query = CarF1T::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_f1_t`.`id`');
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
- }
- if($print_begin != '') {
- $query = $query->andWhere('car_t.print_date>="'.$print_begin.'"');
- }
- if($print_end != '') {
- $query = $query->andWhere('car_t.print_date<="'.$print_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($insurer1_month != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
- }
- if($insurer1_day != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
- }
- if($insurer1_month1 != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
- }
- if($insurer1_day1 != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
- }
-
- if($status == 1) {
- $query = $query->andWhere('car_f1_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('car_f1_t.user_id>0');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_f1_t.user_id='.$user_info->id);
- }
- }
- if($old_user != '') {
- $query = $query->andWhere('car_t.old_user="'.$old_user.'"');
- }
- if($company != '') {
- $query = $query->andWhere('company like"'.$company.'%"');
- }
- if($user1 != '') {
- $query = $query->andWhere('op_user1 like "'.$user1.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', car_f1_t.id '.$sort_value);
- //echo $query->createCommand()->rawSql;
- return $query;
- }
- public function actionF1Index()
- {
- $request = Yii::$app->request;
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $engine_no = $request->get('engine_no');
- $car_frame_no = $request->get('car_frame_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
-
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $user_id = $request->get('user_id');
- $page = $request->get('page',1);
- $op = $request->get('op',1);
- $company = $request->get('company');
- $user1 = $request->get('user1');
-
- $query = $this->getF1Query($request);
- if($op==0) {
- $query = $query->andWhere('car_f1_t.id=-1');
- }
- //echo $query->createCommand()->rawSql;
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
- $monthes= CarT::MONTH;
- $days= CarT::DAYS;
- return $this->render('f1-index',[
- 'items' => $items,
- 'monthes' => $monthes,
- 'days' => $days,
- 'page_info' => $page_info,
- 'page' => $page,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'engine_no' => $engine_no,
- 'car_frame_no' => $car_frame_no,
- 'print_begin' => $print_begin,
- 'print_end' => $print_end,
- 'insurer1_begin' => $insurer1_begin,
- 'insurer1_end' => $insurer1_end,
- 'insurer1_month' =>$insurer1_month,
- 'insurer1_day' =>$insurer1_day,
- 'insurer1_month1' =>$insurer1_month1,
- 'insurer1_day1' =>$insurer1_day1,
- 'invalid_items' => $invalid_items,
- 'user_items' => $user_items,
- 'status' => $status,
- 'username' => $username,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'user_id' => $user_id,
- 'company' => $company,
- 'user1' => $user1
- ]);
- }
- private function getF2Query($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $print_begin = $request->post('print_begin');
- $print_end = $request->post('print_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_month');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_month1');
- $insurer1_day1 = $request->post('insurer1_day1');
-
- $status = $request->post('status');
- $username = $request->post('username');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $old_user = $request->post('old_user');
- $company = $request->post('company');
- $user1 = $request->post('user1');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $old_user = $request->get('old_user');
- $company = $request->get('company');
- $user1 = $request->get('user1');
- }
- $query = CarF2T::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_f2_t`.`id`');
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
- }
- if($print_begin != '') {
- $query = $query->andWhere('car_t.print_date>="'.$print_begin.'"');
- }
- if($print_end != '') {
- $query = $query->andWhere('car_t.print_date<="'.$print_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($insurer1_month != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
- }
- if($insurer1_day != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
- }
- if($insurer1_month1 != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
- }
- if($insurer1_day1 != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
- }
-
- if($status == 1) {
- $query = $query->andWhere('car_f2_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('car_f2_t.user_id>0');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_f2_t.user_id='.$user_info->id);
- }
- }
- if($old_user != '') {
- $query = $query->andWhere('car_t.old_user="'.$old_user.'"');
- }
- if($company != '') {
- $query = $query->andWhere('company like"'.$company.'%"');
- }
- if($user1 != '') {
- $query = $query->andWhere('op_user1 like "'.$user1.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', car_f2_t.id '.$sort_value);
- //echo $query->createCommand()->rawSql;
- return $query;
- }
- public function actionF2Index()
- {
- $request = Yii::$app->request;
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $engine_no = $request->get('engine_no');
- $car_frame_no = $request->get('car_frame_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
-
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $user_id = $request->get('user_id');
- $page = $request->get('page',1);
- $op = $request->get('op',1);
- $company = $request->get('company');
- $user1 = $request->get('user1');
-
- $query = $this->getF2Query($request);
- if($op==0) {
- $query = $query->andWhere('car_f2_t.id=-1');
- }
- //echo $query->createCommand()->rawSql;
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
- $monthes= CarT::MONTH;
- $days= CarT::DAYS;
- return $this->render('f2-index',[
- 'items' => $items,
- 'monthes' => $monthes,
- 'days' => $days,
- 'page_info' => $page_info,
- 'page' => $page,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'engine_no' => $engine_no,
- 'car_frame_no' => $car_frame_no,
- 'print_begin' => $print_begin,
- 'print_end' => $print_end,
- 'insurer1_begin' => $insurer1_begin,
- 'insurer1_end' => $insurer1_end,
- 'insurer1_month' =>$insurer1_month,
- 'insurer1_day' =>$insurer1_day,
- 'insurer1_month1' =>$insurer1_month1,
- 'insurer1_day1' =>$insurer1_day1,
- 'invalid_items' => $invalid_items,
- 'user_items' => $user_items,
- 'status' => $status,
- 'username' => $username,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'user_id' => $user_id,
- 'company' => $company,
- 'user1' => $user1
- ]);
- }
- private function getF4Query($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $print_begin = $request->post('print_begin');
- $print_end = $request->post('print_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_month');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_month1');
- $insurer1_day1 = $request->post('insurer1_day1');
-
- $status = $request->post('status');
- $username = $request->post('username');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $old_user = $request->post('old_user');
- $company = $request->post('company');
- $user1 = $request->post('user1');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $old_user = $request->get('old_user');
- $company = $request->get('company');
- $user1 = $request->get('user1');
- }
- $query = CarF4T::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_f4_t`.`id`');
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
- }
- if($print_begin != '') {
- $query = $query->andWhere('car_t.print_date>="'.$print_begin.'"');
- }
- if($print_end != '') {
- $query = $query->andWhere('car_t.print_date<="'.$print_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($insurer1_month != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
- }
- if($insurer1_day != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
- }
- if($insurer1_month1 != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
- }
- if($insurer1_day1 != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
- }
-
- if($status == 1) {
- $query = $query->andWhere('car_f4_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('car_f4_t.user_id>0');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_f4_t.user_id='.$user_info->id);
- }
- }
- if($old_user != '') {
- $query = $query->andWhere('car_t.old_user="'.$old_user.'"');
- }
- if($company != '') {
- $query = $query->andWhere('company like"'.$company.'%"');
- }
- if($user1 != '') {
- $query = $query->andWhere('op_user1 like "'.$user1.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', car_f4_t.id '.$sort_value);
- //echo $query->createCommand()->rawSql;
- return $query;
- }
- public function actionF4Index()
- {
- $request = Yii::$app->request;
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $engine_no = $request->get('engine_no');
- $car_frame_no = $request->get('car_frame_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
-
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $user_id = $request->get('user_id');
- $page = $request->get('page',1);
- $op = $request->get('op',1);
- $company = $request->get('company');
- $user1 = $request->get('user1');
-
- $query = $this->getF4Query($request);
- if($op==0) {
- $query = $query->andWhere('car_f4_t.id=-1');
- }
- //echo $query->createCommand()->rawSql;
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
- $monthes= CarT::MONTH;
- $days= CarT::DAYS;
- return $this->render('f4-index',[
- 'items' => $items,
- 'monthes' => $monthes,
- 'days' => $days,
- 'page_info' => $page_info,
- 'page' => $page,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'engine_no' => $engine_no,
- 'car_frame_no' => $car_frame_no,
- 'print_begin' => $print_begin,
- 'print_end' => $print_end,
- 'insurer1_begin' => $insurer1_begin,
- 'insurer1_end' => $insurer1_end,
- 'insurer1_month' =>$insurer1_month,
- 'insurer1_day' =>$insurer1_day,
- 'insurer1_month1' =>$insurer1_month1,
- 'insurer1_day1' =>$insurer1_day1,
- 'invalid_items' => $invalid_items,
- 'user_items' => $user_items,
- 'status' => $status,
- 'username' => $username,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'user_id' => $user_id,
- 'company' => $company,
- 'user1' => $user1
- ]);
- }
- private function getF5Query($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $print_begin = $request->post('print_begin');
- $print_end = $request->post('print_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_month');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_month1');
- $insurer1_day1 = $request->post('insurer1_day1');
-
- $status = $request->post('status');
- $username = $request->post('username');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $old_user = $request->post('old_user');
- $company = $request->post('company');
- $user1 = $request->post('user1');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $old_user = $request->get('old_user');
- $company = $request->get('company');
- $user1 = $request->get('user1');
- }
- $query = CarF5T::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_f5_t`.`id`');
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
- }
- if($print_begin != '') {
- $query = $query->andWhere('car_t.print_date>="'.$print_begin.'"');
- }
- if($print_end != '') {
- $query = $query->andWhere('car_t.print_date<="'.$print_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($insurer1_month != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
- }
- if($insurer1_day != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
- }
- if($insurer1_month1 != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
- }
- if($insurer1_day1 != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
- }
-
- if($status == 1) {
- $query = $query->andWhere('car_f5_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('car_f5_t.user_id>0');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_f5_t.user_id='.$user_info->id);
- }
- }
- if($old_user != '') {
- $query = $query->andWhere('car_t.old_user="'.$old_user.'"');
- }
- if($company != '') {
- $query = $query->andWhere('company like"'.$company.'%"');
- }
- if($user1 != '') {
- $query = $query->andWhere('op_user1 like "'.$user1.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.', car_f5_t.id '.$sort_value);
- //echo $query->createCommand()->rawSql;
- return $query;
- }
- public function actionF5Index()
- {
- $request = Yii::$app->request;
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $engine_no = $request->get('engine_no');
- $car_frame_no = $request->get('car_frame_no');
- $print_begin = $request->get('print_begin');
- $print_end = $request->get('print_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
-
-
-
- $status = $request->get('status');
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $user_id = $request->get('user_id');
- $page = $request->get('page',1);
- $op = $request->get('op',1);
- $company = $request->get('company');
- $user1 = $request->get('user1');
-
- $query = $this->getF5Query($request);
- if($op==0) {
- $query = $query->andWhere('car_f5_t.id=-1');
- }
- //echo $query->createCommand()->rawSql;
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTree();
- $user_items = $this->my->getChildren();
- $monthes= CarT::MONTH;
- $days= CarT::DAYS;
- return $this->render('f5-index',[
- 'items' => $items,
- 'monthes' => $monthes,
- 'days' => $days,
- 'page_info' => $page_info,
- 'page' => $page,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'engine_no' => $engine_no,
- 'car_frame_no' => $car_frame_no,
- 'print_begin' => $print_begin,
- 'print_end' => $print_end,
- 'insurer1_begin' => $insurer1_begin,
- 'insurer1_end' => $insurer1_end,
- 'insurer1_month' =>$insurer1_month,
- 'insurer1_day' =>$insurer1_day,
- 'insurer1_month1' =>$insurer1_month1,
- 'insurer1_day1' =>$insurer1_day1,
- 'invalid_items' => $invalid_items,
- 'user_items' => $user_items,
- 'status' => $status,
- 'username' => $username,
- 'sort_key' => $sort_key,
- 'sort_value' => $sort_value,
- 'user_id' => $user_id,
- 'company' => $company,
- 'user1' => $user1
- ]);
- }
-
- private function getDQuery1($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $insurer1_month = $request->post('insurer1_month');
- $insurer1_day = $request->post('insurer1_day');
- $insurer1_month1 = $request->post('insurer1_month1');
- $insurer1_day1 = $request->post('insurer1_day1');
- $status = $request->post('status',1);
- $username = $request->post('username');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- $old_user = $request->post('old_user');
- $user1 = $request->post('user1');
- $user2 = $request->post('user2');
- $company = $request->post('company');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $insurer1_month = $request->get('insurer1_month');
- $insurer1_day = $request->get('insurer1_day');
- $insurer1_month1 = $request->get('insurer1_month1');
- $insurer1_day1 = $request->get('insurer1_day1');
- $status = $request->get('status',1);
- $username = $request->get('username');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- $old_user = $request->get('old_user');
- $user1 = $request->get('user1');
- $user2 = $request->get('user2');
- $company = $request->get('company');
- }
- $params = array();
- $params['car_man'] = $car_man;
- $params['phone'] = $phone;
- $params['car_no'] = $car_no;
- $params['insurer1_begin'] = $insurer1_begin;
- $params['insurer1_end'] = $insurer1_end;
- $params['insurer1_month'] = $insurer1_month;
- $params['insurer1_day'] = $insurer1_day;
- $params['insurer1_month1'] = $insurer1_month1;
- $params['insurer1_day1'] = $insurer1_day1;
- $params['status'] = $status;
- $params['username'] = $username;
- $params['sort_key'] = $sort_key;
- $params['sort_value'] = $sort_value;
- $params['old_user'] = $old_user;
- $params['user1'] = $user1;
- $params['user2'] = $user2;
- $params['company'] = $company;
-
- $query = CarDT::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_d_t`.`id`')
- ->andWhere('car_d_t.back =1');
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man="'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone like "'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($insurer1_month != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"');
- }
- if($insurer1_day != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"');
- }
- if($insurer1_month1 != '') {
- $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"');
- }
- if($insurer1_day1 != '') {
- $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"');
- }
- if($status == 1) {
- $query = $query->andWhere('car_d_t.user_id=0');
- }
- if($status == 2) {
- $query = $query->andWhere('car_d_t.user_id>0');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_d_t.user_id='.$user_info->id);
- }
- }
- if($old_user != '') {
- $query = $query->andWhere('car_t.old_user like "'.$old_user.'%"');
- }
- if($user1 != '') {
- $query = $query->andWhere('car_t.op_user1 like "'.$user1.'%"');
- }
- if($user2 != '') {
- $query = $query->andWhere('car_t.op_user3 like "'.$user2.'%"');
- }
- if($company != '') {
- $query = $query->andWhere('company like "'.$company.'%"');
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.',car_d_t.id '.$sort_value);
- return ['query'=>$query,'params'=>$params];
- }
-
- public function actionDataDReturn()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '操作失败';
-
- if($request->isPost) {
- $ids = $request->post('ids',array());
-
- if(count($ids) == 0) {
- $result['msg'] = '请先钩选车辆';
- return $result;
- }
-
- $tran = CarT::getDb()->beginTransaction();
- try {
- foreach($ids as $id) {
- $d_info = CarDT::findOne(['id'=>$id]);
- if($d_info->user_id > 0){
- $car_info = $d_info->car;
- $car_info->user_id = 0;
- $car_info->save();
-
- $this->addLog($d_info->id,'从业务员:'.$d_info->user->getShowName().'收回数据',1);
- $d_info->user_id=0;
- $d_info->save();
-
-
-
-
- //删除预约
- $row = AppointmentT::find()
- ->where('user_id='.$d_info->user_id.' and car_id='.$d_info->id)
- ->one();
- if($row) {
- $row->delete();
- }
-
- //删除保单
- $order_row = OrderT::find()
- ->where('user_id='.$d_info->user_id.' and car_id='.$d_info->id.' and status_id=1')
- ->one();
- if($order_row) {
- OrderUserT::deleteAll('order_id='.$order_row->id);
- $order_row->delete();
- }
-
- }
-
- }
- $result['success'] = true;
- $result['msg'] = '操作成功';
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- echo $e->getMessage();
- }
- }
- return $result;
- }
-
- private function getInvalidQuery1($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $register_begin = $request->post('register_begin');
- $register_end = $request->post('register_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $invalid_id = $request->post('invalid_id');
- $username = $request->post('username');
- $user1 = $request->post('user1');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $invalid_id = $request->get('invalid_id');
- $username = $request->get('username');
- $user1 = $request->get('user1');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- }
- $params = array();
- $params['car_man'] = $car_man;
- $params['phone'] = $phone;
- $params['car_no'] = $car_no;
- $params['register_begin'] = $register_begin;
- $params['register_end'] = $register_end;
- $params['insurer1_begin'] = $insurer1_begin;
- $params['insurer1_end'] = $insurer1_end;
- $params['invalid_id'] = $invalid_id;
- $params['username'] = $username;
- $params['user1'] = $user1;
- $params['sort_key'] = $sort_key;
- $params['sort_value'] = $sort_value;
-
- $query = CarF3T::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_f3_t`.`id`');
-
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man="'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone="'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no="'.$car_no.'"');
- }
- if($register_begin != '') {
- $query = $query->andWhere('car_t.register_date>="'.$register_begin.'"');
- }
- if($register_end != '') {
- $query = $query->andWhere('car_t.register_date<="'.$register_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($invalid_id > 0) {
- $query = $query->andWhere('car_invalid_t.invalid_id='.$invalid_id);
- }
- if($user1 != '') {
- $query = $query->andWhere('car_t.op_user1 like "'.$user1.'%"');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_f3_t.user_id='.$user_info->id);
- }
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.',car_f3_t.id '.$sort_value);
-// echo $query->createCommand()->rawSql;
- return ['query'=>$query,'params'=>$params];
- }
-
- public function actionInvalidIndex1()
- {
- $request = Yii::$app->request;
- $page = $request->get('page',1);
- $op = $request->get('op',1);
-
- $data = $this->getInvalidQuery1($request);
- $query = $data['query'];
- $params = $data['params'];
- $params['page'] = $page;
-
- if($op==0) {
- $query = $query->andWhere('car_f3_t.id=-1');
- }
-
-// echo $query->createCommand()->rawSql;
-
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTreeXinbaoNew(2);
-
- $params['items'] = $items;
- $params['page_info'] = $page_info;
- $params['invalid_items'] = $invalid_items;
-
- return $this->render('f3-index',$params);
- }
- private function getInvalidQuery2($request)
- {
- if($request->isPost) {
- $car_man = $request->post('car_man');
- $phone = $request->post('phone');
- $car_no = $request->post('car_no');
- $register_begin = $request->post('register_begin');
- $register_end = $request->post('register_end');
- $insurer1_begin = $request->post('insurer1_begin');
- $insurer1_end = $request->post('insurer1_end');
- $invalid_id = $request->post('invalid_id');
- $username = $request->post('username');
- $user1 = $request->post('user1');
- $sort_key = $request->post('sort_key');
- $sort_value = $request->post('sort_value');
- } else {
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $register_begin = $request->get('register_begin');
- $register_end = $request->get('register_end');
- $insurer1_begin = $request->get('insurer1_begin');
- $insurer1_end = $request->get('insurer1_end');
- $invalid_id = $request->get('invalid_id');
- $username = $request->get('username');
- $user1 = $request->get('user1');
- $sort_key = $request->get('sort_key');
- $sort_value = $request->get('sort_value');
- }
- $params = array();
- $params['car_man'] = $car_man;
- $params['phone'] = $phone;
- $params['car_no'] = $car_no;
- $params['register_begin'] = $register_begin;
- $params['register_end'] = $register_end;
- $params['insurer1_begin'] = $insurer1_begin;
- $params['insurer1_end'] = $insurer1_end;
- $params['invalid_id'] = $invalid_id;
- $params['username'] = $username;
- $params['user1'] = $user1;
- $params['sort_key'] = $sort_key;
- $params['sort_value'] = $sort_value;
-
- $query = CarF6T::find()
- ->leftJoin(CarT::tableName(),'`car_t`.`id`=`car_f6_t`.`id`');
-
- if($car_man != '') {
- $query = $query->andWhere('car_t.car_man="'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('car_t.phone="'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_t.car_no="'.$car_no.'"');
- }
- if($register_begin != '') {
- $query = $query->andWhere('car_t.register_date>="'.$register_begin.'"');
- }
- if($register_end != '') {
- $query = $query->andWhere('car_t.register_date<="'.$register_end.'"');
- }
- if($insurer1_begin != '') {
- $query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
- }
- if($insurer1_end != '') {
- $query = $query->andWhere('car_t.insurer1_date<="'.$insurer1_end.'"');
- }
- if($invalid_id > 0) {
- $query = $query->andWhere('car_invalid_t.invalid_id='.$invalid_id);
- }
- if($user1 != '') {
- $query = $query->andWhere('car_t.op_user1 like "'.$user1.'%"');
- }
- if($username != '') {
- $user_info = UserT::findOne(['username'=>$username]);
- if($user_info) {
- $query = $query->andWhere('car_f6_t.user_id='.$user_info->id);
- }
- }
- $query = $query->orderBy($sort_key.' '.$sort_value.',car_f6_t.id '.$sort_value);
-// echo $query->createCommand()->rawSql;
- return ['query'=>$query,'params'=>$params];
- }
-
- public function actionInvalidIndex2()
- {
- $request = Yii::$app->request;
- $page = $request->get('page',1);
- $op = $request->get('op',1);
-
- $data = $this->getInvalidQuery2($request);
- $query = $data['query'];
- $params = $data['params'];
- $params['page'] = $page;
-
- if($op==0) {
- $query = $query->andWhere('car_f6_t.id=-1');
- }
-
-// echo $query->createCommand()->rawSql;
-
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
- $invalid_items = InvalidT::getTreeXubao(2);
-
- $params['items'] = $items;
- $params['page_info'] = $page_info;
- $params['invalid_items'] = $invalid_items;
-
- return $this->render('f6-index',$params);
- }
-
-
-
}
diff --git a/frontend/controllers/FinanceController.php b/frontend/controllers/FinanceController.php
index 284c903..931d407 100644
--- a/frontend/controllers/FinanceController.php
+++ b/frontend/controllers/FinanceController.php
@@ -6425,7 +6425,7 @@ class FinanceController extends \frontend\controllers\UserBaseController
$car_info->id_number = $id_number;
}
if($id_phone != ''){
- $car_info->id_phone = $id_phone;
+ $car_info->id_man_phone = $id_phone;
}
if($seats != ''){
$car_info->seats = $seats;
@@ -6434,7 +6434,7 @@ class FinanceController extends \frontend\controllers\UserBaseController
$car_info->car_man_number = $car_man_number;
}
if($car_man_phone != ''){
- $car_info->phone = $car_man_phone;
+ $car_info->car_man_phone = $car_man_phone;
}
if(!$car_info->save(false)) {
throw new \Exception(print_r($car_info->getErrors(), true));
@@ -6482,7 +6482,7 @@ class FinanceController extends \frontend\controllers\UserBaseController
$car_info->id_number = $id_number;
}
if($id_phone != ''){
- $car_info->id_phone = $id_phone;
+ $car_info->id_man_phone = $id_phone;
}
if($seats != ''){
$car_info->seats = $seats;
@@ -6491,7 +6491,7 @@ class FinanceController extends \frontend\controllers\UserBaseController
$car_info->car_man_number = $car_man_number;
}
if($car_man_phone != ''){
- $car_info->phone = $car_man_phone;
+ $car_info->car_man_phone = $car_man_phone;
}
if(!$car_info->save(false)) {
throw new \Exception(print_r($car_info->getErrors(), true));
@@ -6657,61 +6657,91 @@ class FinanceController extends \frontend\controllers\UserBaseController
return $result;
}
- public function actionTichengJisuan()
- {
+ public function actionSelUserDlg() {
$request = Yii::$app->request;
- $begin_date = $request->get('begin_date',date('Y-m-d'));
- $end_date = $request->get('end_date',date('Y-m-d'));
- $begin_totalclear = $request->get('begin_totalclear');
- $end_totalclear = $request->get('end_totalclear');
- $car_no_type = $request->get('car_no_type');
- $company_id = $request->get('company_id');
- $user_names = $request->get('user_names');
- $car_no = $request->get('car_no');
- $insurer_type = $request->get('insurer_type',1);
-
- $dz_group = $request->get('dz_group');
- $dz_rate = $request->get('dz_rate');
- $dz_names = $request->get('dz_names');
-
- $base_rate = $request->get('base_rate');
- $xiaoyi_rate1 = $request->get('xiaoyi_rate1');
- $xiaoyi_rate2 = $request->get('xiaoyi_rate2');
- $online_rate = $request->get('online_rate');
- $yeji_rate = $request->get('yeji_rate');
- $gift1 = $request->get('gift1');
- $gift2 = $request->get('gift2');
- $gift3 = $request->get('gift3');
- $gift4 = $request->get('gift4');
- $gift5 = $request->get('gift5');
- $ticket1 = $request->get('ticket1');
- $ticket2 = $request->get('ticket2');
- $ticket3 = $request->get('ticket3');
- $zhengben_ticheng = $request->get('zhengben_ticheng');
- $hebao_ticheng = $request->get('hebao_ticheng');
- $songdan_ticheng = $request->get('songdan_ticheng');
- $genzong_ticheng = $request->get('genzong_ticheng');
- $first_xinbao_rate = $request->get('first_xinbao_rate');
- $xianzhong_rate = $request->get('xianzhong_rate');
-
+ $name = $request->get('name');
+ $group_items = GroupT::getTree((int)$this->my->group_id);
+ if($this->my->id == 1)
+ $group_items = GroupT::getTree();
- $is_fan= $request->get('is_fan',0);
+ return $this->render('sel-user-dlg',[
+ 'group_items' => $group_items,
+ 'id_name' => $name
+ ]);
+ }
+ public function actionSelUserSearch() {
+ Yii::$app->response->format = Response::FORMAT_JSON;
+ $request = Yii::$app->request;
+ $result = array();
+ $result['success'] = false;
+ $result['msg'] = '操作失败';
+ $username = $request->get('username');
+ $group_id = $request->get('group_id', 0);
- $page = $request->get('page',1);
- if($page < 1) $page = 1;
+ $query = UserT::find()->where('is_delete=0')
+ ->orderBy('username', 'asc');
+ if($group_id > 0) {
+ $group_items = GroupT::getTree($group_id);
+ $group_ids = [];
+ $group_ids[] = $group_id;
+ foreach($group_items as $group_item) {
+ $group_ids[] = $group_item->id;
+ }
+ $query->andWhere('group_id in ('.join(',',$group_ids).')');
+ }
+ if($username != '') {
+ $query->andWhere('username like "'.$username.'%"');
+ }
+ $items = $query->all();
+ foreach($items as $item) {
+ $row = [];
+ $row['id'] = $item->id;
+ $row['username'] = $item->username;
+ $row['name'] = $item->getShowName();
+ $result['users'][] = $row;
+ }
+ $result['success'] = true;
+ $result['msg'] = '操作成功';
+ return $result;
+ }
- $group_id = $request->get('group_id');
+ public function actionTichengJisuan() {
$group_items = GroupT::getTree((int)$this->my->group_id);
- if($this->my->id == 1 || $this->my->username=='6002' || $this->my->username=='7053')
+ if($this->my->id == 1)
$group_items = GroupT::getTree();
- $group_ids[] = $group_id;
+ $company_items = InsurerCompany2T::find()->all();
+
+ return $this->render('ticheng-jisuan',[
+ 'group_items' => $group_items,
+ 'company_items' => $company_items
+ ]);
+ }
+
+ public function actionTichengJisuanJson()
+ {
+ Yii::$app->response->format = Response::FORMAT_JSON;
+ $request = Yii::$app->request;
+ $user_names = $request->get('user_names');
+ $car_no_type = $request->get('car_no_type');
+ $company_id = $request->get('company_id');
+ $insurer_type = $request->get('insurer_type',1);
+ $car_no = $request->get('car_no');
+ $begin_date = $request->get('begin_date',date('Y-m-d'));
+ $end_date = $request->get('end_date',date('Y-m-d'));
+ $begin_totalclear = $request->get('begin_totalclear');
+ $end_totalclear = $request->get('end_totalclear');
+ $group_id = $request->get('group_id', 0);
+ $offset = $request->get('offset', 0);
+ $limit = $request->get('limit', 10);
+ $group_ids = [];
if($group_id > 0) {
$items = GroupT::getTree($group_id);
+ $group_ids[] = $group_id;
foreach($items as $group_info) {
$group_ids[] = $group_info->id;
}
@@ -6726,92 +6756,68 @@ class FinanceController extends \frontend\controllers\UserBaseController
if($user_names != '' && $user_names != 'null'){
$user_arr = explode(',',$user_names);
$user_ids = [];
- foreach ($user_arr as $user){
- $username = substr($user,0,strpos($user, '('));
+ foreach ($user_arr as $username){
$user = UserT::find()->where('is_delete=0')->andWhere('username="'.$username.'"')->one();
if($user)
$user_ids[] = $user->id;
}
- if($is_fan == 1){
- $query = $query->andWhere(['not in','caiwu_t.user_id',$user_ids]);
- }else{
- $query = $query->andWhere(['in','caiwu_t.user_id',$user_ids]);
- }
-
+ $query->andWhere(['in','caiwu_t.user_id',$user_ids]);
}
if( $company_id > 0) {
- $query = $query->andWhere('order_t.company_id='.$company_id);
+ $query->andWhere('order_t.company2_id='.$company_id);
}
if( $car_no != '') {
- $query = $query->andWhere('order_t.car_no="'.$car_no.'"');
+ $query->andWhere('order_t.car_no="'.$car_no.'"');
}
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){
- $query = $query->andWhere('caiwu_t.car_no not like "' . '京' . '%"');
+ $query->andWhere('caiwu_t.car_no not like "' . '京' . '%"');
}
if($begin_totalclear != ''){
- $query = $query->andWhere('caiwu_t.total_clear >=' . $begin_totalclear);
+ $query->andWhere('caiwu_t.total_clear >=' . $begin_totalclear);
}
if($end_totalclear != ''){
- $query = $query->andWhere('caiwu_t.total_clear <=' . $end_totalclear);
+ $query->andWhere('caiwu_t.total_clear <=' . $end_totalclear);
}
-
if ($begin_date != "") {
- $query = $query->andWhere('order_t.print_date>="' . $begin_date . '"');
+ $query->andWhere('order_t.print_date>="' . $begin_date . '"');
}
if ($end_date != "") {
- $query = $query->andWhere('order_t.print_date<="' . $end_date . '"');
+ $query->andWhere('order_t.print_date<="' . $end_date . '"');
}
-
$user_items = $this->my->getChildren('');
- if($this->my->username == '6002' || $this->my->username == '7053')
- $user_items = $this->my->getChildren('',1);
$user_items[] = $this->my;
$row = array();
foreach($user_items as $user_info) {
-// if ($user_info->is_leave == 1) continue;
-// var_dump($user_info);
if ($group_id > 0) {
if (!in_array($user_info->group_id, $group_ids)) {
continue;
}
}
-
$row[] = $user_info->id;
-
}
-// var_dump($row);
//加上级别筛选
if($group_id > 0){
- if($is_fan == 1){
- $query = $query->andWhere(['not in','caiwu_t.user_id',$row]);
- }else{
- $query = $query->andWhere(['in','caiwu_t.user_id',$row]);
- }
-
+ $query->andWhere(['in','caiwu_t.user_id',$row]);
}
-
-
$query1 = clone $query;
if($insurer_type ==1){
- $query = $query->andWhere('caiwu_t.insurer_type=1');
+ $query->andWhere('caiwu_t.insurer_type=1');
}
$items = $query->all();
-//echo $query->createCommand()->rawSql;
-
$total2_clear_all = $query1->andWhere('caiwu_t.insurer_type=2')->sum('total_clear');
$yewu_ticheng_all = 0;
@@ -6822,7 +6828,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
$liquan_all = 0;
$yuangong_money_all = 0;
foreach($items as $index => $item) {
-
$order_caiwu_info = $item->orderCaiwu;
$order_info = $item->order;
@@ -6839,101 +6844,514 @@ class FinanceController extends \frontend\controllers\UserBaseController
$yuangong_money_all += $yuangong_money;
}
-// $sum_r_total = $query->sum('r_total');
-// //商业净保费综合
-// $sum_total_clear = $query->sum('total_clear'); //是错误的
-//
-// //商业总保费
-// $sum_total = $query->sum('total');
-//
-// $sum_total_dis = $query->sum('total_dis');
+// echo $query->createCommand()->rawSql;exit;
+ $total = $query->count();
+ $query->offset($offset)->limit($limit);
+ $items = $query->all();
- $total = $query->count();
+ $data = [];
+ $data['total'] = $total;
+ $data['rows'] = [];
+ foreach($items as $item) {
+ $row = $item->toArray();
+ $row['company_name'] = $item->order->company2->name;
+ $row['print_date'] = $item->order->print_date;
+ $row['yeji_rate'] = $item->orderCaiwu->yeji_rate;
+ $row['yeji_ticheng'] = $item->orderCaiwu->yeji_ticheng;
+ $row['ticheng_zong_rate'] = $item->order->ticheng_zong_rate;
+ $row['ticheng_money'] = $item->order->ticheng_money;
+ $row['gift1_price'] = $item->order->getGiftPrice(1,1);
+ $row['gift2_price'] = $item->order->getGiftPrice(1,2);
+ $row['yuangong_money'] = $item->order->yuangong_money;
+ $row['yewu_ticheng'] = $item->orderCaiwu->yewu_ticheng;
+ if($item->order->car->op2_id > 0) {
+ $row['op_user'] = $item->order->car->op2->showName;
+ $row['op_user1'] = $item->order->car->op1->showName;
+ } else {
+ $row['op_user'] = $item->order->car->op1->showName;
+ $row['op_user1'] = '';
+ }
+ $row['first_xinbao_ticheng'] = $item->orderCaiwu->first_xinbao_ticheng;
+ $row['hebao_ticheng'] = $item->orderCaiwu->hebao_ticheng;
+ $row['op1_user'] = $item->order->op1->showName;
+ $row['zhengben_ticheng'] = $item->orderCaiwu->zhengben_ticheng;
+ $row['op2_user'] = $item->order->op2->showName;
+ $row['dz_ticheng1'] = $item->orderCaiwu->dz_ticheng1;
+ $row['dz_names1'] = $item->orderCaiwu->dz_names1;
+ $row['dz_ticheng2'] = $item->orderCaiwu->dz_ticheng2;
+ $row['dz_names2'] = $item->orderCaiwu->dz_names2;
+ $row['dz_ticheng3'] = $item->orderCaiwu->dz_ticheng3;
+ $row['dz_names3'] = $item->orderCaiwu->dz_names3;
+ $row['dz_ticheng4'] = $item->orderCaiwu->dz_ticheng4;
+ $row['dz_names4'] = $item->orderCaiwu->dz_names4;
+ $row['dz_ticheng5'] = $item->orderCaiwu->dz_ticheng5;
+ $row['dz_names5'] = $item->orderCaiwu->dz_names5;
+ $data['rows'][] = $row;
+ }
+ return $data;
+ }
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
+ public function actionTichengJisuanSave()
+ {
+ set_time_limit(0);
+ ini_set('memory_limit', '3072M');
+ Yii::$app->response->format = Response::FORMAT_JSON;
+ $request = Yii::$app->request;
+ $result = array();
+ $result['success'] = false;
+ $result['msg'] = '操作失败';
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
+
+ $begin_date = $request->post('begin_date');
+ $end_date = $request->post('end_date');
+ $user_names = $request->post('user_names');
+ $begin_totalclear = $request->post('begin_totalclear');
+ $end_totalclear = $request->post('end_totalclear');
+ $car_no_type = $request->post('car_no_type');
+ $company_id = $request->post('company_id');
+ $car_no = $request->post('car_no');
+ $insurer_type = $request->post('insurer_type');
+
+ $dz_group = $request->post('dz_group');
+ $dz_rate = $request->post('dz_rate');
+ $dz_names = $request->post('dz_names');
+
+
+ $yeji_rate = $request->post('yeji_rate');
+
+ $zhengben_ticheng = $request->post('zhengben_ticheng');
+ $hebao_ticheng = $request->post('hebao_ticheng');
+ $songdan_ticheng = $request->post('songdan_ticheng');
+ $genzong_ticheng = $request->post('genzong_ticheng');
+ $first_xinbao_rate = $request->post('first_xinbao_rate');
+
+ $group_id = $request->post('group_id');
+ $group_ids[] = $group_id;
+
+ if($group_id > 0) {
+ $items = GroupT::getTree($group_id);
+
+ foreach($items as $group_info) {
+ $group_ids[] = $group_info->id;
+ }
+ }
+
+
+ $query = CaiwuT::find()
+ ->leftJoin(OrderT::tableName(), "order_t.id=caiwu_t.order_id")
+ ->where('order_t.status_id>1')
+ ->orderBy('order_t.print_date DESC');
+
+ if($user_names != '' && $user_names != 'null'){
+ $user_arr = explode(',',$user_names);
+ $user_ids = [];
+ foreach ($user_arr as $username){
+ $user = UserT::find()->where('is_delete=0')->andWhere('username="'.$username.'"')->one();
+ if($user)
+ $user_ids[] = $user->id;
+ }
+
+ $query->andWhere(['in','caiwu_t.user_id',$user_ids]);
+ }
+
+ if($company_id > 0) {
+ $query->andWhere('order_t.company2_id='.$company_id);
+ }
+ if( $car_no != '') {
+ $query->andWhere('order_t.car_no="'.$car_no.'"');
+ }
+
+ if($car_no_type == 1){
+ $query->andWhere('caiwu_t.car_no like "' . '京' . '%"');
+ }elseif($car_no_type == 2){
+ $query->andWhere('caiwu_t.car_no not like "' . '京' . '%"');
+ }
+
+ if($begin_totalclear != ''){
+ $query->andWhere('caiwu_t.total_clear >=' . $begin_totalclear);
+ }
+ if($end_totalclear != ''){
+ $query->andWhere('caiwu_t.total_clear <=' . $end_totalclear);
+ }
+
+ if ($begin_date != "") {
+ $query->andWhere('order_t.print_date>="' . $begin_date . '"');
+ }
+ if ($end_date != "") {
+ $query->andWhere('order_t.print_date<="' . $end_date . '"');
+ }
+
+ $user_items = $this->my->getChildren('');
+ $user_items[] = $this->my;
+
+ $row = array();
+ foreach($user_items as $user_info) {
+ if ($group_id > 0) {
+ if (!in_array($user_info->group_id, $group_ids)) {
+ continue;
+ }
+ }
+ $row[] = $user_info->id;
+ }
+
+ //加上级别筛选
+ if($group_id > 0){
+ $query->andWhere(['in','caiwu_t.user_id',$row]);
+ }
+
+ if($insurer_type == 1){
+ $query->andWhere('caiwu_t.insurer_type=1');
+ }
+// echo $query->createCommand()->rawSql;exit;
+ $query1 = clone $query;
$items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
+ $item1s = $query1->all();
+ foreach($items as $item) {
+ //在计算之前检查数据是否匹配
+ $order = $item->order;
+ $car = $order->car;
+ $count = OrderT::find()->where('car_no="' . $car->car_no . '"')->andWhere('status_id>1')
+ ->andWhere('insurance_status <>2')->count();
+ $orders = OrderT::find()->where('car_no="' . $car->car_no . '"')->andWhere('status_id>1')
+ ->andWhere('insurance_status <>2')->orderBy('print_date ASC')->all();
+ if ($car->op2_id == 0 && $car->op1_id != $item->user_id ) {
+ $result['msg'] = '数据错误,车牌:' . $car->car_no . '是新保car_t的op1_id:'.$car->op1_id.'--实际order_t的user_id:'.$item->user_id;
+ return $result;
+ }
+ if ($car->op2_id > 0 && $car->op2_id != $item->user_id) {
+ $result['msg'] = '数据错误,车牌:' . $car->car_no . '是续保但是car_t的op2_id:'.$car->op2_id.'--实际order_t的user_id:'.$item->user_id;
+ return $result;
+ }
- $company_items = InsurerCompanyT::find()->all();
+ if ($count > 1) {
+ $ord = $orders[0];
+ if (empty($ord->user)) {
+ continue;
+ }
+ if ($car->op1_id != $orders[0]->user_id) {
+ $result['msg'] = '数据错误,车牌:' . $car->car_no . '是续保但原新保的car_t的op1_id:'.$car->op1_id.'--实际原新保的order_t的user_id:'.$orders[0]->user_id;
+ return $result;
+ }
- $user_items = UserT::find()
- ->where('is_delete=0')
- ->orderBy('username ASC')
- ->all();
-//
-// $insurer_ticheng_items = InsurerTichengT::find()->orderBy('id')->all();
-// $gift_ticheng_items = InsurerTichengGiftT::find()->orderBy('id')->all();
- $gift_items = GiftT::find()->where('type_id=1')->orderBy('id')->all();
- $ticket_items = GiftT::find()->where('type_id=2')->orderBy('id')->all();
+ }
+ }
+
+ $dz_ids = [];
+ if($dz_names != '' && $dz_names != 'null'){
+ $user_arr = explode(',',$dz_names);
+
+ foreach ($user_arr as $user){
+ $username = substr($user,0,strpos($user, '('));
+ $user = UserT::find()->where('is_delete=0')->andWhere('username="'.$username.'"')->one();
+ if($user)
+ $dz_ids[] = $user->id;
+ }
+
+ }
+
+ $tran = OrderCaiwuT::getDb()->beginTransaction();
+ try {
+
+ foreach ($items as $item){
+ $order_caiwu_info = $item->orderCaiwu;
+ $order_info = $item->order;
+
+ if($order_caiwu_info){
+
+ if($yeji_rate != '')
+ $order_caiwu_info->yeji_rate = $yeji_rate;
+ if($dz_rate != ''){
+ if($dz_group == 1) {
+ $order_caiwu_info->dz_rate1 = $dz_rate;
+ }elseif ($dz_group == 2){
+ $order_caiwu_info->dz_rate2 = $dz_rate;
+ }elseif ($dz_group == 3){
+ $order_caiwu_info->dz_rate3 = $dz_rate;
+ }elseif ($dz_group == 4){
+ $order_caiwu_info->dz_rate4 = $dz_rate;
+ }elseif ($dz_group == 5){
+ $order_caiwu_info->dz_rate5 = $dz_rate;
+ }
+ }
+
+
+ if($dz_names != ''){
+ if($dz_group == 1) {
+ $order_caiwu_info->dz_names1 = $dz_names != 0 ? $dz_names : '';
+ }elseif ($dz_group == 2){
+ $order_caiwu_info->dz_names2 = $dz_names != 0 ? $dz_names : '';
+ }elseif ($dz_group == 3){
+ $order_caiwu_info->dz_names3 = $dz_names != 0 ? $dz_names : '';
+ }elseif ($dz_group == 4){
+ $order_caiwu_info->dz_names4 = $dz_names != 0 ? $dz_names : '';
+ }elseif ($dz_group == 5){
+ $order_caiwu_info->dz_names5 = $dz_names != 0 ? $dz_names : '';
+ }
+ }
+
+
+ if($first_xinbao_rate != '')
+ $order_caiwu_info->first_xinbao_rate = $first_xinbao_rate;
+
+ //商业净保费
+ $total_clear = $item->total_clear;
+
+ //业绩提成
+ if($yeji_rate != '')
+ $yeji_ticheng = $total_clear * $yeji_rate /100;
+
+ if($first_xinbao_rate != '')
+ $first_xinbao_ticheng = $first_xinbao_rate * $total_clear /100;
+
+
+ if($yeji_rate != '')
+ $order_caiwu_info->yeji_ticheng = $yeji_ticheng;
+
+ if($dz_rate != ''){
+ if($dz_group == 1) {
+ $order_caiwu_info->dz_ticheng1 = $total_clear * $dz_rate /100;
+ }elseif ($dz_group == 2){
+ $order_caiwu_info->dz_ticheng2 = $total_clear * $dz_rate /100;
+ }elseif ($dz_group == 3){
+ $order_caiwu_info->dz_ticheng3 = $total_clear * $dz_rate /100;
+ }elseif ($dz_group == 4){
+ $order_caiwu_info->dz_ticheng4 = $total_clear * $dz_rate /100;
+ }elseif ($dz_group == 5){
+ $order_caiwu_info->dz_ticheng5 = $total_clear * $dz_rate /100;
+ }
+ }
+
+ if($first_xinbao_rate != '')
+ $order_caiwu_info->first_xinbao_ticheng = $first_xinbao_ticheng;
+
+
+ $order_caiwu_info->ticheng_zong_rate = $order_info->ticheng_zong_rate;
+ $order_caiwu_info->ticheng_money = $order_info->ticheng_money;
+ $order_caiwu_info->yuangong_money = $order_info->yuangong_money;
+ $order_caiwu_info->celuo_id = $order_info->celuo_id;
+
+ $yuangong_money = $order_caiwu_info->yuangong_money >0 ? $order_caiwu_info->yuangong_money : 0;
+ $yewu_ticheng = $order_caiwu_info->yeji_ticheng + $order_caiwu_info->ticheng_money - $yuangong_money;
+ $yewu_ticheng -= $order_info->getGiftPrice(1,1);
+ $yewu_ticheng -= $order_info->getGiftPrice(1,2);
+
+ $order_caiwu_info->yewu_ticheng = $yewu_ticheng;
+
+ if(!$order_caiwu_info->save()) {
+ throw new \Exception(print_r($order_caiwu_info->getErrors(), true));
+ }
+
+ //处理新保、跟踪、续保提成
+ $order_info = $order_caiwu_info->order;
+ $car_info = $order_info->car;
+
+ //新保
+ if($car_info->op1_id > 0 && ($yeji_rate != '' || $first_xinbao_rate != '' || $yeji_rate === '0' || $first_xinbao_rate === '0')) {
+ $pay1_user = $car_info->op1;
+ if ($pay1_user && $pay1_user->is_delete == 0) {
+ $pay_order_user = PayOrderUserT::find()
+ ->where('order_id='.$order_info->id)
+ ->andWhere('user_id='.$pay1_user->id)
+ ->andWhere('pay_date="'.$order_caiwu_info->pay_date.'"')
+ ->andWhere('type=1')
+ ->one();
+ if(!$pay_order_user) {
+ $pay_order_user = new PayOrderUserT();
+ $pay_order_user->user_id = $pay1_user->id;
+ $pay_order_user->order_id = $order_info->id;
+ $pay_order_user->type = 1; //新保
+ $pay_order_user->is_own = $car_info->op2_id > 0 ? 0 : 1;//现在用判断是原新保
+ $pay_order_user->pay_date = $order_caiwu_info->pay_date;
+
+ if(!$pay_order_user->save()) {
+ throw new \Exception(print_r($pay_order_user->getErrors(), true));
+ }
+ }
+
+ if($pay_order_user){
+
+ $pay_order_user->calPay();
+
+ if($pay_order_user->is_own == 0 && $first_xinbao_rate === '0'){
+ $pay_order_user->delete();
+ }elseif($pay_order_user->is_own == 1 && $yeji_rate === '0'){
+ $pay_order_user->delete();
+ }
+ }
+ }
+ }
+
+ //续保
+ if($car_info->op2_id > 0 && ($yeji_rate != '' || $yeji_rate === '0') ) {
+ $pay3_user = $car_info->op2;
+ if ($pay3_user && $pay3_user->is_delete==0) {
+ $pay_order_user = PayOrderUserT::find()
+ ->where('order_id='.$order_info->id)
+ ->andWhere('user_id='.$pay3_user->id)
+ ->andWhere('pay_date="'.$order_caiwu_info->pay_date.'"')
+ ->andWhere('type=3')
+ ->one();
+ if(!$pay_order_user) {
+ $pay_order_user = new PayOrderUserT();
+ $pay_order_user->user_id = $pay3_user->id;
+ $pay_order_user->order_id = $order_info->id;
+ $pay_order_user->type = 3; //续保
+ $pay_order_user->is_own = 1;
+ $pay_order_user->pay_date = $order_caiwu_info->pay_date;
+ if(!$pay_order_user->save()) {
+ throw new \Exception(print_r($pay_order_user->getErrors(), true));
+ }
+ }
+
+ $pay_order_user->calPay();
+
+ if($yeji_rate === '0'){
+ $pay_order_user->delete();
+ }
+ }
+ }
+
+ foreach ($dz_ids as $id){
+ $pay_order_user = PayOrderUserT::find()
+ ->where('order_id='.$order_info->id)
+ ->andWhere('user_id='.$id)
+ ->andWhere('pay_date="'.$order_caiwu_info->pay_date.'"')
+ ->andWhere('type=10')
+ ->one();
+
+ if(!$pay_order_user){
+ $pay_order_user = new PayOrderUserT();
+ $pay_order_user->user_id = $id;
+ $pay_order_user->order_id = $order_info->id;
+ $pay_order_user->type = 10; //团队长
+ $pay_order_user->is_own = 0;
+ $pay_order_user->pay_date = $order_caiwu_info->pay_date;
+ if(!$pay_order_user->save()) {
+ throw new \Exception(print_r($pay_order_user->getErrors(), true));
+ }
+ }
+
+ $pay_order_user->calPay($dz_group);
+ if($dz_rate === '0'){
+ $pay_order_user->delete();
+ }
+ }
+
+
+ }else{
+ $result['success'] = true;
+ $result['msg'] = '保存失败,order_caiwu_t不存在'.$item->id;
+ return $result;
+ }
+ }
+
+ foreach ($item1s as $item){
+ $order_caiwu_info = $item->orderCaiwu;
+ $order_info = $item->order;
+
+ if($order_caiwu_info){
+ if($hebao_ticheng != '')
+ $order_caiwu_info->hebao_ticheng = $hebao_ticheng;
+ if($zhengben_ticheng != '')
+ $order_caiwu_info->zhengben_ticheng = $zhengben_ticheng;
+ if($songdan_ticheng != '')
+ $order_caiwu_info->songdan_ticheng = $songdan_ticheng;
+ if($genzong_ticheng != '')
+ $order_caiwu_info->genzong_ticheng = $genzong_ticheng;
+
+
+ if(!$order_caiwu_info->save()) {
+ throw new \Exception(print_r($order_caiwu_info->getErrors(), true));
+ }
+
+ //处理新保、跟踪、续保提成
+ $order_info = $order_caiwu_info->order;
+ $car_info = $order_info->car;
+
+ //核保
+ if($order_info->op1 && ($hebao_ticheng != '' || $hebao_ticheng === '0') ){
+ $op11= substr($order_info->op1->getShowName(),0,strpos($order_info->op1->getShowName(),'('));
+ $op1_user = $order_info->op1;
+ if($op1_user && $op1_user->is_delete == 0) {
+ $pay_order_user = PayOrderUserT::find()
+ ->where('order_id='.$order_info->id)
+ ->andWhere('user_id='.$op1_user->id)
+ ->andWhere('pay_date="'.$order_caiwu_info->pay_date.'"')
+ ->andWhere('type=5')
+ ->one();
+
+ if(!$pay_order_user){
+ $pay_order_user = new PayOrderUserT();
+ $pay_order_user->user_id = $op1_user->id;
+ $pay_order_user->order_id = $order_info->id;
+ $pay_order_user->type = 5; //核保
+ $pay_order_user->is_own = 0;
+ $pay_order_user->pay_date = $order_caiwu_info->pay_date;
+ if(!$pay_order_user->save()) {
+ throw new \Exception(print_r($pay_order_user->getErrors(), true));
+ }
+ }
+
+ $pay_order_user->calPay();
+ if($hebao_ticheng === '0'){
+ $pay_order_user->delete();
+ }
+ }
+ }
+
+ //正本
+ if($order_info->op2 && ($zhengben_ticheng != '' || $zhengben_ticheng === '0')){
+ $op22= substr($order_info->op2->getShowName(),0,strpos($order_info->op2->getShowName(),'('));
+ $op2_user = $order_info->op2;
+ if($op2_user && $op2_user->is_delete==0) {
+ $pay_order_user = PayOrderUserT::find()
+ ->where('order_id='.$order_info->id)
+ ->andWhere('user_id='.$op2_user->id)
+ ->andWhere('pay_date="'.$order_caiwu_info->pay_date.'"')
+ ->andWhere('type=6')
+ ->one();
+ if(!$pay_order_user) {
+ $pay_order_user = new PayOrderUserT();
+ $pay_order_user->user_id = $op2_user->id;
+ $pay_order_user->order_id = $order_info->id;
+ $pay_order_user->type = 6; //正本
+ $pay_order_user->is_own = 0;
+ $pay_order_user->pay_date = $order_caiwu_info->pay_date;
+ if(!$pay_order_user->save()) {
+ throw new \Exception(print_r($pay_order_user->getErrors(), true));
+ }
+ }
+ $pay_order_user->calPay();
+ if($zhengben_ticheng === '0'){
+ $pay_order_user->delete();
+ }
+ }
+ }
+ }else{
+ $result['success'] = true;
+ $result['msg'] = '保存失败,order_caiwu_t不存在'.$item->id;
+ return $result;
+ }
+ }
+
+ $result['success'] = true;
+ $result['msg'] = '保存成功';
+ $tran->commit();
+
+ } catch(\Exception $e) {
+ $tran->rollBack();
+ $result['msg'] = $e->getMessage();
+ }
+
+ return $result;
- return $this->render('ticheng-jisuan', [
- 'items' => $items,
- 'page_info' => $page_info,
- 'begin_date' => $begin_date,
- 'end_date' => $end_date,
-// 'sum_r_total' => $sum_r_total,
-// 'sum_total_clear' => $sum_total_clear,
-// 'sum_total' => $sum_total,
-// 'sum_total_dis' => $sum_total_dis,
- 'company_items' => $company_items,
- 'begin_totalclear' => $begin_totalclear,
- 'end_totalclear' => $end_totalclear,
- 'car_no_type' => $car_no_type,
- 'company_id' => $company_id,
- 'car_no' =>$car_no,
- 'is_fan' =>$is_fan,
- 'insurer_type' =>$insurer_type,
- 'user_names' =>$user_names,
- 'dz_group'=>$dz_group,
- 'dz_rate' =>$dz_rate,
- 'dz_names' =>$dz_names,
- 'group_id'=>$group_id,
- 'group_items'=>$group_items,
-
- 'base_rate' => $base_rate,
- 'xiaoyi_rate1' => $xiaoyi_rate1,
- 'xiaoyi_rate2' => $xiaoyi_rate2,
- 'online_rate' => $online_rate,
- 'yeji_rate' => $yeji_rate,
- 'gift1' => $gift1,
- 'gift2' => $gift2,
- 'gift3' => $gift3,
- 'gift4' => $gift4,
- 'gift5' => $gift5,
- 'ticket1' => $ticket1,
- 'ticket2' => $ticket2,
- 'ticket3' => $ticket3,
- 'zhengben_ticheng' => $zhengben_ticheng,
- 'hebao_ticheng' => $hebao_ticheng,
- 'songdan_ticheng' => $songdan_ticheng,
- 'genzong_ticheng' => $genzong_ticheng,
- 'first_xinbao_rate' => $first_xinbao_rate,
- 'xianzhong_rate' => $xianzhong_rate,
- 'user_items' => $user_items,
- 'gift_items'=>$gift_items,
- 'ticket_items'=>$ticket_items,
- 'ticheng_money_all'=>$ticheng_money_all,
- 'total1_clear_all'=>$total1_clear_all,
- 'total2_clear_all'=>$total2_clear_all,
- 'yewu_ticheng_all'=>$yewu_ticheng_all,
- 'yeji_ticheng_all'=>$yeji_ticheng_all,
- 'ticheng_money_all'=>$ticheng_money_all,
- 'lipin_all'=>$lipin_all,
- 'liquan_all'=>$liquan_all,
- 'yuangong_money_all'=>$yuangong_money_all,
-
-// 'insurer_ticheng_items' => $insurer_ticheng_items,
-// 'gift_ticheng_items' => $gift_ticheng_items
- ]);
}
+
/**
* 出纳工资列表
* @return string
diff --git a/frontend/controllers/FixCarController.php b/frontend/controllers/FixCarController.php
index 053683f..7f4cf26 100644
--- a/frontend/controllers/FixCarController.php
+++ b/frontend/controllers/FixCarController.php
@@ -198,7 +198,7 @@ class FixCarController extends BaseController
$info->engine_no = $car_info->engine_no;
$info->car_frame_no = $car_info->car_frame_no;
$info->id_man = $car_info->id_man;
- $info->id_phone = $car_info->phone;
+ $info->id_man_phone = $car_info->phone;
$info->link_man = $car_info->car_man;
$info->link_phone = $car_info->phone;
$info->company = $car_info->company;
@@ -398,7 +398,7 @@ class FixCarController extends BaseController
$row->displacement_id = $displacement_id;
$row->car_year = $car_year;
$row->id_man = $id_man;
- $row->id_phone = $id_phone;
+ $row->id_man_phone = $id_phone;
$row->link_man = $link_man;
$row->link_phone = $link_phone;
$row->company = $company;
diff --git a/frontend/controllers/GiftController.php b/frontend/controllers/GiftController.php
index 43a0842..9a1145d 100644
--- a/frontend/controllers/GiftController.php
+++ b/frontend/controllers/GiftController.php
@@ -998,7 +998,7 @@ class GiftController extends \yii\web\Controller
$query = $query->andWhere('gift_ticket_t_use.type_id='.$type_id);
}
-// echo $query->createCommand()->rawSql;
+// echo $query->createCommand()->rawSql;exit;
$total = $query->count();
$items = $query->offset($offset)->limit($limit)->all();
$data = [];
diff --git a/frontend/controllers/InsurerController.php b/frontend/controllers/InsurerController.php
index 5a84ca6..e0c84b0 100644
--- a/frontend/controllers/InsurerController.php
+++ b/frontend/controllers/InsurerController.php
@@ -387,7 +387,7 @@ class InsurerController extends BaseController
$query->andWhere('id_man="'.$id_man.'"');
}
if($phone != '') {
- $query->andWhere('link_phone="'.$phone.'"');
+ $query->andWhere('car_man_phone=:phone or id_man_phone=:phone or link_man_phone=:phone',[':phone'=>$phone]);
}
if($car_no != '') {
$query->andWhere('car_no="'.$car_no.'"');
@@ -407,7 +407,13 @@ class InsurerController extends BaseController
$row['factory_model'] = $item->car->factory_model;
$row['user_name'] = $item->user?$item->user->getShowName():'';
$row['status_name'] = $item->status->name;
- $row['lock_name'] = $item->lock?$item->lock->getShowName():'';
+ if($item->status_id == 2) {
+ $row['lock_name'] = $item->op1 ? $item->op1->getShowName():'';
+ } else if($item->status_id < 10) {
+ $row['lock_name'] = $item->op2 ? $item->op2->getShowName():'';
+ } else {
+ $row['lock_name'] = '';
+ }
$row['gift_status_name'] = $item->gift_status == 1 ? '已确认':'';
$data['rows'][] = $row;
}
@@ -623,7 +629,7 @@ class InsurerController extends BaseController
$row['user_name'] = $item->user?$item->user->getShowName():'';
$row['status_name'] = $item->status->name;
$row['pay_type'] = ($item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':'').' '.($item->payType?$item->payType->name:'');
- $row['lock_name'] = $item->lock?$item->lock->getShowName():'';
+ $row['lock_name'] = $item->op1?$item->op1->getShowName():'';
$data['rows'][] = $row;
}
@@ -637,20 +643,12 @@ class InsurerController extends BaseController
$order_info = OrderT::findOne(['id'=>$id]);
$car_info = $order_info->car;
- if($order_info->lock_id == 0) {
+ if($order_info->op1_id == 0) {
$tran = OrderT::getDb()->beginTransaction();
try {
- $order_info->lock_id = $this->my->id;
+ $order_info->op1_id = $this->my->id;
$order_info->save();
- $order_user_info = new OrderUserT();
- $order_user_info->user_id = $this->my->id;
- $order_user_info->order_id = $order_info->id;
- $order_user_info->type_id = $order_info->status_id;
- $order_user_info->status = 0;
- if(!$order_user_info->save()) {
- throw new \Exception(print_r($order_user_info->getErrors(), true));
- }
$tran->commit();
} catch (\Exception $e) {
@@ -659,7 +657,7 @@ class InsurerController extends BaseController
exit;
}
} else {
- if($order_info->lock_id != $this->my->id) {
+ if($order_info->op1_id != $this->my->id) {
echo '该记录已经被别人锁定,【返回】';
exit;
}
@@ -698,18 +696,15 @@ class InsurerController extends BaseController
if($order_info) {
$tran = OrderT::getDb()->beginTransaction();
try {
- $order_info->lock_id = 0;
+ if($order_info->status_id == 2) {
+ $order_info->op1_id = 0;
+ } else {
+ $order_info->op2_id = 0;
+ }
if(!$order_info->save()) {
throw new \Exception(print_r($order_info->getErrors(), true));
}
- $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'status'=>0]);
- if($order_user_info) {
- $order_user_info->status = 4; //放弃操作
- if(!$order_user_info->save()) {
- throw new \Exception(print_r($order_user_info->getErrors(), true));
- }
- }
$result['success'] = true;
$result['msg'] = '操作成功';
@@ -779,18 +774,8 @@ class InsurerController extends BaseController
$result['msg'] = '保存成功';
if($status_id > $old_status_id) {
- $order_info->op1_id = $this->my->id;
-
-// $order_info->lock_id = 0;
$result['msg'] = '提交成功';
$this->addLog($car_id,'核保结束,进入正本生成',1);
-
- //处理操作人员状态
- $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]);
- if($order_user_info) {
- $order_user_info->status = 1; //操作结束
- $order_user_info->save();
- }
}
if(!$order_info->save()) {
throw new \Exception(print_r($order_info->getErrors(), true));
@@ -805,254 +790,6 @@ class InsurerController extends BaseController
}
return $result;
}
- /**
- * 核保管理-礼品出库
- * @return array
- * @throws \Exception
- */
- public function actionOfficeMngGiftSave()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '保存失败';
-
- if($request->isPost) {
- $order_id = $request->post('order_id',0);
- $gifts = $request->post('gifts');
- $gift_types = $request->post('gift_types');
-
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $order_info = OrderT::findOne(['id'=>$order_id]);
- if(empty($order_info)) {
- $result['msg'] = '保单错误!';
- return $result;
- }
-
- $car_no = $order_info->car_no;
- foreach($gifts as $gift_id => $code) {
- $gift_info = GiftType3T::findOne(['id'=>$gift_id]);
- $type_id = $gift_types[$gift_id];
- $type_info = GiftType2T::findOne(['id'=>$type_id]);
- $ticket_info = GiftTicketT::findOne(['code'=>$code,'type_id'=>$type_id]);
- if(!$ticket_info) {
- $result['msg'] = $type_info->name.' 礼品编号不存在!';
- return $result;
- }
- if($ticket_info->status != 0) {
- $result['msg'] = $type_info->name.' 礼品编号已经出库!';
- return $result;
- }
- $ticket_info->group_id = $gift_id;
- $ticket_info->car_no = $car_no;
- $ticket_info->status = 1;
- $ticket_info->use_date = date('Y-m-d H:i:s');
- $ticket_info->op_id = $this->my->id;
- if(!$ticket_info->save()) {
- var_dump($ticket_info->errors);
- }
- }
-
- $tran->commit();
-
- } catch(\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
-
- $result['success'] = true;
- $result['msg'] = '礼品出库成功';
- }
- return $result;
- }
-
- /**
- * 配送调度-列表
- *
- * @return string
- */
- public function actionSendMng()
- {
- $request = Yii::$app->request;
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $send_date = $request->get('send_date');
- $page = $request->get('page',1);
- if($page < 1) $page = 1;
-
- $query = OrderT::find()
- ->where('status_id=4')
- ->orderBy('lock_id asc,send_date ASC');
- if($car_man != '') {
- $query = $query->andWhere('car_man="'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('link_phone="'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_no="'.$car_no.'"');
- }
- if($send_date != '') {
- $query = $query->andWhere('send_date="'.$send_date.'"');
- }
-// $query = $query->orderBy('updated_at ASC');
-// if($this->my->username == 'admin')
-// echo $query->createCommand()->rawSql."
";
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
-
- return $this->render('send-mng',[
- 'items' => $items,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'send_date' => $send_date,
- 'page' => $page,
- 'page_info' => $page_info
- ]);
- }
-
- /**
- * 配送调度-详情
- *
- * @return string
- */
- public function actionSendMngEdit()
- {
- $request = Yii::$app->request;
- $id = $request->get('id',0);
- $back_params = $request->get('back_params');
- $order_info = OrderT::findOne(['id'=>$id]);
-
- //获取可以配送的人员
- $user_items = UserT::find()
- ->where(['is_send' => 1,'is_delete'=>0,'is_login'=>1,'is_leave'=>0])
- ->orderBy('username asc')
- ->all();
-
- $gift_items = CarGiftT::find()
- ->where('order_id='.$order_info->id)
- ->orderBy('strategy_id DESC')
- ->all();
- $gift_str = '';
- foreach($gift_items as $item) {
- if(!$item->gift) continue;
- $gift_str .= $item->gift->name.',';
- }
- $gift_str2 = '';
- //获取礼品数据
- $sel_gifts = array();
- $tmp_items = OrderGiftT::find()
- ->where('order_id='.$order_info->id)
- ->all();
- foreach($tmp_items as $item) {
- $sel_gifts[$item->group_id] = $item;
- $gift = $item->gift;
- $gift_str2 .= $item->group->name.":".$gift->name.",";
- }
-
- return $this->render('send-mng-edit',[
- 'order_info'=>$order_info,
- 'gift_str' => $gift_str2,
- 'user_items' => $user_items,
- 'back_params' => $back_params
- ]);
- }
-
- /**
- * 配送调度-保存
- *
- * @return array
- * @throws \Exception
- */
- public function actionSendMngSave()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '保存失败';
-
- if($request->isPost) {
- $order_id = $request->post('order_id',0);
- $lock_id = $request->post('lock_id',0);
- $status_id = $request->post('status_id',4);
-
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $order_info = OrderT::findOne(['id'=>$order_id]);
- if(empty($order_info)) {
- $result['msg'] = '保单错误!';
- return $result;
- }
-
- if($order_info->lock_id == 0 && $lock_id > 0) {
- $user_info = UserT::findOne(['id'=>$lock_id]);
- $order_info->send_times += 1; //首次配送
- if($order_info->send_times == 1)
- $order_info->first_send = 1;
- $this->addLog($order_info->car_id,'分配外勤: '.$user_info->getShowName().' 送单',1);
-
- $order_user_info = new OrderUserT();
- $order_user_info->user_id = $user_info->id;
- $order_user_info->order_id = $order_info->id;
- $order_user_info->type_id = $status_id;
- $order_user_info->status = 0;
- $order_user_info->save();
- }
- $order_info->lock_id = $lock_id;
-// $row->lock_id = 0;
- $old_status_id = $order_info->status_id;
- $order_info->status_id = $status_id;
- $order_info->save();
-
- $old_user_id = $order_info->lock_id;
- if($status_id > $old_status_id && $old_user_id > 0) {
- $order_info->lock_id = 0;
- $order_info->sms_code = '无采集';
- $order_info->send_return_type = '验证码';
- $order_info->save();
-
- $send_info = new SendLogT();
- $send_info->car_id = $order_info->car_id;
- $send_info->order_id = $order_info->id;
- $send_info->user_id = $old_user_id;
- $send_info->send_time = time();
- $send_info->save();
-
- $this->addLog($order_info->car_id,'内勤操作完毕,提交正本单处理。',1);
-
- //处理操作人员状态
- $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'user_id'=>$old_user_id,'type_id'=>$old_status_id,'status'=>0]);
- if($order_user_info) {
- $order_user_info->status = 1; //操作结束
- $order_user_info->save();
- }
- }
- $tran->commit();
-
- } catch(\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
-
- $result['success'] = true;
- $result['msg'] = '保存成功';
- }
- return $result;
- }
-
/**
* 正本管理-列表
* @return string
@@ -1105,7 +842,7 @@ class InsurerController extends BaseController
$row['user_name'] = $item->user?$item->user->getShowName():'';
$row['status_name'] = $item->status->name;
$row['pay_type'] = ($item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':'').' '.($item->payType?$item->payType->name:'');
- $row['lock_name'] = $item->lock?$item->lock->getShowName():'';
+ $row['lock_name'] = $item->op2?$item->op2->getShowName():'';
$data['rows'][] = $row;
}
@@ -1125,21 +862,12 @@ class InsurerController extends BaseController
$order_info = OrderT::findOne(['id'=>$id]);
$car_info = $order_info->car;
- if($order_info->lock_id == 0) {
+ if($order_info->op2_id == 0) {
$tran = OrderT::getDb()->beginTransaction();
try {
- $order_info->lock_id = $this->my->id;
+ $order_info->op2_id = $this->my->id;
$order_info->save();
- $order_user_info = new OrderUserT();
- $order_user_info->user_id = $this->my->id;
- $order_user_info->order_id = $order_info->id;
- $order_user_info->type_id = $order_info->status_id;
- $order_user_info->status = 0;
- if(!$order_user_info->save()) {
- throw new \Exception(print_r($order_user_info->getErrors(), true));
- }
-
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
@@ -1147,7 +875,7 @@ class InsurerController extends BaseController
exit;
}
} else {
- if($order_info->lock_id != $this->my->id) {
+ if($order_info->op2_id != $this->my->id) {
echo '该记录已经被别人锁定,【返回】';
exit;
}
@@ -1159,1037 +887,18 @@ class InsurerController extends BaseController
->all();
return $this->render('original-mng-edit',[
- 'car_info' => $car_info,
- 'insurer_type_items' => $insurer_type_items,
- 'order_info' => $order_info,
- 'insurer_company_items' => $insurer_company_items
- ]);
- }
- /**
- * 正本管理-保存
- * @return array
- * @throws \Exception
- */
- public function actionOriginalMngSave()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '保存失败';
-
- if($request->isPost) {
- $order_id = $request->post('order_id',0);
- $status_id = $request->post('status_id',0);
- $insurer1_no = $request->post('insurer1_no');
- $insurer2_no = $request->post('insurer2_no');
- $payer = $request->post('payer');
- $payee_id = $request->post('payee_id');
- $payment_id = $request->post('payment_id');
- //上传商业和交强文件
- $shangye_src= $request->post('shangye_src');
- $fapiao_src= $request->post('fapiao_src');
- $jiaoqiang_src= $request->post('jiaoqiang_src');
- $jq_fapiao_src= $request->post('jq_fapiao_src');
-
- if($insurer1_no == '' && $insurer2_no == '') {
- $result['msg'] = '请输入商业或交强保单号!';
- return $result;
- }
- //去除首位空格和字符串中间的空格
- $insurer1_no= trim($insurer1_no);
- $insurer1_no=str_replace(" ","",$insurer1_no);
- $insurer2_no= trim($insurer2_no);
- $insurer2_no=str_replace(" ","",$insurer2_no);
-
-
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $order_info = OrderT::findOne(['id'=>$order_id]);
- if(empty($order_info)) {
- $result['msg'] = '保单错误!';
- return $result;
- }
-
- $old_status_id = $order_info->status_id;
- $order_info->insurer1_no = $insurer1_no;
- $order_info->insurer2_no = $insurer2_no;
- //上传文件
- $order_info->shangye_src = $shangye_src;
- $order_info->jiaoqiang_src = $jiaoqiang_src;
- $order_info->fapiao_src = $fapiao_src;
- $order_info->jq_fapiao_src = $jq_fapiao_src;
- $order_info->upload_status = 2;
-
-
- $order_info->payee_id = $payee_id;
- $order_info->payment_id = $payment_id;
- $order_info->status_id = $status_id;
- $order_info->payer = $payer;
- if($status_id == 10) {
- $order_info->op2_id = $this->my->id;
- $order_info->lock_id = 0;
- $order_info->print_date = date('Y-m-d');
- }
- if(!$order_info->save()) {
- throw new \Exception(print_r($order_info->getErrors(), true));
- }
-
- if($status_id == 10) {
- //财务处理
- CaiwuT::deleteAll(['order_id'=>$order_info->id]);
- //商业
- if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
- $row = null;
- CaiwuT::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
- $row = new CaiwuT();
- $row->insurer_no = $order_info->insurer1_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->company = $order_info->company2->name;
- $row->total = sprintf("%.2f",$order_info->total1);
- $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
- $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
- $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
- $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
- $row->total_rate = $order_info->total1_rate;
- $row->total_dis = $row->total_clear_real;
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 1;
- $row->order_id = $order_info->id;
- if(!$row->save()) {
- throw new \Exception(print_r($row->getErrors(), true));
- }
- }
-
- //交强
- if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
- $row = null;
- CaiwuT::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
- $row = new CaiwuT();
- $row->insurer_no = $order_info->insurer2_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->company = $order_info->company2->name;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total2);
- $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
- $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
- $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
- $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
- $row->total_rate = $order_info->total2_rate;
- $row->total_dis = $row->total_clear_real;
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 2;
- $row->order_id = $order_info->id;
- if(!$row->save()) {
- throw new \Exception(print_r($row->getErrors(), true));
- }
- }
-
- //生成财务分支 修改日期2018/5/18
- $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]);
- if(!$order_caiwu) {
- $order_caiwu = new OrderCaiwuT();
- $order_caiwu->order_id = $order_info->id;
- $order_caiwu->status_id = 12;
- $order_caiwu->pay_date = substr($order_info->print_date,0,7);
- if(!$order_caiwu->save()) {
- throw new \Exception(print_r($order_caiwu->getErrors(), true));
- }
- }else{
- $order_caiwu->status_id = 12;
- $order_caiwu->pay_date = substr($order_info->print_date,0,7);
- if(!$order_caiwu->save()) {
- throw new \Exception(print_r($order_caiwu->getErrors(), true));
- }
- }
- //B->C 或 D->C
- $car_info = CarT::findOne(['id'=>$order_info->car_id]);
-
- if($car_info->location == 2){
- $car_info->op_user1 = $order_info->user->getShowName();
-
- }elseif($car_info->location==4){//如果是续保
- //查找上一年的保单
- $near_info= OrderT::find()->where(['car_no'=>$order_info->car_no])
- ->andWhere(['status_id'=>10])
- ->andWhere(['<', 'submit_date', $order_info->submit_date])
- ->orderBy('created_at desc')->one();
- if($near_info){
- $car_info->op_user3 = $order_info->user->getShowName();
- }else{
- $car_info->op_user1 = $order_info->user->getShowName();
- }
- }
-
-
-
- $car_info->location = 3;
- $car_info->print_date = date('Y-m-d');
-
-
- $car_info->user_id = 0;
- //更新保险日期
- $car_info->insurer1_date = $order_info->insurer1_end_date;
- $car_info->insurer2_date = $order_info->insurer2_end_date;
- $car_info->company = $order_info->company->name;
- //续保次数
- $car_info->xubao_num=intval($car_info->xubao_num)+1;
- if(!$car_info->save()) {
- throw new \Exception(print_r($car_info->getErrors(), true));
- }
-
- CarBT::deleteAll(['id'=>$car_info->id]);
- CarDT::deleteAll(['id'=>$car_info->id]);
-
- $c_info = CarCT::findOne(['id'=>$car_info->id]);
- if(!$c_info) {
- $c_info = new CarCT();
- $c_info->id = $car_info->id;
- $c_info->user_id = 0;
- if(!$c_info->save()) {
- throw new \Exception(print_r($c_info->getErrors(), true));
- }
- }
- $this->addLog($order_info->car_id,'正本生成结束',1);
-
- //处理操作人员状态
- $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]);
- if($order_user_info) {
- $order_user_info->status = 1; //操作结束
- if(!$order_user_info->save()) {
- throw new \Exception(print_r($order_user_info->getErrors(), true));
- }
- }
- }
- $result['success'] = true;
- $result['msg'] = '保存成功';
- $tran->commit();
-
- } catch(\Exception $e) {
- $tran->rollBack();
- $result['msg'] = $e->getMessage();
- }
- }
- return $result;
- }
-
-
-
- //针对保单号输入错误的
- public function actionOriginalMngSave1()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '保存失败';
-
- if($request->isPost) {
- $order_id = $request->post('order_id',0);
-
- $insurer1_no = $request->post('insurer1_no');
- $insurer2_no = $request->post('insurer2_no');
-// var_dump($insurer1_no);
-// die;
-
- //去除首位空格和字符串中间的空格
- $insurer1_no= trim($insurer1_no);
- $insurer1_no=str_replace(" ","",$insurer1_no);
- $insurer2_no= trim($insurer2_no);
- $insurer2_no=str_replace(" ","",$insurer2_no);
-
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $order_info = OrderT::findOne(['id'=>$order_id]);
- if(empty($order_info)) {
- $result['msg'] = '保单错误!';
- return $result;
- }
- $order_info->insurer1_no = $insurer1_no;
- $order_info->insurer2_no = $insurer2_no;
- $order_info->save();
-
- //礼品处理
- $car_no = $order_info->car_no;
-
-// dd($order_info->company->name);
-// if($order_info->company_id && ($order_info->company_id !='10'|| $order_info->company_id !='11')){
- if($order_info->company_id && $order_info->company->difc !='2'){
-
-
- //财务处理
- CaiwuT::deleteAll(['order_id'=>$order_info->id]);
- //商业
- if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
- $row = null;
- CaiwuT::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
- $row = new CaiwuT();
- $row->insurer_no = $order_info->insurer1_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total1);
- $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
- $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
- $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
- $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
- $row->total_rate = $order_info->total1_rate;
- $row->total_dis = $row->total_clear_real;
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 1;
- $row->order_id = $order_info->id;
- if(!$row->save()) {
- var_dump($row->errors);
- exit;
- }
- }
-
- //交强
- if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
- $row = null;
- CaiwuT::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
- $row = new CaiwuT();
- $row->insurer_no = $order_info->insurer2_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total2);
- $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
- $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
- $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
- $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
- $row->total_rate = $order_info->total2_rate;
- $row->total_dis = $row->total_clear_real;
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 2;
- $row->order_id = $order_info->id;
- $row->save();
- }
- }
-
-
-
-
-
- $this->addLog($order_info->car_id,'修改保单号增加到回单匹配成功,',1);
-
- //处理操作人员状态
-
- $result['success'] = true;
- $result['msg'] = '保存成功';
- $tran->commit();
-
- } catch(\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- //针对没有财务数据order_caiwu_t
- public function actionOriginalMngSave2()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '保存失败';
-
- if($request->isPost) {
- $order_id = $request->post('order_id',0);
-
- $insurer1_no = $request->post('insurer1_no');
- $insurer2_no = $request->post('insurer2_no');
-// var_dump($insurer1_no);
-// die;
-
- //去除首位空格和字符串中间的空格
- $insurer1_no= trim($insurer1_no);
- $insurer1_no=str_replace(" ","",$insurer1_no);
- $insurer2_no= trim($insurer2_no);
- $insurer2_no=str_replace(" ","",$insurer2_no);
-
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $order_info = OrderT::findOne(['id'=>$order_id]);
- if(empty($order_info)) {
- $result['msg'] = '保单错误!';
- return $result;
- }
-// $order_info->insurer1_no = $insurer1_no;
-// $order_info->insurer2_no = $insurer2_no;
-// $order_info->save();
-
- //礼品处理
- $car_no = $order_info->car_no;
-
-// dd($order_info->company->name);
-// if($order_info->company_id && ($order_info->company_id !='10'|| $order_info->company_id !='11')){
- //生成财务分支 修改日期2018/5/18
- $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]);
- if(!$order_caiwu) {
- $order_caiwu = new OrderCaiwuT();
- $order_caiwu->order_id = $order_info->id;
- $order_caiwu->status_id = 12;
- $order_caiwu->pay_date = substr($order_info->print_date,0,7);
- $order_caiwu->save();
- }else{
- $order_caiwu->status_id = 12;
- $order_caiwu->pay_date = substr($order_info->print_date,0,7);
- $order_caiwu->save();
- }
-
-
-
-
-
- $this->addLog($order_info->car_id,'增加财务分支,',1);
-
- //处理操作人员状态
-
- $result['success'] = true;
- $result['msg'] = '保存成功';
- $tran->commit();
-
- } catch(\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- //针对特殊保险公司流程
- public function actionOriginalMngSave3()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '保存失败';
-
- if($request->isPost) {
- $order_id = $request->post('order_id',0);
-
- $insurer1_no = $request->post('insurer1_no');
- $insurer2_no = $request->post('insurer2_no');
-// var_dump($insurer1_no);
-// die;
-
- //去除首位空格和字符串中间的空格
- $insurer1_no= trim($insurer1_no);
- $insurer1_no=str_replace(" ","",$insurer1_no);
- $insurer2_no= trim($insurer2_no);
- $insurer2_no=str_replace(" ","",$insurer2_no);
-
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $order_info = OrderT::findOne(['id'=>$order_id]);
- if(empty($order_info)) {
- $result['msg'] = '保单错误!';
- return $result;
- }
- $order_info->insurer1_no = $insurer1_no;
- $order_info->insurer2_no = $insurer2_no;
- $order_info->save();
-
- //礼品处理
- $car_no = $order_info->car_no;
-
-// dd($order_info->company->name);
-// if($order_info->company_id && ($order_info->company_id !='10'|| $order_info->company_id !='11')){
- CaiwuT::deleteAll(['order_id'=>$order_info->id]);
- if($order_info->company_id && $order_info->company->difc !='2'){
-
-
- //财务处理
-
- //商业
- if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
- $row = null;
- CaiwuT::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
- $row = new CaiwuT();
- $row->insurer_no = $order_info->insurer1_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total1);
- $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
- $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
- $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
- $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
- $row->total_rate = $order_info->total1_rate;
- $row->total_dis = $row->total_clear_real;
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 1;
- $row->order_id = $order_info->id;
- if(!$row->save()) {
- var_dump($row->errors);
- exit;
- }
- }
-
- //交强
- if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
- $row = null;
- CaiwuT::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
- $row = new CaiwuT();
- $row->insurer_no = $order_info->insurer2_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total2);
- $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
- $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
- $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
- $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
- $row->total_rate = $order_info->total2_rate;
- $row->total_dis = $row->total_clear_real;
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 2;
- $row->order_id = $order_info->id;
- $row->save();
- }
- }else{
- //财务处理
- CaiwuT1::deleteAll(['order_id'=>$order_info->id]);
-
- //商业
- if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
- $row = null;
- CaiwuT1::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
- $row = new CaiwuT1();
- $row->insurer_no = $order_info->insurer1_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total1);
- $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
- $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
- $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
- $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
- $row->total_rate = $order_info->total1_rate;
- $row->total_dis = sprintf("%.2f",($order_info->total1 * $order_info->total1_rate/100));
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 1;
- $row->order_id = $order_info->id;
-
-
- if(!$row->save()) {
- var_dump($row->errors);
- exit;
- }
- }
-
- //交强
- if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
- $row = null;
- CaiwuT1::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
- $row = new CaiwuT1();
- $row->insurer_no = $order_info->insurer2_no;
- $row->car_no = $order_info->car_no;
- $row->factory_model = $order_info->car->factory_model;
- $row->id_man = $order_info->id_man;
- $row->total = sprintf("%.2f",$order_info->total2);
- $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
- $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
- $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
- $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
- $row->total_rate = $order_info->total2_rate;
- $row->total_dis = sprintf("%.2f",($order_info->total2 * $order_info->total2_rate/100));
- $row->user_id = $order_info->user_id;
- $row->status = 0;
- $row->insurer_type = 2;
- $row->order_id = $order_info->id;
-
- $row->save();
- }
- $this->addLog($order_info->car_id,'特殊保险公司提交到回单匹配1',1);
- }
-
-
-
-
-
-
- $this->addLog($order_info->car_id,'修改保单号增加到回单匹配成功,',1);
-
- //处理操作人员状态
-
- $result['success'] = true;
- $result['msg'] = '保存成功';
- $tran->commit();
-
- } catch(\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- }
- return $result;
- }
- /**
- * 正本打印-列表
- * @return string
- */
- public function actionPrintMng()
- {
- $request = Yii::$app->request;
- $id_man = $request->get('id_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $insurer1_no = $request->get('insurer1_no');
- $insurer2_no = $request->get('insurer2_no');
-
- $page = $request->get('page',1);
- if($page < 1) $page = 1;
-
- $query = OrderT::find()
- ->where('status_id=6')
- ->orderBy('submit_date DESC, id DESC');
- if($id_man != '') {
- $query = $query->andWhere('id_man="'.$id_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('link_phone="'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_no="'.$car_no.'"');
- }
- if($insurer1_no != '') {
- $query = $query->andWhere('insurer1_no="'.$insurer1_no.'"');
- }
- if($insurer2_no != '') {
- $query = $query->andWhere('insurer2_no="'.$insurer2_no.'"');
- }
- $query = $query->orderBy('updated_at asc');
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
-
- return $this->render('print-mng',[
- 'items' => $items,
- 'id_man' => $id_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'insurer1_no' => $insurer1_no,
- 'insurer2_no' => $insurer2_no,
- 'page' => $page,
- 'page_info' => $page_info
- ]);
- }
-
- /**
- * 正本打印-详情
- * @return string
- */
- public function actionPrintMngEdit()
- {
- $request = Yii::$app->request;
- $id = $request->get('id',0);
- $back_params = $request->get('back_params');
- $order_info = OrderT::findOne(['id'=>$id]);
- $car_info = $order_info->car;
-
- if($order_info->lock_id == 0) {
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $order_info->lock_id = $this->my->id;
- $order_info->save();
-
- $order_user_info = new OrderUserT();
- $order_user_info->user_id = $this->my->id;
- $order_user_info->order_id = $order_info->id;
- $order_user_info->type_id = $order_info->status_id;
- $order_user_info->status = 0;
- $order_user_info->save();
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- } else {
- if($order_info->lock_id != $this->my->id) {
- echo '该记录已经被别人锁定,【返回】';
- exit;
- }
- }
-
- //礼品
- $gift_group_items = GiftGroupT::find()
- ->where('is_free=0')
- ->all();
- $gift_free_group_items = GiftGroupT::find()
- ->where('is_free=1')
- ->all();
- //获取礼品数据
- $sel_gifts = array();
- $tmp_items = OrderGiftT::find()
- ->where('order_id='.$order_info->id)
- ->all();
- foreach($tmp_items as $item) {
- $sel_gifts[$item->group_id] = $item;
- }
-
- $gift_items = CarGiftT::find()
- ->where('order_id='.$order_info->id)
- ->orderBy('strategy_id DESC')
- ->all();
-
- $insurer_type_items = InsurerTypeT::find()
- ->all();
- $insurer_company_items = InsurerCompanyT::find()
- ->all();
-
- return $this->render('print-mng-edit',[
- 'car_info' => $car_info,
- 'insurer_type_items' => $insurer_type_items,
- 'order_info' => $order_info,
- 'insurer_company_items' => $insurer_company_items,
- 'gift_items' => $gift_items,
- 'back_params' => $back_params,
- 'gift_group_items' => $gift_group_items,
- 'gift_free_group_items' => $gift_free_group_items,
- 'sel_gifts' => $sel_gifts,
- ]);
- }
-
- /**
- * 正本打印-保存
- * @return array
- * @throws \Exception
- */
- public function actionPrintMngSave()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '保存失败';
-
- if($request->isPost) {
- $order_id = $request->post('order_id',0);
- $status_id = $request->post('status_id',0);
-
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $row = OrderT::findOne(['id'=>$order_id]);
- if(empty($row)) {
- $result['msg'] = '保单错误!';
- return $result;
- }
-
- if($status_id == 7) {
- $old_status_id = $row->status_id;
- $row->lock_id = 0;
- $row->status_id = $status_id;
- $row->save();
-
- $this->addLog($row->car_id,'正本打印完成,进入正本配送',1);
-
- //处理操作人员状态
- $order_user_info = OrderUserT::findOne(['order_id'=>$row->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]);
- if($order_user_info) {
- $order_user_info->status = 1; //操作结束
- $order_user_info->save();
- }
- }
-
- $tran->commit();
-
- } catch(\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
-
- $result['success'] = true;
- $result['msg'] = '保存成功';
- }
- return $result;
- }
-
- /**
- * 正本配送-列表
- * @return string
- */
- public function actionOriginalSendMng()
- {
- $request = Yii::$app->request;
- $car_man = $request->get('car_man');
- $phone = $request->get('phone');
- $car_no = $request->get('car_no');
- $send_date = $request->get('send_date');
- $page = $request->get('page',1);
- if($page < 1) $page = 1;
-
- $query = OrderT::find()
- ->where('status_id=8')
- ->orderBy('submit_date DESC, id DESC');
- if($car_man != '') {
- $query = $query->andWhere('id_man="'.$car_man.'"');
- }
- if($phone != '') {
- $query = $query->andWhere('link_phone="'.$phone.'"');
- }
- if($car_no != '') {
- $query = $query->andWhere('car_no="'.$car_no.'"');
- }
- if($send_date != '') {
- $query = $query->andWhere('send_date="'.$send_date.'"');
- }
- $query = $query->orderBy('updated_at ASC');
- $total = $query->count();
-
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
- $items = $query->all();
-
- $page_info = MyLib::getPageInfo($pagination);
-
-
- return $this->render('original-send-mng',[
- 'items' => $items,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'send_date' => $send_date,
- 'page' => $page,
- 'page_info' => $page_info
- ]);
- }
-
- /**
- * 正本配送-详情
- * @return string
- */
- public function actionOriginalSendMngEdit()
- {
- $request = Yii::$app->request;
- $id = $request->get('id',0);
- $back_params = $request->get('back_params');
- $order_info = OrderT::findOne(['id'=>$id]);
- $car_info = $order_info->car;
-
- if($order_info->lock_id == 0) {
- $tran = OrderT::getDb()->beginTransaction();
- try {
- $order_info->lock_id = $this->my->id;
- $order_info->save();
-
- $order_user_info = new OrderUserT();
- $order_user_info->user_id = $this->my->id;
- $order_user_info->order_id = $order_info->id;
- $order_user_info->type_id = $order_info->status_id;
- $order_user_info->status = 0;
- $order_user_info->save();
-
- $tran->commit();
- } catch (\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
- } else {
- if($order_info->lock_id != $this->my->id) {
- echo '该记录已经被别人锁定,【返回】';
- exit;
- }
- }
- //礼品
- $gift_group_items = array();
- $gift_free_group_items = array();
- //获取礼品数据
- $sel_gifts = array();
- $tmp_items = OrderGiftT::find()
- ->where('order_id='.$order_info->id)
- ->all();
- foreach($tmp_items as $item) {
- $gift_info = $item->gift;
- if($gift_info->type == 1) {
- $gift_free_group_items[] = $gift_info;
- } else {
- $gift_group_items[] = $gift_info;
- }
- $sel_gifts[$item->group_id] = $item;
- }
-
- $gift_items = CarGiftT::find()
- ->where('order_id='.$order_info->id)
- ->orderBy('strategy_id DESC')
- ->all();
-
- $insurer_type_items = InsurerTypeT::find()
- ->all();
- $insurer_company_items = InsurerCompanyT::find()
- ->all();
- $type_items = GiftType2T::find()->all();
-// $ex_info=ExpressT::findOne(['id'=>$id]);
- return $this->render('original-send-mng-edit',[
- 'car_info' => $car_info,
- 'insurer_type_items' => $insurer_type_items,
- 'order_info' => $order_info,
- 'insurer_company_items' => $insurer_company_items,
- 'gift_items' => $gift_items,
- 'back_params' => $back_params,
- 'gift_group_items' => $gift_group_items,
- 'gift_free_group_items' => $gift_free_group_items,
- 'sel_gifts' => $sel_gifts,
- 'type_items' => $type_items,
-// 'ex_info' => $ex_info?$ex_info:'',
+ 'car_info' => $car_info,
+ 'insurer_type_items' => $insurer_type_items,
+ 'order_info' => $order_info,
+ 'insurer_company_items' => $insurer_company_items
]);
}
-
/**
- * 正本配送-保存
+ * 正本管理-保存
* @return array
* @throws \Exception
*/
-// public function actionOriginalSendMngSave()
-// {
-// Yii::$app->response->format = Response::FORMAT_JSON;
-// $request = Yii::$app->request;
-// $result = array();
-// $result['success'] = false;
-// $result['msg'] = '保存失败';
-//
-// if($request->isPost) {
-// $order_id = $request->post('order_id',0);
-// $status_id = $request->post('status_id',0);
-// $gifts = $request->post('gifts',array());
-// $gift_types = $request->post('gift_types',array());
-// $ems_company = $request->post('ems_company');
-// $ems_no = $request->post('ems_no');
-// $link_name = $request->post('link_name');
-// $link_tel = $request->post('link_tel');
-// $link_address = $request->post('link_address');
-//
-//
-//
-// $tran = OrderT::getDb()->beginTransaction();
-// try {
-// $row = OrderT::findOne(['id'=>$order_id]);
-// if(empty($row)) {
-// $result['msg'] = '保单错误!';
-// return $result;
-// }
-//
-// $old_status_id = $row->status_id;
-// $row->status_id = $status_id;
-// if($status_id > $old_status_id) {
-//
-// //礼品处理
-// $car_no = $row->car_no;
-//// dd($gifts);
-// foreach ($gifts as $gift_id => $code) {
-// $gift_info = GiftType3T::findOne(['id'=>$gift_id]);
-//
-// $type_id = $gift_types[$gift_id];
-// $type_info = GiftType2T::findOne(['id'=>$type_id]);
-// if(!$type_info) continue;
-// if($code == '') continue;
-//
-//
-// if(is_array($code)){
-//
-// foreach ($code as $vs) {
-//
-// $ticket_info = GiftTicketT::findOne(['code'=>$vs,'type_id'=>$type_id]);
-// if(!$ticket_info) {
-// $result['msg'] = $type_info->name.' 礼品编号不存在!';
-// return $result;
-// }
-// if($ticket_info->status != 0) {
-// $result['msg'] = $type_info->name.' 礼品编号已经出库!';
-// return $result;
-// }
-// $ticket_info->group_id = $gift_id;
-// $ticket_info->car_no = $car_no;
-// $ticket_info->status = 1;
-// $ticket_info->use_date = date('Y-m-d H:i:s');
-// $ticket_info->op_id = $this->my->id;
-// if(!$ticket_info->save()) {
-// var_dump($ticket_info->errors);
-// }
-//
-// }
-//
-// }else{
-//// $gift_info= OrderGiftT::findOne(['gift_id'=>$gift_id]);
-// $gift_info= OrderGiftT::find()->where(['gift_id'=>$gift_id,'order_id'=>$order_id])->one();
-// $gift_info->is_stock=$code;
-// $gift_info->save();
-// }
-//
-// }
-//
-// //快递表处理
-// if(empty($ems_no)) {
-// $result['msg'] = '快递单号不能为空!';
-// return $result;
-// }
-// ExpressT::deleteAll(['order_id'=>$row->id]);
-// $express_info = new ExpressT();
-// $express_info->car_id=$row->car_id;
-// $express_info->order_id=$row->id;
-// $express_info->user_id=$this->my->id;
-// $express_info->car_no=$row->car_no;
-// $express_info->ex_ad_id=$row->addr_id;
-// $express_info->ems_company=$ems_company;
-// $express_info->ems_no=$ems_no;
-// $express_info->link_name=$link_name;
-// $express_info->link_tel=$link_tel;
-// $express_info->link_address=$link_address;
-// $express_info->original_date=$row->print_date;
-// $express_info->send_date=date('Y-m-d');
-// $express_info->return_slip=8;
-// $express_info->save();
-// $this->addLog($row->car_id,'保存快递单',1);
-//
-//
-//
-//
-// $row->lock_id = 0;
-// $this->addLog($row->car_id,'正本配送完成,进入正常保险状态',1);
-//
-// //处理操作人员状态
-// $order_user_info = OrderUserT::findOne(['order_id'=>$row->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]);
-// if($order_user_info) {
-// $order_user_info->status = 1; //操作结束
-// $order_user_info->save();
-// }
-// }
-// $row->save();
-//
-// $tran->commit();
-//
-// } catch(\Exception $e) {
-// $tran->rollBack();
-// throw $e;
-// }
-//
-// $result['success'] = true;
-// $result['msg'] = '保存成功';
-// }
-// return $result;
-// }
- public function actionOriginalSendMngSave()
+ public function actionOriginalMngSave()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
@@ -2200,198 +909,180 @@ class InsurerController extends BaseController
if($request->isPost) {
$order_id = $request->post('order_id',0);
$status_id = $request->post('status_id',0);
- $gifts = $request->post('gifts',array());
- $gift_types = $request->post('gift_types',array());
- $ems_company = $request->post('ems_company');
- $ems_no = $request->post('ems_no');
- $physical_no = $request->post('physical_no');
-
- $link_name = $request->post('link_name');
- $link_tel = $request->post('link_tel');
- $link_address = $request->post('link_address');
- $is_express = $request->post('is_express');
+ $insurer1_no = $request->post('insurer1_no');
+ $insurer2_no = $request->post('insurer2_no');
+ $payer = $request->post('payer');
+ $payee_id = $request->post('payee_id');
+ $payment_id = $request->post('payment_id');
+ //上传商业和交强文件
+ $shangye_src= $request->post('shangye_src');
+ $fapiao_src= $request->post('fapiao_src');
+ $jiaoqiang_src= $request->post('jiaoqiang_src');
+ $jq_fapiao_src= $request->post('jq_fapiao_src');
+ if($insurer1_no == '' && $insurer2_no == '') {
+ $result['msg'] = '请输入商业或交强保单号!';
+ return $result;
+ }
+ //去除首位空格和字符串中间的空格
+ $insurer1_no= trim($insurer1_no);
+ $insurer1_no=str_replace(" ","",$insurer1_no);
+ $insurer2_no= trim($insurer2_no);
+ $insurer2_no=str_replace(" ","",$insurer2_no);
$tran = OrderT::getDb()->beginTransaction();
try {
- $row = OrderT::findOne(['id'=>$order_id]);
- if(empty($row)) {
+ $order_info = OrderT::findOne(['id'=>$order_id]);
+ if(empty($order_info)) {
$result['msg'] = '保单错误!';
return $result;
}
- $old_status_id = $row->status_id;
- $row->status_id = $status_id;
- if($status_id > $old_status_id) {
-
- //礼品处理
- $car_no = $row->car_no;
-// dd($gifts);
- foreach ($gifts as $gift_id => $code) {
- $gift_info = GiftType3T::findOne(['id'=>$gift_id]);
-
- $type_id = $gift_types[$gift_id];
- $type_info = GiftType2T::findOne(['id'=>$type_id]);
- if(!$type_info) continue;
- if($code == '') continue;
-
-
- if(is_array($code)){
-
- foreach ($code as $vs) {
+ $old_status_id = $order_info->status_id;
+ $order_info->insurer1_no = $insurer1_no;
+ $order_info->insurer2_no = $insurer2_no;
+ //上传文件
+ $order_info->shangye_src = $shangye_src;
+ $order_info->jiaoqiang_src = $jiaoqiang_src;
+ $order_info->fapiao_src = $fapiao_src;
+ $order_info->jq_fapiao_src = $jq_fapiao_src;
+ $order_info->upload_status = 2;
- $ticket_info = GiftTicketT::findOne(['code'=>$vs,'type_id'=>$type_id]);
- if(!$ticket_info) {
- $result['msg'] = $type_info->name.' 礼品编号不存在!';
- return $result;
- }
- if($ticket_info->status != 0) {
- $result['msg'] = $type_info->name.' 礼品编号已经出库!';
- return $result;
- }
- $ticket_info->group_id = $gift_id;
- $ticket_info->car_no = $car_no;
- $ticket_info->status = 1;
- $ticket_info->use_date = date('Y-m-d H:i:s');
- $ticket_info->op_id = $this->my->id;
- if(!$ticket_info->save()) {
- var_dump($ticket_info->errors);
- }
- }
+ $order_info->payee_id = $payee_id;
+ $order_info->payment_id = $payment_id;
+ $order_info->status_id = $status_id;
+ $order_info->payer = $payer;
+ if($status_id == 10) {
+ $order_info->print_date = date('Y-m-d');
+ }
+ if(!$order_info->save()) {
+ throw new \Exception(print_r($order_info->getErrors(), true));
+ }
- }else{
-// $gift_info= OrderGiftT::findOne(['gift_id'=>$gift_id]);
- $gift_info= OrderGiftT::find()->where(['gift_id'=>$gift_id,'order_id'=>$order_id])->one();
- $gift_info->is_stock=$code;
- $gift_info->save();
+ if($status_id == 10) {
+ //财务处理
+ CaiwuT::deleteAll(['order_id'=>$order_info->id]);
+ //商业
+ if($order_info->insurer1_no != '' && $order_info->total1_clear > 0) {
+ $row = null;
+ CaiwuT::deleteAll('insurer_no="'.$order_info->insurer1_no.'"');
+ $row = new CaiwuT();
+ $row->insurer_no = $order_info->insurer1_no;
+ $row->car_no = $order_info->car_no;
+ $row->factory_model = $order_info->car->factory_model;
+ $row->id_man = $order_info->id_man;
+ $row->company = $order_info->company2->name;
+ $row->total = sprintf("%.2f",$order_info->total1);
+ $row->total_clear = sprintf("%.2f",$order_info->total1_clear);
+ $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100));
+ $row->total_tax = sprintf("%.2f",$order_info->total1 - $order_info->total1_clear);
+ $row->total_tax_real = sprintf("%.2f",(($order_info->total1-$order_info->total1_clear) * $order_info->total1_rate/100));
+ $row->total_rate = $order_info->total1_rate;
+ $row->total_dis = $row->total_clear_real;
+ $row->user_id = $order_info->user_id;
+ $row->status = 0;
+ $row->insurer_type = 1;
+ $row->order_id = $order_info->id;
+ if(!$row->save()) {
+ throw new \Exception(print_r($row->getErrors(), true));
}
-
}
- //快递表处理
- if(empty($ems_no)) {
- $result['msg'] = '快递单号不能为空!';
- return $result;
- }
- ExpressT::deleteAll(['order_id'=>$row->id]);
- $express_info = new ExpressT();
- $express_info->car_id=$row->car_id;
- $express_info->car_no=$row->car_no;
- $express_info->order_id=$row->id;
- $express_info->user_id=$this->my->id;
- $express_info->ex_ad_id=$row->addr_id;
- if($is_express==2){
- $express_info->is_express=$is_express;
- $express_info->ems_price=0;
- $express_info->return_slip=0;
- $express_info->ems_company=0;
- }elseif($is_express==1){
- $express_info->return_slip=8;
- $express_info->ems_company=$ems_company;
+ //交强
+ if($order_info->insurer2_no != '' && $order_info->total2_clear > 0) {
+ $row = null;
+ CaiwuT::deleteAll('insurer_no="'.$order_info->insurer2_no.'"');
+ $row = new CaiwuT();
+ $row->insurer_no = $order_info->insurer2_no;
+ $row->car_no = $order_info->car_no;
+ $row->factory_model = $order_info->car->factory_model;
+ $row->company = $order_info->company2->name;
+ $row->id_man = $order_info->id_man;
+ $row->total = sprintf("%.2f",$order_info->total2);
+ $row->total_clear = sprintf("%.2f",$order_info->total2_clear);
+ $row->total_tax = sprintf("%.2f",($order_info->total2 - $order_info->total2_clear));
+ $row->total_clear_real = sprintf("%.2f",($order_info->total2_clear * $order_info->total2_rate/100));
+ $row->total_tax_real = sprintf("%.2f",(($order_info->total2-$order_info->total2_clear) * $order_info->total2_rate/100));
+ $row->total_rate = $order_info->total2_rate;
+ $row->total_dis = $row->total_clear_real;
+ $row->user_id = $order_info->user_id;
+ $row->status = 0;
+ $row->insurer_type = 2;
+ $row->order_id = $order_info->id;
+ if(!$row->save()) {
+ throw new \Exception(print_r($row->getErrors(), true));
+ }
}
- $express_info->ems_no=$ems_no;
- $express_info->physical_no=$physical_no;
-
- $express_info->link_name=$link_name;
- $express_info->link_tel=$link_tel;
- $express_info->link_address=$link_address;
- $express_info->original_date=$row->print_date;
- $express_info->send_date=date('Y-m-d');
-
- $express_info->save();
- $this->addLog($row->car_id,'保存快递单',1);
-
-
-
-
- $row->lock_id = 0;
- $this->addLog($row->car_id,'正本配送完成,进入正常保险状态',1);
-
- //处理操作人员状态
- $order_user_info = OrderUserT::findOne(['order_id'=>$row->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]);
- if($order_user_info) {
- $order_user_info->status = 1; //操作结束
- $order_user_info->save();
+ //生成财务分支 修改日期2018/5/18
+ $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]);
+ if(!$order_caiwu) {
+ $order_caiwu = new OrderCaiwuT();
+ $order_caiwu->order_id = $order_info->id;
+ $order_caiwu->status_id = 12;
+ $order_caiwu->pay_date = substr($order_info->print_date,0,7);
+ if(!$order_caiwu->save()) {
+ throw new \Exception(print_r($order_caiwu->getErrors(), true));
+ }
+ }else{
+ $order_caiwu->status_id = 12;
+ $order_caiwu->pay_date = substr($order_info->print_date,0,7);
+ if(!$order_caiwu->save()) {
+ throw new \Exception(print_r($order_caiwu->getErrors(), true));
+ }
}
- }
- $row->save();
-
- $tran->commit();
-
- } catch(\Exception $e) {
- $tran->rollBack();
- throw $e;
- }
+ //B->C 或 D->C
+ $car_info = CarT::findOne(['id'=>$order_info->car_id]);
- $result['success'] = true;
- $result['msg'] = '保存成功';
- }
- return $result;
- }
- public function actionKuaidiSave()
- {
- Yii::$app->response->format = Response::FORMAT_JSON;
- $request = Yii::$app->request;
- $result = array();
- $result['success'] = false;
- $result['msg'] = '保存失败';
+ if($car_info->is_xubao == 0){
+ $car_info->op1_id = $order_info->user_id;
- if($request->isPost) {
+ }elseif($car_info->is_xubao==1){//如果是续保
+ //查找上一年的保单
+ $car_info->op2_id = $order_info->user_id;
+ }
- $ems_no = $request->post('ems_no');
- $link_name = $request->post('insurer_name');
- $link_tel = $request->post('link_tel');
- $ems_remark = $request->post('ems_remark');
- $link_address = $request->post('receiver_province');
- $link_address .= $request->post('receiver_city');
- $link_address .= $request->post('receiver_county');
- $link_address .= $request->post('receiver_address');
+ $car_info->location = 3;
+ $car_info->is_xubao = 1;
+ $car_info->print_date = date('Y-m-d');
- $tran = OrderT::getDb()->beginTransaction();
- try {
+ $car_info->user_id = 0;
+ //更新保险日期
+ $car_info->insurer1_date = $order_info->insurer1_end_date;
+ $car_info->insurer2_date = $order_info->insurer2_end_date;
+ $car_info->company = $order_info->company->name;
+ //续保次数
+ if(!$car_info->save()) {
+ throw new \Exception(print_r($car_info->getErrors(), true));
+ }
+ CarBT::deleteAll(['id'=>$car_info->id]);
+ CarDT::deleteAll(['id'=>$car_info->id]);
- //快递表处理
- if(empty($ems_no)) {
- $result['msg'] = '快递单号不能为空!';
- return $result;
+ $c_info = CarCT::findOne(['id'=>$car_info->id]);
+ if(!$c_info) {
+ $c_info = new CarCT();
+ $c_info->id = $car_info->id;
+ $c_info->user_id = 0;
+ if(!$c_info->save()) {
+ throw new \Exception(print_r($c_info->getErrors(), true));
+ }
+ }
+ $this->addLog($order_info->car_id,'正本生成结束',1);
}
-
- $express_info = new ExpressT();
-
- $express_info->user_id=$this->my->id;
-
-
- $express_info->ems_no=$ems_no;
- $express_info->link_name=$link_name;
- $express_info->link_tel=$link_tel;
- $express_info->link_address=$link_address;
- $express_info->send_date=date('Y-m-d');
- $express_info->return_slip=8;
- $express_info->ems_remark=$ems_remark;
- $express_info->is_order=2;
- $express_info->save();
-
-
-
-
-
-
+ $result['success'] = true;
+ $result['msg'] = '保存成功';
$tran->commit();
} catch(\Exception $e) {
$tran->rollBack();
- throw $e;
+ $result['msg'] = $e->getMessage();
}
-
- $result['success'] = true;
- $result['msg'] = '保存成功';
}
return $result;
}
@@ -3343,29 +2034,15 @@ class InsurerController extends BaseController
$row->return_status_id = $return_status_id;
$row->return_remark = $return_remark;
$row->return_time = time();
- $row->lock_id = 0;
+// if($return_status_id == 2) {
+// $row->op1_id = 0;
+// } else {
+// $row->op2_id = 0;
+// }
if(!$row->save()) {
throw new \Exception(print_r($row->getErrors(), true));
}
- //处理操作人员状态
- $order_user_info = OrderUserT::findOne(['order_id'=>$row->id,'user_id'=>$this->my->id,'status'=>0]);
- if($order_user_info) {
- $order_user_info->status = 2; //退回
- if(!$order_user_info->save()) {
- throw new \Exception(print_r($order_user_info->getErrors(), true));
- }
-
- $order_user_info2 = new OrderUserT();
- $order_user_info2->user_id = $row->user_id;
- $order_user_info2->order_id = $row->id;
- $order_user_info2->type_id = 1;
- $order_user_info2->status = 0;
- if(!$order_user_info2->save()) {
- throw new \Exception(print_r($order_user_info2->getErrors(), true));
- }
- }
-
$this->addLog($row->car_id,'退回业务员,理由是:'.$return_remark,1);
$tran->commit();
diff --git a/frontend/controllers/MarketingStrategyController.php b/frontend/controllers/MarketingStrategyController.php
index 9c5ea79..12e2eaf 100644
--- a/frontend/controllers/MarketingStrategyController.php
+++ b/frontend/controllers/MarketingStrategyController.php
@@ -4,6 +4,7 @@
namespace frontend\controllers;
+use common\models\CarT;
use common\models\GiftT;
use common\models\OrderGiftT;
use common\models\UserT;
@@ -462,11 +463,17 @@ class MarketingStrategyController extends UserBaseController
$result['success'] = false;
$result['msg'] = '没有合适的策略';
+ $car_id = $request->post('car_id');
$total1_clear = $request->post('total1_clear', 0);
$car_no = $request->post('car_no');
$car_use_id = $request->post('car_use_id', 0);
$company2_id = $request->post('company2_id', 0);
+ $car_info = CarT::findOne($car_id);
+ if(!$car_info) {
+ $result['msg'] = '车辆信息不存在';
+ return $result;
+ }
//获取自己的所有策略
$items = ZhongjiUserT::find()
->where(['user_id'=>$this->my->id])
@@ -519,7 +526,7 @@ class MarketingStrategyController extends UserBaseController
if($item->type_ids != '') {
$type_ids = explode(',',$item->type_ids);
$tmp_type_id = 1;
- if($car_no->xubao_num > 0)
+ if($car_info->is_xubao > 0)
$tmp_type_id = 2;
if(in_array($tmp_type_id, $type_ids)) {
$flag = true;
diff --git a/frontend/controllers/PhoneController.php b/frontend/controllers/PhoneController.php
index 0cd9f90..d977a5d 100644
--- a/frontend/controllers/PhoneController.php
+++ b/frontend/controllers/PhoneController.php
@@ -286,7 +286,6 @@ class PhoneController extends \yii\web\Controller
//$b = new GiftCreateImageErrorT();
$network_phone = NetworkPhoneT::findOne(['recorder_id'=>$recorder_id]);
if(!$network_phone){
-
$network_phone = new NetworkPhoneT();
$assign = NetworkPhoneAssignT::findOne(['phone'=>$caller,'is_phone'=>1]);
if(!$assign){
@@ -372,33 +371,6 @@ class PhoneController extends \yii\web\Controller
}
return json_encode(['code' => 0,'message' => "成功"]);
-
- $phone_items = NetworkPhoneT::find()->where('release_time>="'.$begin_time.'"')
- ->andWhere('release_time<="'.$end_time.'"')
- ->andWhere('call_result="ANSWERED"')
- ->andWhere('record_file_url is null or record_file_url = ""')
- ->andWhere('record_file_url_real is not null or record_file_url_real <> ""')
- ->all();
- foreach ($phone_items as $item) {
- if ($item->record_file_url == '') {
- $url = '';
-
- if ($item->record_file_url_real != '') {
-
- $url = $this->phoneMp3($item->record_file_url_real);
-
- }
-
- if ($url != '') {
- $item->record_file_url = $url;
- $item->save(false);
- }
-
-
- }
- }
-
- return json_encode(['code' => 0,'message' => "成功"]);
}
function phoneMp3Bak($url) {
diff --git a/frontend/views/car/info-track.php b/frontend/views/car/info-track.php
index dc15952..40924d0 100644
--- a/frontend/views/car/info-track.php
+++ b/frontend/views/car/info-track.php
@@ -49,7 +49,7 @@ use \common\libs\MyLib;
证件号码 |
=$car_info->car_man_number?> |
联系电话 |
- =$car_info->phone?> |
+ =$car_info->car_man_phone?> |
商业起保日期 |
@@ -193,6 +193,7 @@ use \common\libs\MyLib;
o['car_id'] = '=$car_info->id?>';
o['limit'] = params['limit'];
o['offset'] = params['offset'];
+ return o;
}
});
return false;
diff --git a/frontend/views/car/info.php b/frontend/views/car/info.php
index c520ce3..3fc7a8d 100644
--- a/frontend/views/car/info.php
+++ b/frontend/views/car/info.php
@@ -50,8 +50,8 @@ use \common\libs\MyLib;
-
-
+
+
diff --git a/frontend/views/finance/sel-user-dlg.php b/frontend/views/finance/sel-user-dlg.php
new file mode 100644
index 0000000..91e49ef
--- /dev/null
+++ b/frontend/views/finance/sel-user-dlg.php
@@ -0,0 +1,74 @@
+
+beginBlock('header_css'); ?>
+endBlock(); ?>
+
+
+
+beginBlock('footer_js'); ?>
+
+endBlock('footer_js'); ?>
diff --git a/frontend/views/finance/ticheng-jisuan.php b/frontend/views/finance/ticheng-jisuan.php
index 0e925fa..fb6762d 100644
--- a/frontend/views/finance/ticheng-jisuan.php
+++ b/frontend/views/finance/ticheng-jisuan.php
@@ -1,369 +1,239 @@
-
-
-
-
-
-
-
- 序号 |
- 车牌号 |
- 被保险人 |
- 保险公司 |
- 保单号 |
- 出单日期 |
- 商业净保费 |
- 手续费比例 |
- 基本提成比例 |
- 基本提成 |
- 加点提成比例 |
- 加点提成 |
- 自费礼品 |
- 自费礼券 |
- 自费减免金额 |
- 提成 |
- 业务员 |
- 原新保提成 |
- 原新保业务员 |
- 核保提成 |
- 核保业务员 |
- 正本提成 |
- 正本业务员 |
- 送单提成 |
- 送单人 |
- 团队长组1提成 |
- 团队长组1 |
- 团队长组2提成 |
- 团队长组2 |
- 团队长组3提成 |
- 团队长组3 |
- 团队长组4提成 |
- 团队长组4 |
- 团队长组5提成 |
- 团队长组5 |
-
- $item) {
- $start_index = $index;
-
-// $users=$item->user->group;
-// $username=$item->user;
-// $uname=$username['name'];
-// $nams=$users['name'];
-
- $total_real = $item->total * $item->total_rate/100;
- $total_clear_real = $item->total_clear * $item->total_rate/100;
- $total_dis = round($total_clear_real - $item->r_total,2);
-
- $order_caiwu_info = $item->orderCaiwu;
- $order_info = $item->order;
- $car_info = $order_info->car;
-
- $is_xinbao = $car_info->op_user3 == ''?1:0;
-
- ?>
-
- =$start_index+1?> |
- =$item->car_no?> |
- =$item->id_man?> |
- =$order_info && $order_info->company ? $order_info->company->name:''?> |
- =$item->insurer_no?> |
- =$order_info ? $order_info->print_date : ''?> |
- =$item->total_clear?> |
- =$item->total_rate?> |
- =$order_caiwu_info?$order_caiwu_info->yeji_rate:''?> |
- =$order_caiwu_info?$order_caiwu_info->yeji_ticheng:''?> |
- =$order_info?$order_info->ticheng_zong_rate:''?> |
- =$order_info?$order_info->ticheng_money:''?> |
-
- =$order_info?$order_info->getGiftPrice(1,1):''?> |
- =$order_info?$order_info->getGiftPrice(1,2):''?> |
- =$order_info?$order_info->yuangong_money:''?> |
- =$order_caiwu_info?$order_caiwu_info->yewu_ticheng:''?> |
-
- =$car_info?$car_info->op_user1:''?> |
- =$order_caiwu_info?$order_caiwu_info->first_xinbao_ticheng:''?> |
- |
-
- =$car_info?$car_info->op_user3:''?> |
- =$order_caiwu_info?$order_caiwu_info->first_xinbao_ticheng:''?> |
- =$car_info?$car_info->op_user1:''?> |
-
-
-
- =$order_caiwu_info?$order_caiwu_info->hebao_ticheng:''?> |
- =$order_info->op1?$order_info->op1->getShowName():''?> |
- =$order_caiwu_info?$order_caiwu_info->zhengben_ticheng:''?> |
- =$order_info->op2?$order_info->op2->getShowName():''?> |
- =$order_caiwu_info?$order_caiwu_info->songdan_ticheng:''?> |
- =$order_info->sendLog?$order_info->sendLog->user->getShowName():''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_ticheng1:''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_names1:''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_ticheng2:''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_names2:''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_ticheng3:''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_names3:''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_ticheng4:''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_names4:''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_ticheng5:''?> |
- =$order_caiwu_info?$order_caiwu_info->dz_names5:''?> |
-
-
- beginBlock('header_css'); ?>
+
+endBlock(); ?>
+
+
+
+
+
+
+
+
+
+
+
+ |
+ ID |
+ 车牌号 |
+ 被保险人 |
+ 保险公司 |
+ 保单号 |
+ 出单日期 |
+ 商业净保费 |
+ 手续费比例 |
+ 基本提成比例 |
+ 基本提成 |
+ 加点提成比例 |
+ 加点提成 |
+ 自费礼品 |
+ 自费礼券 |
+ 自费减免金额 |
+ 提成 |
+ 业务员 |
+ 原新保提成 |
+ 原新保业务员 |
+ 核保提成 |
+ 核保业务员 |
+ 正本提成 |
+ 正本业务员 |
+ 团队长组1提成 |
+ 团队长组1 |
+ 团队长组2提成 |
+ 团队长组2 |
+ 团队长组3提成 |
+ 团队长组3 |
+ 团队长组4提成 |
+ 团队长组4 |
+ 团队长组5提成 |
+ 团队长组5 |
+
+
+
+
+
+
+
+
+
+beginBlock('footer_js'); ?>
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+ });
+
+endBlock(); ?>