Files
pgserver3.0/pgserver/application/admin/controller/ChargeManage.php
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

641 lines
29 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 收费管理
*/
namespace app\admin\controller;
use app\model\Charge as ChargeModel;
use app\model\Income;
use Exception;
use PHPExcel_Exception;
use PHPExcel_IOFactory;
use PHPExcel_Reader_Exception;
use PHPExcel_Style_Alignment;
use PHPExcel_Writer_Exception;
use think\Db;
use think\Response;
use app\admin\service\ChargeService;
class ChargeManage extends Base
{
public function __construct(){
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: userId, ApiAuth, Category, User-Agent, Keep-Alive, Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With");
header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS,PATCH');
header('Access-Control-Allow-Credentials:true');
exit;
}
parent::__construct();
}
/**
* 收费更新列表
*/
public function getList() {
$data = $this->getUpdateList();
return $this->buildSuccess($data);
}
public function getUpdateList() {
$charge_service = new ChargeService();
$map = $charge_service->searchCondition();
$charge = new ChargeModel();
$order = ['report_completion_time'];
return $charge->getList($map, $order, $this->getPage());
}
/**
* 收费更新列表单条录入应收金额
*/
public function updReceivable() {
$charge_id = $this->request->param('charge_id');
$amount = $this->request->param('amount', 0);
if (empty($charge_id)) {
return $this->buildFailed('参数错误');
}
$upd_result = Db::name('charge')->where(['charge_id'=>$charge_id])->update(['receivable'=>$amount]);
if ($upd_result) {
return $this->buildSuccess($upd_result, '录入成功');
} else {
return $this->buildFailed('录入失败');
}
}
/**
* 收费更新列表数据导入更新操作
* @throws PHPExcel_Exception
* @throws PHPExcel_Reader_Exception
* @throws Exception
*/
public function import(){
// 如果是POST请求方式提交数据
if($this->request->isPost()){
$file = request()->file('import_file');
if (!$file) {
return $this->buildFailed('请选择要导入的文件!');
}
// 移动到框架根目录 /public/uploads/ 目录下
$info = $file->move('../public/uploads');
if($info){
// 获取文件所在目录名
$path = '../public/uploads/'.$info->getSaveName();
// 实例化PHPExcel_IOFactory类注意实例化的时候前面需要加'\'
$objReader = PHPExcel_IOFactory::createReaderForFile($path);
// 获取excel文件
$objPHPExcel = $objReader->load($path,$encode='utf-8');
// 激活当前的表
$sheet = $objPHPExcel->getSheet(0);
// 取得总行数
$highestRow = $sheet->getHighestRow();
// 取得总列数
$highestColumn = $sheet->getHighestColumn();
$a = 0;
// 将表格里面的数据循环到数组中
$data = [];
for($i=2;$i<=$highestRow;$i++)
{
$data[$a]['charge_id'] = $objPHPExcel->getActiveSheet()->getCell("A".$i)->getValue();
$data[$a]['receivable'] = $objPHPExcel->getActiveSheet()->getCell("O".$i)->getValue();
$receivable = str_replace(',', '', $data[$a]['receivable']);
$receivable = sprintf('%.2f', $receivable);
(new ChargeModel())->save(['receivable'=>$receivable], ['charge_id'=>$data[$a]['charge_id']]);
$a++;
}
return $this->buildSuccess('', '更新成功!');
}else{
// 上传失败获取错误信息
return $this->buildFailed($file->getError());
}
} else {
return $this->buildFailed('请求方式错误');
}
}
/**
* 月结收费列表-未收费
*/
public function getMonthListNotCollected() {
$pay_type = ['pay_type', '=', 1];
$collection_status = ['collection_status', '=', 1];
$data = $this->getSalesmanData($pay_type, $collection_status);
return $this->buildSuccess($data);
}
/**
* 月结收费列表-已收费
*/
public function getMonthListCollected() {
$pay_type = ['pay_type', '=', 1];
$collection_status = ['collection_status', '=', 3];
$data = $this->getSalesmanData($pay_type, $collection_status);
return $this->buildSuccess($data);
}
/**
* 月结收费列表-导入
*/
public function monthUpdImport() {
if ($this->request->isPost()) {
$file = request()->file('import_file');
if (!$file) {
return $this->buildFailed('请选择要导入的文件!');
}
$info = $file->move('../public/uploads');
if($info){
$path = '../public/uploads/'.$info->getSaveName();
$objReader = PHPExcel_IOFactory::createReaderForFile($path);
$objPHPExcel = $objReader->load($path,$encode='utf-8');
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
$a = 0;
$data = [];
for($i=2;$i<=$highestRow;$i++)
{
$data[$a]['report_no'] = $objPHPExcel->getActiveSheet()->getCell("A".$i)->getValue();
$receivable_result = Db::name('charge')
->where([
'report_no' => $data[$a]['report_no'],
'collection_status' => 1,
'pay_type' => 1
])
->find();
if ($receivable_result) {
Db::name('charge')
->where(['report_no'=>$data[$a]['report_no']])
->inc('confirm_amount', $receivable_result['receivable'])
->data([
'collection_status' => 3,
'confirm_time' => date('Y-m-d H:i:s')
])
->update();
}
$a++;
}
return $this->buildSuccess('', '更新成功!');
}else{
return $this->buildFailed($file->getError());
}
} else {
return $this->buildFailed('请求方式错误');
}
}
/**
* 业务员收费列表-未收费
*/
public function getSalesmanListNotCollected() {
$pay_type = ['pay_type', '=', 2];
$collection_status = ['collection_status', 'in', [1,2]];
$data = $this->getSalesmanData($pay_type, $collection_status);
return $this->buildSuccess($data);
}
/**
* 业务员收费列表-已收费
*/
public function getSalesmanListCollected() {
$pay_type = ['pay_type', '=', 2];
$collection_status = ['collection_status', '=', 3];
$data = $this->getSalesmanData($pay_type, $collection_status);
return $this->buildSuccess($data);
}
public function getSalesmanData($pay_type, $collection_status) {
$charge_service = new ChargeService();
$map = $charge_service->summarySearchCondition();
// 收费方式
$map[] = $pay_type;
// 收款状态
$map[] = $collection_status;
if (in_array("Evaluation_salesman", $this->userInfo['roleCode'])) {
$map[] = ['a.salesman_id', '=', $this->userInfo['user_id']];
} elseif (in_array("ROLE_ADMIN", $this->userInfo['roleCode']) || in_array("Finance_CSPG", $this->userInfo['roleCode']) || in_array("Integrated_Management_Manager_CSPG", $this->userInfo['roleCode'])) {
$map[] = ['a.salesman_id', '<>', 0];
} else {
$map[] = ['a.salesman_id', 'in', $this->userInfo['user_ids']];
}
$charge = new ChargeModel();
$order = ['a.report_completion_time'=>'desc'];
return $charge->getSummaryList($map, $order, $this->getPage());
}
public function getSalesmanDataExport($pay_type, $collection_status) {
$charge_service = new ChargeService();
$map = $charge_service->summarySearchCondition();
// 收费方式
$map[] = $pay_type;
// 收款状态
$map[] = $collection_status;
if (in_array("Evaluation_salesman", $this->userInfo['roleCode'])) {
$map[] = ['a.salesman_id', '=', $this->userInfo['user_id']];
} elseif (in_array("ROLE_ADMIN", $this->userInfo['roleCode']) || in_array("Finance_CSPG", $this->userInfo['roleCode']) || in_array("Integrated_Management_Manager_CSPG", $this->userInfo['roleCode'])) {
$map[] = ['a.salesman_id', '<>', 0];
} else {
$map[] = ['a.salesman_id', 'in', $this->userInfo['user_ids']];
}
$charge = new ChargeModel();
$order = ['a.report_completion_time'=>'desc'];
return $charge->getSummaryList($map, $order, ['list_rows' => 10000000, 'page' => 1]);
}
/**
* 业务员收费列表导出-已收费
*/
public function salesExportCollected() {
$pay_type = ['pay_type', '=', 2];
$collection_status = ['collection_status', '=', 3];
$data = $this->getSalesmanDataExport($pay_type, $collection_status);
$indexKey = ['report_no', 'bank_customer_mgr_name', 'city', 'region', 'building_name', 'assessment_purpose', 'business_source_str', 'assessment_total', 'is_housing_fund', 'business_type', 'is_confirm_str', 'collection_status_str', 'receivable', 'received', 'confirm_amount', 'uncollected_amount', 'check_amount', 'charge_status_str', 'real_check_time', 'report_completion_time', 'salesman_name', 'department_name', 'youhui_amount', 'tui_amount'];
$indexValue = ['报告编号', '银行', '城市', '城区', '物业名称', '评估目的', '业务来源', '评估总值', '是否公积金', '业务类别', '实收状态', '收款状态', '应收金额', '实收金额', '确认金额', '未收金额', '结单金额', '结单状态', '实结单时间', '出报告日期', '业务员', '部门', '优惠金额', '退费金额'];
$this->exportExcel($data['data'], 'salesman_'.date('Ymd'), $indexKey, $indexValue);
}
/**
* 业务员收费列表导出-未收费
*/
public function salesExportNotCollected() {
$pay_type = ['pay_type', '=', 2];
$collection_status = ['collection_status', 'in', [1,2]];
$data = $this->getSalesmanDataExport($pay_type, $collection_status);
$indexKey = ['report_no', 'bank_customer_mgr_name', 'city', 'region', 'building_name', 'assessment_purpose', 'business_source_str', 'assessment_total', 'is_housing_fund', 'business_type', 'is_confirm_str', 'collection_status_str', 'receivable', 'received', 'confirm_amount', 'uncollected_amount', 'check_amount', 'charge_status_str', 'real_check_time', 'report_completion_time', 'salesman_name', 'department_name', 'youhui_amount', 'tui_amount'];
$indexValue = ['报告编号', '银行', '城市', '城区', '物业名称', '评估目的', '业务来源', '评估总值', '是否公积金', '业务类别', '实收状态', '收款状态', '应收金额', '实收金额', '确认金额', '未收金额', '结单金额', '结单状态', '实结单时间', '出报告日期', '业务员', '部门', '优惠金额', '退费金额'];
$this->exportExcel($data['data'], 'salesman_'.date('Ymd'), $indexKey, $indexValue);
}
/**
* 月结收费列表导出-未收费
*/
public function monthExportNotCollected() {
$pay_type = ['pay_type', '=', 1];
$collection_status = ['collection_status', '=', 1];
$data = $this->getSalesmanDataExport($pay_type, $collection_status);
$indexKey = ['report_no', 'bank_customer_mgr_name', 'city', 'region', 'building_name', 'assessment_purpose', 'business_source_str', 'assessment_total', 'is_housing_fund', 'business_type', 'collection_status_str', 'receivable', 'confirm_amount', 'check_amount', 'charge_status_str', 'real_check_time', 'report_completion_time', 'salesman_name', 'department_name', 'youhui_amount', 'tui_amount'];
$indexValue = ['报告编号', '银行', '城市', '城区', '物业名称', '评估目的', '业务来源', '评估总值', '是否公积金', '业务类别', '收款状态', '应收金额', '确认金额', '结单金额', '结单状态', '实结单时间', '出报告日期', '业务员', '部门', '优惠金额', '退费金额'];
$this->exportExcel($data['data'], 'salesman_'.date('Ymd'), $indexKey, $indexValue);
}
/**
* 月结收费列表导出-已收费
*/
public function monthExportCollected() {
$pay_type = ['pay_type', '=', 1];
$collection_status = ['collection_status', '=', 3];
$data = $this->getSalesmanDataExport($pay_type, $collection_status);
$indexKey = ['report_no', 'bank_customer_mgr_name', 'city', 'region', 'building_name', 'assessment_purpose', 'business_source_str', 'assessment_total', 'is_housing_fund', 'business_type', 'collection_status_str', 'receivable', 'confirm_amount', 'confirm_time', 'check_amount', 'charge_status_str', 'real_check_time', 'report_completion_time', 'salesman_name', 'youhui_amount', 'tui_amount'];
$indexValue = ['报告编号', '银行', '城市', '城区', '物业名称', '评估目的', '业务来源', '评估总值', '是否公积金', '业务类别', '收款状态', '应收金额', '确认金额', '确认时间', '结单金额', '结单状态', '实结单时间', '出报告日期', '业务员', '优惠金额', '退费金额'];
$this->exportExcel($data['data'], 'salesman_'.date('Ymd'), $indexKey, $indexValue);
}
/**
* 业务员确认金额
*/
public function salesmanConfirm() {
$charge_id = $this->request->param('charge_id');
$bank_account_id = $this->request->param('bank_account_id');
$amount = $this->request->param('amount');
$pay_time = $this->request->param('pay_time');
$remark = $this->request->param('remark');
$transfer_voucher = $this->request->param('transfer_voucher');
// if (empty($charge_id) || empty($bank_account_id) || empty($amount) || empty($pay_time) || empty($transfer_voucher)) {
// return $this->buildFailed('参数错误');
// }
if (empty($charge_id) || empty($bank_account_id) || empty($amount) || empty($pay_time)) {
return $this->buildFailed('参数错误');
}
// 验证is_confirm的值是否为1和确认金额是否正确
$check_result = ChargeModel::where(['charge_id'=>$charge_id])->field('receivable,is_confirm,received')->find();
// 实收金额累计
$received = $amount + $check_result['received'];
if ($check_result['is_confirm'] != 1) {
return $this->buildFailed('业务员已确认不能重复确认');
}
// if($check_result['receivable'] > $received) {
// return $this->buildFailed('实收金额不能小于应收金额');
// }
// 开启事务
Db::startTrans();
// 更新表pg_charge的数据
$upd_charge_data = [
'is_confirm' => 2,
'received' => $received
];
$upd_charge_result = (new ChargeModel())->save($upd_charge_data, ['charge_id'=>$charge_id]);
// 向表pg_income_expenditure_detail插入一条记录
$ins_data = [
'charge_id' => $charge_id,
'content' => '报告收费',
'type' => 1,
'amount' => $amount,
'remark' => $remark,
'salesman_id' => $this->userInfo['user_id'],
'salesman_name' => $this->userInfo['user_name'],
'apply_time' => date('Y-m-d H:i:s'),
'pay_time' => $pay_time,
'bank_account_id' => $bank_account_id,
'transfer_voucher' => implode(',', $transfer_voucher),
'create_time'=> date('Y-m-d H:i:s'),
'update_time'=> date('Y-m-d H:i:s')
];
$ins_result = Db::name('income_expenditure_detail')->insert($ins_data);
if ($upd_charge_result && $ins_result) {
// 事务提交
Db::commit();
return $this->buildSuccess('', '确认收款成功');
} else {
// 事务回滚
Db::rollback();
return $this->buildFailed('确认收款失败');
}
}
/**
* 获取收款银行账户
*/
public function getBankAccount() {
$data = Db::name('bank_account')
->where(['type'=>1, 'status'=>1])
->field('id,bank_account,bank_card,bank')
->paginate()
->each(function ($item,$key){
$item['select_show_str'] = $item['bank_account'].'-'.$item['bank_card'].'-'.$item['bank'];
return $item;
})
->toArray();
return $this->buildSuccess($data['data']);
}
/**
* 收费更新列表导出操作
* @throws PHPExcel_Exception
* @throws PHPExcel_Writer_Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function export(){
$data = $this->getUpdateListExport();
$indexKey = ['charge_id', 'report_no', 'bank', 'bank_sub_branch', 'city', 'region', 'building_name', 'inquiry_type_str', 'assessment_purpose', 'business_source_str', 'business_type', 'estate_area', 'assessment_total', 'report_completion_time', 'account_manager_name', 'salesman_name', 'receivable'];
$indexValue = ['主键id', '报告编号', '银行', '支行', '城市', '城区', '物业名称', '业务类型', '评估目的', '业务来源', '业务类别', '面积', '评估总值', '出报告日期', '客户经理', '业务员', '应收金额'];
$this->exportExcel($data['data'], 'update_'.date('Ymd'), $indexKey, $indexValue);
}
public function getUpdateListExport() {
$charge_service = new ChargeService();
$map = $charge_service->searchCondition();
$charge = new ChargeModel();
$order = ['report_completion_time'];
return $charge->getList($map, $order, ['list_rows' => 10000000, 'page' => 1]);
}
/**
* 导出通用方法
* @param $list
* @param $filename
* @param array $indexKey
* @param array $indexValue
* @throws PHPExcel_Exception
* @throws PHPExcel_Writer_Exception
*/
function exportExcel($list, $filename, $indexKey = [], $indexValue = []){
$header_arr = ['A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z','AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM', 'AN','AO','AP','AQ','AR','AS','AT','AU','AV','AW','AX','AY','AZ','BA','BB','BC','BD','BE','BF','BG','BH','BI','BJ','BK','BL','BM', 'BN','BO','BP','BQ','BR','BS','BT','BU','BV','BW','BX','BY','BZ','CA','CB','CC','CD','CE','CF','CG','CH','CI','CJ','CK','CL','CM', 'CN','CO','CP','CQ','CR','CS','CT','CU','CV','CW','CX','CY','CZ'];
// 初始化PHPExcel()
$objPHPExcel = new \PHPExcel();
$PHPExcel_Cell_DataType =new \PHPExcel_Cell_DataType();
// 设置保存版本格式
$objWriter = new \PHPExcel_Writer_Excel2007($objPHPExcel);
// 接下来就是写数据到表格里面去
$objActSheet = $objPHPExcel -> getActiveSheet();
// 设置当前活动sheet的名称
$objActSheet->setTitle($filename);
$i = 1;
$j = 2;
// 设置表头
foreach ( $indexValue as $key => $value ){
// 这个比较有用,能自适应列宽
$objActSheet->getColumnDimension($header_arr[$key])->setAutoSize(true);
$objStyleA5 = $objActSheet->getStyle($header_arr[$key]);
//设置对齐方式
$objAlignA5 = $objStyleA5->getAlignment();
$objAlignA5->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objAlignA5->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objActSheet->setCellValue($header_arr[$key].$i,$value);
}
// 设置主要内容
foreach ($list as $row) {
foreach ($indexKey as $key => $value){
if(!isset($row[$value]))
continue;
// 这里是设置单元格的内容
$objActSheet->setCellValueExplicit($header_arr[$key].$j,$row[$value], $PHPExcel_Cell_DataType::TYPE_STRING);
// $objActSheet->setCellValue($header_arr[$key].$j,$row[$value]);
}
$j++;
}
// 下载这个表格,在浏览器输出就好了
header("Pragma: public");
header("Expires: 0");
header("Cache-Control:must-revalidate,post-check=0,pre-check=0");
header("Content-Type:application/force-download");
header("Content-Type:application/vnd.ms-execl;charset=UTF-8");
header("Content-Type:application/octet-stream");
header("Content-Type:application/download");
header('Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition:attachment;filename='.$filename.'.xlsx');
header("Content-Transfer-Encoding:binary");
header("Access-Control-Expose-Headers:content-disposition");
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter -> save('php://output');
}
/**
* 简易报告收费-未收费
*/
public function getSimpleReportUncollected() {
$collection_status = ['simple_collection_status', '=', 1];
$data = $this->getSimpleReportData($collection_status);
return $this->buildSuccess($data);
}
/**
* 简易报告收费-未收费-导出
*/
public function getSimpleReportUncollectedExport() {
$collection_status = ['simple_collection_status', '=', 1];
$data = $this->getSimpleReportDataExport($collection_status);
$indexKey = ['report_no', 'assessment_total', 'receivable', 'confirm_amount'];
$indexValue = ['报告编号', '评估总值', '应收金额', '确认金额'];
$this->exportExcel($data['data'],'simple_report_'.date('Ymd'), $indexKey, $indexValue);
}
/**
* 简易报告收费-未收费-导入
*/
public function getSimpleReportUncollectedImport() {
if ($this->request->isPost()) {
$file = request()->file('import_file');
if (!$file) {
return $this->buildFailed('请选择要导入的文件!');
}
$info = $file->move('../public/uploads');
if($info){
$path = '../public/uploads/'.$info->getSaveName();
$objReader = PHPExcel_IOFactory::createReaderForFile($path);
$objPHPExcel = $objReader->load($path,$encode='utf-8');
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
$a = 0;
$data = [];
for($i=2;$i<=$highestRow;$i++)
{
$data[$a]['report_no'] = $objPHPExcel->getActiveSheet()->getCell("A".$i)->getValue();
// $receivable_result = Db::name('charge')
// ->where([
// 'report_no' => $data[$a]['report_no'],
// 'simple_collection_status' => 1,
// 'is_simple' => 1
// ])
// ->field('receivable')
// ->find();
// if ($receivable_result) {
// Db::name('charge')
// ->where(['report_no'=>$data[$a]['report_no']])
// ->inc('confirm_amount', $receivable_result['receivable'])
// ->data(['simple_collection_status'=>2])
// ->update();
// }
$data[$a]['confirm_amount'] = $objPHPExcel->getActiveSheet()->getCell("D".$i)->getValue();
$confirm_amount = str_replace(',', '', $data[$a]['confirm_amount']);
$confirm_amount = sprintf('%.2f', $confirm_amount);
(new ChargeModel())->save(['confirm_amount'=>$confirm_amount,'simple_collection_status'=>2], ['report_no'=>$data[$a]['report_no']]);
$a++;
}
return $this->buildSuccess('', '更新成功!');
}else{
return $this->buildFailed($file->getError());
}
} else {
return $this->buildFailed('请求方式错误');
}
}
/**
* 简易报告收费-已收费
*/
public function getSimpleReportCollected() {
$collection_status = ['simple_collection_status', '<>', 1];
$data = $this->getSimpleReportData($collection_status);
return $this->buildSuccess($data);
}
/**
* 简易报告收费-已收费-导出
*/
public function getSimpleReportCollectedExport() {
$collection_status = ['simple_collection_status', '<>', 1];
$data = $this->getSimpleReportDataExport($collection_status);
$indexKey = ['report_no', 'building_name', 'inquiry_type_str', 'estate_area', 'eva_unit_price', 'assessment_total', 'simple_collection_status_str', 'receivable', 'confirm_amount', 'confirm_time', 'inquiry_time', 'salesman_name', 'department_name', 'report_completion_time'];
$indexValue = ['报告编号', '物业名称', '业务类型', '面积(㎡)', '单价(㎡/元)', '评估总值(元)', '收款状态', '应收金额', '确认金额', '确认时间', '询价时间', '业务员', '部门', '出报告日期'];
$this->exportExcel($data['data'],'simple_report_'.date('Ymd'), $indexKey, $indexValue);
}
/**
* 简易报告收费-已收费-金额确认
*/
public function getSimpleReportCollectedConfirm() {
$charge_id = $this->request->param('charge_id');
if (empty($charge_id)) {
return $this->buildFailed('参数错误');
}
$charge_ids = [];
if (strpos($charge_id, ',') !== false) {
$charge_ids = explode(',', $charge_id);
} else {
$charge_ids[] = $charge_id;
}
$i = 0;
$report_no_str = '';
$chargeModel = new ChargeModel();
foreach ($charge_ids as $key=>$value) {
$report_no = $chargeModel->where(['charge_id'=>$value])->field('report_no')->find();
$result = ChargeModel::where(['charge_id'=>$value])->update(['simple_collection_status'=>3,'confirm_time'=>date('Y-m-d H:i:s')]);
if ($result) {
$i++;
} else {
$report_no_str .= ','.$report_no['report_no'];
}
}
if (count($charge_ids) == $i) {
return Response::create(['code'=>1, 'msg'=>'确认成功'], 'json');
} else {
$report_no_str = trim($report_no_str, ',');
return $this->buildFailed('报告编号为['.$report_no_str.']确认失败');
}
}
/**
* 简易报告收费-已收费-修改
*/
public function getSimpleReportCollectedEdit() {
$charge_id = $this->request->param('charge_id');
$confirm_amount = $this->request->param('confirm_amount');
if (empty($confirm_amount) || empty($charge_id)) {
return $this->buildFailed('参数错误');
}
$update_result = Db::name('charge')
->where(['charge_id'=>$charge_id])
->update(['confirm_amount'=>$confirm_amount]);
if ($update_result) {
return $this->buildSuccess('', '修改成功');
} else {
return $this->buildFailed('修改失败');
}
}
/**
* 获取简易报告数据公共方法
* @param $collection_status
* @return array
*/
public function getSimpleReportData($collection_status) {
$charge_service = new ChargeService();
$map = $charge_service->simpleReportListSearchCondition();
$map[] = $collection_status;
$charge = new ChargeModel();
$order = ['report_completion_time'];
return $charge->getSimpleReportList($map, $order, $this->getPage());
}
public function getSimpleReportDataExport($collection_status) {
$charge_service = new ChargeService();
$map = $charge_service->simpleReportListSearchCondition();
$map[] = $collection_status;
$charge = new ChargeModel();
$order = ['report_completion_time'];
return $charge->getSimpleReportList($map, $order, ['list_rows' => 10000000, 'page' => 1]);
}
}