|
|
|
@ -75,7 +75,6 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
$map['i.batch_num'] = $_REQUEST['batch_num'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$CompanyInfo = M("excel_statement_info","tab_")
|
|
|
|
|
->alias('i')
|
|
|
|
|
->field("i.*")
|
|
|
|
@ -105,10 +104,7 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
$countmap['pay_status']=["neq",1];
|
|
|
|
|
$money = M("excel_statement_info","tab_")->alias('i')->field("sum(statement_money) statement_money")->where($countmap)->find();
|
|
|
|
|
$count = M("excel_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find();
|
|
|
|
|
// dd($count);
|
|
|
|
|
$parameter['p'] = $page;
|
|
|
|
|
$parameter['row'] = $row;
|
|
|
|
|
$page = set_pagination($count['count'], $row, $parameter);
|
|
|
|
|
$page = set_pagination($count['count'], $row);
|
|
|
|
|
if ($page) {
|
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
|
}
|
|
|
|
@ -137,6 +133,7 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
$ExcelStatementInfo = M('ExcelStatementInfo',"tab_");
|
|
|
|
|
foreach ($checkarr as $k => &$v) {
|
|
|
|
|
$company_info = $v['company_info'];
|
|
|
|
|
$v['statement_begin_time'] = $statement_begin_time;
|
|
|
|
|
$v['statement_end_time'] = $statement_end_time;
|
|
|
|
|
$v['batch_num'] = $batch;
|
|
|
|
@ -145,14 +142,14 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
$v['company_type'] = 2;
|
|
|
|
|
$v['create_time'] = time();
|
|
|
|
|
$v['statement_num'] = "JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5);
|
|
|
|
|
if(!isset($v['company_info']['ali_user']) || !isset($v['company_info']['ali_account']) || $v['company_info']['ali_user'] == '' || $v['company_info']['ali_account'] == ''){
|
|
|
|
|
M('ExcelStatementInfo')->where("statement_num = '{$v['statement_num']}'")->delete();
|
|
|
|
|
if(!isset($company_info['ali_user']) || !isset($company_info['ali_account']) || $company_info['ali_user'] == '' || $company_info['ali_account'] == ''){
|
|
|
|
|
M('ExcelStatementInfo',"tab_")->where("statement_num = '{$v['statement_num']}'")->delete();
|
|
|
|
|
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$res = $ExcelStatementInfo->add($v);
|
|
|
|
|
if($res === false){
|
|
|
|
|
M('ExcelStatementInfo')->where("statement_num = '{$v['statement_num']}'")->delete();
|
|
|
|
|
M('ExcelStatementInfo',"tab_")->where("statement_num = '{$v['statement_num']}'")->delete();
|
|
|
|
|
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -170,12 +167,34 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
$is_export = true;
|
|
|
|
|
}
|
|
|
|
|
//获取基本信息
|
|
|
|
|
$dbres = M("ExcelStatementInfo","tab_")->where("id='{$id}'")->select();
|
|
|
|
|
$title = $dbres[0]['company_name'];
|
|
|
|
|
$this->assign("title",$title);
|
|
|
|
|
if($is_export && isset($_REQUEST['exporttype']) && $_REQUEST['exporttype']=='all'){
|
|
|
|
|
$dbres = M("ExcelStatementInfo","tab_")->where("id in ({$id})")->select();
|
|
|
|
|
$title = date("YmdHis");
|
|
|
|
|
}else{
|
|
|
|
|
$dbres = M("ExcelStatementInfo","tab_")->where("id ='{$id}'")->select();
|
|
|
|
|
$title = $dbres[0]['company_name'].date("YmdHis");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assign("title",$title);
|
|
|
|
|
$this->viewPuPool($dbres,$is_export);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public function delItem()
|
|
|
|
|
{
|
|
|
|
|
if(!isset($_REQUEST['ids'])){
|
|
|
|
|
$this->error('参数错误');
|
|
|
|
|
}
|
|
|
|
|
$ids = $_REQUEST['ids'];
|
|
|
|
|
$map = [
|
|
|
|
|
"pay_status"=>["NEQ",1],
|
|
|
|
|
"id"=>["IN",$ids]
|
|
|
|
|
];
|
|
|
|
|
$dbres = M("ExcelStatementInfo","tab_")->where($map)->delete();
|
|
|
|
|
if($dbres === false){
|
|
|
|
|
$this->ajaxReturn(["status"=>0,"info"=>"删除失败"]);
|
|
|
|
|
}
|
|
|
|
|
$this->ajaxReturn(["status"=>1,"info"=>"删除成功"]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//个人汇总结算查看
|
|
|
|
|
public function viewPuPool(&$infolist,$is_export){
|
|
|
|
@ -203,8 +222,10 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
$val['ratio'] = 0;
|
|
|
|
|
}
|
|
|
|
|
if($is_export){
|
|
|
|
|
$val['ratio'] = $val['ratio']*100;
|
|
|
|
|
$val['increment_ratio'] = $val['increment_ratio']*100;
|
|
|
|
|
//J3*(K3+L3)+M3-N3
|
|
|
|
|
$va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
|
|
|
|
|
$val['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
|
|
|
|
|
$count['sum_money_exp'] .= "O{$line}+";
|
|
|
|
|
$count['platform_amount_exp'] .= "J{$line}+";
|
|
|
|
|
|
|
|
|
@ -220,7 +241,6 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
$count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+");
|
|
|
|
|
$count["sum_money"] = "=".trim($count["sum_money_exp"],"+");
|
|
|
|
|
}
|
|
|
|
|
// dd($infolist);
|
|
|
|
|
$this->assign("data",$infolist);
|
|
|
|
|
$this->assign("count",$count);
|
|
|
|
|
$this->assign("is_export",$is_export);
|
|
|
|
@ -288,10 +308,11 @@ class ExcelPaymentController extends BaseController
|
|
|
|
|
$dbres = M("ExcelStatementInfo","tab_")->where("id='{$id}'")->find();
|
|
|
|
|
$company_info = json_decode($dbres['company_info'],true);
|
|
|
|
|
|
|
|
|
|
if($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1){
|
|
|
|
|
if($dbres['pay_status'] != 1){
|
|
|
|
|
//执行打款
|
|
|
|
|
$title = "信息服务费";
|
|
|
|
|
$title = $remark;
|
|
|
|
|
$amount = $dbres['statement_money'];
|
|
|
|
|
$amount = 0.1;
|
|
|
|
|
$payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title);
|
|
|
|
|
$resultCode = $payres->code;
|
|
|
|
|
|
|
|
|
|