|
|
|
@ -52,7 +52,7 @@ class SubCompanyStatementPoolController extends ThinkController
|
|
|
|
|
public function _initialize()
|
|
|
|
|
{
|
|
|
|
|
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
|
|
|
|
|
$this->DBModel = SM("CompanyStatementPool","tab_");
|
|
|
|
|
$this->DBModel = SM("new_company_statement_info","tab_");
|
|
|
|
|
parent::_initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -115,79 +115,17 @@ class SubCompanyStatementPoolController extends ThinkController
|
|
|
|
|
->where($map)
|
|
|
|
|
->order("id desc")
|
|
|
|
|
->page($page,$row)->select();
|
|
|
|
|
|
|
|
|
|
foreach($data as $k => &$v) {
|
|
|
|
|
|
|
|
|
|
$v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']);
|
|
|
|
|
$v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']);
|
|
|
|
|
|
|
|
|
|
$v['company_type_str'] = $this->CompanyType[$v['company_type']];
|
|
|
|
|
$v['is_payment_str'] = $this->IsPayment[$v['is_payment']];
|
|
|
|
|
// $v['can_export'] = $v['platform_amount'] == 0 ? "0" : '1';
|
|
|
|
|
// if($v['company_type'] == 2){
|
|
|
|
|
$v['can_export'] = 1;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
$v['op_time'] = date('Y.m.d H:i:s',$v['op_time']);
|
|
|
|
|
$v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}";
|
|
|
|
|
|
|
|
|
|
$v['ext_file_type'] = empty($v['ext_file']) ? "无" : "有";
|
|
|
|
|
$v['withdraw_type'] = $this->WithdrawType[$v['withdraw_type']];;
|
|
|
|
|
|
|
|
|
|
$v['verify_log'] = json_decode($v['verify_log'], true);
|
|
|
|
|
if (isset($params['export'])) {
|
|
|
|
|
$symbol = "\n";
|
|
|
|
|
} else {
|
|
|
|
|
$symbol = "<br>";
|
|
|
|
|
}
|
|
|
|
|
$v["create"]= "{$v['verify_log']['create_user']} {$symbol} {$v['verify_log']['create_time']}";
|
|
|
|
|
|
|
|
|
|
if(isset($v['verify_log']['firstverify_user'])){
|
|
|
|
|
if($v['verify_status'] == -3){
|
|
|
|
|
$ts = "初审拒绝";
|
|
|
|
|
}else{
|
|
|
|
|
$ts = "初审通过";
|
|
|
|
|
}
|
|
|
|
|
$v["firstverify"]= "{$ts}({$v['verify_log']['firstverify_user']}) {$symbol} {$v['verify_log']['firstverify_time']}";
|
|
|
|
|
$ts = '';
|
|
|
|
|
}else{
|
|
|
|
|
$v["firstverify"] = '--';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(isset($v['verify_log']['verify_user'])){
|
|
|
|
|
if($v['verify_status'] == -1){
|
|
|
|
|
$ts = "审核拒绝";
|
|
|
|
|
}else{
|
|
|
|
|
$ts = "审核通过";
|
|
|
|
|
}
|
|
|
|
|
$v["verify"]= "{$ts}({$v['verify_log']['verify_user']}) {$symbol} {$v['verify_log']['verify_time']}";
|
|
|
|
|
}else{
|
|
|
|
|
$v["verify"] = '--';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($v['verify_log']['payment_user'])){
|
|
|
|
|
if($v['verify_status'] == -2){
|
|
|
|
|
$ts = "拒绝打款";
|
|
|
|
|
}elseif($v['verify_status'] == 1){
|
|
|
|
|
$ts = "打款信息确认";
|
|
|
|
|
}elseif($v['verify_status'] == 2){
|
|
|
|
|
$ts = "待打款";
|
|
|
|
|
}elseif($v['verify_status'] == 3){
|
|
|
|
|
$ts = "打款中";
|
|
|
|
|
}elseif($v['verify_status'] == 4){
|
|
|
|
|
$ts="打款成功";
|
|
|
|
|
}elseif($v['verify_status'] == 5){
|
|
|
|
|
$ts="无需打款";
|
|
|
|
|
}
|
|
|
|
|
$v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}";
|
|
|
|
|
}else{
|
|
|
|
|
$v["payment"] = '--';
|
|
|
|
|
}
|
|
|
|
|
$v["create_time"] = date("Y.m.d H:i:s",$v["create_time"]);
|
|
|
|
|
|
|
|
|
|
$v['oplist'] = $this->OpWmAuth($v);
|
|
|
|
|
}
|
|
|
|
|
// dump($data);die();
|
|
|
|
|
$count = $this->DBModel->field("count(id) count,SUM(statement_money) as statement_money,SUM(lack_statement_money) lack_statement_money")->where($map)->find();
|
|
|
|
|
|
|
|
|
|
$count = $this->DBModel->field("count(id) count")->where($map)->find();
|
|
|
|
|
// dd($count);
|
|
|
|
|
$params['p'] = $page;
|
|
|
|
|
$params['row'] = $row;
|
|
|
|
@ -198,10 +136,6 @@ class SubCompanyStatementPoolController extends ThinkController
|
|
|
|
|
|
|
|
|
|
$this->assign('data',$data);
|
|
|
|
|
$this->assign('count',$count);
|
|
|
|
|
$this->assign('CompanyType',$this->CompanyType);
|
|
|
|
|
$this->assign('IsPayment',$this->IsPayment);
|
|
|
|
|
$this->assign('VerifyStatus',$this->VerifyStatus);
|
|
|
|
|
$this->assign('WithdrawType',$this->WithdrawType);
|
|
|
|
|
$this->display();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -209,6 +143,7 @@ class SubCompanyStatementPoolController extends ThinkController
|
|
|
|
|
//查看
|
|
|
|
|
public function viewPool()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(!isset($_REQUEST['id'])){
|
|
|
|
|
$this->error('参数错误');
|
|
|
|
|
}
|
|
|
|
@ -218,53 +153,8 @@ class SubCompanyStatementPoolController extends ThinkController
|
|
|
|
|
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
|
|
|
|
|
$is_export = true;
|
|
|
|
|
}
|
|
|
|
|
//获取基本信息
|
|
|
|
|
$infolist = SM("company_statement_info","tab_")->field("*,'1' as st")->where("pool_id = '{$id}'")->select();
|
|
|
|
|
//获取母单
|
|
|
|
|
$pool_info = SM("company_statement_pool","tab_")
|
|
|
|
|
->field('wm_statement_ids,statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time,verify_log')->where("id={$id}")->find();
|
|
|
|
|
if(!empty($pool_info['create_lack_ids'])){
|
|
|
|
|
$l_ids = $pool_info['create_lack_ids'];
|
|
|
|
|
$lack_info = SM("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select();
|
|
|
|
|
$infolist =array_merge($infolist,$lack_info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($is_export) {
|
|
|
|
|
$symbol = "\n";
|
|
|
|
|
} else {
|
|
|
|
|
$symbol = "<br>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$pool_info['verify_log'] = json_decode($pool_info['verify_log'], true);
|
|
|
|
|
|
|
|
|
|
if(isset($pool_info['verify_log']['firstverify_user'])){
|
|
|
|
|
if($pool_info['verify_status'] == -3){
|
|
|
|
|
$ts = "初审拒绝";
|
|
|
|
|
}else{
|
|
|
|
|
$ts = "初审通过";
|
|
|
|
|
}
|
|
|
|
|
$pool_info["firstverify"]= "{$ts}({$pool_info['verify_log']['firstverify_user']}) {$symbol} {$pool_info['verify_log']['firstverify_time']}";
|
|
|
|
|
$ts = '';
|
|
|
|
|
}else{
|
|
|
|
|
$pool_info["firstverify"] = '--';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(isset($pool_info['verify_log']['verify_user'])){
|
|
|
|
|
if($pool_info['verify_status'] == -1){
|
|
|
|
|
$ts = "审核拒绝";
|
|
|
|
|
}else{
|
|
|
|
|
$ts = "审核通过";
|
|
|
|
|
}
|
|
|
|
|
$pool_info["verify"]= "{$ts}({$pool_info['verify_log']['verify_user']}) {$symbol} {$pool_info['verify_log']['verify_time']}";
|
|
|
|
|
}else{
|
|
|
|
|
$pool_info["verify"] = '--';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(true) {
|
|
|
|
|
|
|
|
|
|
$this->viewWmStatement($pool_info['wm_statement_ids'],$is_export);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$this->viewWmStatement($id,$is_export);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -400,37 +290,27 @@ class SubCompanyStatementPoolController extends ThinkController
|
|
|
|
|
if(!isset($_REQUEST['id'])) $this->error("参数错误");
|
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
|
|
|
|
|
|
//获取基础信息
|
|
|
|
|
$db_res = $this->DBModel->where("id='{$id}'")->find();
|
|
|
|
|
|
|
|
|
|
if (IS_SUBSITE) {
|
|
|
|
|
$this->cancelWmCompanyPool($db_res);
|
|
|
|
|
$this->cancelWmCompanyPool($id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function cancelWmCompanyPool($info)
|
|
|
|
|
public function cancelWmCompanyPool($id)
|
|
|
|
|
{
|
|
|
|
|
if(in_array($info['verify_status'],[3,4])) return;//有打款就不允许回退
|
|
|
|
|
|
|
|
|
|
$sids = $info['statement_ids'];
|
|
|
|
|
$wm_statement_ids = $info['wm_statement_ids'];
|
|
|
|
|
$wm_statement_ids = $id;
|
|
|
|
|
|
|
|
|
|
SM()->startTrans();//事务
|
|
|
|
|
|
|
|
|
|
$data = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->find();
|
|
|
|
|
//删除info
|
|
|
|
|
$infores = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->delete();
|
|
|
|
|
if($infores === false){
|
|
|
|
|
SM()->rollback();
|
|
|
|
|
$this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败"));
|
|
|
|
|
}
|
|
|
|
|
//删除自己
|
|
|
|
|
$poolres = $this->DBModel->where("id = {$info['id']}")->delete();
|
|
|
|
|
if($poolres === false){
|
|
|
|
|
SM()->rollback();
|
|
|
|
|
$this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败"));
|
|
|
|
|
}
|
|
|
|
|
//修改结算单信息
|
|
|
|
|
$sids = array_filter(explode(",",$sids));
|
|
|
|
|
$sids = array_filter(explode(",",$data["statement_ids"]));
|
|
|
|
|
|
|
|
|
|
$st_res = SM("company_statement","tab_")->field("id,verify_status,verify_log")->where(["id"=>['in',$sids]])->select();
|
|
|
|
|
|
|
|
|
|