优化审核流程

master
chenzhi 4 years ago
parent 0aac0cfad7
commit 2a303cf0f5

@ -19,13 +19,18 @@ class CompanyStatementController extends ThinkController
"9"=>"上游"
];
public $VerifyStatus=[
"-2"=>"汇总撤销",
"-1"=>"审批拒绝",
"-3"=>"汇总撤销",
"-2"=>"审核拒绝",
"-1"=>"管理员审批拒绝",
"0"=>"未审批",
"1"=>"审核通过",
"2"=>"对外发起",
"3"=>"合作确认",
"4"=>"已汇总"
"1"=>"管理员审核通过",
"2"=>"审核通过",
"3"=>"已汇总"
];
public $ConfirmStatus=[
"0"=>"未发起",
"1"=>"已发起",
"2"=>"已确认"
];
public $admininfo;
public $DBModel;
@ -112,12 +117,15 @@ class CompanyStatementController extends ThinkController
if(isset($_REQUEST['verify_status'])){
$map['verify_status'] = $_REQUEST['verify_status'];
}
if(isset($_REQUEST['confirm_status'])){
$map['confirm_status'] = $_REQUEST['confirm_status'];
}
// $this->checkListOrCountAuthRestMap($map);//导出权限
//条件end
$data = M("company_statement","tab_")
->field("id,withdraw_type,company_name,company_belong,statement_begin_time,statement_end_time,statement_money,platform_amount,verify_status,verify_log,op_time,remark")
->field("id,withdraw_type,company_name,company_belong,statement_begin_time,statement_end_time,statement_money,platform_amount,verify_status,verify_log,confirm_status,confirm_log,op_time,remark")
->where($map)
->order("FIELD(verify_status,0,1,-1,2,3,-2,4,5),id desc")->page($page,$row)->select();
->order("FIELD(verify_status,0,1,-1,2,3,-2,-3),id desc")->page($page,$row)->select();
foreach($data as $k => &$v) {
$v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
@ -132,14 +140,26 @@ class CompanyStatementController extends ThinkController
$v['withdraw_type_2'] = ($v['withdraw_type'] == 2 ? "补点" :"正常结算");
$v['verify_log'] = json_decode($v['verify_log'], true);
$v['confirm_log'] = json_decode($v['confirm_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']['verify_user'])){
if(isset($v['verify_log']['admin_user'])){
if($v['verify_status'] == -1){
$ts = "管理员审核拒绝";
}else{
$ts = "管理员审核通过";
}
$v["admin"]= "{$ts}({$v['verify_log']['admin_user']}) {$symbol} {$v['verify_log']['admin_time']}";
}else{
$v["admin"] = '--';
}
if(isset($v['verify_log']['verify_user'])){
if($v['verify_status'] == -2){
$ts = "审核拒绝";
}else{
$ts = "审核通过";
@ -149,21 +169,21 @@ class CompanyStatementController extends ThinkController
$v["verify"] = '--';
}
if(isset($v['verify_log']['launch_user'])){
if(isset($v['confirm_log']['launch_user'])){
$ts = "已发起";
$v["launch"]= "{$ts}({$v['verify_log']['launch_user']}) {$symbol} {$v['verify_log']['launch_time']}";
$v["launch"]= "{$ts}({$v['confirm_log']['launch_user']}) {$symbol} {$v['confirm_log']['launch_time']}";
}else{
$v["launch"] = '--';
}
if(isset($v['verify_log']['confirm_user'])){
if(isset($v['confirm_log']['confirm_user'])){
$ts = "已确认";
$v["confirm"]= "{$ts}({$v['verify_log']['confirm_user']}) {$symbol} {$v['verify_log']['confirm_time']}";
$v["confirm"]= "{$ts}({$v['confirm_log']['confirm_user']}) {$symbol} {$v['confirm_log']['confirm_time']}";
}else{
$v["confirm"] = '--';
}
if(isset($v['verify_log']['pool_user'])){
if($v['verify_status'] == -2){
if($v['verify_status'] == -3){
$ts = "撤销汇总";
$v["pool"]= "{$ts}({$v['verify_log']['pool_user']}){$symbol} {$v['verify_log']['pool_time']}";
}else{
@ -190,6 +210,7 @@ class CompanyStatementController extends ThinkController
$this->assign('CompanyType',$this->CompanyType);
$this->assign('CompanyBelong',$this->CompanyBelong);
$this->assign('VerifyStatus',$this->VerifyStatus);
$this->assign('ConfirmStatus',$this->ConfirmStatus);
$this->display();
}
@ -296,15 +317,40 @@ class CompanyStatementController extends ThinkController
}
}
//审批通过
public function adminAgree(){
$this->setVerifyStatus(0,1,"admin");
}
public function adminRefuse(){
$this->setVerifyStatus(0,-1,"admin");
}
public function verifyAgree(){
$this->setVerifyStatus(0,1,"verify");
$this->setVerifyStatus(1,2,"verify");
}
public function verifyRefuse(){
$this->setVerifyStatus(0,-1,"verify");
$this->setVerifyStatus(1,-2,"verify");
}
public function launch(){
$this->setVerifyStatus(1,2,"launch");
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = $this->DBModel->field("id,confirm_status,confirm_log")->where("id in ({$ids})")->select();
foreach($dbres as $k=>&$v){
if($v['confirm_status'] != 0) continue;
$v['confirm_log'] = json_decode($v['confirm_log'],true);
$v['confirm_log']['launch_user']=$this->admininfo["username"];
$v['confirm_log']['launch_time']=date("Y-m-d H:i:s");
$v['confirm_log'] = json_encode($v['confirm_log']);
$v['confirm_status']=1;
// $v['op_time'] = time();
$this->DBModel->save($v);
addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"发起确认",'url'=>U('lists')]);
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>"对外发起成功"
));
}
protected function setVerifyStatus($old_status,$change_status,$op_pre)
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
@ -457,7 +503,7 @@ class CompanyStatementController extends ThinkController
}
foreach ($dbres as $k=>$v) {
if($v['verify_status'] != 3) continue;
if($v['verify_status'] != 2) continue;
if($v['company_belong'] == 9){
//上游
if($v['is_payment'] == 1){
@ -516,7 +562,7 @@ class CompanyStatementController extends ThinkController
M("company_lack_statement_info","tab_")->where("id in ({$v['del_lack_ids']})")->save(["is_pool"=>1]);
}
//修改结算单规则
$this->updatePoolVerifyStatus($v['statement_ids'],3,4,"pool",$v['statement_num']);
$this->updatePoolVerifyStatus($v['statement_ids'],2,3,"pool",$v['statement_num']);
}
$this->ajaxReturn(array(
'status' => 1,
@ -843,9 +889,6 @@ class CompanyStatementController extends ThinkController
case '3':
$optist = ["viewStatement","addRemark","viewRemark","editRemark"];
break;
case '4':
$optist = ["viewStatement","addRemark","viewRemark","editRemark"];
break;
default:
break;
}
@ -871,13 +914,15 @@ class CompanyStatementController extends ThinkController
public function menuAuth()
{
$mentBtn = [
"adminAgree"=>"<a class='butn' id='adminAgree'>管理员审核通过</a>",
"adminRefuse"=>"<a class='butn' id='adminRefuse' style='background-color: red;'>管理员审核拒绝</a>",
"verifyAgree"=>"<a class='butn' id='verifyAgree'>审批通过</a>",
"verifyRefuse"=>"<a class='butn' id='verifyRefuse' style='background-color: red;'>审核拒绝</a>",
"launch"=>"<a class='butn' id='launch'>对外发起</a>",
"pool"=>"<a class='butn' id='pool'>发起汇总</a>",
"updateStatement"=>"<a class='butn' id='updateStatement' style='background-color: green;'>重算金额</a>",
"export"=>"<a class='butn' id='export'>批量导出</a>",
"updateNewStatement"=>"<a class='butn' id='updateNewStatement' style='background-color: green;'>新增结算</a>",
"launch"=>"<a class='butn' id='launch'>对外发起</a>",
];
$resarr = [];
foreach ($mentBtn as $k => $v) {

@ -146,6 +146,15 @@
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="confirm_status" name="confirm_status" class="select_gallery" >
<option value="">请选择确认状态</option>
<volist name="ConfirmStatus" id="vo">
<option value="{$key}" <if condition="isset($_GET['confirm_status']) && $key eq I('confirm_status')">selected</if> >{$vo}</option>
</volist>
</select>
</div>
<div class="input-list">
<input type="text" readonly id="time_start2" name="time_start2" class="" value="{:I('time_start2')}" placeholder="操作开始时间" />
&nbsp;-&nbsp;
@ -186,10 +195,11 @@
<th>结算金额</th>
<th>结算流水</th>
<th>创建记录</th>
<th>管理员审核</th>
<th>审批状态</th>
<th>汇总状态</th>
<th>对外发起</th>
<th>合作确认</th>
<th>汇总状态</th>
<th>操作</th>
</tr>
</thead>
@ -204,7 +214,7 @@
<notemtpy name = "data">
<volist name="data" id="data">
<tr>
<td ><input class="ids" type="checkbox" data-status="{$data.verify_status}" value="{$data['id']}" name="ids[]"></td>
<td ><input class="ids" type="checkbox" data-status="{$data.verify_status}" data-confirm="{$data.confirm_status}" value="{$data['id']}" name="ids[]"></td>
<td>{$data.company_name}</td>
<td>{$data.company_belong}</td>
<td>{$data.valid}</td>
@ -215,6 +225,17 @@
<td>{$data.create}</td>
<td>
<if condition="$data.verify_status eq -1 ">
<div style="line-height: 2;color: red;">
{$data.admin}
</div>
<else />
<div style="line-height: 2;">
{$data.admin}
</div>
</if>
</td>
<td>
<if condition="$data.verify_status eq -2 ">
<div style="line-height: 2;color: red;">
{$data.verify}
</div>
@ -224,10 +245,8 @@
</div>
</if>
</td>
<td>{$data.launch}</td>
<td>{$data.confirm}</td>
<td>
<if condition="$data.verify_status eq -2 ">
<if condition="$data.verify_status eq -3 ">
<div style="line-height: 2;color: red;">
{$data.pool}
</div>
@ -237,6 +256,8 @@
</div>
</if>
</td>
<td>{$data.launch}</td>
<td>{$data.confirm}</td>
<td>
<foreach name="data.oplist" item="vo" >
{$vo}
@ -244,7 +265,7 @@
</td>
</tr>
</volist>
<tr><td style="line-height: 42px;">合计</td><td colspan="13" style="line-height: 42px;">结算总金额:&nbsp;{$count.statement_money}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;结算总流水:&nbsp;{$count['platform_amount']}&nbsp;(补点不重复统计在内)</td></tr>
<tr><td style="line-height: 42px;">合计</td><td colspan="14" style="line-height: 42px;">结算总金额:&nbsp;{$count.statement_money}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;结算总流水:&nbsp;{$count['platform_amount']}&nbsp;(补点不重复统计在内)</td></tr>
</notemtpy>
</tbody>
</table>
@ -386,7 +407,7 @@
//设置对账网址
var order_url = window.location.protocol+"//"+window.location.host+"/admin.php?s=/Public/cp_login.html";
$("#order_url").html("流程说明:结算自动生成对账单--->财务审核对账单--->发起对外对账--->合作方进行确认--->进入报销流程【合作方确认地址:"+order_url+"】");
$("#order_url").html("流程说明:结算自动生成对账单--->管理员审核--->财务审核对账单--->发起汇总 / 确认流程: 发起对外对账--->合作方进行确认【合作方确认地址:"+order_url+"】");
$("#updateNewStatement").on("click",function(){
layer.confirm("新增结算需要花费2分钟左右时间,并且只计算一个月内的新增结算,请勿在中途关闭页面,无需新增结算请取消",{title:false}, function(index){
@ -428,33 +449,38 @@
});
});
$("#verifyAgree,#verifyRefuse,#launch,#pool,#updateStatement").on("click",function(){
$("#adminAgree,#adminRefuse,#verifyAgree,#verifyRefuse,#pool,#updateStatement").on("click",function(){
var id = $(this).attr("id");
if(id == "verifyAgree"){
var opname = "审批通过";
var opurl = "{:U('verifyAgree')}";
if(id == "adminAgree"){
var opname = "管理员审批通过";
var opurl = "{:U('adminAgree')}";
var opst ="[未进行审批]";
var status = [0];
}else if(id=="adminRefuse"){
var opname = "管理员审批拒绝";
var opurl = "{:U('adminRefuse')}";
var opst ="[未进行审批]";
var status = [0];
}else if(id == "verifyAgree"){
var opname = "审批通过";
var opurl = "{:U('verifyAgree')}";
var opst ="[管理员审批通过]";
var status = [1];
}else if(id=="verifyRefuse"){
var opname = "审批拒绝";
var opurl = "{:U('verifyRefuse')}";
var opst ="[未进行审批]";
var status = [0];
}else if(id=="launch"){
var opname = "对外发起";
var opurl = "{:U('launch')}";
var opst ="[审批通过]";
var opst ="[管理员审批通过]";
var status = [1];
}else if(id=="pool"){
var opname = "发起汇总";
var opurl = "{:U('pool')}";
var opst ="[合作方确认]";
var status = [3];
var opst ="[审批通过]";
var status = [2];
}else if(id=="updateStatement"){
var opname = "重算金额";
var opurl = "{:U('updateStatement')}";
var opst ="[汇总撤销,审批拒绝,未进行审批,审批通过,对外发起]";
var status = [-2,-1,0,1,2];
var opst ="[汇总撤销,管理员审批拒绝,审批拒绝,未进行审批,管理员审批通过,审批通过]";
var status = [-3,-2,-1,0,1,2];
var confirm = true;
}
var confirm = confirm ? confirm :false;
@ -521,6 +547,49 @@
});
}
})
$("#launch").on("click",function(){
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("confirm") == 0){
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要进行[对外发起]的申请,仅[未发起]状态可以进行[对外发起]操作</font>');
return;
}
text = text.join(",");
layer.confirm('【警告】[对外发起]将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(index){
layer.close(index);
_doAgreeApply();
});
function _doAgreeApply(){
//执行
layer.load(2);
$.ajax({
type: "POST",
url: "{:U('launch')}",
dataType: 'json',
async: true,
data: {ids:text},
success:function(data){
layer.closeAll('loading');
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
}
})
$("#export").click(function () {
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {

@ -2241,4 +2241,47 @@ INSERT INTO `tab_payment_member` (`id`, `real_name`, `mobile`, `last_login_time`
ALTER TABLE `tab_game`
ADD COLUMN `select_package_name` tinyint(2) NOT NULL DEFAULT 0 COMMENT '结算包名 0:原包名 1:现包名' AFTER `original_package_name`;
--chenzhi
CREATE TABLE `tab_company_statement` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`withdraw_type` tinyint(2) DEFAULT '0' COMMENT '对账类型(0-周结 1月结 2补点)',
`company_id` int(11) DEFAULT '0' COMMENT '对账公司id',
`company_name` varchar(60) NOT NULL DEFAULT '' COMMENT '对账公司名称',
`company_belong` tinyint(1) NOT NULL DEFAULT '0' COMMENT '工会归属0-下游内团1-下游外团 2-下游分发联盟 3 下游无9:上游',
`company_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '公司性质1-公司 2-个人',
`is_payment` tinyint(3) NOT NULL DEFAULT '1' COMMENT '是否需要打款1-是 2-否(线下)',
`statement_begin_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账开始时间',
`statement_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账截止时间',
`statement_money` decimal(10,2) DEFAULT '0.00' COMMENT '对账金额',
`pay_amount` decimal(10,2) DEFAULT '0.00' COMMENT '总计',
`platform_amount` decimal(10,2) DEFAULT '0.00' COMMENT '平台流水金额',
`verify_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '审核状态 -2:汇总驳回 -1审批拒绝 0:系统生成 1:审核通过 2:对外发起 3:合作确认 4:汇总',
`verify_log` text NOT NULL COMMENT '审批相关信息json',
`pay_type` tinyint(2) DEFAULT '0' COMMENT '1甲方收款;2乙方收款',
`first_party_info` text NOT NULL COMMENT '甲方相关信息json',
`second_party_info` text NOT NULL COMMENT '乙方相关信息json',
`statement_info` text NOT NULL COMMENT '订单相关信息json',
`op_time` int(11) NOT NULL DEFAULT '0' COMMENT '操作时间',
`remark` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注',
PRIMARY KEY (`id`),
KEY `withdraw_type` (`withdraw_type`) USING BTREE,
KEY `company_id` (`company_id`) USING BTREE,
KEY `statement_begin_time` (`statement_begin_time`) USING BTREE,
KEY `statement_end_time` (`statement_end_time`) USING BTREE,
KEY `verify_status` (`verify_status`) USING BTREE,
KEY `op_time` (`op_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='聚合上游联运上下游对账单';
ALTER TABLE `tab_company_statement`
ADD COLUMN `confirm_status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '确认状态 0:未处理 1:发起 2审核' AFTER `verify_log`;
ALTER TABLE `tab_company_statement`
ADD COLUMN `confirm_log` text COMMENT '确认信息' AFTER `confirm_status`;
ALTER TABLE `tab_company_statement`
MODIFY COLUMN `verify_status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '审核状态 -3:汇总驳回 -2:审核拒绝 -1管理员审批拒绝 0:系统生成 1:管理员审核通过 2:审核通过 3:汇总' AFTER `platform_amount`;
Loading…
Cancel
Save