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

'调整费用报销与借款单逻辑'

上级 63166013
...@@ -30,7 +30,7 @@ class flow_emfkClassModel extends flowModel ...@@ -30,7 +30,7 @@ class flow_emfkClassModel extends flowModel
$this->updatestatus(5); $this->updatestatus(5);
if($zt == 2) $this->sendMess(0,9); if($zt == 2) $this->sendMess(0,9);
} }
__
/** /**
* @param int $messType 动作 * @param int $messType 动作
* @param int $status 状态 * @param int $status 状态
...@@ -50,99 +50,108 @@ class flow_emfkClassModel extends flowModel ...@@ -50,99 +50,108 @@ class flow_emfkClassModel extends flowModel
} }
// //二级 或一级审批同意之后进行预扣款 protected function flowsubmit($na, $sm){
// protected function flowcheckbefore($zt, $sm){ $url = getconfig('base_url'). 'v2/project/list?key=';
// $id=$this->rs['id']; $key = substr(md5(getconfig('openkey').date('Y-m-d')),0,12);
// $sql = " mid ='$id' and `table`='c_emfk' "; $url = $url.$key;
// $flow_bill = m('flow_bill')->getone($sql,'allcheckid'); $url .= '&project_code='.'WJFX-3-14066';
// $allcheckid=explode(',',$flow_bill['allcheckid']); $res = curlGet($url);
// $option = m('option')->getall('pid = 1497 and num =1 order by sort desc','num,name,value,sort'); var_dump($res);die;
// foreach ($option as $key => $value) { }
// if(in_array($value['value'], $allcheckid)){
// $checkid= $value['value']; //二级 或一级审批同意之后进行预扣款
// break; protected function flowcheckbefore($zt, $sm){
// } $id=$this->rs['id'];
// } $sql = " mid ='$id' and `table`='c_emfk' ";
// $flow_bill = m('flow_bill')->getone($sql,'allcheckid');
// if(empty($checkid)){ $allcheckid=explode(',',$flow_bill['allcheckid']);
// $option = m('option')->getall('pid = 1497 and num =2 order by sort desc','num,name,value,sort,`explain`'); $option = m('option')->getall('pid = 1497 and num =1 order by sort desc','num,name,value,sort');
// foreach ($option as $key => $value) { foreach ($option as $key => $value) {
// if(in_array($value['value'], $allcheckid)){ if(in_array($value['value'], $allcheckid)){
// $checkid= $value['value']; $checkid= $value['value'];
// break; break;
// } }
// } }
// }
// if(empty($checkid)){
// $option = m('option')->getall('pid = 1497 and num =2 order by sort desc','num,name,value,sort,`explain`');
// //zt 1代表同意 foreach ($option as $key => $value) {
// if($zt==1){ if(in_array($value['value'], $allcheckid)){
// $flowid=$this->getflow(); $checkid= $value['value'];
// break;
// if($flowid['nowcheckid']==$checkid){ }
// $data = m('c_emfk_details')->getall('mid='.$this->rs['id'], 'id,cbzxid,amount'); }
// }
// foreach ($data as $key => $vo) {
// $cbzx_code=$vo['cbzxid'];
// $cbzxid = m('tmp_department')->getone('', 'id,cost');//查询账户表成本中心id //zt 1代表同意
// if($zt==1){
// $sql = " cost_id='$cbzx_code' and status = 1 and is_default=1"; $flowid=$this->getflow();
// $cost = m('c_fund_account')->getone($sql, 'id,type,freeze_amount,account_balance');//查询账户表成本中心id
// if($cost['type']=='1'){ if($flowid['nowcheckid']==$checkid){
// if(($cost['account_balance']-$cost['freeze_amount'])<$vo['amount']){ $data = m('c_emfk_details')->getall('mid='.$this->rs['id'], 'id,cbzxid,amount');
// return "账户余额不足";die;
// } foreach ($data as $key => $vo) {
// } $cbzx_code=$vo['cbzxid'];
// $id=$cost['id']; $cbzxid = m('tmp_department')->getone('', 'id,cost');//查询账户表成本中心id
//
// $c_withhold = array( $sql = " cost_id='$cbzx_code' and status = 1 and is_default=1";
// 'fund_account_id' => $id, $cost = m('c_fund_account')->getone($sql, 'id,type,freeze_amount,account_balance');//查询账户表成本中心id
// 'docnum' => $this->rs['docnum'], if($cost['type']=='1'){
// 'cost_id' => $vo['cbzxid'], if(($cost['account_balance']-$cost['freeze_amount'])<$vo['amount']){
// 'amount' => $vo['amount'], return "账户余额不足";die;
// 'status' => 1, }
// 'create_time' => date("Y-m-d H:i:s"), }
// 'uid' => $this->rs['uid'], $id=$cost['id'];
// );
// m('c_withhold_emfk')->insert($c_withhold); $c_withhold = array(
// 'fund_account_id' => $id,
// //修改冻结余额 'docnum' => $this->rs['docnum'],
// $freeze = array( 'cost_id' => $vo['cbzxid'],
// 'freeze_amount' => $cost['freeze_amount'] + $vo['amount'], 'amount' => $vo['amount'],
// ); 'status' => 1,
// 'create_time' => date("Y-m-d H:i:s"),
// m('c_fund_account')->update($freeze, "`id`='$id'"); 'uid' => $this->rs['uid'],
// } );
// } m('c_withhold_emfk')->insert($c_withhold);
//
// }else{ //修改冻结余额
// $docnum=$this->rs['docnum']; $freeze = array(
// //将单据状态作废余额 'freeze_amount' => $cost['freeze_amount'] + $vo['amount'],
// );
// $withhold_cost = m('c_withhold_emfk')->getall("docnum='$docnum' and status =1", 'id,cost_id,amount');
// m('c_fund_account')->update($freeze, "`id`='$id'");
// foreach ($withhold_cost as $key => $vo) { }
// //减去冻结金额 }
// $cost_id=$vo['cost_id'];
// $sql = " cost_id='$cost_id' and status = 1 and is_default=1"; }else{
// $fund_account_cost = m('c_fund_account')->getone($sql, 'id,freeze_amount'); $docnum=$this->rs['docnum'];
// //将单据状态作废余额
// $id=$fund_account_cost['id'];
// $freeze = array( $withhold_cost = m('c_withhold_emfk')->getall("docnum='$docnum' and status =1", 'id,cost_id,amount');
// 'freeze_amount' => $fund_account_cost['freeze_amount'] - $vo['amount'],
// ); foreach ($withhold_cost as $key => $vo) {
// //减去冻结金额
// m('c_fund_account')->update($freeze, "`id`='$id'"); $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'];
// $status = array( $freeze = array(
// 'status' => 0, 'freeze_amount' => $fund_account_cost['freeze_amount'] - $vo['amount'],
// ); );
// m('c_withhold_emfk')->update($status, "docnum='$docnum'");
// } m('c_fund_account')->update($freeze, "`id`='$id'");
// }
}
$status = array(
'status' => 0,
);
m('c_withhold_emfk')->update($status, "docnum='$docnum'");
}
}
//流程全部完成后调用 //流程全部完成后调用
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论