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

费用报销脚本

上级 d4754a39
...@@ -275,46 +275,45 @@ class flow_projectfkClassModel extends flowModel ...@@ -275,46 +275,45 @@ class flow_projectfkClassModel extends flowModel
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');
$sumamount=0;
foreach ($data as $v) {
$sumamount +=int($v['amount']);
}
foreach ($data as $key => $vo) { foreach ($data as $key => $vo) {
$project=self::project(substr($vo['cbzxid'],0,strpos($vo['cbzxid'], "("))); $project=self::project(substr($vo['cbzxid'],0,strpos($vo['cbzxid'], "(")));
$cbzx_code= self::dept($project['data'][0]['jz_cur_dept']); $cbzx_code= self::dept($project['data'][0]['jz_cur_dept']);
$sql = " cost_id='$cbzx_code' and status = 1 and is_default=1"; $sql = " cost_id='$cbzx_code' and status = 1 and is_default=1";
$cost = m('c_fund_account')->getone($sql, 'id,type,name,freeze_amount,account_balance');//查询账户表成本中心id $cost = m('c_fund_account')->getone($sql, 'id,type,name,freeze_amount,account_balance');//查询账户表成本中心id
if(count($data)>1){
var_dump($vo[$key]['amount']); if(($cost['account_balance']-$cost['freeze_amount'])<$vo['sumamount']){
}else{ return $cost['name']."余额不足";die;
if(($cost['account_balance']-$cost['freeze_amount'])<$vo['amount']){ }
return $cost['name']."余额不足";die;
}
}
var_dump($cost['account_balance']-$cost['freeze_amount']);
} }
foreach ($data as $key => $vo) { foreach ($data as $key => $vo) {
echo 111;
// $id=$cost['id']; $id=$cost['id'];
// $c_withhold = array( $c_withhold = array(
// 'fund_account_id' => $id, 'fund_account_id' => $id,
// 'docnum' => $this->rs['docnum'], 'docnum' => $this->rs['docnum'],
// 'cost_id' => $vo['cbzxid'], 'cost_id' => $vo['cbzxid'],
// 'amount' => $vo['amount'], 'amount' => $vo['amount'],
// 'status' => 1, 'status' => 1,
// 'create_time' => date("Y-m-d H:i:s"), 'create_time' => date("Y-m-d H:i:s"),
// 'uid' => $this->rs['uid'], 'uid' => $this->rs['uid'],
// ); );
// m('c_withhold_projectfk')->insert($c_withhold); m('c_withhold_projectfk')->insert($c_withhold);
// //修改冻结余额 //修改冻结余额
// $freeze = array( $freeze = array(
// 'freeze_amount' => $cost['freeze_amount'] + $vo['amount'], 'freeze_amount' => $cost['freeze_amount'] + $vo['amount'],
// ); );
// m('c_fund_account')->update($freeze, "`id`='$id'"); m('c_fund_account')->update($freeze, "`id`='$id'");
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论