更新到账管理
This commit is contained in:
parent
dcc2a64222
commit
abcf1dce71
|
@ -52,11 +52,14 @@ class FinanceIncome extends ApiController
|
|||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
$this->uid = JWT_UID;
|
||||
$auth = isAuthIncome($this->uid);
|
||||
if (request()->isAjax()) {
|
||||
if($auth == 0){
|
||||
return to_assign(1, "你没有到账管理权限,请联系管理员或者HR");
|
||||
$this->apiError("你没有到账管理权限,请联系管理员或者HR");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$inid = $param['inid'];
|
||||
$admin_id = $this->uid;
|
||||
//计算已到账的金额
|
||||
|
@ -141,39 +144,7 @@ class FinanceIncome extends ApiController
|
|||
return to_assign();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if($auth == 0){
|
||||
return view('../../base/view/common/roletemplate');
|
||||
}
|
||||
$id = isset($param['id']) ? $param['id']: 0 ;
|
||||
$model = new Invoice();
|
||||
$detail = $model->detail($id);
|
||||
if(empty($detail)){
|
||||
throw new \think\exception\HttpException(406, '找不到记录');
|
||||
}
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
|
||||
if($detail['other_file_ids'] !=''){
|
||||
$fileArrayOther = Db::name('File')->where('id','in',$detail['other_file_ids'])->select();
|
||||
$detail['fileArrayOther'] = $fileArrayOther;
|
||||
}
|
||||
$detail['not_income'] = ($detail['amount']*100 - $detail['enter_amount']*100)/100;
|
||||
//已到账的记录
|
||||
$detail['income'] = InvoiceIncome::field('i.*,a.name as admin')
|
||||
->alias('i')
|
||||
->join('Admin a', 'a.id = i.admin_id', 'LEFT')
|
||||
->where(['i.inid'=>$id,'i.status'=>1])
|
||||
->order('i.enter_time desc')
|
||||
->select();
|
||||
View::assign('uid', $this->uid);
|
||||
View::assign('id', $id);
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
//查看
|
||||
public function view()
|
||||
|
@ -210,7 +181,7 @@ class FinanceIncome extends ApiController
|
|||
public function delete()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$this->uid = JWT_UID;
|
||||
//作废初始化发票到账数据
|
||||
$income =InvoiceIncome::where(['id'=>$param['id']])->find();
|
||||
$invoice = Invoice::where(['id'=>$income['inid']])->find();
|
||||
|
@ -227,12 +198,12 @@ class FinanceIncome extends ApiController
|
|||
Invoice::where(['id'=>$income['inid']])->update(['is_cash'=>1,'enter_amount'=>$incomeTotal,'enter_time'=>time()]);
|
||||
}
|
||||
add_log('enter',$income['inid'],$invoice);
|
||||
return to_assign();
|
||||
$this->apiSuccess('操作成功');
|
||||
}
|
||||
else{
|
||||
return to_assign(1,'操作失败');
|
||||
}
|
||||
$this->apiError('操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue