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

测试付款单

上级 250cdb91
......@@ -43,12 +43,11 @@ class flow_oafkClassModel extends flowModel
$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
$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(
......@@ -68,10 +67,31 @@ class flow_oafkClassModel extends flowModel
);
m('c_fund_account')->update($freeze, "`id`='$id'");
}
}
}
}
}else{
$data = m('c_fund_details_fk')->getall('mid='.$this->rs['id'], 'id,cbzx_code,charge_amount');
foreach ($data as $key => $vo) {
//将单据状态作废余额
$docnum = array(
'status' => 0,
);
$docnum=$this->rs['docnum'];
m('c_withhold')->update($docnum, "`docnum`='$docnum'");
//减去冻结金额
$cbzx_code=$vo['cbzx_code'];
$withhold_cost = m('c_withhold')->getone('cost_id='.$cbzx_code, 'id,amount');
$sql = " cost_id='$cbzx_code' 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'] - $withhold_cost['amount'],
);
m('c_fund_account')->update($freeze, "`id`='$id'");
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论