提交 52c75640 authored 作者: fengzy's avatar fengzy

费用报销脚本

上级 1a543a2c
...@@ -273,31 +273,28 @@ class flow_projectfkClassModel extends flowModel ...@@ -273,31 +273,28 @@ class flow_projectfkClassModel extends flowModel
if($zt==1){ if($zt==1){
$flowid=$this->getflow(); $flowid=$this->getflow();
if($flowid['nowcheckid']==$checkid){ if($flowid['nowcheckid']==$checkid){
$data = m('c_projectfk_details')->getall('mid='.$this->rs['id'], 'id,cbzxid,amount'); $data = m('c_projectfk_details')->getall('mid='.$this->rs['id'], 'id,cbzxid,amount');
foreach($data as $v){ foreach($data as $v){
if(!isset($ret[$v['cbzxid']])){ if(!isset($ret[$v['cbzxid']])){
$ret[$v['cbzxid']] = $v; $ret[$v['cbzxid']] = $v;
}else{ }else{
$ret[$v['cbzxid']]['amount'] += $v['amount']; $ret[$v['cbzxid']]['amount'] += $v['amount'];
}
} }
} $ret = array_values($ret);
foreach ($ret as $key => $vo) {
$project=self::project(substr($vo['cbzxid'],0,strpos($vo['cbzxid'], "(")));
$ret = array_values($ret); $cbzx_code= self::dept($project['data'][0]['jz_cur_dept']);
foreach ($ret as $key => $vo) { $sql = " cost_id='$cbzx_code' and status = 1 and is_default=1";
$project=self::project(substr($vo['cbzxid'],0,strpos($vo['cbzxid'], "("))); $cost = m('c_fund_account')->getone($sql, 'id,type,name,freeze_amount,account_balance');//查询账户表成本中心id
$cbzx_code= self::dept($project['data'][0]['jz_cur_dept']); if(($cost['account_balance']-$cost['freeze_amount'])<$vo['amount']){
$sql = " cost_id='$cbzx_code' and status = 1 and is_default=1"; return $cost['name']."余额不足";die;
$cost = m('c_fund_account')->getone($sql, 'id,type,name,freeze_amount,account_balance');//查询账户表成本中心id }
if(($cost['account_balance']-$cost['freeze_amount'])<$vo['amount']){
return $cost['name']."余额不足";die;
} }
}
foreach ($data as $key => $va) { foreach ($data as $key => $va) {
$project=self::project(substr($va['cbzxid'],0,strpos($va['cbzxid'], "("))); $project=self::project(substr($va['cbzxid'],0,strpos($va['cbzxid'], "(")));
...@@ -316,8 +313,6 @@ class flow_projectfkClassModel extends flowModel ...@@ -316,8 +313,6 @@ class flow_projectfkClassModel extends flowModel
'uid' => $this->rs['uid'], 'uid' => $this->rs['uid'],
); );
m('c_withhold_projectfk')->insert($c_withhold); m('c_withhold_projectfk')->insert($c_withhold);
var_dump($va['amount']);
var_dump($id);
//修改冻结余额 //修改冻结余额
$freeze = array( $freeze = array(
'freeze_amount' => $cost['freeze_amount'] + $va['amount'], 'freeze_amount' => $cost['freeze_amount'] + $va['amount'],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论