Files
duolamaojiazhen/application/admin/controller/Finance.php
2025-12-22 13:59:40 +08:00

177 lines
5.2 KiB
PHP

<?php
namespace app\admin\controller;
use think\Db;
use app\admin\logic\FinanceLogic;
use app\admin\logic\StaffLogic;
class Finance extends AdminBase
{
public function lists()
{
$data = FinanceLogic::lists();
$this->assign('data', $data);
return $this->fetch();
}
public function acctypelist(){
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = FinanceLogic::acctypelist($get);
$this->_success('',$lists);
}
return $this->fetch();
}
public function acctypeadd(){
if ($this->request->isAjax()) {
$post = $this->request->post();
$lists = FinanceLogic::acctypeadd($post);
$this->_success('增加成功');
}
return $this->fetch();
}
public function acctypedit($id){
if ($this->request->isAjax()) {
$get = $this->request->post();
$data=Db::name('finance_type')->where('id',$get['id'])->data(['name'=>$get['name']])->update();
$this->_success('更改分类成功');
}
$detail=Db::name('finance_type')->where('id',$id)->find();
$this->assign('detail',$detail);
return $this->fetch();
}
public function acctypedel($id){
$data=Db::name('finance_type')->where('id',$id)->delete();
$this->_success('删除成功');
}
public function fidlists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = FinanceLogic::fidlists($get);
$this->_success('',$lists);
}
$this->assign('satff',StaffLogic::serverstaff());
$this->assign('type',FinanceLogic::typelist());
return $this->fetch();
}
public function add(){
if ($this->request->isAjax()) {
$post = $this->request->post();
$lists = FinanceLogic::add($post);
$this->_success('增加报销单据成功');
}
$this->assign('brand_lists', json_encode(FinanceLogic::typelist(), JSON_UNESCAPED_UNICODE));
return $this->fetch();
}
public function examine(){
$id = $this->request->post('id');
$data=Db::name('finance')->where('id',$id)->update(['status'=>2,'reason'=>'']);
$this->_success('审核成功');
}
public function examines(){
$post = $this->request->post();
$data=Db::name('finance')->where('id',$post['id'])->update(['status'=>3,'reason'=>$post['code']]);
$this->_success('审核不通过');
}
//获取报销的内容的内容
public function infos(){
$id = $this->request->get('id');
$data=Db::name('finance')->where('id',$id)->find();
$this->_success('获取数据成功', $data);
}
public function edit(){
if ($this->request->isAjax()) {
$post = $this->request->post();
$lists = FinanceLogic::eidt($post);
$this->_success('编辑报销单据成功');
}
$id = $this->request->get('id');
$this->assign('info', json_encode(FinanceLogic::info($id),JSON_UNESCAPED_UNICODE));
$this->assign('brand_lists', json_encode(FinanceLogic::typelist(), JSON_UNESCAPED_UNICODE));
return $this->fetch();
}
//员工加时申请
public function stafftime(){
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = FinanceLogic::stafftime($get);
$this->_success('',$lists);
}
$this->assign('satff',StaffLogic::serverstaff());
$data=Db::name('admin')->where('id','<>',1)->select();
$this->assign('admin',$data);
return $this->fetch();
}
//修改员工加时间
public function editaddtim(){
if ($this->request->isAjax()) {
$get=$this->request->post();
$lists = FinanceLogic::editaddtimup($get);
if($lists){
$this->_success('修改成功');
}else{
$this->_error('修改失败请检查金额');
}
}
$id=$this->request->get('id');
$this->assign('info',FinanceLogic::stafftimeinfo($id));
return $this->fetch();
}
//加时结算费用
public function order_pay(){
$get = $this->request->get();
$this->_success('');
}
public function order_pays(){
$post = $this->request->post();
$data=Db::name('order_timeadd')->where('id',$post['id'])->update(['pay_status'=>1,'status'=>2]);
$this->_success('审核成功');
}
public function editsd(){
$post = $this->request->post();
$data=Db::name('order_timeadd')->where('id',$post['id'])->update(['pay_status'=>0,'status'=>3,'reason'=>$post['code']]);
$this->_success('修改成功');
}
public function infoeditsd(){
$post = $this->request->get();
$lists = FinanceLogic::stafftimeinfo($post['id']);
$this->_success('',$lists);
}
public function del_addtime(){
$post = $this->request->post();
$data=Db::name('order_timeadd')->where('id',$post['id'])->delete();
$this->_success('删除成功');
}
//处罚审核通过
}