diff --git a/Application/Admin/Conf/config.php b/Application/Admin/Conf/config.php index 6b0389167..3394d0686 100644 --- a/Application/Admin/Conf/config.php +++ b/Application/Admin/Conf/config.php @@ -130,5 +130,6 @@ return array( "sys_action_log", "tab_reward_detail", "tab_reward_record", + "tab_new_company_statement_info", ] ); \ No newline at end of file diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index 68f239367..90fde3595 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -430,12 +430,12 @@ class CompanyStatementController extends ThinkController $ids = $_POST['id']; if (!$ids) { - $this->ajaxReturn(["status"=>1]); + $this->ajaxReturn(["status"=>0]); } $count = SM("company_statement","tab_") ->where("id in({$ids})") - ->group("company_type,withdraw_type") + ->group("company_type,withdraw_type,company_belong") ->select(); foreach ($count as $key => $value) { @@ -600,6 +600,8 @@ class CompanyStatementController extends ThinkController } A("FinancialSummary")->getYearList(); + + $this->assign("year",date("Y")); $this->assign("data",$data); $this->display(); @@ -894,36 +896,24 @@ class CompanyStatementController extends ThinkController $save['sum_money'] = $amount_data['sum_money']-($amount_data['sum_money']*$_POST['fax_ratio']/100); $save['user_newcount'] = $amount_data['user_newcount']; $save['fax_ratio'] = $_POST['fax_ratio']; + $save['statement_ids'] = $_POST['id'].','.$_POST['other_id']; + $save['create_time'] = time(); + $save['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3); $is_success = SM("new_company_statement_info","tab_")->add($save); - $pool['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3); - $pool['statement_ids'] = $_POST['id'].','.$_POST['other_id']; - $pool['withdraw_type'] = 1; - $pool['wm_statement_ids'] = $is_success; - $pool['statement_begin_time'] = strtotime(str_replace(".", "-", $amount_data['statement_begin_time'])); - $pool['statement_end_time'] = strtotime(str_replace(".", "-", $amount_data['statement_end_time'])) + 86399; - $pool['statement_money'] = $save['sum_money']; - $pool['pay_amount'] = $save['pay_amount']; - $pool['platform_amount'] = $save['pay_amount']; - $pool['company_type'] = 2; - $pool['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s")]); - SM("company_statement_pool","tab_")->add($pool); - - if ($_POST['other_id']) { $statement_id = $_POST['id'].','.$_POST['other_id']; } else { $statement_id = $_POST['id']; } - $dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id in ({$statement_id})")->select(); foreach ($dbres as $k => $v) { $v['verify_log'] = json_decode($v['verify_log'],true); $v['verify_log']['pool_user']=$this->admininfo["username"]; $v['verify_log']['pool_time']=date("Y.m.d H:i:s"); - $v['verify_log']['pool_num']=$pool['statement_num']; + $v['verify_log']['pool_num']=$save['statement_num']; $v['verify_log'] = json_encode($v['verify_log']); $v['verify_status']=2; $v['op_time']=time(); diff --git a/Application/Admin/Controller/SubCompanyStatementPoolController.class.php b/Application/Admin/Controller/SubCompanyStatementPoolController.class.php index 347b03063..1d0eac592 100644 --- a/Application/Admin/Controller/SubCompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/SubCompanyStatementPoolController.class.php @@ -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 = "
"; - } - $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 = "
"; - } - - $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(); diff --git a/Application/Admin/View/CompanyStatement/showCpStatementList.html b/Application/Admin/View/CompanyStatement/showCpStatementList.html index 55c4171ed..0750ffb93 100644 --- a/Application/Admin/View/CompanyStatement/showCpStatementList.html +++ b/Application/Admin/View/CompanyStatement/showCpStatementList.html @@ -106,7 +106,7 @@
diff --git a/Application/Admin/View/SubCompanyStatementPool/lists.html b/Application/Admin/View/SubCompanyStatementPool/lists.html index 9286ddb56..78168727a 100644 --- a/Application/Admin/View/SubCompanyStatementPool/lists.html +++ b/Application/Admin/View/SubCompanyStatementPool/lists.html @@ -67,10 +67,6 @@
-
-   -
-
@@ -104,16 +100,10 @@ - 结算汇总单订单号 + 公司名称 结算时间 - 结算类型 - 结算周期 - 结算金额 - - 不结算金额 - 创建记录 - 凭证 + 创建时间 操作 @@ -129,21 +119,13 @@ - {$data.statement_num} - {$data.valid} - {$data.company_type_str} - {$data.withdraw_type} - - {$data.statement_money} - - {$data.lack_statement_money} - {$data.create} - - {$data.ext_file_type} + {$data.company_name} + {$data.statement_begin_time}-{$data.statement_end_time} + {$data.sum_money} + {$data.create_time} - - {$vo} - + 查看 + 撤销汇总 @@ -419,11 +401,7 @@ $("#export").click(function () { var flag = false; var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { - if($(elem).data("export") == 1){ - return $(elem).val(); - }else{ - flag = true; - } + return $(elem).val(); }).get(); if(text.length > 20){