Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
OA
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
PHP
OA
Commits
ae7d2d30
提交
ae7d2d30
authored
7月 23, 2020
作者:
fengzy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
'调整费用报销与借款单逻辑'
上级
6949f01e
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
99 行增加
和
94 行删除
+99
-94
emfkModel.php
webmain/model/flow/emfkModel.php
+99
-94
没有找到文件。
webmain/model/flow/emfkModel.php
浏览文件 @
ae7d2d30
...
...
@@ -48,6 +48,12 @@ class flow_emfkClassModel extends flowModel
m
(
'log'
)
->
addlog
(
'电费付款'
,
'接口返回信息:'
.
$res
);
}
static
function
dept
(
$data
)
{
$sql
=
' id='
.
$data
;
$cbzxid
=
m
(
'tmp_department'
)
->
getone
(
$sql
,
'id,cost'
);
//查询账户表成本中心id
return
$cbzxid
;
}
protected
function
flowsubmit
(
$na
,
$sm
){
...
...
@@ -56,102 +62,101 @@ class flow_emfkClassModel extends flowModel
$url
=
$url
.
$key
;
$url
.=
'&project_code='
.
'WJFX-3-14066'
;
$res
=
curlGet
(
$url
);
var_dump
(
$res
);
die
;
}
// //二级 或一级审批同意之后进行预扣款
// protected function flowcheckbefore($zt, $sm){
// $id=$this->rs['id'];
// $sql = " mid ='$id' and `table`='c_emfk' ";
// $flow_bill = m('flow_bill')->getone($sql,'allcheckid');
// $allcheckid=explode(',',$flow_bill['allcheckid']);
// $option = m('option')->getall('pid = 1497 and num =1 order by sort desc','num,name,value,sort');
// foreach ($option as $key => $value) {
// if(in_array($value['value'], $allcheckid)){
// $checkid= $value['value'];
// break;
// }
// }
//
// if(empty($checkid)){
// $option = m('option')->getall('pid = 1497 and num =2 order by sort desc','num,name,value,sort,`explain`');
// foreach ($option as $key => $value) {
// if(in_array($value['value'], $allcheckid)){
// $checkid= $value['value'];
// break;
// }
// }
// }
//
//
// //zt 1代表同意
// if($zt==1){
// $flowid=$this->getflow();
//
// 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
//
// $sql = " cost_id='$cbzx_code' and status = 1 and is_default=1";
// $cost = m('c_fund_account')->getone($sql, 'id,type,freeze_amount,account_balance');//查询账户表成本中心id
// if($cost['type']=='1'){
// if(($cost['account_balance']-$cost['freeze_amount'])<$vo['amount']){
// return "账户余额不足";die;
// }
// }
// $id=$cost['id'];
//
// $c_withhold = array(
// 'fund_account_id' => $id,
// 'docnum' => $this->rs['docnum'],
// 'cost_id' => $vo['cbzxid'],
// 'amount' => $vo['amount'],
// 'status' => 1,
// 'create_time' => date("Y-m-d H:i:s"),
// 'uid' => $this->rs['uid'],
// );
// m('c_withhold_emfk')->insert($c_withhold);
//
// //修改冻结余额
// $freeze = array(
// 'freeze_amount' => $cost['freeze_amount'] + $vo['amount'],
// );
//
// m('c_fund_account')->update($freeze, "`id`='$id'");
// }
// }
//
// }else{
// $docnum=$this->rs['docnum'];
// //将单据状态作废余额
//
// $withhold_cost = m('c_withhold_emfk')->getall("docnum='$docnum' and status =1", 'id,cost_id,amount');
//
// foreach ($withhold_cost as $key => $vo) {
// //减去冻结金额
// $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'];
// $freeze = array(
// 'freeze_amount' => $fund_account_cost['freeze_amount'] - $vo['amount'],
// );
//
// m('c_fund_account')->update($freeze, "`id`='$id'");
//
// }
//
//
// $status = array(
// 'status' => 0,
// );
// m('c_withhold_emfk')->update($status, "docnum='$docnum'");
// }
// }
//二级 或一级审批同意之后进行预扣款
protected
function
flowcheckbefore
(
$zt
,
$sm
){
$id
=
$this
->
rs
[
'id'
];
$sql
=
" mid ='
$id
' and `table`='c_emfk' "
;
$flow_bill
=
m
(
'flow_bill'
)
->
getone
(
$sql
,
'allcheckid'
);
$allcheckid
=
explode
(
','
,
$flow_bill
[
'allcheckid'
]);
$option
=
m
(
'option'
)
->
getall
(
'pid = 1497 and num =1 order by sort desc'
,
'num,name,value,sort'
);
foreach
(
$option
as
$key
=>
$value
)
{
if
(
in_array
(
$value
[
'value'
],
$allcheckid
)){
$checkid
=
$value
[
'value'
];
break
;
}
}
if
(
empty
(
$checkid
)){
$option
=
m
(
'option'
)
->
getall
(
'pid = 1497 and num =2 order by sort desc'
,
'num,name,value,sort,`explain`'
);
foreach
(
$option
as
$key
=>
$value
)
{
if
(
in_array
(
$value
[
'value'
],
$allcheckid
)){
$checkid
=
$value
[
'value'
];
break
;
}
}
}
//zt 1代表同意
if
(
$zt
==
1
){
$flowid
=
$this
->
getflow
();
if
(
$flowid
[
'nowcheckid'
]
==
$checkid
){
$data
=
m
(
'c_emfk_details'
)
->
getall
(
'mid='
.
$this
->
rs
[
'id'
],
'id,cbzxid,amount'
);
foreach
(
$data
as
$key
=>
$vo
)
{
$cbzx_code
=
self
::
dept
(
$vo
[
'cbzxid'
]);
var_dump
(
$cbzx_code
);
die
;
$sql
=
" cost_id='
$cbzx_code
' and status = 1 and is_default=1"
;
$cost
=
m
(
'c_fund_account'
)
->
getone
(
$sql
,
'id,type,freeze_amount,account_balance'
);
//查询账户表成本中心id
if
(
$cost
[
'type'
]
==
'1'
){
if
((
$cost
[
'account_balance'
]
-
$cost
[
'freeze_amount'
])
<
$vo
[
'amount'
]){
return
"账户余额不足"
;
die
;
}
}
$id
=
$cost
[
'id'
];
$c_withhold
=
array
(
'fund_account_id'
=>
$id
,
'docnum'
=>
$this
->
rs
[
'docnum'
],
'cost_id'
=>
$vo
[
'cbzxid'
],
'amount'
=>
$vo
[
'amount'
],
'status'
=>
1
,
'create_time'
=>
date
(
"Y-m-d H:i:s"
),
'uid'
=>
$this
->
rs
[
'uid'
],
);
m
(
'c_withhold_emfk'
)
->
insert
(
$c_withhold
);
//修改冻结余额
$freeze
=
array
(
'freeze_amount'
=>
$cost
[
'freeze_amount'
]
+
$vo
[
'amount'
],
);
m
(
'c_fund_account'
)
->
update
(
$freeze
,
"`id`='
$id
'"
);
}
}
}
else
{
$docnum
=
$this
->
rs
[
'docnum'
];
//将单据状态作废余额
$withhold_cost
=
m
(
'c_withhold_emfk'
)
->
getall
(
"docnum='
$docnum
' and status =1"
,
'id,cost_id,amount'
);
foreach
(
$withhold_cost
as
$key
=>
$vo
)
{
//减去冻结金额
$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'
];
$freeze
=
array
(
'freeze_amount'
=>
$fund_account_cost
[
'freeze_amount'
]
-
$vo
[
'amount'
],
);
m
(
'c_fund_account'
)
->
update
(
$freeze
,
"`id`='
$id
'"
);
}
$status
=
array
(
'status'
=>
0
,
);
m
(
'c_withhold_emfk'
)
->
update
(
$status
,
"docnum='
$docnum
'"
);
}
}
//流程全部完成后调用
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论