提交 31a29e0b authored 作者: fengzy's avatar fengzy

资金管理

上级 bc84f74a
......@@ -22,63 +22,7 @@ class mode_finfybxClassAction extends inputAction{
}
protected function saveafter($table, $arr, $id, $addbo){
// 扣除账户余额 c_fund_account account_balance
$cbzxid= $arr['cbzxid'];
$model = 'c_fund_account';
$sql = " cost_id ='$cbzxid' and status = 1 and is_default=1";
$data = m($model)->getone($sql,'id,name,account_balance');
$zfarr = array(
'account_balance' =>$data['account_balance']-$arr['amountOfThisPayment'],
);
$id=$data['id'];
m('c_fund_account')->update($zfarr,"`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']+$arr['amountOfThisPayment'],
);
m('c_cbzx')->update($cbarr,"`code`='$cbzx'");
//账户明细 c_account_detail
$account_detail=array(
'account' => $data['name'],
'opt_type' => 2,
'amount' =>$arr['amountOfThisPayment'],
'trans_numb' => $arr['docnum'],
'account_balance' => $data['account_balance']-$arr['amountOfThisPayment'],
'create_time' =>date("Y-m-d H:i:s"),
'uid' =>$arr['optid'],
);
m('c_account_detail')->insert($account_detail);
// 业务付款8业务预付款10费用报销11 oa_c_fund_detail
$fund_detail=array(
'trans_numb' =>$arr['docnum'],
'account' => $data['name'],
'toaccount' =>$arr['payee'],
'trans_amount' => $arr['amountOfThisPayment'],
'business_type' =>11,
'opt_type' =>2,
'account_balance'=>$data['account_balance']-$arr['amountOfThisPayment'],
'create_time' =>date("Y-m-d H:i:s"),
);
m('c_fund_detail')->insert($fund_detail);
}
public function getlastAjax()
{
......
......@@ -17,7 +17,7 @@ class mode_oayfkClassAction extends inputAction{
$model = 'c_fund_account';
$sql = " cost_id ='$cbzxid' and status = 1 and is_default=1";
$data = m($model)->getone($sql,'id,account_balance');
var_dump($data);die;
if(!$data){
return "未检测到该成本中心默认扣款账户";
}
......@@ -32,63 +32,5 @@ class mode_oayfkClassAction extends inputAction{
}
protected function saveafter($table, $arr, $id, $addbo){
// 扣除账户余额 c_fund_account account_balance
$cbzxid= $arr['cbzxid'];
$model = 'c_fund_account';
$sql = " cost_id ='$cbzxid' and status = 1 and is_default=1";
$data = m($model)->getone($sql,'id,name,account_balance');
$zfarr = array(
'account_balance' =>$data['account_balance']-$arr['amountOfThisPayment'],
);
$id=$data['id'];
m('c_fund_account')->update($zfarr,"`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']+$arr['amountOfThisPayment'],
);
m('c_cbzx')->update($cbarr,"`code`='$cbzx'");
//账户明细 c_account_detail
$account_detail=array(
'account' => $data['name'],
'opt_type' => 2,
'amount' =>$arr['amountOfThisPayment'],
'trans_numb' => $arr['docnum'],
'account_balance' => $data['account_balance']-$arr['amountOfThisPayment'],
'create_time' =>date("Y-m-d H:i:s"),
'uid' =>$arr['optid'],
);
m('c_account_detail')->insert($account_detail);
// 业务付款8业务预付款10费用报销11 oa_c_fund_detail
$fund_detail=array(
'trans_numb' =>$arr['docnum'],
'account' => $data['name'],
'toaccount' =>$arr['payee'],
'trans_amount' => $arr['amountOfThisPayment'],
'business_type' =>10,
'opt_type' =>2,
'account_balance'=>$data['account_balance']-$arr['amountOfThisPayment'],
'create_time' =>date("Y-m-d H:i:s"),
);
m('c_fund_detail')->insert($fund_detail);
}
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论