You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
4.6 KiB
PHP
125 lines
4.6 KiB
PHP
<?php
|
|
|
|
namespace Admin\Controller;
|
|
use User\Api\UserApi as UserApi;
|
|
use Base\Service\PromoteService as PromoteService;
|
|
use Think\Controller;
|
|
|
|
/**
|
|
* 后台首页控制器
|
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
|
*/
|
|
class VerifyBillController extends Controller {
|
|
/**
|
|
* VerifyBillController constructor.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
if(ACTION_NAME == "show" && isset($_REQUEST['from']) && $_REQUEST['from']=="pc"){
|
|
//不验证
|
|
}else{
|
|
if (empty(session('cp_user_auth'))) {
|
|
redirect('admin.php?s=public/cp_login.html');
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public function index(){
|
|
$m_title = '对账单管理';
|
|
$list_data = DM('statement')
|
|
->where(['company_id' => session('cp_user_auth.company_id')])
|
|
->order('create_time desc')
|
|
->select();
|
|
foreach ($list_data as $key => $value) {
|
|
$list_data[$key]['statement_type_str'] = $value['statement_type'] ? '工会对账单' : 'cp对账单';
|
|
if ($value['verify_status'] == 1) {
|
|
$list_data[$key]['verify_status_str'] = '审核通过';
|
|
} elseif ($value['verify_status'] == 1) {
|
|
$list_data[$key]['verify_status_str'] = '审核拒绝';
|
|
} else {
|
|
$list_data[$key]['verify_status_str'] = '未审核';
|
|
}
|
|
}
|
|
$this->assign('list_data', $list_data);
|
|
$this->assign('meta_title', $m_title);
|
|
$this->display();
|
|
}
|
|
|
|
public function show()
|
|
{
|
|
$id = I('id');
|
|
$data = DM('statement')->where(['id' => $id])->find();
|
|
$data['first_party_info'] = json_decode($data['first_party_info'], 1);//甲方
|
|
$data['second_party_info'] = json_decode($data['second_party_info'], 1);//乙方
|
|
$data['statement_info'] = json_decode($data['statement_info'], 1);//结算记录
|
|
//收款方
|
|
$data['receive_company'] = $data['pay_type'] ? $data['first_party_info']['partner'] : $data['second_party_info']['partner'];
|
|
// dd($data);
|
|
$all_sum_money = array_sum(array_column($data['statement_info'], 'sum_money'));//合计平台总额
|
|
$all_pay_amount = array_sum(array_column($data['statement_info'], 'pay_amount'));//合计结算金额
|
|
$big_all_sum_money = convertAmountToCn($data['statement_money']);//大写
|
|
$this->assign('big_all_sum_money', $big_all_sum_money);
|
|
$this->assign('all_sum_money', $all_sum_money);
|
|
$this->assign('all_pay_amount', $all_pay_amount);
|
|
$this->assign('data', $data);
|
|
$from = I('from');
|
|
if (empty($from) && $data['verify_status'] != 1) {//未审核通过不可确认
|
|
$from = 'not_verify';
|
|
}
|
|
$this->assign('from', $from);
|
|
if ($data['statement_type'] == 1) {//下游
|
|
$template = 'company_show';
|
|
} else {
|
|
$template = 'partner_show';//上游
|
|
}
|
|
$this->display($template);
|
|
}
|
|
|
|
public function confirm()
|
|
{
|
|
$id = I('id');
|
|
$res = DM('statement')->where(['id' => $id])->save(['is_confirm' => 1]);
|
|
if ($res) {
|
|
$this->success("操作成功", U('index'));
|
|
} else {
|
|
$this->error('操作失败');
|
|
}
|
|
}
|
|
|
|
/**
|
|
*导出excell
|
|
* @param int id
|
|
*/
|
|
public function export()
|
|
{
|
|
$id = I('id');
|
|
$data = DM('statement')->where(['id' => $id])->find();
|
|
$data['first_party_info'] = json_decode($data['first_party_info'], 1);//甲方
|
|
$data['second_party_info'] = json_decode($data['second_party_info'], 1);//乙方
|
|
$data['statement_info'] = json_decode($data['statement_info'], 1);//结算记录
|
|
//收款方
|
|
// dd($data);
|
|
$all_sum_money = array_sum(array_column($data['statement_info'], 'sum_money'));//合计平台总额
|
|
$all_pay_amount = array_sum(array_column($data['statement_info'], 'pay_amount'));//合计结算金额
|
|
|
|
$big_all_sum_money = convertAmountToCn($data['statement_money']);//大写
|
|
$data['receive_company'] = $data['pay_type'] ? $data['first_party_info'] : $data['second_party_info'];
|
|
$data['pay_company'] = $data['pay_type'] ? $data['second_party_info'] : $data['first_party_info'];
|
|
if ($data['statement_type'] == 1) {//下游
|
|
excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money);
|
|
} else {//上游
|
|
excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|