113 lines
4.4 KiB
PHP
113 lines
4.4 KiB
PHP
<?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\auth\Admin;
|
||
use app\common\model\dept\Dept;
|
||
use app\common\model\financial\FinancialPerformanceMoneyApply;
|
||
use app\common\model\GeoCity;
|
||
use app\common\model\GeoProvince;
|
||
use app\common\model\marketing\MarketingContract;
|
||
use app\common\model\marketing\MarketingCustom;
|
||
|
||
|
||
/**
|
||
* 财务管理--履约金申请列表
|
||
* Class FinancialPerformanceMoneyApplyLists
|
||
* @package app\adminapi\listsfinancial
|
||
*/
|
||
class FinancialPerformanceMoneyApplyLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/04/13 17:24
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['contract_id'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取财务管理--履约金申请列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/04/13 17:24
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
$params = $this->request->get();
|
||
$where = [];
|
||
if (!empty($params['payment_date'])) {
|
||
$date = explode(',', $params['payment_date']);
|
||
$where[] = ['payment_date', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]];
|
||
}
|
||
return FinancialPerformanceMoneyApply::withoutField('update_time,delete_time')->where($this->searchWhere)->where($where)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function ($data) {
|
||
$contract = MarketingContract::field('contract_name,part_a,signed_amount,performance_money,performance_money_expiration_time,signed_dept,project_manager')->where('id', $data['contract_id'])->findOrEmpty();
|
||
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
|
||
$signed_dept = Dept::field('name')->where('id', $contract['signed_dept'])->findOrEmpty();
|
||
$project_manager = Admin::field('name')->where('id', $contract['project_manager'])->findOrEmpty();
|
||
$province = GeoProvince::field('province_name')->where('province_code', $data['province'])->findOrEmpty();
|
||
$city = GeoCity::field('city_name')->where('city_code', $data['city'])->findOrEmpty();
|
||
$pay_user = Admin::field('name')->where('id', $data['pay_user'])->findOrEmpty();
|
||
$data['contract_name'] = $contract?->contract_name;
|
||
$data['part_a'] = $part_a?->name;
|
||
$data['signed_amount'] = $contract?->signed_amount;
|
||
$data['performance_money'] = $contract?->performance_money;
|
||
$data['performance_money_expiration_time'] = $contract?->performance_money_expiration_time;
|
||
$data['signed_dept'] = $signed_dept?->name;
|
||
$data['project_manager'] = $project_manager?->name;
|
||
$data['province_name'] = $province?->province_name;
|
||
$data['city_name'] = $city?->city_name;
|
||
$data['pay_type_text'] = $data->pay_type_text;
|
||
$data['pay_user_name'] = $pay_user?->name;
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取财务管理--履约金申请数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/04/13 17:24
|
||
*/
|
||
public function count(): int
|
||
{
|
||
$params = $this->request->get();
|
||
$where = [];
|
||
if (!empty($params['payment_date'])) {
|
||
$date = explode(',', $params['payment_date']);
|
||
$where[] = ['payment_date', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]];
|
||
}
|
||
return FinancialPerformanceMoneyApply::where($this->searchWhere)->where($where)->count();
|
||
}
|
||
|
||
} |