提交 d9662851 authored 作者: fengzy's avatar fengzy

测试付款单

上级 b8a3775f
...@@ -19,6 +19,10 @@ class flow_account_detailClassModel extends flowModel ...@@ -19,6 +19,10 @@ class flow_account_detailClassModel extends flowModel
} else { } else {
$v = ''; $v = '';
} }
case 'docnum':
$v = "<a href='http://oa-test.gonn.tech/task.php?a=p&num=oafk&mid=44'>$v </a>";
continue; continue;
break; break;
...@@ -29,7 +33,7 @@ class flow_account_detailClassModel extends flowModel ...@@ -29,7 +33,7 @@ class flow_account_detailClassModel extends flowModel
return $rs; return $rs;
} }
//
} }
...@@ -16,8 +16,6 @@ class flow_oafkClassModel extends flowModel ...@@ -16,8 +16,6 @@ class flow_oafkClassModel extends flowModel
//zt 1代表同意 //zt 1代表同意
if($zt==1){ if($zt==1){
$deptdata = m('admin')->getone('id='.$this->adminid,'deptname'); $deptdata = m('admin')->getone('id='.$this->adminid,'deptname');
// $deptdata['deptname'];//当前人部门
$deptdata['deptname']='建设运营一中心合规部';
$option = m('option')->getall('pid = 1497','num,name');//当前部门 $option = m('option')->getall('pid = 1497','num,name');//当前部门
foreach ($option as $key => $vo) { foreach ($option as $key => $vo) {
if($vo['name']==$deptdata['deptname']){ if($vo['name']==$deptdata['deptname']){
...@@ -25,7 +23,6 @@ class flow_oafkClassModel extends flowModel ...@@ -25,7 +23,6 @@ class flow_oafkClassModel extends flowModel
} }
} }
$flowid=$this->getflow(); $flowid=$this->getflow();
if($flowid['nowcheckname']==$num){ if($flowid['nowcheckname']==$num){
$data = m('c_fund_details_fk')->getall('mid='.$this->rs['id'], 'id,cbzx_code,charge_amount'); $data = m('c_fund_details_fk')->getall('mid='.$this->rs['id'], 'id,cbzx_code,charge_amount');
foreach ($data as $key => $vo) { foreach ($data as $key => $vo) {
...@@ -54,8 +51,6 @@ class flow_oafkClassModel extends flowModel ...@@ -54,8 +51,6 @@ class flow_oafkClassModel extends flowModel
} }
} }
}else{ }else{
$docnum=$this->rs['docnum']; $docnum=$this->rs['docnum'];
//将单据状态作废余额 //将单据状态作废余额
......
...@@ -10,6 +10,146 @@ class flow_oayfkClassModel extends flowModel ...@@ -10,6 +10,146 @@ class flow_oayfkClassModel extends flowModel
} }
//二级 或一级审批同意之后进行预扣款
protected function flowcheckbefore($zt, $sm){
//zt 1代表同意
if($zt==1){
$deptdata = m('admin')->getone('id='.$this->adminid,'deptname');
$option = m('option')->getall('pid = 1497','num,name');//当前部门
foreach ($option as $key => $vo) {
if($vo['name']==$deptdata['deptname']){
$num= $vo['num'];
}
}
$flowid=$this->getflow();
if($flowid['nowcheckname']==$num){
$data = m('c_fund_details_fk')->getall('mid='.$this->rs['id'], 'id,cbzx_code,charge_amount');
foreach ($data as $key => $vo) {
$cbzx_code=$vo['cbzx_code'];
$sql = " cost_id='$cbzx_code' and status = 1 and is_default=1";
$cost = m('c_fund_account')->getone($sql, 'id,freeze_amount');//查询账户表成本中心id
$id=$cost['id'];
$c_withhold = array(
'fund_account_id' => $id,
'docnum' => $this->rs['docnum'],
'cost_id' => $vo['cbzx_code'],
'amount' => $vo['charge_amount'],
'status' => 1,
'create_time' => date("Y-m-d H:i:s"),
'uid' => $this->rs['uid'],
);
m('c_withhold')->insert($c_withhold);
//修改冻结余额
$freeze = array(
'freeze_amount' => $cost['freeze_amount'] + $vo['charge_amount'],
);
m('c_fund_account')->update($freeze, "`id`='$id'");
}
}
}else{
$docnum=$this->rs['docnum'];
//将单据状态作废余额
$withhold_cost = m('c_withhold')->getall("docnum='$docnum' and status =1", 'id,cost_id,amount');
foreach ($withhold_cost as $key => $vo) {
//减去冻结金额
$cost_id=$vo['cost_id'];
$sql = " cost_id='$cost_id' and status = 1 and is_default=1";
$fund_account_cost = m('c_fund_account')->getone($sql, 'id,freeze_amount');
$id=$fund_account_cost['id'];
$freeze = array(
'freeze_amount' => $fund_account_cost['freeze_amount'] - $vo['amount'],
);
m('c_fund_account')->update($freeze, "`id`='$id'");
}
$status = array(
'status' => 0,
);
m('c_withhold')->update($status, "docnum='$docnum'");
}
}
//流程全部完成后调用
protected function flowcheckfinsh($zt){
$docnum=$this->rs['docnum'];
$withhold_cost = m('c_withhold')->getall("docnum='$docnum' and status =1", 'id,cost_id,amount');
foreach ($withhold_cost as $key => $vo) {
// 扣除账户余额 c_fund_account account_balance
$cbzxid= $vo['cost_id'];
$model = 'c_fund_account';
$sql = " cost_id ='$cbzxid' and status = 1 and is_default=1";
$data = m($model)->getone($sql,'id,name,account_balance,freeze_amount');
$zfarr = array(
'account_balance' =>$data['account_balance']-$vo['amount'],
);
$id=$data['id'];
m('c_fund_account')->update($zfarr,"`id`='$id'");
$freeze = array(
'freeze_amount' => $data['freeze_amount'] - $vo['amount'],
);
m('c_fund_account')->update($freeze, "`id`='$id'");
// 成本中心 amount 变更
$cbzx = substr($cbzxid,0,strrpos($cbzxid,"("));
$cbzxsql = " code ='$cbzx' and status = 1";
$cbzxdata = m('c_cbzx')->getone($cbzxsql,'id,amount');
$cbarr = array(
'amount' =>$cbzxdata['amount']+$vo['amount'],
);
m('c_cbzx')->update($cbarr,"`code`='$cbzx'");
//账户明细 c_account_detail
$account_detail=array(
'account' => $data['name'],
'opt_type' => 2,
'amount' =>$vo['amount'],
'trans_numb' => $this->rs['docnum'],
'account_balance' => $data['account_balance']-$vo['amount'],
'create_time' =>date("Y-m-d H:i:s"),
'uid' =>$this->rs['uid'],
);
m('c_account_detail')->insert($account_detail);
// 业务付款8业务预付款10费用报销11 oa_c_fund_detail
$fund_detail=array(
'trans_numb' =>$this->rs['docnum'],
'account' => $data['name'],
'toaccount' =>$this->rs['payee'],
'trans_amount' =>$vo['amount'],
'business_type' =>8,
'opt_type' =>2,
'account_balance'=>$data['account_balance']-$vo['amount'],
'create_time' =>date("Y-m-d H:i:s"),
'uid' =>$this->rs['uid'],
);
m('c_fund_detail')->insert($fund_detail);
}
}
//流程全部完成后调用 //流程全部完成后调用
protected function flowcheckfinsh($zt){ protected function flowcheckfinsh($zt){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论