新增报销模块

This commit is contained in:
yaooo 2023-12-19 11:20:32 +08:00
parent 3ce6f09746
commit d6f8fffd3a
17 changed files with 1367 additions and 4 deletions

View File

@ -16,9 +16,9 @@
namespace app\adminapi\controller\cost;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\cost\CostBudgetLists;
use app\adminapi\logic\cost\CostBudgetLogic;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\cost\CostBudgetLists;
use app\adminapi\logic\cost\CostBudgetLogic;
use app\adminapi\validate\cost\CostBudgetValidate;

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\expense;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\expense\ExpenseReimbursementLists;
use app\adminapi\logic\expense\ExpenseReimbursementLogic;
use app\adminapi\validate\expense\ExpenseReimbursementValidate;
/**
* ExpenseReimbursement控制器
* Class ExpenseReimbursementController
* @package app\adminapi\controller\expense
*/
class ExpenseReimbursementController extends BaseAdminController
{
/**
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function lists()
{
return $this->dataLists(new ExpenseReimbursementLists());
}
/**
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function add()
{
$params = (new ExpenseReimbursementValidate())->post()->goCheck('add');
$result = ExpenseReimbursementLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(ExpenseReimbursementLogic::getError());
}
/**
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function edit()
{
$params = (new ExpenseReimbursementValidate())->post()->goCheck('edit');
$result = ExpenseReimbursementLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(ExpenseReimbursementLogic::getError());
}
/**
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function delete()
{
$params = (new ExpenseReimbursementValidate())->post()->goCheck('delete');
ExpenseReimbursementLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function detail()
{
$params = (new ExpenseReimbursementValidate())->goCheck('detail');
$result = ExpenseReimbursementLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\expense;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\expense\ExpenseReimbursementDetailLists;
use app\adminapi\logic\expense\ExpenseReimbursementDetailLogic;
use app\adminapi\validate\expense\ExpenseReimbursementDetailValidate;
/**
* ExpenseReimbursementDetail控制器
* Class ExpenseReimbursementDetailController
* @package app\adminapi\controller\expense
*/
class ExpenseReimbursementDetailController extends BaseAdminController
{
/**
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function lists()
{
return $this->dataLists(new ExpenseReimbursementDetailLists());
}
/**
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function add()
{
$params = (new ExpenseReimbursementDetailValidate())->post()->goCheck('add');
$result = ExpenseReimbursementDetailLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(ExpenseReimbursementDetailLogic::getError());
}
/**
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function edit()
{
$params = (new ExpenseReimbursementDetailValidate())->post()->goCheck('edit');
$result = ExpenseReimbursementDetailLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(ExpenseReimbursementDetailLogic::getError());
}
/**
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function delete()
{
$params = (new ExpenseReimbursementDetailValidate())->post()->goCheck('delete');
ExpenseReimbursementDetailLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function detail()
{
$params = (new ExpenseReimbursementDetailValidate())->goCheck('detail');
$result = ExpenseReimbursementDetailLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\expense;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\expense\ExpenseReimbursementInvoiceDetailLists;
use app\adminapi\logic\expense\ExpenseReimbursementInvoiceDetailLogic;
use app\adminapi\validate\expense\ExpenseReimbursementInvoiceDetailValidate;
/**
* ExpenseReimbursementInvoiceDetail控制器
* Class ExpenseReimbursementInvoiceDetailController
* @package app\adminapi\controller\expense
*/
class ExpenseReimbursementInvoiceDetailController extends BaseAdminController
{
/**
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function lists()
{
return $this->dataLists(new ExpenseReimbursementInvoiceDetailLists());
}
/**
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function add()
{
$params = (new ExpenseReimbursementInvoiceDetailValidate())->post()->goCheck('add');
$result = ExpenseReimbursementInvoiceDetailLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(ExpenseReimbursementInvoiceDetailLogic::getError());
}
/**
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function edit()
{
$params = (new ExpenseReimbursementInvoiceDetailValidate())->post()->goCheck('edit');
$result = ExpenseReimbursementInvoiceDetailLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(ExpenseReimbursementInvoiceDetailLogic::getError());
}
/**
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function delete()
{
$params = (new ExpenseReimbursementInvoiceDetailValidate())->post()->goCheck('delete');
ExpenseReimbursementInvoiceDetailLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function detail()
{
$params = (new ExpenseReimbursementInvoiceDetailValidate())->goCheck('detail');
$result = ExpenseReimbursementInvoiceDetailLogic::detail($params);
return $this->data($result);
}
}

View File

@ -66,7 +66,7 @@ class ProcurementContractLists extends BaseAdminDataLists implements ListsSearch
return Db::name('ProcurementContract')->alias('pc')
->where($this->searchWhere)->where($this->querySearch())
->leftJoin('project p','p.id = pc.project_id')
->field('pc.*, p.name as project_name')
->field('pc.*, p.name as project_name, p.project_code')
->limit($this->limitOffset, $this->limitLength)
->order(['pc.id' => 'desc'])
->select()->each(function($item, $key){

View File

@ -0,0 +1,77 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\expense;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\expense\ExpenseReimbursementDetail;
use app\common\lists\ListsSearchInterface;
/**
* ExpenseReimbursementDetail列表
* Class ExpenseReimbursementDetailLists
* @package app\adminapi\listsexpense
*/
class ExpenseReimbursementDetailLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function setSearch(): array
{
return [
'=' => ['expense_id', 'cost_subject_id'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function lists(): array
{
return ExpenseReimbursementDetail::where($this->searchWhere)
->field(['id', 'expense_id', 'cost_subject_id', 'use_to', 'amount', 'remark'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function count(): int
{
return ExpenseReimbursementDetail::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,77 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\expense;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\expense\ExpenseReimbursementInvoiceDetail;
use app\common\lists\ListsSearchInterface;
/**
* ExpenseReimbursementInvoiceDetail列表
* Class ExpenseReimbursementInvoiceDetailLists
* @package app\adminapi\listsexpense
*/
class ExpenseReimbursementInvoiceDetailLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function setSearch(): array
{
return [
'=' => ['expense_id', 'invoice_type', 'invoice_sn'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function lists(): array
{
return ExpenseReimbursementInvoiceDetail::where($this->searchWhere)
->field(['id', 'expense_id', 'invoice_type', 'invoice_sn', 'tax_rate', 'invoice_form', 'amount', 'tax', 'annex', 'remark'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function count(): int
{
return ExpenseReimbursementInvoiceDetail::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,77 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\expense;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\expense\ExpenseReimbursement;
use app\common\lists\ListsSearchInterface;
/**
* ExpenseReimbursement列表
* Class ExpenseReimbursementLists
* @package app\adminapi\listsexpense
*/
class ExpenseReimbursementLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function setSearch(): array
{
return [
'=' => ['reimburser', 'reimbursement_date', 'customer_id', 'payee_name', 'payee_account'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function lists(): array
{
return ExpenseReimbursement::where($this->searchWhere)
->field(['id', 'org_id', 'dept_id', 'approve_id', 'reimburser', 'reimbursement_date', 'customer_id', 'pay_type', 'reimbursement_amount', 'reimbursement_amount_daxie', 'payee_name', 'payee_bank', 'payee_account', 'remark', 'annex'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function count(): int
{
return ExpenseReimbursement::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,114 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\expense;
use app\common\model\expense\ExpenseReimbursementDetail;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* ExpenseReimbursementDetail逻辑
* Class ExpenseReimbursementDetailLogic
* @package app\adminapi\logic\expense
*/
class ExpenseReimbursementDetailLogic extends BaseLogic
{
/**
* @notes 添加
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/19 11:10
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
ExpenseReimbursementDetail::create([
'expense_id' => $params['expense_id'],
'cost_subject_id' => $params['cost_subject_id'],
'use_to' => $params['use_to'],
'amount' => $params['amount'],
'remark' => $params['remark'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/19 11:10
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
ExpenseReimbursementDetail::where('id', $params['id'])->update([
'expense_id' => $params['expense_id'],
'cost_subject_id' => $params['cost_subject_id'],
'use_to' => $params['use_to'],
'amount' => $params['amount'],
'remark' => $params['remark'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/19 11:10
*/
public static function delete(array $params): bool
{
return ExpenseReimbursementDetail::destroy($params['id']);
}
/**
* @notes 获取详情
* @param $params
* @return array
* @author likeadmin
* @date 2023/12/19 11:10
*/
public static function detail($params): array
{
return ExpenseReimbursementDetail::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,122 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\expense;
use app\common\model\expense\ExpenseReimbursementInvoiceDetail;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* ExpenseReimbursementInvoiceDetail逻辑
* Class ExpenseReimbursementInvoiceDetailLogic
* @package app\adminapi\logic\expense
*/
class ExpenseReimbursementInvoiceDetailLogic extends BaseLogic
{
/**
* @notes 添加
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/19 11:09
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
ExpenseReimbursementInvoiceDetail::create([
'expense_id' => $params['expense_id'],
'invoice_type' => $params['invoice_type'],
'invoice_sn' => $params['invoice_sn'],
'tax_rate' => $params['tax_rate'],
'invoice_form' => $params['invoice_form'],
'amount' => $params['amount'],
'tax' => $params['tax'],
'annex' => $params['annex'],
'remark' => $params['remark'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/19 11:09
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
ExpenseReimbursementInvoiceDetail::where('id', $params['id'])->update([
'expense_id' => $params['expense_id'],
'invoice_type' => $params['invoice_type'],
'invoice_sn' => $params['invoice_sn'],
'tax_rate' => $params['tax_rate'],
'invoice_form' => $params['invoice_form'],
'amount' => $params['amount'],
'tax' => $params['tax'],
'annex' => $params['annex'],
'remark' => $params['remark'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/19 11:09
*/
public static function delete(array $params): bool
{
return ExpenseReimbursementInvoiceDetail::destroy($params['id']);
}
/**
* @notes 获取详情
* @param $params
* @return array
* @author likeadmin
* @date 2023/12/19 11:09
*/
public static function detail($params): array
{
return ExpenseReimbursementInvoiceDetail::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,132 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\expense;
use app\common\model\expense\ExpenseReimbursement;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* ExpenseReimbursement逻辑
* Class ExpenseReimbursementLogic
* @package app\adminapi\logic\expense
*/
class ExpenseReimbursementLogic extends BaseLogic
{
/**
* @notes 添加
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/19 11:12
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
ExpenseReimbursement::create([
'org_id' => $params['org_id'],
'dept_id' => $params['dept_id'],
'approve_id' => $params['approve_id'],
'reimburser' => $params['reimburser'],
'reimbursement_date' => $params['reimbursement_date'],
'customer_id' => $params['customer_id'],
'pay_type' => $params['pay_type'],
'reimbursement_amount' => $params['reimbursement_amount'],
'reimbursement_amount_daxie' => $params['reimbursement_amount_daxie'],
'payee_name' => $params['payee_name'],
'payee_bank' => $params['payee_bank'],
'payee_account' => $params['payee_account'],
'remark' => $params['remark'],
'annex' => $params['annex'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/19 11:12
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
ExpenseReimbursement::where('id', $params['id'])->update([
'org_id' => $params['org_id'],
'dept_id' => $params['dept_id'],
'approve_id' => $params['approve_id'],
'reimburser' => $params['reimburser'],
'reimbursement_date' => $params['reimbursement_date'],
'customer_id' => $params['customer_id'],
'pay_type' => $params['pay_type'],
'reimbursement_amount' => $params['reimbursement_amount'],
'reimbursement_amount_daxie' => $params['reimbursement_amount_daxie'],
'payee_name' => $params['payee_name'],
'payee_bank' => $params['payee_bank'],
'payee_account' => $params['payee_account'],
'remark' => $params['remark'],
'annex' => $params['annex'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/19 11:12
*/
public static function delete(array $params): bool
{
return ExpenseReimbursement::destroy($params['id']);
}
/**
* @notes 获取详情
* @param $params
* @return array
* @author likeadmin
* @date 2023/12/19 11:12
*/
public static function detail($params): array
{
return ExpenseReimbursement::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,100 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\expense;
use app\common\validate\BaseValidate;
/**
* ExpenseReimbursementDetail验证器
* Class ExpenseReimbursementDetailValidate
* @package app\adminapi\validate\expense
*/
class ExpenseReimbursementDetailValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'expense_id' => 'require',
'cost_subject_id' => 'require',
'amount' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'expense_id' => '报销id',
'cost_subject_id' => '费用科目id',
'amount' => '金额',
];
/**
* @notes 添加场景
* @return ExpenseReimbursementDetailValidate
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function sceneAdd()
{
return $this->only(['expense_id','cost_subject_id','amount']);
}
/**
* @notes 编辑场景
* @return ExpenseReimbursementDetailValidate
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function sceneEdit()
{
return $this->only(['id','expense_id','cost_subject_id','amount']);
}
/**
* @notes 删除场景
* @return ExpenseReimbursementDetailValidate
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return ExpenseReimbursementDetailValidate
* @author likeadmin
* @date 2023/12/19 11:10
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,102 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\expense;
use app\common\validate\BaseValidate;
/**
* ExpenseReimbursementInvoiceDetail验证器
* Class ExpenseReimbursementInvoiceDetailValidate
* @package app\adminapi\validate\expense
*/
class ExpenseReimbursementInvoiceDetailValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'expense_id' => 'require',
'invoice_type' => 'require',
'invoice_sn' => 'require',
'amount' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'expense_id' => '报销id',
'invoice_type' => '发票类型',
'invoice_sn' => '发票号',
'amount' => '发票金额',
];
/**
* @notes 添加场景
* @return ExpenseReimbursementInvoiceDetailValidate
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function sceneAdd()
{
return $this->only(['expense_id','invoice_type','invoice_sn','amount']);
}
/**
* @notes 编辑场景
* @return ExpenseReimbursementInvoiceDetailValidate
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function sceneEdit()
{
return $this->only(['id','expense_id','invoice_type','invoice_sn','amount']);
}
/**
* @notes 删除场景
* @return ExpenseReimbursementInvoiceDetailValidate
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return ExpenseReimbursementInvoiceDetailValidate
* @author likeadmin
* @date 2023/12/19 11:09
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,114 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\expense;
use app\common\validate\BaseValidate;
/**
* ExpenseReimbursement验证器
* Class ExpenseReimbursementValidate
* @package app\adminapi\validate\expense
*/
class ExpenseReimbursementValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'org_id' => 'require',
'dept_id' => 'require',
'approve_id' => 'require',
'reimburser' => 'require',
'reimbursement_date' => 'require',
'customer_id' => 'require',
'pay_type' => 'require',
'payee_name' => 'require',
'payee_bank' => 'require',
'payee_account' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'org_id' => '机构id',
'dept_id' => '部门id',
'approve_id' => '审批id',
'reimburser' => '报销人',
'reimbursement_date' => '报销日期',
'customer_id' => '客户id',
'pay_type' => '付款方式',
'payee_name' => '收款人姓名',
'payee_bank' => '收款银行',
'payee_account' => '收款账号',
];
/**
* @notes 添加场景
* @return ExpenseReimbursementValidate
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function sceneAdd()
{
return $this->only(['org_id','dept_id','approve_id','reimburser','reimbursement_date','customer_id','pay_type','payee_name','payee_bank','payee_account']);
}
/**
* @notes 编辑场景
* @return ExpenseReimbursementValidate
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function sceneEdit()
{
return $this->only(['id','org_id','dept_id','approve_id','reimburser','reimbursement_date','customer_id','pay_type','payee_name','payee_bank','payee_account']);
}
/**
* @notes 删除场景
* @return ExpenseReimbursementValidate
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return ExpenseReimbursementValidate
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,56 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\expense;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* ExpenseReimbursement模型
* Class ExpenseReimbursement
* @package app\common\model\expense
*/
class ExpenseReimbursement extends BaseModel
{
use SoftDelete;
protected $name = 'expense_reimbursement';
protected $deleteTime = 'delete_time';
/**
* @notes 关联detail
* @return \think\model\relation\HasMany
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function detail()
{
return $this->hasMany(\app\common\model\expense\ExpenseReimbursementDetail::class, 'expense_id', 'id');
}
/**
* @notes 关联invoice
* @return \think\model\relation\HasMany
* @author likeadmin
* @date 2023/12/19 11:12
*/
public function invoice()
{
return $this->hasMany(\app\common\model\expense\ExpenseReimbursementInvoiceDetail::class, 'expense_id', 'id');
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\expense;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* ExpenseReimbursementDetail模型
* Class ExpenseReimbursementDetail
* @package app\common\model\expense
*/
class ExpenseReimbursementDetail extends BaseModel
{
use SoftDelete;
protected $name = 'expense_reimbursement_detail';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\expense;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* ExpenseReimbursementInvoiceDetail模型
* Class ExpenseReimbursementInvoiceDetail
* @package app\common\model\expense
*/
class ExpenseReimbursementInvoiceDetail extends BaseModel
{
use SoftDelete;
protected $name = 'expense_reimbursement_invoice_detail';
protected $deleteTime = 'delete_time';
}