134 lines
4.7 KiB
PHP
134 lines
4.7 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\finance;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\lists\ListsExcelInterface;
|
||
use app\common\model\contract\ProcurementContract;
|
||
use app\common\model\contract\SubcontractingContract;
|
||
use app\common\model\finance\FinancePaymentApply;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use app\common\model\finance\FinancePaymentPlan;
|
||
use app\common\model\project\Project;
|
||
use app\common\model\supplier\Supplier;
|
||
use think\facade\Db;
|
||
|
||
|
||
/**
|
||
* FinancePaymentApply列表
|
||
* Class FinancePaymentApplyLists
|
||
* @package app\adminapi\listsfinance
|
||
*/
|
||
class FinancePaymentApplyLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2023/12/15 13:47
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['supplier_id', 'project_id', 'contract_type', 'contract_id', 'payment_plan_id', 'payment_nature', 'pay_type', 'invoice_status'],
|
||
'%like%' => ['apply_user']
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2023/12/15 13:47
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
return FinancePaymentApply::where($this->searchWhere)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function($data){
|
||
$data['payment_nature_text'] = $data->payment_nature_text;
|
||
$data['pay_type_text'] = $data->pay_type_text;
|
||
$data['invoice_status_text'] = $data->invoice_status_text;
|
||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id',$data['supplier_id'])->findOrEmpty();
|
||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||
$finance_payment_plan = FinancePaymentPlan::field('period')->where('id',$data['finance_payment_plan_id'])->findOrEmpty();
|
||
$data['supplier_name'] = $supplier['supplier_name'];
|
||
$data['supplier_code'] = $supplier['supplier_code'];
|
||
$data['project_name'] = $project['name'];
|
||
$data['project_code'] = $project['project_code'];
|
||
$data['contract_type_text'] = $data->contract_type_text;
|
||
if($data['contract_type'] == 1){
|
||
$contract = ProcurementContract::field('contract_no,contract_name')->where('id',$data['contract_id'])->findOrEmpty();
|
||
}else{
|
||
$contract = SubcontractingContract::field('contract_no,contract_name')->where('id',$data['contract_id'])->findOrEmpty();
|
||
}
|
||
$data['contract_no'] = $contract['contract_no'];
|
||
$data['contract_name'] = $contract['contract_name'];
|
||
$data['period'] = $finance_payment_plan->period_text;
|
||
return $data;
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2023/12/15 13:47
|
||
*/
|
||
public function count(): int
|
||
{
|
||
return FinancePaymentApply::where($this->searchWhere)->count();
|
||
}
|
||
|
||
public function setFileName(): string
|
||
{
|
||
return '付款申请列表';
|
||
}
|
||
|
||
/**
|
||
* @notes 导出字段
|
||
* @return string[]
|
||
* @author 段誉
|
||
* @date 2022/11/24 16:17
|
||
*/
|
||
public function setExcelFields(): array
|
||
{
|
||
return [
|
||
"id" => "id",
|
||
"payment_apply_code" => "付款单号",
|
||
"supplier_name" => "供应商名称",
|
||
"project_name" => "项目名称",
|
||
"contract_no" => "合同编号",
|
||
"pay_date" => "付款日期",
|
||
"amount" => "付款金额",
|
||
"pay_type_text" => "付款方式",
|
||
"payment_nature_text" => "付款性质",
|
||
"period" => "期次",
|
||
"apply_user" => "申请人",
|
||
"remark" => "备注",
|
||
];
|
||
}
|
||
|
||
} |