|
|
|
@ -17,17 +17,25 @@ class AggregateFinanceStatementController extends ThinkController
|
|
|
|
|
"5"=>"已到账"
|
|
|
|
|
];
|
|
|
|
|
public $admininfo;
|
|
|
|
|
public $OpAuthList=[];
|
|
|
|
|
//TODO:
|
|
|
|
|
public function _initialize()
|
|
|
|
|
{
|
|
|
|
|
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
|
|
|
|
|
parent::_initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function lists() {
|
|
|
|
|
$is_export= false;
|
|
|
|
|
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
|
|
|
|
|
$is_export = true;
|
|
|
|
|
}
|
|
|
|
|
//权限
|
|
|
|
|
if(!IS_ROOT){
|
|
|
|
|
$this->getAuth();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//分页
|
|
|
|
|
$page = intval(I('get.p', 0));
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
|
|
$row = intval(I('row', 0));
|
|
|
|
@ -99,6 +107,8 @@ class AggregateFinanceStatementController extends ThinkController
|
|
|
|
|
$data[$key]['endtime'] = date('Y-m-d',$value['endtime']);
|
|
|
|
|
$data[$key]['withdraw_type_1'] = ($value['withdraw_type'] == 1 ? "月结" :"周结");
|
|
|
|
|
$data[$key]['withdraw_type_2'] = ($value['withdraw_type'] == 2 ? "补点" :"正常结算");
|
|
|
|
|
|
|
|
|
|
$data[$key]['oplist'] = $this->OpAuth($value);
|
|
|
|
|
}
|
|
|
|
|
$count = M("aggregate_statement","tab_")->field("count(id) count,SUM(ratio_money) ratio_money")->where($map)->find();
|
|
|
|
|
|
|
|
|
@ -109,6 +119,8 @@ class AggregateFinanceStatementController extends ThinkController
|
|
|
|
|
if ($page) {
|
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
$this->assign('menubtn',$this->menuAuth());
|
|
|
|
|
$this->assign('data',$data);
|
|
|
|
|
$this->assign('total',$count['ratio_money']);
|
|
|
|
|
$this->assign('channel',$this->getAggChannel());
|
|
|
|
@ -434,7 +446,14 @@ class AggregateFinanceStatementController extends ThinkController
|
|
|
|
|
public function cancelApply(){
|
|
|
|
|
if(!isset($_REQUEST['id'])) $this->error("参数错误");
|
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
|
$data = M("aggregate_statement","tab_")->where("id = '{$id}'")->find();
|
|
|
|
|
$savedata = ["verify_status"=>0,"create_time"=>time(),"admin_name"=>$this->admininfo["username"],"admin_id"=>$this->admininfo["uid"]];
|
|
|
|
|
$first_party_info = json_decode($data['first_party_info'], 1);
|
|
|
|
|
if($first_party_info['partner'] == $data['channel_name']){
|
|
|
|
|
$savedata['second_party_info'] = $data['first_party_info'];
|
|
|
|
|
$savedata['first_party_info'] = $data['second_party_info'];
|
|
|
|
|
$savedata['pay_type'] =0;
|
|
|
|
|
}
|
|
|
|
|
M("aggregate_statement","tab_")->where("id ='{$id}'")->save($savedata);
|
|
|
|
|
$this->ajaxReturn(array(
|
|
|
|
|
'status' => 1,
|
|
|
|
@ -531,6 +550,118 @@ class AggregateFinanceStatementController extends ThinkController
|
|
|
|
|
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
|
|
|
|
$objWriter->save('php://output');
|
|
|
|
|
}
|
|
|
|
|
//获取权限
|
|
|
|
|
public function getAuth()
|
|
|
|
|
{
|
|
|
|
|
$group = $_SESSION['onethink_admin']['user_group_id'];
|
|
|
|
|
//获取全部权限列表
|
|
|
|
|
$ruleList = M("AuthGroup")->field("rules")->where("id='{$group}'")->find()['rules'];
|
|
|
|
|
//获取所有含有规则的数据
|
|
|
|
|
$authlist = M("AuthRule")->field('name')->where("name like 'Admin/AggregateFinanceStatement%' AND id in ($ruleList)")->select();
|
|
|
|
|
$Auth = [];
|
|
|
|
|
foreach ($authlist as $k => $v) {
|
|
|
|
|
$a = str_replace("Admin/AggregateFinanceStatement/","",$v['name']);
|
|
|
|
|
$Auth[] = $a;
|
|
|
|
|
}
|
|
|
|
|
$this->OpAuthList = $Auth;
|
|
|
|
|
}
|
|
|
|
|
public function OpAuth($info)
|
|
|
|
|
{
|
|
|
|
|
$id = $info['id'];
|
|
|
|
|
$img = $info['ext_field'];
|
|
|
|
|
$remark = $info['remark'];
|
|
|
|
|
//原始列表
|
|
|
|
|
$opBtn = [
|
|
|
|
|
"viewStatement"=>"<a class='confirm viewStatement' data-id='{$id}'>查看</a>",
|
|
|
|
|
"createStatement"=>"<a class='confirm createStatement' data-id='{$id}'>申请开票</a>",
|
|
|
|
|
"editStatement"=>"<a class='confirm editStatement' data-id='{$id}'>编辑</a>",
|
|
|
|
|
"uploadVoucher"=>"<a class='confirm uploadVoucher' data-id='{$id}'>上传凭证</a>",
|
|
|
|
|
"viewVoucher"=>"<a class='confirm viewVoucher' data-img='{$img}' data-id='{$id}'>查看凭证</a>",
|
|
|
|
|
"editVoucher"=>" <a class='confirm editVoucher' data-id='{$id}'>编辑凭证</a>",
|
|
|
|
|
"addRemark"=>"<a class='confirm addRemark' data-id='{$id}'>新增备注</a>",
|
|
|
|
|
"editRemark"=>"<a class='confirm editRemark' data-remark='{$remark}' data-id='{$id}'>修改备注</a>",
|
|
|
|
|
"viewRemark"=>"<a class='confirm viewRemark' data-remark='{$remark}' data-id='{$id}'>查看备注</a>",
|
|
|
|
|
"cancelVerify"=>"<a class='confirm cancelVerify' data-id='{$id}' style='color: red;'>撤销审核</a>",
|
|
|
|
|
"cancelApply"=>"<a class='confirm cancelApply' data-id='{$id}' style='color: red;'>撤销申请</a>",
|
|
|
|
|
];
|
|
|
|
|
//操作对应菜单
|
|
|
|
|
$optist = [];
|
|
|
|
|
switch ($info['verify_status']) {
|
|
|
|
|
case '-1':
|
|
|
|
|
$optist = ["viewStatement","cancelVerify","addRemark","editRemark","viewRemark"];
|
|
|
|
|
break;
|
|
|
|
|
case '0':
|
|
|
|
|
$optist = ["viewStatement","createStatement"];
|
|
|
|
|
break;
|
|
|
|
|
case '1':
|
|
|
|
|
$optist = ["viewStatement","editStatement","cancelApply"];
|
|
|
|
|
break;
|
|
|
|
|
case '2':
|
|
|
|
|
$optist = ["viewStatement","cancelVerify","addRemark","editRemark","viewRemark"];
|
|
|
|
|
break;
|
|
|
|
|
case '3':
|
|
|
|
|
$optist = ["viewStatement","uploadVoucher","addRemark","editRemark","viewRemark"];
|
|
|
|
|
break;
|
|
|
|
|
case '4':
|
|
|
|
|
$optist = ["viewStatement","viewVoucher","editVoucher","addRemark","editRemark","viewRemark"];
|
|
|
|
|
break;
|
|
|
|
|
case '5':
|
|
|
|
|
$optist = ["viewStatement","uploadVoucher","viewVoucher","editVoucher","addRemark","editRemark","viewRemark"];
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//判断凭证和备注
|
|
|
|
|
if(empty($info['ext_field'])){
|
|
|
|
|
//未上传凭证
|
|
|
|
|
if($optist['viewVoucher']) unset($optist['viewVoucher']);
|
|
|
|
|
if($optist['editVoucher']) unset($optist['editVoucher']);
|
|
|
|
|
}else{
|
|
|
|
|
if($optist['uploadVoucher']) unset($optist['uploadVoucher']);
|
|
|
|
|
}
|
|
|
|
|
if(empty($info['remark'])){
|
|
|
|
|
//未上传备注
|
|
|
|
|
if($optist['editRemark']) unset($optist['editRemark']);
|
|
|
|
|
if($optist['viewRemark']) unset($optist['viewRemark']);
|
|
|
|
|
}else{
|
|
|
|
|
if($optist['addRemark']) unset($optist['addRemark']);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
$resarr = [];
|
|
|
|
|
foreach ($optist as $k => $v) {
|
|
|
|
|
if(IS_ROOT){
|
|
|
|
|
$resarr[] = $opBtn[$v];
|
|
|
|
|
}else{
|
|
|
|
|
if(in_array($v,$this->OpAuthList)){
|
|
|
|
|
$resarr[] = $opBtn[$v];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $resarr;
|
|
|
|
|
}
|
|
|
|
|
public function menuAuth()
|
|
|
|
|
{
|
|
|
|
|
$optist = ['agreeApply',"refuseApply","Invoiced","Received","updateStatement","export"];
|
|
|
|
|
$mentBtn = [
|
|
|
|
|
"agreeApply"=>"<a class='butn' id='agreeApply'>审批通过</a>",
|
|
|
|
|
"refuseApply"=>"<a class='butn' id='refuseApply' style='background-color: red;'>审批拒绝</a>",
|
|
|
|
|
"Invoiced"=>"<a class='butn' id='Invoiced'>已开票</a>",
|
|
|
|
|
"Received"=>"<a class='butn' id='Received'>已到账</a>",
|
|
|
|
|
"updateStatement"=>"<a class='butn' id='updateStatement' style='width: 150px;background-color:green;'>重算结算金额</a>",
|
|
|
|
|
"export"=>"<a class='butn' id='export'>批量导出</a>"
|
|
|
|
|
];
|
|
|
|
|
$resarr = [];
|
|
|
|
|
foreach ($optist as $k => $v) {
|
|
|
|
|
if(IS_ROOT){
|
|
|
|
|
$resarr[] = $mentBtn[$v];
|
|
|
|
|
}else{
|
|
|
|
|
if(in_array($v,$this->OpAuthList)){
|
|
|
|
|
$resarr[] = $mentBtn[$v];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $resarr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|