update
This commit is contained in:
parent
ab005f90c1
commit
32b287b856
@ -11,136 +11,135 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | author: likeadminTeam
|
// | author: likeadminTeam
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\adminapi\lists\project;
|
|
||||||
|
|
||||||
|
|
||||||
use app\adminapi\lists\BaseAdminDataLists;
|
|
||||||
use app\common\lists\ListsExcelInterface;
|
|
||||||
use app\common\model\project\Project;
|
|
||||||
use app\common\model\project\ProjectExpenseReimbursement;
|
|
||||||
use app\common\model\project\ProjectExpenseReimbursementInvoiceDetail;
|
|
||||||
use app\common\lists\ListsSearchInterface;
|
|
||||||
use think\helper\Str;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发票明细列表
|
|
||||||
* Class ProjectExpenseReimbursementInvoiceDetailLists
|
|
||||||
* @package app\adminapi\listsproject
|
|
||||||
*/
|
|
||||||
class ProjectExpenseReimbursementInvoiceDetailLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 设置搜索条件
|
|
||||||
* @return \string[][]
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2024/01/19 13:44
|
|
||||||
*/
|
|
||||||
public function setSearch(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'=' => ['expense_reimbursement_id', 'invoice_type', 'invoice_form'],
|
|
||||||
'%like%' => ['invoice_sn'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 获取发票明细列表
|
|
||||||
* @return array
|
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
|
||||||
* @throws \think\db\exception\DbException
|
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2024/01/19 13:44
|
|
||||||
*/
|
|
||||||
public function lists(): array
|
|
||||||
{
|
|
||||||
$params = $this->request->get(['expense_reimbursement_code','project_code']);
|
|
||||||
$where = [];
|
|
||||||
if(isset($params['expense_reimbursement_code']) && $params['expense_reimbursement_code']){
|
|
||||||
$expense_reimbursement_ids = ProjectExpenseReimbursement::where('expense_reimbursement_code','like','%'.$params['expense_reimbursement_code'].'%')->column('id');
|
|
||||||
$where[] = ['expense_reimbursement_id','in',$expense_reimbursement_ids];
|
|
||||||
}
|
|
||||||
if(isset($params['project_code']) && $params['project_code']){
|
|
||||||
$project_ids = Project::where('project_code','like','%'.$params['project_code'].'%')->column('id');
|
|
||||||
$expense_reimbursement_ids = ProjectExpenseReimbursement::where('project_id','in',$project_ids)->column('id');
|
|
||||||
$where[] = ['expense_reimbursement_id','in',$expense_reimbursement_ids];
|
|
||||||
}
|
|
||||||
return ProjectExpenseReimbursementInvoiceDetail::where($this->searchWhere)->where($where)
|
|
||||||
->field(['id', 'expense_reimbursement_id', 'invoice_type', 'invoice_sn', 'tax_rate', 'invoice_form', 'invoice_amount', 'tax_amount', 'remark'])
|
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
|
||||||
->order(['id' => 'desc'])
|
|
||||||
->select()->each(function($data){
|
|
||||||
$expense_reimbursement = ProjectExpenseReimbursement::field('expense_reimbursement_code,project_id,apply_user,apply_date')->where('id',$data['expense_reimbursement_id'])->findOrEmpty();
|
|
||||||
$project = Project::field('name,project_code')->where('id',$expense_reimbursement['project_id'])->findOrEmpty();
|
|
||||||
$data['expense_reimbursement_code'] = $expense_reimbursement['expense_reimbursement_code'];
|
|
||||||
$data['project_name'] = $project['name'];
|
|
||||||
$data['project_code'] = $project['project_code'];
|
|
||||||
$data['apply_user'] = $expense_reimbursement['apply_user'];
|
|
||||||
$data['apply_date'] = $expense_reimbursement['apply_date'];
|
|
||||||
$data['invoice_type_text'] = $data->invoice_type_text;
|
|
||||||
$data['tax_rate_text'] = $data->tax_rate_text;
|
|
||||||
$data['invoice_form_text'] = $data->invoice_form_text;
|
|
||||||
$data['invoice_type'] = (string)$data['invoice_type'];
|
|
||||||
$data['tax_rate'] = (string)$data['tax_rate'];
|
|
||||||
$data['invoice_form'] = (string)$data['invoice_form'];
|
|
||||||
return $data;
|
|
||||||
})
|
|
||||||
->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 获取发票明细数量
|
|
||||||
* @return int
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2024/01/19 13:44
|
|
||||||
*/
|
|
||||||
public function count(): int
|
|
||||||
{
|
|
||||||
$params = $this->request->get(['expense_reimbursement_code','project_code']);
|
|
||||||
$where = [];
|
|
||||||
if(isset($params['expense_reimbursement_code']) && $params['expense_reimbursement_code']){
|
|
||||||
$expense_reimbursement_ids = ProjectExpenseReimbursement::where('expense_reimbursement_code','like','%'.$params['expense_reimbursement_code'].'%')->column('id');
|
|
||||||
$where[] = ['expense_reimbursement_id','in',$expense_reimbursement_ids];
|
|
||||||
}
|
|
||||||
if(isset($params['project_code']) && $params['project_code']){
|
|
||||||
$project_ids = Project::where('project_code','like','%'.$params['project_code'].'%')->column('id');
|
|
||||||
$expense_reimbursement_ids = ProjectExpenseReimbursement::where('project_id','in',$project_ids)->column('id');
|
|
||||||
$where[] = ['expense_reimbursement_id','in',$expense_reimbursement_ids];
|
|
||||||
}
|
|
||||||
return ProjectExpenseReimbursementInvoiceDetail::where($this->searchWhere)->where($where)->count();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setFileName(): string
|
namespace app\adminapi\lists\project;
|
||||||
{
|
|
||||||
return '费用报销发票明细列表';
|
|
||||||
}
|
use app\adminapi\lists\BaseAdminDataLists;
|
||||||
|
use app\common\lists\ListsExcelInterface;
|
||||||
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\project\Project;
|
||||||
|
use app\common\model\project\ProjectExpenseReimbursement;
|
||||||
|
use app\common\model\project\ProjectExpenseReimbursementInvoiceDetail;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 导出字段
|
* 发票明细列表
|
||||||
* @return string[]
|
* Class ProjectExpenseReimbursementInvoiceDetailLists
|
||||||
* @author 段誉
|
* @package app\adminapi\listsproject
|
||||||
* @date 2022/11/24 16:17
|
|
||||||
*/
|
*/
|
||||||
public function setExcelFields(): array
|
class ProjectExpenseReimbursementInvoiceDetailLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||||
{
|
{
|
||||||
return [
|
|
||||||
"id" => "id",
|
|
||||||
"project_name" => "项目名称",
|
/**
|
||||||
"expense_reimbursement_code" => "费用报销单号",
|
* @notes 设置搜索条件
|
||||||
"invoice_form_text" => "发票类型",
|
* @return \string[][]
|
||||||
"invoice_sn" => "发票号",
|
* @author likeadmin
|
||||||
"tax_rate_text" => "发票税率(%)",
|
* @date 2024/01/19 13:44
|
||||||
"invoice_type_text" => "发票形式",
|
*/
|
||||||
"invoice_amount" => "发票金额",
|
public function setSearch(): array
|
||||||
"tax_amount" => "发票税额",
|
{
|
||||||
"remark" => "发票备注",
|
return [
|
||||||
];
|
'=' => ['expense_reimbursement_id', 'invoice_type', 'invoice_form'],
|
||||||
}
|
'%like%' => ['invoice_sn'],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取发票明细列表
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/01/19 13:44
|
||||||
|
*/
|
||||||
|
public function lists(): array
|
||||||
|
{
|
||||||
|
$params = $this->request->get(['expense_reimbursement_code', 'project_code']);
|
||||||
|
$where = [];
|
||||||
|
if (isset($params['expense_reimbursement_code']) && $params['expense_reimbursement_code']) {
|
||||||
|
$expense_reimbursement_ids = ProjectExpenseReimbursement::where('expense_reimbursement_code', 'like', '%' . $params['expense_reimbursement_code'] . '%')->column('id');
|
||||||
|
$where[] = ['expense_reimbursement_id', 'in', $expense_reimbursement_ids];
|
||||||
|
}
|
||||||
|
if (isset($params['project_code']) && $params['project_code']) {
|
||||||
|
$project_ids = Project::where('project_code', 'like', '%' . $params['project_code'] . '%')->column('id');
|
||||||
|
$expense_reimbursement_ids = ProjectExpenseReimbursement::where('project_id', 'in', $project_ids)->column('id');
|
||||||
|
$where[] = ['expense_reimbursement_id', 'in', $expense_reimbursement_ids];
|
||||||
|
}
|
||||||
|
return ProjectExpenseReimbursementInvoiceDetail::where($this->searchWhere)->where($where)
|
||||||
|
->field(['id', 'expense_reimbursement_id', 'invoice_type', 'invoice_sn', 'tax_rate', 'invoice_form', 'invoice_amount', 'tax_amount', 'remark', 'annex'])
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()->each(function ($data) {
|
||||||
|
$expense_reimbursement = ProjectExpenseReimbursement::field('expense_reimbursement_code,project_id,apply_user,apply_date')->where('id', $data['expense_reimbursement_id'])->findOrEmpty();
|
||||||
|
$project = Project::field('name,project_code')->where('id', $expense_reimbursement['project_id'])->findOrEmpty();
|
||||||
|
$data['expense_reimbursement_code'] = $expense_reimbursement['expense_reimbursement_code'];
|
||||||
|
$data['project_name'] = $project['name'];
|
||||||
|
$data['project_code'] = $project['project_code'];
|
||||||
|
$data['apply_user'] = $expense_reimbursement['apply_user'];
|
||||||
|
$data['apply_date'] = $expense_reimbursement['apply_date'];
|
||||||
|
$data['invoice_type_text'] = $data->invoice_type_text;
|
||||||
|
$data['tax_rate_text'] = $data->tax_rate_text;
|
||||||
|
$data['invoice_form_text'] = $data->invoice_form_text;
|
||||||
|
$data['invoice_type'] = (string)$data['invoice_type'];
|
||||||
|
$data['tax_rate'] = (string)$data['tax_rate'];
|
||||||
|
$data['invoice_form'] = (string)$data['invoice_form'];
|
||||||
|
return $data;
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取发票明细数量
|
||||||
|
* @return int
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/01/19 13:44
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
$params = $this->request->get(['expense_reimbursement_code', 'project_code']);
|
||||||
|
$where = [];
|
||||||
|
if (isset($params['expense_reimbursement_code']) && $params['expense_reimbursement_code']) {
|
||||||
|
$expense_reimbursement_ids = ProjectExpenseReimbursement::where('expense_reimbursement_code', 'like', '%' . $params['expense_reimbursement_code'] . '%')->column('id');
|
||||||
|
$where[] = ['expense_reimbursement_id', 'in', $expense_reimbursement_ids];
|
||||||
|
}
|
||||||
|
if (isset($params['project_code']) && $params['project_code']) {
|
||||||
|
$project_ids = Project::where('project_code', 'like', '%' . $params['project_code'] . '%')->column('id');
|
||||||
|
$expense_reimbursement_ids = ProjectExpenseReimbursement::where('project_id', 'in', $project_ids)->column('id');
|
||||||
|
$where[] = ['expense_reimbursement_id', 'in', $expense_reimbursement_ids];
|
||||||
|
}
|
||||||
|
return ProjectExpenseReimbursementInvoiceDetail::where($this->searchWhere)->where($where)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFileName(): string
|
||||||
|
{
|
||||||
|
return '费用报销发票明细列表';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 导出字段
|
||||||
|
* @return string[]
|
||||||
|
* @author 段誉
|
||||||
|
* @date 2022/11/24 16:17
|
||||||
|
*/
|
||||||
|
public function setExcelFields(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
"id" => "id",
|
||||||
|
"project_name" => "项目名称",
|
||||||
|
"expense_reimbursement_code" => "费用报销单号",
|
||||||
|
"invoice_form_text" => "发票类型",
|
||||||
|
"invoice_sn" => "发票号",
|
||||||
|
"tax_rate_text" => "发票税率(%)",
|
||||||
|
"invoice_type_text" => "发票形式",
|
||||||
|
"invoice_amount" => "发票金额",
|
||||||
|
"tax_amount" => "发票税额",
|
||||||
|
"remark" => "发票备注",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -11,147 +11,147 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | author: likeadminTeam
|
// | author: likeadminTeam
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\adminapi\lists\project;
|
|
||||||
|
|
||||||
|
|
||||||
use app\adminapi\lists\BaseAdminDataLists;
|
|
||||||
use app\common\lists\ListsExcelInterface;
|
|
||||||
use app\common\model\project\Project;
|
|
||||||
use app\common\model\project\ProjectTravelReimbursement;
|
|
||||||
use app\common\model\project\ProjectTravelReimbursementInvoiceDetail;
|
|
||||||
use app\common\lists\ListsSearchInterface;
|
|
||||||
use app\common\model\project\ProjectTripApply;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发票明细列表
|
|
||||||
* Class ProjectTravelReimbursementInvoiceDetailLists
|
|
||||||
* @package app\adminapi\listsproject
|
|
||||||
*/
|
|
||||||
class ProjectTravelReimbursementInvoiceDetailLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 设置搜索条件
|
|
||||||
* @return \string[][]
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2024/01/18 13:57
|
|
||||||
*/
|
|
||||||
public function setSearch(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'=' => ['travel_reimbursement_id', 'invoice_type', 'invoice_form'],
|
|
||||||
'%like%' => ['invoice_sn']
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 获取发票明细列表
|
|
||||||
* @return array
|
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
|
||||||
* @throws \think\db\exception\DbException
|
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2024/01/18 13:57
|
|
||||||
*/
|
|
||||||
public function lists(): array
|
|
||||||
{
|
|
||||||
$params = $this->request->get(['trip_reimbursement_code','project_code','trip_apply_code']);
|
|
||||||
$where = [];
|
|
||||||
if(isset($params['trip_reimbursement_code']) && $params['trip_reimbursement_code']){
|
|
||||||
$travel_reimbursement_ids = ProjectTravelReimbursement::where('trip_reimbursement_code','like','%'.$params['trip_reimbursement_code'].'%')->column('id');
|
|
||||||
$where[] = ['travel_reimbursement_id','in',$travel_reimbursement_ids];
|
|
||||||
}
|
|
||||||
if(isset($params['project_code']) && $params['project_code']){
|
|
||||||
$project_ids = Project::where('project_code','like','%'.$params['project_code'].'%')->column('id');
|
|
||||||
$travel_reimbursement_ids = ProjectTravelReimbursement::where('project_id','in',$project_ids)->column('id');
|
|
||||||
$where[] = ['travel_reimbursement_id','in',$travel_reimbursement_ids];
|
|
||||||
}
|
|
||||||
if(isset($params['trip_apply_code']) && $params['trip_apply_code']){
|
|
||||||
$trip_apply_ids = ProjectTripApply::where('trip_apply_code','like','%'.$params['trip_apply_code'].'%')->column('id');
|
|
||||||
$travel_reimbursement_ids = ProjectTravelReimbursement::where('trip_apply_id','in',$trip_apply_ids)->column('id');
|
|
||||||
$where[] = ['travel_reimbursement_id','in',$travel_reimbursement_ids];
|
|
||||||
}
|
|
||||||
return ProjectTravelReimbursementInvoiceDetail::where($this->searchWhere)->where($where)
|
|
||||||
->field(['id', 'travel_reimbursement_id', 'invoice_type', 'invoice_sn', 'tax_rate', 'invoice_form', 'invoice_amount', 'tax_amount', 'remark'])
|
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
|
||||||
->order(['id' => 'desc'])
|
|
||||||
->select()->each(function($data){
|
|
||||||
$travel_reimbursement = ProjectTravelReimbursement::field('trip_reimbursement_code,trip_apply_id,project_id,apply_user,apply_date')->where('id',$data['travel_reimbursement_id'])->findOrEmpty();
|
|
||||||
$trip_apply = ProjectTripApply::field('trip_apply_code')->where('id',$travel_reimbursement['trip_apply_id'])->findOrEmpty();
|
|
||||||
$project = Project::field('name,project_code')->where('id',$travel_reimbursement['project_id'])->findOrEmpty();
|
|
||||||
$data['trip_apply_code'] = $trip_apply['trip_apply_code'];
|
|
||||||
$data['project_name'] = $project['name'];
|
|
||||||
$data['project_code'] = $project['project_code'];
|
|
||||||
$data['trip_reimbursement_code'] = $travel_reimbursement['trip_reimbursement_code'];
|
|
||||||
$data['apply_user'] = $travel_reimbursement['apply_user'];
|
|
||||||
$data['apply_date'] = $travel_reimbursement['apply_date'];
|
|
||||||
$data['invoice_type_text'] = $data->invoice_type_text;
|
|
||||||
$data['tax_rate_text'] = $data->tax_rate_text;
|
|
||||||
$data['invoice_form_text'] = $data->invoice_form_text;
|
|
||||||
$data['invoice_type'] = (string)$data['invoice_type'];
|
|
||||||
$data['tax_rate'] = (string)$data['tax_rate'];
|
|
||||||
$data['invoice_form'] = (string)$data['invoice_form'];
|
|
||||||
return $data;
|
|
||||||
})
|
|
||||||
->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 获取发票明细数量
|
|
||||||
* @return int
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2024/01/18 13:57
|
|
||||||
*/
|
|
||||||
public function count(): int
|
|
||||||
{
|
|
||||||
$params = $this->request->get(['trip_reimbursement_code','project_code','trip_apply_code']);
|
|
||||||
$where = [];
|
|
||||||
if(isset($params['trip_reimbursement_code']) && $params['trip_reimbursement_code']){
|
|
||||||
$travel_reimbursement_ids = ProjectTravelReimbursement::where('trip_reimbursement_code','like','%'.$params['trip_reimbursement_code'].'%')->column('id');
|
|
||||||
$where[] = ['travel_reimbursement_id','in',$travel_reimbursement_ids];
|
|
||||||
}
|
|
||||||
if(isset($params['project_code']) && $params['project_code']){
|
|
||||||
$project_ids = Project::where('project_code','like','%'.$params['project_code'].'%')->column('id');
|
|
||||||
$travel_reimbursement_ids = ProjectTravelReimbursement::where('project_id','in',$project_ids)->column('id');
|
|
||||||
$where[] = ['travel_reimbursement_id','in',$travel_reimbursement_ids];
|
|
||||||
}
|
|
||||||
if(isset($params['trip_apply_code']) && $params['trip_apply_code']){
|
|
||||||
$trip_apply_ids = ProjectTripApply::where('trip_apply_code','like','%'.$params['trip_apply_code'].'%')->column('id');
|
|
||||||
$travel_reimbursement_ids = ProjectTravelReimbursement::where('trip_apply_id','in',$trip_apply_ids)->column('id');
|
|
||||||
$where[] = ['travel_reimbursement_id','in',$travel_reimbursement_ids];
|
|
||||||
}
|
|
||||||
return ProjectTravelReimbursementInvoiceDetail::where($this->searchWhere)->where($where)->count();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setFileName(): string
|
namespace app\adminapi\lists\project;
|
||||||
{
|
|
||||||
return '差旅报销发票明细列表';
|
|
||||||
}
|
use app\adminapi\lists\BaseAdminDataLists;
|
||||||
|
use app\common\lists\ListsExcelInterface;
|
||||||
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\project\Project;
|
||||||
|
use app\common\model\project\ProjectTravelReimbursement;
|
||||||
|
use app\common\model\project\ProjectTravelReimbursementInvoiceDetail;
|
||||||
|
use app\common\model\project\ProjectTripApply;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 导出字段
|
* 发票明细列表
|
||||||
* @return string[]
|
* Class ProjectTravelReimbursementInvoiceDetailLists
|
||||||
* @author 段誉
|
* @package app\adminapi\listsproject
|
||||||
* @date 2022/11/24 16:17
|
|
||||||
*/
|
*/
|
||||||
public function setExcelFields(): array
|
class ProjectTravelReimbursementInvoiceDetailLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||||
{
|
{
|
||||||
return [
|
|
||||||
"id" => "id",
|
|
||||||
"trip_reimbursement_code" => "差旅报销单号",
|
/**
|
||||||
"invoice_type_text" => "发票类型",
|
* @notes 设置搜索条件
|
||||||
"invoice_sn" => "发票号",
|
* @return \string[][]
|
||||||
"tax_rate_text" => "发票税率(%)",
|
* @author likeadmin
|
||||||
"invoice_form_text" => "发票形式",
|
* @date 2024/01/18 13:57
|
||||||
"invoice_amount" => "发票金额",
|
*/
|
||||||
"tax_amount" => "发票税额",
|
public function setSearch(): array
|
||||||
"remark" => "发票备注",
|
{
|
||||||
];
|
return [
|
||||||
}
|
'=' => ['travel_reimbursement_id', 'invoice_type', 'invoice_form'],
|
||||||
|
'%like%' => ['invoice_sn']
|
||||||
}
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取发票明细列表
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/01/18 13:57
|
||||||
|
*/
|
||||||
|
public function lists(): array
|
||||||
|
{
|
||||||
|
$params = $this->request->get(['trip_reimbursement_code', 'project_code', 'trip_apply_code']);
|
||||||
|
$where = [];
|
||||||
|
if (isset($params['trip_reimbursement_code']) && $params['trip_reimbursement_code']) {
|
||||||
|
$travel_reimbursement_ids = ProjectTravelReimbursement::where('trip_reimbursement_code', 'like', '%' . $params['trip_reimbursement_code'] . '%')->column('id');
|
||||||
|
$where[] = ['travel_reimbursement_id', 'in', $travel_reimbursement_ids];
|
||||||
|
}
|
||||||
|
if (isset($params['project_code']) && $params['project_code']) {
|
||||||
|
$project_ids = Project::where('project_code', 'like', '%' . $params['project_code'] . '%')->column('id');
|
||||||
|
$travel_reimbursement_ids = ProjectTravelReimbursement::where('project_id', 'in', $project_ids)->column('id');
|
||||||
|
$where[] = ['travel_reimbursement_id', 'in', $travel_reimbursement_ids];
|
||||||
|
}
|
||||||
|
if (isset($params['trip_apply_code']) && $params['trip_apply_code']) {
|
||||||
|
$trip_apply_ids = ProjectTripApply::where('trip_apply_code', 'like', '%' . $params['trip_apply_code'] . '%')->column('id');
|
||||||
|
$travel_reimbursement_ids = ProjectTravelReimbursement::where('trip_apply_id', 'in', $trip_apply_ids)->column('id');
|
||||||
|
$where[] = ['travel_reimbursement_id', 'in', $travel_reimbursement_ids];
|
||||||
|
}
|
||||||
|
return ProjectTravelReimbursementInvoiceDetail::where($this->searchWhere)->where($where)
|
||||||
|
->field(['id', 'travel_reimbursement_id', 'invoice_type', 'invoice_sn', 'tax_rate', 'invoice_form', 'invoice_amount', 'tax_amount', 'remark', 'annex'])
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()->each(function ($data) {
|
||||||
|
$travel_reimbursement = ProjectTravelReimbursement::field('trip_reimbursement_code,trip_apply_id,project_id,apply_user,apply_date')->where('id', $data['travel_reimbursement_id'])->findOrEmpty();
|
||||||
|
$trip_apply = ProjectTripApply::field('trip_apply_code')->where('id', $travel_reimbursement['trip_apply_id'])->findOrEmpty();
|
||||||
|
$project = Project::field('name,project_code')->where('id', $travel_reimbursement['project_id'])->findOrEmpty();
|
||||||
|
$data['trip_apply_code'] = $trip_apply['trip_apply_code'];
|
||||||
|
$data['project_name'] = $project['name'];
|
||||||
|
$data['project_code'] = $project['project_code'];
|
||||||
|
$data['trip_reimbursement_code'] = $travel_reimbursement['trip_reimbursement_code'];
|
||||||
|
$data['apply_user'] = $travel_reimbursement['apply_user'];
|
||||||
|
$data['apply_date'] = $travel_reimbursement['apply_date'];
|
||||||
|
$data['invoice_type_text'] = $data->invoice_type_text;
|
||||||
|
$data['tax_rate_text'] = $data->tax_rate_text;
|
||||||
|
$data['invoice_form_text'] = $data->invoice_form_text;
|
||||||
|
$data['invoice_type'] = (string)$data['invoice_type'];
|
||||||
|
$data['tax_rate'] = (string)$data['tax_rate'];
|
||||||
|
$data['invoice_form'] = (string)$data['invoice_form'];
|
||||||
|
return $data;
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取发票明细数量
|
||||||
|
* @return int
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/01/18 13:57
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
$params = $this->request->get(['trip_reimbursement_code', 'project_code', 'trip_apply_code']);
|
||||||
|
$where = [];
|
||||||
|
if (isset($params['trip_reimbursement_code']) && $params['trip_reimbursement_code']) {
|
||||||
|
$travel_reimbursement_ids = ProjectTravelReimbursement::where('trip_reimbursement_code', 'like', '%' . $params['trip_reimbursement_code'] . '%')->column('id');
|
||||||
|
$where[] = ['travel_reimbursement_id', 'in', $travel_reimbursement_ids];
|
||||||
|
}
|
||||||
|
if (isset($params['project_code']) && $params['project_code']) {
|
||||||
|
$project_ids = Project::where('project_code', 'like', '%' . $params['project_code'] . '%')->column('id');
|
||||||
|
$travel_reimbursement_ids = ProjectTravelReimbursement::where('project_id', 'in', $project_ids)->column('id');
|
||||||
|
$where[] = ['travel_reimbursement_id', 'in', $travel_reimbursement_ids];
|
||||||
|
}
|
||||||
|
if (isset($params['trip_apply_code']) && $params['trip_apply_code']) {
|
||||||
|
$trip_apply_ids = ProjectTripApply::where('trip_apply_code', 'like', '%' . $params['trip_apply_code'] . '%')->column('id');
|
||||||
|
$travel_reimbursement_ids = ProjectTravelReimbursement::where('trip_apply_id', 'in', $trip_apply_ids)->column('id');
|
||||||
|
$where[] = ['travel_reimbursement_id', 'in', $travel_reimbursement_ids];
|
||||||
|
}
|
||||||
|
return ProjectTravelReimbursementInvoiceDetail::where($this->searchWhere)->where($where)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFileName(): string
|
||||||
|
{
|
||||||
|
return '差旅报销发票明细列表';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 导出字段
|
||||||
|
* @return string[]
|
||||||
|
* @author 段誉
|
||||||
|
* @date 2022/11/24 16:17
|
||||||
|
*/
|
||||||
|
public function setExcelFields(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
"id" => "id",
|
||||||
|
"trip_reimbursement_code" => "差旅报销单号",
|
||||||
|
"invoice_type_text" => "发票类型",
|
||||||
|
"invoice_sn" => "发票号",
|
||||||
|
"tax_rate_text" => "发票税率(%)",
|
||||||
|
"invoice_form_text" => "发票形式",
|
||||||
|
"invoice_amount" => "发票金额",
|
||||||
|
"tax_amount" => "发票税额",
|
||||||
|
"remark" => "发票备注",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user