diff --git a/frontend/controllers/FinanceController.php b/frontend/controllers/FinanceController.php index 6279d15..62fba5b 100644 --- a/frontend/controllers/FinanceController.php +++ b/frontend/controllers/FinanceController.php @@ -227,6 +227,10 @@ class FinanceController extends \frontend\controllers\UserBaseController public function actionReceiptImport() { return $this->render('receipt-import'); } + public function actionReceipt2Import() { + return $this->render('receipt2-import'); + } + public function actionEmsReceipt() { $request = Yii::$app->request; @@ -3864,10 +3868,17 @@ class FinanceController extends \frontend\controllers\UserBaseController return $result; } - public function actionReceipt2() + public function actionReceipt2() { + $insurer_company_items = InsurerCompany2T::find()->all(); + + return $this->render('receipt2', [ + 'insurer_company_items' => $insurer_company_items + ]); + } + public function actionReceipt2Json() { + Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; - $page = $request->get('page', 1); $begin_date = $request->get('begin_date'); $end_date = $request->get('end_date'); $r_begin_date = $request->get('r_begin_date'); @@ -3878,43 +3889,14 @@ class FinanceController extends \frontend\controllers\UserBaseController $sort_key = $request->get('sort_key'); $sort_value = $request->get('sort_value'); $company_id = $request->get('company_id'); - if ($page < 1) $page = 1; + $insurer_type = $request->get('insurer_type'); + $offset = $request->get('offset', 0); + $limit = $request->get('limit', 10); -// $query = OrderCaiwuT::find() -// ->where('budian_rate>0'); $query = CaiwuT::find() ->leftJoin(OrderCaiwuT::tableName(), "order_caiwu_t.order_id=caiwu_t.order_id") ->leftJoin(OrderT::tableName(), "order_caiwu_t.order_id=order_t.id") - ->where('order_caiwu_t.budian_rate > 0'); -// ->orderBy('order_t.print_date DESC'); - -// switch ($sort_key) { -// case 'total': -// $sort = 'caiwu_t.total '; -// break; -// case 'total_clear': -// $sort = 'caiwu_t.total_clear '; -// break; -// case 'total_rate': -// $sort = 'caiwu_t.total_rate '; -// break; -// case 'print_date'://默认按照print_date排序 -// default: -// $sort = 'order_t.print_date '; -// break; -// } - -// switch ($sort_value) { -// case 'ASC': -// $sort .= 'ASC'; -// break; -// case 'DESC': -// default: -// $sort .= 'DESC'; -// break; -// } - -// $query = $query->orderBy($sort); + ->where('caiwu_t.budian_rate > 0'); if( $company_id > 0) { $query = $query->andWhere('order_t.company_id='.$company_id); } @@ -3926,10 +3908,10 @@ class FinanceController extends \frontend\controllers\UserBaseController } if ($status > 0) { if ($status == 1) { - $query = $query->andWhere('r_date=""'); + $query = $query->andWhere('b1_date is null'); } if ($status == 2) { - $query = $query->andWhere('r_date<>""'); + $query = $query->andWhere('b1_date is not null'); } } if ($begin_date != "") { @@ -3944,43 +3926,38 @@ class FinanceController extends \frontend\controllers\UserBaseController if ($r_end_date != "") { $query = $query->andWhere('caiwu_t.r_date<="' . $r_end_date . '"'); } + + if($insurer_type != 0){ + $query = $query->andWhere('caiwu_t.insurer_type =' . $insurer_type); + } // 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); + $query->offset($offset)->limit($limit); $items = $query->all(); -// $sum_r_total = $query->sum('r_total'); - //商业净保费综合 -// $sum_total_clear = $query->sum('total_clear'); - - //商业总保费 -// $sum_total = $query->sum('total'); + $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['total_real'] = round($item->total_clear,2); + $row['budian_rate'] = $item->budian_rate; + $row['budian_money'] = $item->budian_money; + $row['b1_total'] = $item->b1_total; + $row['b1_date'] = $item->b1_date; + $row['b2_total'] = $item->b2_total; + $row['b2_date'] = $item->b2_date; + $row['b3_total'] = $item->b3_total; + $row['b3_date'] = $item->b3_date; + $row['b_total'] = round($row['b1_total']+$row['b2_total']+$row['b3_total'],2); + $row['un_b_total'] = round($row['budian_money'] - $row['b_total'],2); + $data['rows'][] = $row; + } - $page_info = MyLib::getPageInfo($pagination); - $company_items = InsurerCompanyT::find()->all(); - return $this->render('receipt2', [ - 'items' => $items, - 'page' => $page, - 'car_no' => $car_no, - 'insurer_no' => $insurer_no, - 'status' => $status, - 'begin_date' => $begin_date, - 'end_date' => $end_date, - 'r_begin_date' => $r_begin_date, - 'r_end_date' => $r_end_date, - 'page_info' => $page_info, - 'sort_key' => $sort_key, - 'company_items' => $company_items, - 'company_id' => $company_id, - 'sort_value' => $sort_value -// 'sum_r_total' => $sum_r_total, -// 'sum_total_clear' => $sum_total_clear, -// 'sum_total' => $sum_total, - ]); + return $data; } public function actionReceipt2Output() { @@ -4139,22 +4116,13 @@ class FinanceController extends \frontend\controllers\UserBaseController $insurer_total = $cell->getValue();//$data[$i][6]; $cell = $currentSheet->getCellByColumnAndRow(7, $i); $insurer_date = $cell->getFormattedValue(); -// $insurer_date = \PHPExcel_Shared_Date::ExcelToPHP($cell->getValue());//$data[$i][7]; $cell = $currentSheet->getCellByColumnAndRow(8, $i); $car_no = $cell->getValue();//$data[$i][8]; -// if($insurer_no == 'PDAA201811010000089441') { -// echo $insurer_no.'='.$policy_man.'='.$total_real.'='.$total_rate.'='; -// echo $pay_total.'='.$insurer_total.'='.date('Y-m-d',$insurer_date).'='.$car_no."\r\n"; -// exit; -// } -// $row = CaiwuT::findOne(['car_no' => $car_no, 'insurer_no' => $insurer_no]); $row = CaiwuT::findOne(['insurer_no' => $insurer_no]); if ($row) { CaiwuErrorT::deleteAll(['insurer_no' => $insurer_no]); -// echo $insurer_no.'='.$policy_man.'='.$total_real.'='.$total_rate.'='; -// echo $pay_total.'='.$insurer_total.'='.date('Y-m-d',$insurer_date).'='.$car_no."\r\n"; if($bdlx == 1) { $row->b1_total = $insurer_total; $row->b1_date = $insurer_date; diff --git a/frontend/views/finance/receipt2-import.php b/frontend/views/finance/receipt2-import.php new file mode 100644 index 0000000..b18cb9a --- /dev/null +++ b/frontend/views/finance/receipt2-import.php @@ -0,0 +1,93 @@ + +beginBlock('header_css'); ?> +endBlock(); ?> + +
+
+
+
+
+
+
+ +
+ +
+
+
+ + +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + +endBlock('footer_js'); ?> diff --git a/frontend/views/finance/receipt2.php b/frontend/views/finance/receipt2.php index c61f6a4..c201754 100644 --- a/frontend/views/finance/receipt2.php +++ b/frontend/views/finance/receipt2.php @@ -1,222 +1,141 @@ - - - - - - - - - - - - - - - -
导入类型 - -
批对日期 - - -
- -    - -
- - - - - - - -
- - - - 保单号: - 车牌: - - 出单日期: - - -- - - 回单日期: - - -- - - 保险公司: - 排序: - - - - -
- - - - - - - - - - - - - - - - - - - - $item) { - $start_index = ($page-1)*20+$index; - $order = $item->order; - $caiwu = $order->caiwu; -// $caiwu = $order->caiwu; -// $rate = $caiwu ? $caiwu->budian_rate : 0; - if($item->insurer_type==2){ - $caiwu->budian_rate=0; - } - $total_clear = round($item->total_clear * $caiwu->budian_rate/100,2); - $b_total = $item->b1_total+$item->b2_total+$item->b3_total; -// $total_clear_real = $item->total_clear * $rate/100; -// $total_dis = round($total_clear_real - $item->r_total,2); - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
序号车牌号保险公司保单号出单日期商业净保费补点比例应得金额补点1回款补点1日期补点2回款补点2日期补点3回款补点3日期已回金额未回金额
car_no?>company ? $order->company->name:''?>insurer_no?>print_date?>total_clear?>budian_rate?>b1_total?>b1_date?>b2_total?>b2_date?>b3_total?>b3_date?>
- - - - - - - - + + + +endBlock(); ?>