update
This commit is contained in:
parent
83216ffd64
commit
c755ea1db7
@ -0,0 +1,111 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\financial\FinancialTravelReimbursementLists;
|
||||
use app\adminapi\logic\financial\FinancialTravelReimbursementLogic;
|
||||
use app\adminapi\validate\financial\FinancialTravelReimbursementValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单控制器
|
||||
* Class FinancialTravelReimbursementController
|
||||
* @package app\adminapi\controller\financial
|
||||
*/
|
||||
class FinancialTravelReimbursementController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new FinancialTravelReimbursementLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加财务管理--差旅费报销单
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new FinancialTravelReimbursementValidate())->post()->goCheck('add');
|
||||
$result = FinancialTravelReimbursementLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(FinancialTravelReimbursementLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑财务管理--差旅费报销单
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new FinancialTravelReimbursementValidate())->post()->goCheck('edit');
|
||||
$result = FinancialTravelReimbursementLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(FinancialTravelReimbursementLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除财务管理--差旅费报销单
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new FinancialTravelReimbursementValidate())->post()->goCheck('delete');
|
||||
$result = FinancialTravelReimbursementLogic::delete($params);
|
||||
if (true === $result) {
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(FinancialTravelReimbursementLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new FinancialTravelReimbursementValidate())->goCheck('detail');
|
||||
$result = FinancialTravelReimbursementLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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\financial;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\financial\FinancialTravelReimbursementDetailLists;
|
||||
use app\adminapi\logic\financial\FinancialTravelReimbursementDetailLogic;
|
||||
use app\adminapi\validate\financial\FinancialTravelReimbursementDetailValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单--报销明细控制器
|
||||
* Class FinancialTravelReimbursementDetailController
|
||||
* @package app\adminapi\controller\financial
|
||||
*/
|
||||
class FinancialTravelReimbursementDetailController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单--报销明细列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new FinancialTravelReimbursementDetailLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加财务管理--差旅费报销单--报销明细
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new FinancialTravelReimbursementDetailValidate())->post()->goCheck('add');
|
||||
$result = FinancialTravelReimbursementDetailLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(FinancialTravelReimbursementDetailLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑财务管理--差旅费报销单--报销明细
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new FinancialTravelReimbursementDetailValidate())->post()->goCheck('edit');
|
||||
$result = FinancialTravelReimbursementDetailLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(FinancialTravelReimbursementDetailLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除财务管理--差旅费报销单--报销明细
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new FinancialTravelReimbursementDetailValidate())->post()->goCheck('delete');
|
||||
FinancialTravelReimbursementDetailLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单--报销明细详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new FinancialTravelReimbursementDetailValidate())->goCheck('detail');
|
||||
$result = FinancialTravelReimbursementDetailLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\financial\FinancialTravelReimbursementDetail;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单--报销明细列表
|
||||
* Class FinancialTravelReimbursementDetailLists
|
||||
* @package app\adminapi\listsfinancial
|
||||
*/
|
||||
class FinancialTravelReimbursementDetailLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['travel_reimbursement_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单--报销明细列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return FinancialTravelReimbursementDetail::where($this->searchWhere)
|
||||
->field(['id', 'travel_reimbursement_id', 'dept_id', 'date', 'address', 'traffic_amount', 'stay_amount', 'stay_days', 'stay_price', 'subsidy_days', 'subsidy_price', 'subsidy_amount', 'subsidy_deduction', 'abstract'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$dept = Dept::field('name')->where('id', $data['dept_id'])->findOrEmpty();
|
||||
$data['dept_name'] = $dept['name'];
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单--报销明细数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return FinancialTravelReimbursementDetail::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\financial\FinancialTravelReimbursement;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单列表
|
||||
* Class FinancialTravelReimbursementLists
|
||||
* @package app\adminapi\listsfinancial
|
||||
*/
|
||||
class FinancialTravelReimbursementLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['code', 'approve_dept', 'cost_type', 'pay_type', 'create_user'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if (!empty($params['create_time'])) {
|
||||
$date = explode(',', $params['create_time']);
|
||||
$where[] = ['create_time', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]];
|
||||
}
|
||||
return FinancialTravelReimbursement::where($this->searchWhere)->where($where)
|
||||
->field(['id', 'code', 'approve_dept', 'cost_type', 'pay_type', 'tax_deductible_amount', 'bill_num', 'fee_application_id', 'content', 'create_user', 'create_time'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$dept = Dept::field('name')->where('id', $data['approve_dept'])->findOrEmpty();
|
||||
$data['approve_dept_name'] = $dept['name'];
|
||||
$data['pay_type_text'] = $data->pay_type_text;
|
||||
$data['cost_type_text'] = $data->cost_type_text;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if (!empty($params['create_time'])) {
|
||||
$date = explode(',', $params['create_time']);
|
||||
$where[] = ['create_time', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]];
|
||||
}
|
||||
return FinancialTravelReimbursement::where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
}
|
@ -168,7 +168,6 @@
|
||||
$data['contract_type'] = !$contract->isEmpty() ? $contract['contract_type'] : 0;
|
||||
$data['contract_type_text'] = !$contract->isEmpty() ? $contract->contract_type_text : '';
|
||||
$data['fee_application_theme'] = !$fee_application->isEmpty() ? $fee_application['theme'] : '';
|
||||
$data['pay_type'] = (string)$data['pay_type'];
|
||||
$data['pay_type_text'] = $data->pay_type_text;
|
||||
$data['total_amount'] = FinancialExpenseReimbursementDetail::where('expense_reimbursement_id', $data['id'])->sum('amount');
|
||||
return $data->toArray();
|
||||
|
@ -0,0 +1,133 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\financial\FinancialTravelReimbursementDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单--报销明细逻辑
|
||||
* Class FinancialTravelReimbursementDetailLogic
|
||||
* @package app\adminapi\logic\financial
|
||||
*/
|
||||
class FinancialTravelReimbursementDetailLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加财务管理--差旅费报销单--报销明细
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialTravelReimbursementDetail::create([
|
||||
'travel_reimbursement_id' => $params['travel_reimbursement_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'date' => !empty($params['date']) ? strtotime($params['date']) : 0,
|
||||
'address' => $params['address'],
|
||||
'traffic_amount' => $params['traffic_amount'] ?? 0,
|
||||
'stay_amount' => $params['stay_amount'] ?? 0,
|
||||
'stay_days' => $params['stay_days'] ?? 0,
|
||||
'stay_price' => $params['stay_price'] ?? 0,
|
||||
'subsidy_days' => $params['subsidy_days'] ?? 0,
|
||||
'subsidy_price' => $params['subsidy_price'] ?? 0,
|
||||
'subsidy_amount' => $params['subsidy_amount'] ?? 0,
|
||||
'subsidy_deduction' => $params['subsidy_deduction'],
|
||||
'abstract' => $params['abstract'] ?? '',
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑财务管理--差旅费报销单--报销明细
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialTravelReimbursementDetail::where('id', $params['id'])->update([
|
||||
'travel_reimbursement_id' => $params['travel_reimbursement_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'date' => !empty($params['date']) ? strtotime($params['date']) : 0,
|
||||
'address' => $params['address'],
|
||||
'traffic_amount' => $params['traffic_amount'] ?? 0,
|
||||
'stay_amount' => $params['stay_amount'] ?? 0,
|
||||
'stay_days' => $params['stay_days'] ?? 0,
|
||||
'stay_price' => $params['stay_price'] ?? 0,
|
||||
'subsidy_days' => $params['subsidy_days'] ?? 0,
|
||||
'subsidy_price' => $params['subsidy_price'] ?? 0,
|
||||
'subsidy_amount' => $params['subsidy_amount'] ?? 0,
|
||||
'subsidy_deduction' => $params['subsidy_deduction'],
|
||||
'abstract' => $params['abstract'] ?? '',
|
||||
'update_time' => time()
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除财务管理--差旅费报销单--报销明细
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinancialTravelReimbursementDetail::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单--报销明细详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinancialTravelReimbursementDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
|
||||
$dept = Dept::field('name')->where('id', $data['dept_id'])->findOrEmpty();
|
||||
$data['dept_name'] = $dept['name'];
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\financial\FinancialFeeApplication;
|
||||
use app\common\model\financial\FinancialTravelReimbursement;
|
||||
use app\common\model\financial\FinancialTravelReimbursementDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单逻辑
|
||||
* Class FinancialTravelReimbursementLogic
|
||||
* @package app\adminapi\logic\financial
|
||||
*/
|
||||
class FinancialTravelReimbursementLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加财务管理--差旅费报销单
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = FinancialTravelReimbursement::create([
|
||||
'code' => data_unique_code('CLBX'),
|
||||
'approve_dept' => $params['approve_dept'],
|
||||
'cost_type' => $params['cost_type'],
|
||||
'pay_type' => $params['pay_type'],
|
||||
'tax_deductible_amount' => $params['tax_deductible_amount'] ?? 0,
|
||||
'bill_num' => $params['bill_num'],
|
||||
'fee_application_id' => $params['fee_application_id'] ?? 0,
|
||||
'content' => $params['content'] ?? '',
|
||||
'create_user' => $params['create_user'],
|
||||
'create_time' => !empty($params['create_time']) ? strtotime($params['create_time']) : time(),
|
||||
]);
|
||||
if (!empty($params['detail'])) {
|
||||
foreach ($params['detail'] as $v) {
|
||||
FinancialTravelReimbursementDetail::create([
|
||||
'travel_reimbursement_id' => $res->id,
|
||||
'dept_id' => $v['dept_id'],
|
||||
'date' => !empty($v['date']) ? strtotime($v['date']) : 0,
|
||||
'address' => $v['address'],
|
||||
'traffic_amount' => $v['traffic_amount'] ?? 0,
|
||||
'stay_amount' => $v['stay_amount'] ?? 0,
|
||||
'stay_days' => $v['stay_days'] ?? 0,
|
||||
'stay_price' => $v['stay_price'] ?? 0,
|
||||
'subsidy_days' => $v['subsidy_days'] ?? 0,
|
||||
'subsidy_price' => $v['subsidy_price'] ?? 0,
|
||||
'subsidy_amount' => $v['subsidy_amount'] ?? 0,
|
||||
'subsidy_deduction' => $v['subsidy_deduction'] ?? 0,
|
||||
'abstract' => $v['abstract'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑财务管理--差旅费报销单
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialTravelReimbursement::where('id', $params['id'])->update([
|
||||
'approve_dept' => $params['approve_dept'],
|
||||
'cost_type' => $params['cost_type'],
|
||||
'pay_type' => $params['pay_type'],
|
||||
'tax_deductible_amount' => $params['tax_deductible_amount'] ?? 0,
|
||||
'bill_num' => $params['bill_num'],
|
||||
'fee_application_id' => $params['fee_application_id'] ?? 0,
|
||||
'content' => $params['content'] ?? '',
|
||||
'create_user' => $params['create_user'],
|
||||
'create_time' => !empty($params['create_time']) ? strtotime($params['create_time']) : time(),
|
||||
'update_time' => time(),
|
||||
]);
|
||||
if (!empty($params['detail'])) {
|
||||
foreach ($params['detail'] as $v) {
|
||||
if (!empty($v['id'])) {
|
||||
FinancialTravelReimbursementDetail::where('id', $v['id'])->update([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'dept_id' => $v['dept_id'],
|
||||
'date' => !empty($v['date']) ? strtotime($v['date']) : 0,
|
||||
'address' => $v['address'],
|
||||
'traffic_amount' => $v['traffic_amount'] ?? 0,
|
||||
'stay_amount' => $v['stay_amount'] ?? 0,
|
||||
'stay_days' => $v['stay_days'] ?? 0,
|
||||
'stay_price' => $v['stay_price'] ?? 0,
|
||||
'subsidy_days' => $v['subsidy_days'] ?? 0,
|
||||
'subsidy_price' => $v['subsidy_price'] ?? 0,
|
||||
'subsidy_amount' => $v['subsidy_amount'] ?? 0,
|
||||
'subsidy_deduction' => $v['subsidy_deduction'] ?? 0,
|
||||
'abstract' => $v['abstract'] ?? '',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
} else {
|
||||
FinancialTravelReimbursementDetail::create([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'dept_id' => $v['dept_id'],
|
||||
'date' => !empty($v['date']) ? strtotime($v['date']) : 0,
|
||||
'address' => $v['address'],
|
||||
'traffic_amount' => $v['traffic_amount'] ?? 0,
|
||||
'stay_amount' => $v['stay_amount'] ?? 0,
|
||||
'stay_days' => $v['stay_days'] ?? 0,
|
||||
'stay_price' => $v['stay_price'] ?? 0,
|
||||
'subsidy_days' => $v['subsidy_days'] ?? 0,
|
||||
'subsidy_price' => $v['subsidy_price'] ?? 0,
|
||||
'subsidy_amount' => $v['subsidy_amount'] ?? 0,
|
||||
'subsidy_deduction' => $v['subsidy_deduction'] ?? 0,
|
||||
'abstract' => $v['abstract'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除财务管理--差旅费报销单
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$detail = FinancialTravelReimbursementDetail::where('expense_reimbursement_id', 'in', $params['id'])->findOrEmpty();
|
||||
if (!$detail->isEmpty()) {
|
||||
self::setError('此数据关联了报销明细信息,需删除报销明细信息');
|
||||
return false;
|
||||
}
|
||||
return FinancialTravelReimbursement::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取财务管理--差旅费报销单详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinancialTravelReimbursement::withoutField('update_time,delete_time')->findOrEmpty($params['id']);
|
||||
$fee_application = FinancialFeeApplication::field('theme')->where('id', $data['fee_application_id'])->findOrEmpty();
|
||||
$dept = Dept::field('name')->where('id', $data['approve_dept'])->findOrEmpty();
|
||||
$data['fee_application_theme'] = !$fee_application->isEmpty() ? $fee_application['theme'] : '';
|
||||
$data['approve_dept_name'] = $dept['name'];
|
||||
$data['pay_type_text'] = $data->pay_type_text;
|
||||
$data['cost_type_text'] = $data->cost_type_text;
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
@ -123,12 +123,14 @@
|
||||
|
||||
public function checkContract($value): bool|string
|
||||
{
|
||||
if (empty($value)) return true;
|
||||
$data = CostApprovedProject::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '合同信息不存在' : true;
|
||||
}
|
||||
|
||||
public function checkFeeApplication($value): bool|string
|
||||
{
|
||||
if (empty($value)) return true;
|
||||
$data = FinancialFeeApplication::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '费用申请信息不存在' : true;
|
||||
}
|
||||
|
@ -0,0 +1,141 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\financial\FinancialTravelReimbursement;
|
||||
use app\common\model\financial\FinancialTravelReimbursementDetail;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单--报销明细验证器
|
||||
* Class FinancialTravelReimbursementDetailValidate
|
||||
* @package app\adminapi\validate\financial
|
||||
*/
|
||||
class FinancialTravelReimbursementDetailValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|checkData',
|
||||
'travel_reimbursement_id' => 'require|checkTravelReimbursement',
|
||||
'dept_id' => 'require|checkDept',
|
||||
'date' => 'require|dateFormat:Y-m-d',
|
||||
'address' => 'require',
|
||||
'traffic_amount' => 'float|egt:0',
|
||||
'stay_amount' => 'float|egt:0',
|
||||
'stay_days' => 'integer|egt:0',
|
||||
'stay_price' => 'float|egt:0',
|
||||
'subsidy_days' => 'integer|egt:0',
|
||||
'subsidy_price' => 'float|egt:0',
|
||||
'subsidy_amount' => 'float|egt:0',
|
||||
'subsidy_deduction' => 'float|egt:0',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'travel_reimbursement_id' => '差旅报销id',
|
||||
'dept_id' => '费用归属部门',
|
||||
'date' => '起止日期',
|
||||
'address' => '起止地点',
|
||||
'traffic_amount' => '交通费',
|
||||
'stay_amount' => '住宿费',
|
||||
'stay_days' => '住宿天数',
|
||||
'stay_price' => '住宿单价',
|
||||
'subsidy_days' => '补助天数',
|
||||
'subsidy_price' => '补助标准',
|
||||
'subsidy_amount' => '补助金额',
|
||||
'subsidy_deduction' => '补贴减扣',
|
||||
'abstract' => '摘要',
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return FinancialTravelReimbursementDetailValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['travel_reimbursement_id', 'dept_id', 'date', 'address', 'traffic_amount', 'stay_amount', 'stay_days', 'stay_price', 'subsidy_days', 'subsidy_price', 'subsidy_amount', 'subsidy_deduction', 'abstract']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return FinancialTravelReimbursementDetailValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'travel_reimbursement_id', 'dept_id', 'date', 'address', 'traffic_amount', 'stay_amount', 'stay_days', 'stay_price', 'subsidy_days', 'subsidy_price', 'subsidy_amount', 'subsidy_deduction', 'abstract']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return FinancialTravelReimbursementDetailValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])->remove('id', 'checkData');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return FinancialTravelReimbursementDetailValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = FinancialTravelReimbursementDetail::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkTravelReimbursement($value): bool|string
|
||||
{
|
||||
$data = FinancialTravelReimbursement::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '差旅费报销单信息不存在' : true;
|
||||
}
|
||||
|
||||
public function checkDept($value): bool|string
|
||||
{
|
||||
$data = Dept::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '审批部门信息不存在' : true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,177 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\financial\FinancialFeeApplication;
|
||||
use app\common\model\financial\FinancialTravelReimbursement;
|
||||
use app\common\model\financial\FinancialTravelReimbursementDetail;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单验证器
|
||||
* Class FinancialTravelReimbursementValidate
|
||||
* @package app\adminapi\validate\financial
|
||||
*/
|
||||
class FinancialTravelReimbursementValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|checkData',
|
||||
'approve_dept' => 'require|checkDept',
|
||||
'cost_type' => 'require|checkCostType',
|
||||
'pay_type' => 'require|checkPayType',
|
||||
'tax_deductible_amount' => 'float|egt:0',
|
||||
'bill_num' => 'require|integer|egt:0',
|
||||
'fee_application_id' => 'checkFeeApplication',
|
||||
'create_user' => 'require',
|
||||
'create_time' => 'require|dateFormat:Y-m-d H:i:s',
|
||||
'detail' => 'checkDetail'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'code' => '单据编号',
|
||||
'approve_dept' => '审批部门',
|
||||
'cost_type' => '费用类别',
|
||||
'pay_type' => '支付方式',
|
||||
'tax_deductible_amount' => '可抵扣税额',
|
||||
'bill_num' => '附单据张数',
|
||||
'fee_application_id' => '关联费用申请',
|
||||
'content' => '事由',
|
||||
'create_user' => '申请人',
|
||||
'create_time' => '申请日期',
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return FinancialTravelReimbursementValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return FinancialTravelReimbursementValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id', 'approve_dept', 'cost_type', 'pay_type', 'tax_deductible_amount', 'bill_num', 'fee_application_id', 'content', 'create_user', 'create_time', 'detail']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return FinancialTravelReimbursementValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])->remove('id', 'checkData');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return FinancialTravelReimbursementValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/28 14:23
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = FinancialTravelReimbursement::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkDept($value): bool|string
|
||||
{
|
||||
$data = Dept::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '审批部门信息不存在' : true;
|
||||
}
|
||||
|
||||
public function checkCostType($value): bool|string
|
||||
{
|
||||
$dict = DictData::where('type_value', 'cost_type')->column('value');
|
||||
return !in_array($value, $dict) ? '费用类别数据值无效' : true;
|
||||
}
|
||||
|
||||
public function checkPayType($value): bool|string
|
||||
{
|
||||
$dict = DictData::where('type_value', 'financial_pay_type')->column('value');
|
||||
return !in_array($value, $dict) ? '支付方式数据值无效' : true;
|
||||
}
|
||||
|
||||
public function checkFeeApplication($value): bool|string
|
||||
{
|
||||
if (empty($value)) return true;
|
||||
$data = FinancialFeeApplication::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '费用申请信息不存在' : true;
|
||||
}
|
||||
|
||||
public function checkDetail($value): bool|string
|
||||
{
|
||||
if (empty($value) || $value == '') return true;
|
||||
if (!is_array($value)) return '报销明细数据格式错误';
|
||||
foreach ($value as $k => $v) {
|
||||
if (isset($v['id']) && !empty($v['id'])) {
|
||||
$data = FinancialTravelReimbursementDetail::where('id', $v['id'])->findOrEmpty();
|
||||
if ($data->isEmpty()) {
|
||||
return '第' . ($k + 1) . '行报销明细信息不存在';
|
||||
}
|
||||
}
|
||||
if (empty($v['dept_id'])) {
|
||||
return '第' . ($k + 1) . '行费用归属部门为空';
|
||||
} else {
|
||||
$dept = Dept::where('id', $v['dept_id'])->findOrEmpty();
|
||||
if ($dept->isEmpty()) return '第' . ($k + 1) . '行费用归属部门信息不存在';
|
||||
}
|
||||
if (empty($v['date'])) {
|
||||
return '第' . ($k + 1) . '行起止日期为空';
|
||||
}
|
||||
if (empty($v['address'])) {
|
||||
return '第' . ($k + 1) . '行起止地点为空';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -11,24 +11,30 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\financial;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--费用报销单模型
|
||||
* Class FinancialExpenseReimbursement
|
||||
* @package app\common\model\financial
|
||||
*/
|
||||
class FinancialExpenseReimbursement extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'financial_expense_reimbursement';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
||||
|
||||
namespace app\common\model\financial;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\dict\DictData;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--费用报销单模型
|
||||
* Class FinancialExpenseReimbursement
|
||||
* @package app\common\model\financial
|
||||
*/
|
||||
class FinancialExpenseReimbursement extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'financial_expense_reimbursement';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getPayTypeTextAttr($value, $data)
|
||||
{
|
||||
$dictDate = DictData::where('type_value', 'financial_pay_type')->column('name', 'value');
|
||||
return $dictDate[$data['pay_type']];
|
||||
}
|
||||
}
|
46
app/common/model/financial/FinancialTravelReimbursement.php
Normal file
46
app/common/model/financial/FinancialTravelReimbursement.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\dict\DictData;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单模型
|
||||
* Class FinancialTravelReimbursement
|
||||
* @package app\common\model\financial
|
||||
*/
|
||||
class FinancialTravelReimbursement extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'financial_travel_reimbursement';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getPayTypeTextAttr($value, $data)
|
||||
{
|
||||
$dictDate = DictData::where('type_value', 'financial_pay_type')->column('name', 'value');
|
||||
return $dictDate[$data['pay_type']];
|
||||
}
|
||||
|
||||
public function getCostTypeTextAttr($value, $data)
|
||||
{
|
||||
$dictDate = DictData::where('type_value', 'cost_type')->column('name', 'value');
|
||||
return $dictDate[$data['cost_type']];
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?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\financial;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 财务管理--差旅费报销单--报销明细模型
|
||||
* Class FinancialTravelReimbursementDetail
|
||||
* @package app\common\model\financial
|
||||
*/
|
||||
class FinancialTravelReimbursementDetail extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'financial_travel_reimbursement_detail';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getDateAttr($value)
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d', $value) : '';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user