Commit e78dd105 authored by hujun's avatar hujun

收款删除

parent 9e4445d9
......@@ -3211,6 +3211,9 @@ class Finance extends Basic
* 撤销调整
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function delAdjustment() {
$code = 101;
......@@ -3219,17 +3222,23 @@ class Finance extends Basic
}
$m_pay_adjustment = new OPayLogAdjustment();
$pay_adjustment = $m_pay_adjustment->getAdjustmentList('new_paylog_id,paylog_id', ['id'=>$this->params['id']]);
$new_paylog_id = $m_pay_adjustment->getFieldValue('new_paylog_id', ['id'=>$this->params['id']]);
if (empty($new_paylog_id)) {
if (empty($pay_adjustment[0]['new_paylog_id'])) {
return $this->response($code, '无调整信息');
}
$pay_log_id = $m_pay_adjustment->getAdjustmentList('paylog_id', ['paylog_id'=>$pay_adjustment[0]['paylog_id']]);
if (count($pay_log_id) > 1) {
return $this->response($code, '存在多次调整,不能删除');
}
$num = $m_pay_adjustment->editData(['is_del'=>1], $this->params['id']);
if ($num > 0) {
$m_pay = new OPayLogModel();
$save_data['id'] = $new_paylog_id;
$save_data['id'] = $pay_adjustment[0]['new_paylog_id'];
$save_data['is_del'] = 1;
$m_pay->updatePayLog($save_data);
$code = 200;
......@@ -3360,14 +3369,21 @@ class Finance extends Basic
return $this->response($code, '参数错误');
}
$m_pay = new OPayLogModel();
$num = $m_pay->getTotal('id', ['id'=>$this->params['pay_id']]);
if (empty($num)) {
return $this->response($code, '无收款信息');
}
$m_pay_adjustment = new OPayLogAdjustment();
$pay_id = $m_pay_adjustment->getFieldValue('id', ['new_paylog_id'=>$this->params['pay_id']]);
if ($pay_id) {
return $this->response($code, '该收款有调整信息,不能删除');
$adjustment_num = $m_pay_adjustment->getAdjustmentList('id', ['pay_id'=>$this->params['pay_id']]);
if ($adjustment_num > 1) {
return $this->response($code, '存在多次调整,不能删除');
}
$m_pay = new OPayLogModel();
$num = $m_pay->updatePayLog(['is_del'=>1, 'id'=>$this->params['pay_id']]);
if ($num > 0) {
$m_pay_adjustment->editData(['is_del'=>1], $adjustment_num[0]['id']);
$code = 200;
} else {
$code = 101;
......
......@@ -47,7 +47,7 @@ define(['doT', 'text!temp/adjustment_template_tpl.html', 'css!style/home.css', '
});
//搜索
$(document).on('click','#search',function(e){
that.getList(that.pageNo);
that.getList(1);
});
//重置搜索条件
......
......@@ -198,7 +198,7 @@ define(['doT', 'text!temp/receivables_template_tpl.html', 'css!style/home.css',
});
//搜索
$(document).on('click','#search',function(e){
that.getList(that.pageNo);
that.getList(1);
});
//重置搜索条件
$(document).on('click','#reset',function(e){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment