update
This commit is contained in:
parent
273849ec62
commit
3286e65cb8
@ -11,134 +11,135 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* 投标决策列表
|
||||
* Class BidBiddingDecisionLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
class BidBiddingDecisionLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:14
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'bidding_project_fund_source', 'bid_type', 'is_margin'],
|
||||
'%like%' => ['code']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取投标决策列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:14
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['project_name','custom_name']);
|
||||
$where = [];
|
||||
if(isset($params['custom_name']) && $params['custom_name'] != ''){
|
||||
$custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id');
|
||||
$project_ids = Project::where('custom_id','in',$custom_ids)->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return BidBiddingDecision::where($this->searchWhere)->where($where)->limit($this->limitOffset, $this->limitLength)
|
||||
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* 投标决策列表
|
||||
* Class BidBiddingDecisionLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
class BidBiddingDecisionLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:14
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'bidding_project_fund_source', 'bid_type', 'is_margin'],
|
||||
'%like%' => ['code']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取投标决策列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:14
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['project_name', 'custom_name']);
|
||||
$where = [];
|
||||
if (isset($params['custom_name']) && $params['custom_name'] != '') {
|
||||
$custom_ids = Custom::where('name', 'like', '%' . $params['custom_name'] . '%')->column('id');
|
||||
$project_ids = Project::where('custom_id', 'in', $custom_ids)->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return BidBiddingDecision::where($this->searchWhere)->where($where)->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('id,name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['custom_id'] = $custom['id'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$item['bidding_project_fund_source'] = $item->bidding_project_fund_source_text;
|
||||
$item['bid_type'] = $item->bid_type_text;
|
||||
$item['is_margin'] = $item->is_margin_text;
|
||||
$item['is_internal_resources'] = $item->is_internal_resources_text;
|
||||
$item['project_assurance'] = $item->project_assurance_text;
|
||||
unset($item['delete_time']);
|
||||
return $item;
|
||||
->select()->each(function ($item) {
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $item['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('id,name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['custom_id'] = $custom['id'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$item['bidding_project_fund_source'] = $item->bidding_project_fund_source_text;
|
||||
$item['bid_type'] = $item->bid_type_text;
|
||||
$item['is_margin'] = $item->is_margin_text;
|
||||
$item['is_internal_resources'] = $item->is_internal_resources_text;
|
||||
$item['project_assurance'] = $item->project_assurance_text;
|
||||
$item['approve_check_status_text'] = $item->approve_check_status_text;
|
||||
unset($item['delete_time']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取投标决策数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:14
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['project_name','custom_name']);
|
||||
$where = [];
|
||||
if(isset($params['custom_name']) && $params['custom_name'] != ''){
|
||||
$custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id');
|
||||
$project_ids = Project::where('custom_id','in',$custom_ids)->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return BidBiddingDecision::where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出文件名
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '投标决策列表';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'id',
|
||||
'code' => '投标决策编码',
|
||||
'custom_name' => '客户名称',
|
||||
'project_name' => '项目名称',
|
||||
'project_estimation' => '项目估算',
|
||||
'bidding_project_fund_source' => '资金来源',
|
||||
'bidding_time' => '投标时间',
|
||||
'bid_type' => '招标方式',
|
||||
'competitor' => '竞争对手',
|
||||
'margin_amount' => '保证金金额',
|
||||
'bid_opening_date' => '开标日期',
|
||||
'margin_amount_return_date' => '保证金退还时间',
|
||||
'is_internal_resources' => '有无内部资源',
|
||||
'project_assurance' => '项目把握度',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取投标决策数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:14
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['project_name', 'custom_name']);
|
||||
$where = [];
|
||||
if (isset($params['custom_name']) && $params['custom_name'] != '') {
|
||||
$custom_ids = Custom::where('name', 'like', '%' . $params['custom_name'] . '%')->column('id');
|
||||
$project_ids = Project::where('custom_id', 'in', $custom_ids)->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return BidBiddingDecision::where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出文件名
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '投标决策列表';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'id',
|
||||
'code' => '投标决策编码',
|
||||
'custom_name' => '客户名称',
|
||||
'project_name' => '项目名称',
|
||||
'project_estimation' => '项目估算',
|
||||
'bidding_project_fund_source' => '资金来源',
|
||||
'bidding_time' => '投标时间',
|
||||
'bid_type' => '招标方式',
|
||||
'competitor' => '竞争对手',
|
||||
'margin_amount' => '保证金金额',
|
||||
'bid_opening_date' => '开标日期',
|
||||
'margin_amount_return_date' => '保证金退还时间',
|
||||
'is_internal_resources' => '有无内部资源',
|
||||
'project_assurance' => '项目把握度',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,140 +11,141 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* 购买标书列表
|
||||
* Class BidBuyBiddingDocumentLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
class BidBuyBiddingDocumentLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['bid_document_no', 'invite_tenders_company_name', 'bid_company_name'],
|
||||
'=' => ['project_id']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取购买标书列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(isset($params['custom_name']) && $params['custom_name'] != ''){
|
||||
$custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id');
|
||||
$project_ids = Project::where('custom_id','in',$custom_ids)->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
if(isset($params['bid_decision_code']) && $params['bid_decision_code'] != ''){
|
||||
$bid_decision_ids = BidBiddingDecision::where('code','like','%'.$params['bid_decision_code'].'%')->column('id');
|
||||
$where[] = ['bid_decision_id','in',$bid_decision_ids];
|
||||
}
|
||||
return BidBuyBiddingDocument::field('id,project_id,bid_decision_id,bid_document_no,invite_tenders_company_name,bid_company_name,buyer,amount,buy_date')
|
||||
->where($this->searchWhere)->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$bid_decision = BidBiddingDecision::field('code,bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount')->where('id',$item['bid_decision_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id',$item['buyer'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$item['bid_decision_code'] = $bid_decision['code'];
|
||||
$item['buyer'] = $admin['name'];
|
||||
$item['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$item['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text;
|
||||
$item['bid_type'] = $bid_decision->bid_type_text;
|
||||
$item['is_margin'] = $bid_decision->is_margin_text;
|
||||
$item['margin_amount'] = $bid_decision['margin_amount'];
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取购买标书数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(isset($params['custom_name']) && $params['custom_name'] != ''){
|
||||
$custom_ids = Custom::where('name','like','%'.$params['custom_name'].'%')->column('id');
|
||||
$project_ids = Project::where('custom_id','in',$custom_ids)->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
if(isset($params['bid_decision_code']) && $params['bid_decision_code'] != ''){
|
||||
$bid_decision_ids = BidBiddingDecision::where('code','like','%'.$params['bid_decision_code'].'%')->column('id');
|
||||
$where[] = ['bid_decision_id','in',$bid_decision_ids];
|
||||
}
|
||||
return BidBuyBiddingDocument::where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '购买标书列表';
|
||||
}
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 购买标书列表
|
||||
* Class BidBuyBiddingDocumentLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class BidBuyBiddingDocumentLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
'id' => 'id',
|
||||
'bid_decision_code' => '投标决策编码',
|
||||
'custom_name' => '客户名称',
|
||||
'project_name' => '项目名称',
|
||||
'bid_document_no' => '标书编号',
|
||||
'invite_tenders_company_name' => '招标公司名称',
|
||||
'bid_company_name' => '投标公司名称',
|
||||
'buyer' => '购买人员',
|
||||
'amount' => '购买标书金额',
|
||||
'bidding_project_fund_source' => '招标项目资金来源',
|
||||
'bidding_time' => '投标时间',
|
||||
'buy_date' => '购买标书时间',
|
||||
'bid_type' => '招标方式',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['bid_document_no', 'invite_tenders_company_name', 'bid_company_name'],
|
||||
'=' => ['project_id']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取购买标书列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if (isset($params['custom_name']) && $params['custom_name'] != '') {
|
||||
$custom_ids = Custom::where('name', 'like', '%' . $params['custom_name'] . '%')->column('id');
|
||||
$project_ids = Project::where('custom_id', 'in', $custom_ids)->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
if (isset($params['bid_decision_code']) && $params['bid_decision_code'] != '') {
|
||||
$bid_decision_ids = BidBiddingDecision::where('code', 'like', '%' . $params['bid_decision_code'] . '%')->column('id');
|
||||
$where[] = ['bid_decision_id', 'in', $bid_decision_ids];
|
||||
}
|
||||
return BidBuyBiddingDocument::field('id,project_id,bid_decision_id,bid_document_no,invite_tenders_company_name,bid_company_name,buyer,amount,buy_date')
|
||||
->where($this->searchWhere)->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) {
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $item['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$bid_decision = BidBiddingDecision::field('code,bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount')->where('id', $item['bid_decision_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id', $item['buyer'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$item['bid_decision_code'] = $bid_decision['code'];
|
||||
$item['buyer'] = $admin['name'];
|
||||
$item['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$item['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text;
|
||||
$item['bid_type'] = $bid_decision->bid_type_text;
|
||||
$item['is_margin'] = $bid_decision->is_margin_text;
|
||||
$item['margin_amount'] = $bid_decision['margin_amount'];
|
||||
$item['approve_check_status_text'] = $item->approve_check_status_text;
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取购买标书数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if (isset($params['custom_name']) && $params['custom_name'] != '') {
|
||||
$custom_ids = Custom::where('name', 'like', '%' . $params['custom_name'] . '%')->column('id');
|
||||
$project_ids = Project::where('custom_id', 'in', $custom_ids)->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
if (isset($params['bid_decision_code']) && $params['bid_decision_code'] != '') {
|
||||
$bid_decision_ids = BidBiddingDecision::where('code', 'like', '%' . $params['bid_decision_code'] . '%')->column('id');
|
||||
$where[] = ['bid_decision_id', 'in', $bid_decision_ids];
|
||||
}
|
||||
return BidBuyBiddingDocument::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',
|
||||
'bid_decision_code' => '投标决策编码',
|
||||
'custom_name' => '客户名称',
|
||||
'project_name' => '项目名称',
|
||||
'bid_document_no' => '标书编号',
|
||||
'invite_tenders_company_name' => '招标公司名称',
|
||||
'bid_company_name' => '投标公司名称',
|
||||
'buyer' => '购买人员',
|
||||
'amount' => '购买标书金额',
|
||||
'bidding_project_fund_source' => '招标项目资金来源',
|
||||
'bidding_time' => '投标时间',
|
||||
'buy_date' => '购买标书时间',
|
||||
'bid_type' => '招标方式',
|
||||
];
|
||||
}
|
||||
}
|
@ -11,136 +11,137 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\bid\BidDocumentExaminationDetail;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* 标书审查列表
|
||||
* Class BidDocumentExaminationLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
class BidDocumentExaminationLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['code']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取标书审查列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['bid_document_no','project_name']);
|
||||
$where = [];
|
||||
if(isset($params['bid_document_no']) && $params['bid_document_no'] != ''){
|
||||
$bid_doc_ids = BidBuyBiddingDocument::where('bid_document_no','like','%'.$params['bid_document_no'].'%')->column('id');
|
||||
$where[] = ['buy_bidding_document_id','in',$bid_doc_ids];
|
||||
}
|
||||
$field = 'id,code,project_id,buy_bidding_document_id';
|
||||
return BidDocumentExamination::where($this->searchWhere)->where($where)
|
||||
->field($field)->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$bid_buy_doc = BidBuyBiddingDocument::field('bid_decision_id,bid_document_no,invite_tenders_company_name,bid_company_name,buyer,buy_date')->where('id',$item['buy_bidding_document_id'])->findOrEmpty();
|
||||
$bid_decision = BidBiddingDecision::field('bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount,bid_opening_date')->where('id',$bid_buy_doc['bid_decision_id'])->findOrEmpty();
|
||||
$buyer = Admin::field('name')->where('id',$bid_buy_doc['buyer'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$item['bid_document_no'] = $bid_buy_doc['bid_document_no'];
|
||||
$item['invite_tenders_company_name'] = $bid_buy_doc['invite_tenders_company_name'];
|
||||
$item['bid_company_name'] = $bid_buy_doc['bid_company_name'];
|
||||
$item['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text;
|
||||
$item['buyer'] = $buyer['name'];
|
||||
$item['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$item['bid_type'] = $bid_decision->bid_type_text;
|
||||
$item['is_margin'] = $bid_decision->is_margin_text;
|
||||
$item['margin_amount'] = $bid_decision['margin_amount'];
|
||||
$item['bid_opening_date'] = $bid_decision['bid_opening_date'];
|
||||
$item['total_amount'] = BidDocumentExaminationDetail::where('bid_document_examination_id',$item['id'])->sum('sale_amount');
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取标书审查数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['bid_document_no','project_name']);
|
||||
$where = [];
|
||||
if(isset($params['bid_document_no']) && $params['bid_document_no'] != ''){
|
||||
$bid_doc_ids = BidBuyBiddingDocument::where('bid_document_no','like','%'.$params['bid_document_no'].'%')->column('id');
|
||||
$where[] = ['buy_bidding_document_id','in',$bid_doc_ids];
|
||||
}
|
||||
return BidDocumentExamination::field('id')->where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '标书审查列表';
|
||||
}
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\bid\BidDocumentExaminationDetail;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 标书审查列表
|
||||
* Class BidDocumentExaminationLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class BidDocumentExaminationLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
'id' => 'id',
|
||||
'code' => '审查编号',
|
||||
'bid_document_no' => '标书编号',
|
||||
'project_name' => '项目名称',
|
||||
'invite_tenders_company_name' => '招标公司名称',
|
||||
'bid_company_name' => '投标公司名称',
|
||||
'bidding_project_fund_source' => '招标项目资金来源',
|
||||
'is_margin' => '是否需要保证金',
|
||||
'margin_amount' => '保证金金额',
|
||||
'bid_opening_date' => '开标日期',
|
||||
'total_amount' => '总金额',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['code']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取标书审查列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['bid_document_no', 'project_name']);
|
||||
$where = [];
|
||||
if (isset($params['bid_document_no']) && $params['bid_document_no'] != '') {
|
||||
$bid_doc_ids = BidBuyBiddingDocument::where('bid_document_no', 'like', '%' . $params['bid_document_no'] . '%')->column('id');
|
||||
$where[] = ['buy_bidding_document_id', 'in', $bid_doc_ids];
|
||||
}
|
||||
$field = 'id,code,project_id,buy_bidding_document_id';
|
||||
return BidDocumentExamination::where($this->searchWhere)->where($where)
|
||||
->field($field)->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) {
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $item['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$bid_buy_doc = BidBuyBiddingDocument::field('bid_decision_id,bid_document_no,invite_tenders_company_name,bid_company_name,buyer,buy_date')->where('id', $item['buy_bidding_document_id'])->findOrEmpty();
|
||||
$bid_decision = BidBiddingDecision::field('bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount,bid_opening_date')->where('id', $bid_buy_doc['bid_decision_id'])->findOrEmpty();
|
||||
$buyer = Admin::field('name')->where('id', $bid_buy_doc['buyer'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$item['bid_document_no'] = $bid_buy_doc['bid_document_no'];
|
||||
$item['invite_tenders_company_name'] = $bid_buy_doc['invite_tenders_company_name'];
|
||||
$item['bid_company_name'] = $bid_buy_doc['bid_company_name'];
|
||||
$item['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text;
|
||||
$item['buyer'] = $buyer['name'];
|
||||
$item['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$item['bid_type'] = $bid_decision->bid_type_text;
|
||||
$item['is_margin'] = $bid_decision->is_margin_text;
|
||||
$item['margin_amount'] = $bid_decision['margin_amount'];
|
||||
$item['bid_opening_date'] = $bid_decision['bid_opening_date'];
|
||||
$item['total_amount'] = BidDocumentExaminationDetail::where('bid_document_examination_id', $item['id'])->sum('sale_amount');
|
||||
$item['approve_check_status_text'] = $item->approve_check_status_text;
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取标书审查数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['bid_document_no', 'project_name']);
|
||||
$where = [];
|
||||
if (isset($params['bid_document_no']) && $params['bid_document_no'] != '') {
|
||||
$bid_doc_ids = BidBuyBiddingDocument::where('bid_document_no', 'like', '%' . $params['bid_document_no'] . '%')->column('id');
|
||||
$where[] = ['buy_bidding_document_id', 'in', $bid_doc_ids];
|
||||
}
|
||||
return BidDocumentExamination::field('id')->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',
|
||||
'code' => '审查编号',
|
||||
'bid_document_no' => '标书编号',
|
||||
'project_name' => '项目名称',
|
||||
'invite_tenders_company_name' => '招标公司名称',
|
||||
'bid_company_name' => '投标公司名称',
|
||||
'bidding_project_fund_source' => '招标项目资金来源',
|
||||
'is_margin' => '是否需要保证金',
|
||||
'margin_amount' => '保证金金额',
|
||||
'bid_opening_date' => '开标日期',
|
||||
'total_amount' => '总金额',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,116 +11,117 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\bid\BidSecurityRefund;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
/**
|
||||
* BidSecurityApply列表
|
||||
* Class BidSecurityApplyLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
class BidSecurityApplyLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['bidding_decision_id', 'project_id', 'pay_type'],
|
||||
'%like%' => ['applier']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return BidSecurityApply::where($this->searchWhere)
|
||||
->field('id,security_apply_code,project_id,bidding_decision_id,applier,refund_date,create_time')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$bidding_decision = BidBiddingDecision::field('code,margin_amount,bidding_time')->where('id',$data['bidding_decision_id'])->findOrEmpty();
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$data['bidding_decision_code'] = $bidding_decision['code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bidding_time'] = $bidding_decision['bidding_time'];
|
||||
//保证金金额
|
||||
$data['margin_amount'] = $bidding_decision['margin_amount'];
|
||||
//已退金额
|
||||
$data['has_refund_amount'] = BidSecurityRefund::where('bid_security_apply_id',$data['id'])->sum('refund_amount');
|
||||
//未退金额
|
||||
$data['not_refund_amount'] = $data['margin_amount'] - $data['has_refund_amount'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return BidSecurityApply::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '投标保证金列表';
|
||||
}
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\model\bid\BidSecurityRefund;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* BidSecurityApply列表
|
||||
* Class BidSecurityApplyLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class BidSecurityApplyLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"security_apply_code" => "投标编号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"bidding_time" => "投标时间",
|
||||
"refund_date" => "预计退还时间",
|
||||
"margin_amount" => "保证金金额",
|
||||
"applier" => "申请人",
|
||||
"has_refund_amount" => "已退金额",
|
||||
"not_refund_amount" => "未退金额",
|
||||
"create_time" => "创建日期",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['bidding_decision_id', 'project_id', 'pay_type'],
|
||||
'%like%' => ['applier']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return BidSecurityApply::where($this->searchWhere)
|
||||
->field('id,security_apply_code,project_id,bidding_decision_id,applier,refund_date,create_time')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$bidding_decision = BidBiddingDecision::field('code,margin_amount,bidding_time')->where('id', $data['bidding_decision_id'])->findOrEmpty();
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$data['bidding_decision_code'] = $bidding_decision['code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bidding_time'] = $bidding_decision['bidding_time'];
|
||||
//保证金金额
|
||||
$data['margin_amount'] = $bidding_decision['margin_amount'];
|
||||
//已退金额
|
||||
$data['has_refund_amount'] = BidSecurityRefund::where('bid_security_apply_id', $data['id'])->sum('refund_amount');
|
||||
//未退金额
|
||||
$data['not_refund_amount'] = $data['margin_amount'] - $data['has_refund_amount'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return BidSecurityApply::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",
|
||||
"security_apply_code" => "投标编号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"bidding_time" => "投标时间",
|
||||
"refund_date" => "预计退还时间",
|
||||
"margin_amount" => "保证金金额",
|
||||
"applier" => "申请人",
|
||||
"has_refund_amount" => "已退金额",
|
||||
"not_refund_amount" => "未退金额",
|
||||
"create_time" => "创建日期",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,110 +11,110 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\model\bid\BidSecurityRefund;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* BidSecurityRefund列表
|
||||
* Class BidSecurityRefundLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
class BidSecurityRefundLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['bid_security_apply_id', 'project_id', 'bank_account_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return BidSecurityRefund::where($this->searchWhere)
|
||||
->field('id,project_id,bid_security_apply_id,refund_amount,refund_date,remark,annex,bank_account_id,create_time')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$bid_security_apply = BidSecurityApply::field('bidding_decision_id')->where('id',$data['bid_security_apply_id'])->findOrEmpty();
|
||||
$bidding_decision = BidBiddingDecision::field('code,bidding_time')->where('id',$bid_security_apply['bidding_decision_id'])->findOrEmpty();
|
||||
$data['bidding_decision_code'] = $bidding_decision['code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['bidding_time'] = $bidding_decision['bidding_time'];
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return BidSecurityRefund::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '投标保证金退还列表';
|
||||
}
|
||||
namespace app\adminapi\lists\bid;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\model\bid\BidSecurityRefund;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* BidSecurityRefund列表
|
||||
* Class BidSecurityRefundLists
|
||||
* @package app\adminapi\listsbid
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class BidSecurityRefundLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"bidding_decision_code" => "投标编号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_code" => "项目编码",
|
||||
"project_name" => "项目名称",
|
||||
"bidding_time" => "投标时间",
|
||||
"refund_amount" => "退款金额",
|
||||
"refund_date" => "退款日期",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['bid_security_apply_id', 'project_id', 'bank_account_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return BidSecurityRefund::where($this->searchWhere)
|
||||
->field('id,project_id,bid_security_apply_id,refund_amount,refund_date,remark,annex,bank_account_id,create_time')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$bid_security_apply = BidSecurityApply::field('bidding_decision_id')->where('id', $data['bid_security_apply_id'])->findOrEmpty();
|
||||
$bidding_decision = BidBiddingDecision::field('code,bidding_time')->where('id', $bid_security_apply['bidding_decision_id'])->findOrEmpty();
|
||||
$data['bidding_decision_code'] = $bidding_decision['code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['bidding_time'] = $bidding_decision['bidding_time'];
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id', $data['bank_account_id'])->findOrEmpty();
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return BidSecurityRefund::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",
|
||||
"bidding_decision_code" => "投标编号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_code" => "项目编码",
|
||||
"project_name" => "项目名称",
|
||||
"bidding_time" => "投标时间",
|
||||
"refund_amount" => "退款金额",
|
||||
"refund_date" => "退款日期",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
}
|
@ -11,162 +11,162 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceInvoiceApply;
|
||||
use app\common\model\finance\FinanceRefundApply;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* 项目合同列表
|
||||
* Class ContractLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
class ContractLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id','contract_type', 'contract_code'],
|
||||
'%like%' => ['contract_code','contract_name']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取项目合同列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(isset($params['business_director_name']) && $params['business_director_name'] != ''){
|
||||
$business_director_ids = Admin::where('name','like','%'.$params['business_director_name'].'%')->column('id');
|
||||
$where[] = ['business_director','in',$business_director_ids];
|
||||
}
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id','=',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return Contract::where($this->searchWhere)->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('bid_document_no')->where('id',$data['buy_bidding_document_id'])->findOrEmpty();
|
||||
$business_director = Admin::field('name')->where('id',$data['business_director'])->findOrEmpty();
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_document_no'] = $buy_bidding_document['bid_document_no'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['contract_pricing_method_text'] = $data->contract_pricing_method_text;
|
||||
$data['contract_status_text'] = $data->contract_status_text;
|
||||
$data['business_director_name'] = $business_director['name'];
|
||||
//洽商金额
|
||||
$data['negotiation_amount'] = ContractNegotiation::where('contract_id',$data['id'])->sum('negotiation_amount');
|
||||
//回款金额
|
||||
$data['returned_amount'] = FinanceReturnedRecord::where('contract_id',$data['id'])->sum('amount');
|
||||
//开票金额
|
||||
$data['invoicing_amount'] = FinanceInvoiceApply::where('contract_id',$data['id'])->sum('invoicing_amount');
|
||||
//退款金额
|
||||
$data['refund_amount'] = FinanceRefundApply::where('contract_id',$data['id'])->sum('amount');
|
||||
//实际合同金额=合同金额+洽商金额-退款金额
|
||||
$data['reality_contract_amount'] = $data['amount'] + $data['negotiation_amount'] - $data['refund_amount'];
|
||||
//未回款金额
|
||||
$data['not_returned_amount'] = $data['reality_contract_amount'] - $data['returned_amount'];
|
||||
//未开票金额
|
||||
$data['not_invoicing_amount'] = $data['reality_contract_amount'] - $data['invoicing_amount'];
|
||||
//结算差异(带计算)
|
||||
$data['settlement_difference'] = 0;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取项目合同数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(isset($params['business_director_name']) && $params['business_director_name'] != ''){
|
||||
$business_director_ids = Admin::where('name','like','%'.$params['business_director_name'].'%')->column('id');
|
||||
$where[] = ['business_director','in',$business_director_ids];
|
||||
}
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id','=',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return Contract::field('id')->where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '项目合同列表';
|
||||
}
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceInvoiceApply;
|
||||
use app\common\model\finance\FinanceRefundApply;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 项目合同列表
|
||||
* Class ContractLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ContractLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"contract_code" => "合同编号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"contract_type_text" => "合同类型",
|
||||
"contract_pricing_method_text" => "合同计价方式",
|
||||
"business_director_name" => "业务负责人",
|
||||
"contract_status_text" => "合同状态",
|
||||
"expire" => "合同有效期",
|
||||
"contract_date" => "签约日期",
|
||||
"amount" =>"合同金额",
|
||||
"negotiation_amount" =>"洽商金额",
|
||||
"reality_contract_amount" =>"实际合同金额",
|
||||
"returned_amount" =>"已回款",
|
||||
"not_returned_amount" =>"未回款",
|
||||
"invoicing_amount" =>"已开票",
|
||||
"not_invoicing_amount" =>"未开票",
|
||||
"refund_amount" =>"已退款金额",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_type', 'contract_code'],
|
||||
'%like%' => ['contract_code', 'contract_name']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取项目合同列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if (isset($params['business_director_name']) && $params['business_director_name'] != '') {
|
||||
$business_director_ids = Admin::where('name', 'like', '%' . $params['business_director_name'] . '%')->column('id');
|
||||
$where[] = ['business_director', 'in', $business_director_ids];
|
||||
}
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', '=', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return Contract::where($this->searchWhere)->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('bid_document_no')->where('id', $data['buy_bidding_document_id'])->findOrEmpty();
|
||||
$business_director = Admin::field('name')->where('id', $data['business_director'])->findOrEmpty();
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_document_no'] = $buy_bidding_document['bid_document_no'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['contract_pricing_method_text'] = $data->contract_pricing_method_text;
|
||||
$data['contract_status_text'] = $data->contract_status_text;
|
||||
$data['business_director_name'] = $business_director['name'];
|
||||
//洽商金额
|
||||
$data['negotiation_amount'] = ContractNegotiation::where('contract_id', $data['id'])->sum('negotiation_amount');
|
||||
//回款金额
|
||||
$data['returned_amount'] = FinanceReturnedRecord::where('contract_id', $data['id'])->sum('amount');
|
||||
//开票金额
|
||||
$data['invoicing_amount'] = FinanceInvoiceApply::where('contract_id', $data['id'])->sum('invoicing_amount');
|
||||
//退款金额
|
||||
$data['refund_amount'] = FinanceRefundApply::where('contract_id', $data['id'])->sum('amount');
|
||||
//实际合同金额=合同金额+洽商金额-退款金额
|
||||
$data['reality_contract_amount'] = $data['amount'] + $data['negotiation_amount'] - $data['refund_amount'];
|
||||
//未回款金额
|
||||
$data['not_returned_amount'] = $data['reality_contract_amount'] - $data['returned_amount'];
|
||||
//未开票金额
|
||||
$data['not_invoicing_amount'] = $data['reality_contract_amount'] - $data['invoicing_amount'];
|
||||
//结算差异(带计算)
|
||||
$data['settlement_difference'] = 0;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取项目合同数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if (isset($params['business_director_name']) && $params['business_director_name'] != '') {
|
||||
$business_director_ids = Admin::where('name', 'like', '%' . $params['business_director_name'] . '%')->column('id');
|
||||
$where[] = ['business_director', 'in', $business_director_ids];
|
||||
}
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', '=', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return Contract::field('id')->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",
|
||||
"contract_code" => "合同编号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"contract_type_text" => "合同类型",
|
||||
"contract_pricing_method_text" => "合同计价方式",
|
||||
"business_director_name" => "业务负责人",
|
||||
"contract_status_text" => "合同状态",
|
||||
"expire" => "合同有效期",
|
||||
"contract_date" => "签约日期",
|
||||
"amount" => "合同金额",
|
||||
"negotiation_amount" => "洽商金额",
|
||||
"reality_contract_amount" => "实际合同金额",
|
||||
"returned_amount" => "已回款",
|
||||
"not_returned_amount" => "未回款",
|
||||
"invoicing_amount" => "已开票",
|
||||
"not_invoicing_amount" => "未开票",
|
||||
"refund_amount" => "已退款金额",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,128 +11,128 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* 合同洽商列表
|
||||
* Class ContractNegotiationLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
class ContractNegotiationLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 21:26
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['contract_id', 'project_id', 'negotiation_type'],
|
||||
'%like%' => ['negotiation_no']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取合同洽商列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 21:26
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return ContractNegotiation::field('id,project_id,contract_id,negotiation_name,negotiation_no,negotiation_amount,negotiation_type,profit,profit_rate')
|
||||
->where($this->searchWhere)->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$contract = Contract::field('contract_name,contract_code,contract_date,business_director')->where('id',$data['contract_id'])->findOrEmpty();
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$business_director = Admin::field('name')->where('id',$contract['business_director'])->findOrEmpty();
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['contract_date'] = $contract['contract_date'];
|
||||
$data['business_director'] = $business_director['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['negotiation_type'] = $data->negotiation_type_text;
|
||||
$data['profit_rate'] = ($data['profit_rate'] * 100).'%';
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取合同洽商数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 21:26
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return ContractNegotiation::field('id')->where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '项目合同洽商列表';
|
||||
}
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 合同洽商列表
|
||||
* Class ContractNegotiationLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ContractNegotiationLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"negotiation_no" => "洽商编号",
|
||||
"contract_code" => "合同编号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"negotiation_amount" => "洽商报价金额",
|
||||
"negotiation_type" => "洽商类别",
|
||||
"contract_date" => "签约日期",
|
||||
"business_director" => "业务负责人",
|
||||
"profit" => "利润",
|
||||
"profit_rate" => "利润率",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 21:26
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['contract_id', 'project_id', 'negotiation_type'],
|
||||
'%like%' => ['negotiation_no']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取合同洽商列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 21:26
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return ContractNegotiation::field('id,project_id,contract_id,negotiation_name,negotiation_no,negotiation_amount,negotiation_type,profit,profit_rate')
|
||||
->where($this->searchWhere)->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$contract = Contract::field('contract_name,contract_code,contract_date,business_director')->where('id', $data['contract_id'])->findOrEmpty();
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$business_director = Admin::field('name')->where('id', $contract['business_director'])->findOrEmpty();
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['contract_date'] = $contract['contract_date'];
|
||||
$data['business_director'] = $business_director['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['negotiation_type'] = $data->negotiation_type_text;
|
||||
$data['profit_rate'] = ($data['profit_rate'] * 100) . '%';
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取合同洽商数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 21:26
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return ContractNegotiation::field('id')->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",
|
||||
"negotiation_no" => "洽商编号",
|
||||
"contract_code" => "合同编号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"negotiation_amount" => "洽商报价金额",
|
||||
"negotiation_type" => "洽商类别",
|
||||
"contract_date" => "签约日期",
|
||||
"business_director" => "业务负责人",
|
||||
"profit" => "利润",
|
||||
"profit_rate" => "利润率",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,133 +11,133 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\ProcurementContractDetail;
|
||||
use app\common\model\finance\FinancePaymentApply;
|
||||
use app\common\model\finance\FinanceReceiptRecord;
|
||||
use app\common\model\finance\FinanceRefundRecord;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* 采购合同列表
|
||||
* Class ProcurementContractLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
class ProcurementContractLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id'],
|
||||
'%like%' => ['contract_no']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取采购合同列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProcurementContract::where($this->searchWhere)
|
||||
->field('id,project_id,supplier_id,contract_no,contract_name,contract_type,signing_date')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id',$data['supplier_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['contract_type'] = $data->contract_type_text;
|
||||
$data['contract_amount'] = ProcurementContractDetail::where('contract_id',$data['id'])->sum('amount_including_tax');
|
||||
//已付款金额
|
||||
$data['has_pay_amount'] = FinancePaymentApply::where('contract_id',$data['id'])->where('contract_type',1)->sum('amount');
|
||||
//未付款金额
|
||||
$data['not_pay_amount'] = $data['contract_amount'] - $data['has_pay_amount'];
|
||||
//已开票金额
|
||||
$data['has_invoice_amount'] = FinanceReceiptRecord::where('contract_id',$data['id'])->where('contract_type',1)->sum('invoice_amount');
|
||||
//未开票金额
|
||||
$data['not_invoice_amount'] = $data['contract_amount'] - $data['has_invoice_amount'];
|
||||
//退款金额
|
||||
$data['refund_amount'] = FinanceRefundRecord::where('contract_id',$data['id'])->where('contract_type',1)->sum('refund_amount');
|
||||
//数量
|
||||
$data['num'] = ProcurementContractDetail::where('contract_id',$data['id'])->sum('num');
|
||||
//已入库数量
|
||||
$data['has_storage_num'] = 0;
|
||||
//未入库数量
|
||||
$data['not_storage_num'] = $data['num'] - $data['has_storage_num'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取采购合同数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProcurementContract::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '采购合同列表';
|
||||
}
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\ProcurementContractDetail;
|
||||
use app\common\model\finance\FinancePaymentApply;
|
||||
use app\common\model\finance\FinanceReceiptRecord;
|
||||
use app\common\model\finance\FinanceRefundRecord;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 采购合同列表
|
||||
* Class ProcurementContractLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProcurementContractLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"project_name" => "项目名称",
|
||||
"contract_name" => "合同名称",
|
||||
"contract_no" => "合同编号",
|
||||
"supplier_name" => "供应商名称",
|
||||
"contract_type" => "合同类型",
|
||||
"signing_date" => "签订日期",
|
||||
"contract_amount" => "合同金额",
|
||||
"has_pay_amount" => "已付款金额",
|
||||
"has_invoice_amount" => "已开票金额",
|
||||
"not_pay_amount" => "未付款金额",
|
||||
"not_invoice_amount" => "未开票金额",
|
||||
"refund_amount" => "退款金额",
|
||||
"has_storage_num" => "已入库数量",
|
||||
"not_storage_num" => "未入库数量",
|
||||
"num" => "数量",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id'],
|
||||
'%like%' => ['contract_no']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取采购合同列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProcurementContract::where($this->searchWhere)
|
||||
->field('id,project_id,supplier_id,contract_no,contract_name,contract_type,signing_date')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id', $data['supplier_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['contract_type'] = $data->contract_type_text;
|
||||
$data['contract_amount'] = ProcurementContractDetail::where('contract_id', $data['id'])->sum('amount_including_tax');
|
||||
//已付款金额
|
||||
$data['has_pay_amount'] = FinancePaymentApply::where('contract_id', $data['id'])->where('contract_type', 1)->sum('amount');
|
||||
//未付款金额
|
||||
$data['not_pay_amount'] = $data['contract_amount'] - $data['has_pay_amount'];
|
||||
//已开票金额
|
||||
$data['has_invoice_amount'] = FinanceReceiptRecord::where('contract_id', $data['id'])->where('contract_type', 1)->sum('invoice_amount');
|
||||
//未开票金额
|
||||
$data['not_invoice_amount'] = $data['contract_amount'] - $data['has_invoice_amount'];
|
||||
//退款金额
|
||||
$data['refund_amount'] = FinanceRefundRecord::where('contract_id', $data['id'])->where('contract_type', 1)->sum('refund_amount');
|
||||
//数量
|
||||
$data['num'] = ProcurementContractDetail::where('contract_id', $data['id'])->sum('num');
|
||||
//已入库数量
|
||||
$data['has_storage_num'] = 0;
|
||||
//未入库数量
|
||||
$data['not_storage_num'] = $data['num'] - $data['has_storage_num'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取采购合同数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProcurementContract::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",
|
||||
"project_name" => "项目名称",
|
||||
"contract_name" => "合同名称",
|
||||
"contract_no" => "合同编号",
|
||||
"supplier_name" => "供应商名称",
|
||||
"contract_type" => "合同类型",
|
||||
"signing_date" => "签订日期",
|
||||
"contract_amount" => "合同金额",
|
||||
"has_pay_amount" => "已付款金额",
|
||||
"has_invoice_amount" => "已开票金额",
|
||||
"not_pay_amount" => "未付款金额",
|
||||
"not_invoice_amount" => "未开票金额",
|
||||
"refund_amount" => "退款金额",
|
||||
"has_storage_num" => "已入库数量",
|
||||
"not_storage_num" => "未入库数量",
|
||||
"num" => "数量",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,137 +11,138 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\model\contract\SubcontractingContractNegotiation;
|
||||
use app\common\model\finance\FinancePaymentApply;
|
||||
use app\common\model\finance\FinanceReceiptRecord;
|
||||
use app\common\model\finance\FinanceRefundRecord;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
|
||||
/**
|
||||
* SubcontractingContract列表
|
||||
* Class SubcontractingContractLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
class SubcontractingContractLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id'],
|
||||
'%like%' => ['contract_no']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return SubcontractingContract::where($this->searchWhere)
|
||||
->field('id,project_id,supplier_id,contract_no,contract_name,contract_type,signing_date')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id',$data['supplier_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['contract_type'] = $data->contract_type_text;
|
||||
$data['contract_amount'] = SubcontractingContractDetail::where('contract_id',$data['id'])->sum('amount_including_tax');
|
||||
//洽商金额
|
||||
$data['negotiation_amount'] = SubcontractingContractNegotiation::where('subcontracting_contract_id',$data['id'])->sum('negotiation_amount');
|
||||
//实际合同金额
|
||||
$data['reality_contract_amount'] = $data['contract_amount'] + $data['negotiation_amount'];
|
||||
//不含税金额
|
||||
$data['excluding_tax_amount'] = SubcontractingContractDetail::where('contract_id',$data['id'])->sum('amount_excluding_tax');
|
||||
//已付款金额
|
||||
$data['has_pay_amount'] = FinancePaymentApply::where('contract_id',$data['id'])->where('contract_type',2)->sum('amount');;
|
||||
//未付款金额
|
||||
$data['not_pay_amount'] = $data['contract_amount'] - $data['has_pay_amount'];
|
||||
//已开票金额
|
||||
$data['has_invoice_amount'] = FinanceReceiptRecord::where('contract_id',$data['id'])->where('contract_type',2)->sum('invoice_amount');
|
||||
//未开票金额
|
||||
$data['not_invoice_amount'] = $data['contract_amount'] - $data['has_invoice_amount'];
|
||||
//退款金额
|
||||
$data['refund_amount'] = FinanceRefundRecord::where('contract_id',$data['id'])->where('contract_type',2)->sum('refund_amount');;
|
||||
//结算差异
|
||||
$data['settlement_difference'] = 0;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return SubcontractingContract::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '分包合同列表';
|
||||
}
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\model\contract\SubcontractingContractNegotiation;
|
||||
use app\common\model\finance\FinancePaymentApply;
|
||||
use app\common\model\finance\FinanceReceiptRecord;
|
||||
use app\common\model\finance\FinanceRefundRecord;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* SubcontractingContract列表
|
||||
* Class SubcontractingContractLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class SubcontractingContractLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"project_name" => "项目名称",
|
||||
"contract_no" => "合同编号",
|
||||
"contract_name" => "合同名称",
|
||||
"supplier_name" => "供应商名称",
|
||||
"signing_date" => "签订日期",
|
||||
"contract_type" => "合同类型",
|
||||
"contract_amount" => "合同金额",
|
||||
"negotiation_amount" => "洽商金额",
|
||||
"excluding_tax_amount" => "不含税金额",
|
||||
"reality_contract_amount" => "实际合同金额",
|
||||
"has_pay_amount" => "已付款金额",
|
||||
"not_pay_amount" => "未付款金额",
|
||||
"invoice_amount" => "已开票金额",
|
||||
"not_invoice_amount" => "未开票金额",
|
||||
"refund_amount" => "已退款金额",
|
||||
"settlement_difference" => "结算差异",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id'],
|
||||
'%like%' => ['contract_no']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return SubcontractingContract::where($this->searchWhere)
|
||||
->field('id,project_id,supplier_id,contract_no,contract_name,contract_type,signing_date')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id', $data['supplier_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['contract_type'] = $data->contract_type_text;
|
||||
$data['contract_amount'] = SubcontractingContractDetail::where('contract_id', $data['id'])->sum('amount_including_tax');
|
||||
//洽商金额
|
||||
$data['negotiation_amount'] = SubcontractingContractNegotiation::where('subcontracting_contract_id', $data['id'])->sum('negotiation_amount');
|
||||
//实际合同金额
|
||||
$data['reality_contract_amount'] = $data['contract_amount'] + $data['negotiation_amount'];
|
||||
//不含税金额
|
||||
$data['excluding_tax_amount'] = SubcontractingContractDetail::where('contract_id', $data['id'])->sum('amount_excluding_tax');
|
||||
//已付款金额
|
||||
$data['has_pay_amount'] = FinancePaymentApply::where('contract_id', $data['id'])->where('contract_type', 2)->sum('amount');;
|
||||
//未付款金额
|
||||
$data['not_pay_amount'] = $data['contract_amount'] - $data['has_pay_amount'];
|
||||
//已开票金额
|
||||
$data['has_invoice_amount'] = FinanceReceiptRecord::where('contract_id', $data['id'])->where('contract_type', 2)->sum('invoice_amount');
|
||||
//未开票金额
|
||||
$data['not_invoice_amount'] = $data['contract_amount'] - $data['has_invoice_amount'];
|
||||
//退款金额
|
||||
$data['refund_amount'] = FinanceRefundRecord::where('contract_id', $data['id'])->where('contract_type', 2)->sum('refund_amount');;
|
||||
//结算差异
|
||||
$data['settlement_difference'] = 0;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return SubcontractingContract::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",
|
||||
"project_name" => "项目名称",
|
||||
"contract_no" => "合同编号",
|
||||
"contract_name" => "合同名称",
|
||||
"supplier_name" => "供应商名称",
|
||||
"signing_date" => "签订日期",
|
||||
"contract_type" => "合同类型",
|
||||
"contract_amount" => "合同金额",
|
||||
"negotiation_amount" => "洽商金额",
|
||||
"excluding_tax_amount" => "不含税金额",
|
||||
"reality_contract_amount" => "实际合同金额",
|
||||
"has_pay_amount" => "已付款金额",
|
||||
"not_pay_amount" => "未付款金额",
|
||||
"invoice_amount" => "已开票金额",
|
||||
"not_invoice_amount" => "未开票金额",
|
||||
"refund_amount" => "已退款金额",
|
||||
"settlement_difference" => "结算差异",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,113 +11,113 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\contract\SubcontractingContractNegotiation;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* SubcontractingContractNegotiation列表
|
||||
* Class SubcontractingContractNegotiationLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
class SubcontractingContractNegotiationLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:21
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id','subcontracting_contract_id','negotiation_type'],
|
||||
'%like%' => ['negotiation_name','negotiation_no']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:21
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return SubcontractingContractNegotiation::where($this->searchWhere)
|
||||
->field('id,project_id,subcontracting_contract_id,negotiation_name,negotiation_no,negotiation_amount,negotiation_type,sign_date,warranty_amount,warranty_expire_date')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$subcontracting_contract = SubcontractingContract::field('supplier_id,contract_no,contract_name')->where('id',$data['subcontracting_contract_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id',$subcontracting_contract['supplier_id'])->findOrEmpty();
|
||||
$data['contract_no'] = $subcontracting_contract['contract_no'];
|
||||
$data['contract_name'] = $subcontracting_contract['contract_name'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['negotiation_type_text'] = $data->negotiation_type_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:21
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return SubcontractingContractNegotiation::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '分包洽商列表';
|
||||
}
|
||||
namespace app\adminapi\lists\contract;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\contract\SubcontractingContractNegotiation;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* SubcontractingContractNegotiation列表
|
||||
* Class SubcontractingContractNegotiationLists
|
||||
* @package app\adminapi\listscontract
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class SubcontractingContractNegotiationLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"negotiation_no" => "洽商编号",
|
||||
"contract_no" => "合同编号",
|
||||
"negotiation_name" => "洽商单名称",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编号",
|
||||
"supplier_name" => "供应商",
|
||||
"negotiation_amount" => "洽商金额",
|
||||
"negotiation_type_text" => "洽商类别",
|
||||
"warranty_amount" => "洽商质保金额",
|
||||
"warranty_expire_date" => "洽商质保到期时间",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:21
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'subcontracting_contract_id', 'negotiation_type'],
|
||||
'%like%' => ['negotiation_name', 'negotiation_no']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:21
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return SubcontractingContractNegotiation::where($this->searchWhere)
|
||||
->field('id,project_id,subcontracting_contract_id,negotiation_name,negotiation_no,negotiation_amount,negotiation_type,sign_date,warranty_amount,warranty_expire_date')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$subcontracting_contract = SubcontractingContract::field('supplier_id,contract_no,contract_name')->where('id', $data['subcontracting_contract_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id', $subcontracting_contract['supplier_id'])->findOrEmpty();
|
||||
$data['contract_no'] = $subcontracting_contract['contract_no'];
|
||||
$data['contract_name'] = $subcontracting_contract['contract_name'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['negotiation_type_text'] = $data->negotiation_type_text;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:21
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return SubcontractingContractNegotiation::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",
|
||||
"negotiation_no" => "洽商编号",
|
||||
"contract_no" => "合同编号",
|
||||
"negotiation_name" => "洽商单名称",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编号",
|
||||
"supplier_name" => "供应商",
|
||||
"negotiation_amount" => "洽商金额",
|
||||
"negotiation_type_text" => "洽商类别",
|
||||
"warranty_amount" => "洽商质保金额",
|
||||
"warranty_expire_date" => "洽商质保到期时间",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,123 +11,124 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceInvoiceApply;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
/**
|
||||
* FinanceInvoiceApply列表
|
||||
* Class FinanceInvoiceApplyLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class FinanceInvoiceApplyLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_id','invoice_type'],
|
||||
'%like%' => ['invoicing_code','invoicing_company_name'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return FinanceInvoiceApply::where($this->searchWhere)->where($where)
|
||||
->field('id,contract_id,project_id,invoicing_code,invoicing_date,period,tax_rate,invoice_type,invoicing_amount,tax_amount,amount_including_tax,invoicing_company_name')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_code,contract_name,amount')->where('id',$data['contract_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['period'] = $data->period_text;
|
||||
$data['tax_rate'] = $data->tax_rate_text;
|
||||
$data['invoice_type'] = $data->invoice_type_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return FinanceInvoiceApply::where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '开票申请列表';
|
||||
}
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceInvoiceApply;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* FinanceInvoiceApply列表
|
||||
* Class FinanceInvoiceApplyLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class FinanceInvoiceApplyLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"custom_name" => "客户名称",
|
||||
"project_code" => "项目编码",
|
||||
"project_name" => "项目名称",
|
||||
"invoicing_date" => "开票日期",
|
||||
"period" => "期次",
|
||||
"invoice_type" => "发票类型",
|
||||
"invoicing_amount" => "开票金额(含税)",
|
||||
"amount_including_tax" => "开票金额(非税)",
|
||||
"tax_rate" => "税率(%)",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_id', 'invoice_type'],
|
||||
'%like%' => ['invoicing_code', 'invoicing_company_name'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return FinanceInvoiceApply::where($this->searchWhere)->where($where)
|
||||
->field('id,contract_id,project_id,invoicing_code,invoicing_date,period,tax_rate,invoice_type,invoicing_amount,tax_amount,amount_including_tax,invoicing_company_name')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_code,contract_name,amount')->where('id', $data['contract_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['period'] = $data->period_text;
|
||||
$data['tax_rate'] = $data->tax_rate_text;
|
||||
$data['invoice_type'] = $data->invoice_type_text;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return FinanceInvoiceApply::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",
|
||||
"custom_name" => "客户名称",
|
||||
"project_code" => "项目编码",
|
||||
"project_name" => "项目名称",
|
||||
"invoicing_date" => "开票日期",
|
||||
"period" => "期次",
|
||||
"invoice_type" => "发票类型",
|
||||
"invoicing_amount" => "开票金额(含税)",
|
||||
"amount_including_tax" => "开票金额(非税)",
|
||||
"tax_rate" => "税率(%)",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,124 +11,124 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 '付款申请列表';
|
||||
}
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\finance\FinancePaymentApply;
|
||||
use app\common\model\finance\FinancePaymentPlan;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* FinancePaymentApply列表
|
||||
* Class FinancePaymentApplyLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class FinancePaymentApplyLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
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" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_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" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,121 +11,121 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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\model\finance\FinancePaymentPlan;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* FinancePaymentPlan列表
|
||||
* Class FinancePaymentPlanLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class FinancePaymentPlanLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 11:14
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id', 'contract_id', 'contract_type', 'period', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 11:14
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return FinancePaymentPlan::where($this->searchWhere)
|
||||
->field('id,supplier_id,project_id,contract_id,contract_type,period,pay_date,amount,foreign_currency_remark,status,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$data['period_text'] = $data->period_text;
|
||||
$data['status_text'] = $data->status_text;
|
||||
$data['contract_type_text'] = $data->contract_type_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();
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
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['has_payment_amount'] = FinancePaymentApply::where('finance_payment_plan_id',$data['id'])->sum('amount');
|
||||
$data['not_payment_amount'] = $data['amount'] - $data['has_payment_amount'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 11:14
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return FinancePaymentPlan::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '付款计划列表';
|
||||
}
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\finance\FinancePaymentApply;
|
||||
use app\common\model\finance\FinancePaymentPlan;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* FinancePaymentPlan列表
|
||||
* Class FinancePaymentPlanLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class FinancePaymentPlanLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"supplier_name" => "供应商名称",
|
||||
"project_name" => "项目名称",
|
||||
"contract_no" => "合同编号",
|
||||
"pay_date" => "计划付款日期",
|
||||
"amount" => "金额",
|
||||
"period_text" => "期次",
|
||||
"status_text" => "状态",
|
||||
"has_payment_amount" => "已付款",
|
||||
"not_payment_amount" => "未付款",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 11:14
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id', 'contract_id', 'contract_type', 'period', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 11:14
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return FinancePaymentPlan::where($this->searchWhere)
|
||||
->field('id,supplier_id,project_id,contract_id,contract_type,period,pay_date,amount,foreign_currency_remark,status,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$data['period_text'] = $data->period_text;
|
||||
$data['status_text'] = $data->status_text;
|
||||
$data['contract_type_text'] = $data->contract_type_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();
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
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['has_payment_amount'] = FinancePaymentApply::where('finance_payment_plan_id', $data['id'])->sum('amount');
|
||||
$data['not_payment_amount'] = $data['amount'] - $data['has_payment_amount'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 11:14
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return FinancePaymentPlan::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",
|
||||
"supplier_name" => "供应商名称",
|
||||
"project_name" => "项目名称",
|
||||
"contract_no" => "合同编号",
|
||||
"pay_date" => "计划付款日期",
|
||||
"amount" => "金额",
|
||||
"period_text" => "期次",
|
||||
"status_text" => "状态",
|
||||
"has_payment_amount" => "已付款",
|
||||
"not_payment_amount" => "未付款",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,123 +11,123 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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\FinanceReceiptRecord;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceReceiptRecord列表
|
||||
* Class FinanceReceiptRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class FinanceReceiptRecordLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id', 'contract_id', 'contract_type', 'invoice_type'],
|
||||
'%like%' => ['commitor','invoice_no'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return FinanceReceiptRecord::where($this->searchWhere)
|
||||
->field('id,supplier_id,project_id,contract_id,contract_type,invoicing_date,commitor,invoice_type,invoice_no,invoice_amount,invoice_tax_rate,tax_amount,amount_excluding_tax,receipt_date')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$data['invoice_type_text'] = $data->invoice_type_text;
|
||||
$data['invoice_tax_rate_text'] = $data->invoice_tax_rate_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();
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
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['contract_type'] = $data->contract_type_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return FinanceReceiptRecord::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '收票记录列表';
|
||||
}
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\finance\FinanceReceiptRecord;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* FinanceReceiptRecord列表
|
||||
* Class FinanceReceiptRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class FinanceReceiptRecordLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"project_name" => "项目名称",
|
||||
"contract_no" => "合同编号",
|
||||
"contract_type" => "合同类型",
|
||||
"supplier_name" => "供应商名称",
|
||||
"receipt_date" => "收票日期",
|
||||
"invoicing_date" => "开票日期",
|
||||
"commitor" => "提交人",
|
||||
"invoice_tax_rate_text" => "发票税率",
|
||||
"invoice_amount" => "发票金额",
|
||||
"amount_excluding_tax" => "不含税金额",
|
||||
"tax_amount" => "税额",
|
||||
"invoice_type_text" => "发票类型",
|
||||
"invoice_no" => "发票编号",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id', 'contract_id', 'contract_type', 'invoice_type'],
|
||||
'%like%' => ['commitor', 'invoice_no'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return FinanceReceiptRecord::where($this->searchWhere)
|
||||
->field('id,supplier_id,project_id,contract_id,contract_type,invoicing_date,commitor,invoice_type,invoice_no,invoice_amount,invoice_tax_rate,tax_amount,amount_excluding_tax,receipt_date')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$data['invoice_type_text'] = $data->invoice_type_text;
|
||||
$data['invoice_tax_rate_text'] = $data->invoice_tax_rate_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();
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
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['contract_type'] = $data->contract_type_text;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return FinanceReceiptRecord::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",
|
||||
"project_name" => "项目名称",
|
||||
"contract_no" => "合同编号",
|
||||
"contract_type" => "合同类型",
|
||||
"supplier_name" => "供应商名称",
|
||||
"receipt_date" => "收票日期",
|
||||
"invoicing_date" => "开票日期",
|
||||
"commitor" => "提交人",
|
||||
"invoice_tax_rate_text" => "发票税率",
|
||||
"invoice_amount" => "发票金额",
|
||||
"amount_excluding_tax" => "不含税金额",
|
||||
"tax_amount" => "税额",
|
||||
"invoice_type_text" => "发票类型",
|
||||
"invoice_no" => "发票编号",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,125 +11,126 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceRefundApply;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceRefundApply列表
|
||||
* Class FinanceRefundApplyLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class FinanceRefundApplyLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_id', 'refund_type'],
|
||||
'%like%' => ['refund_user']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return FinanceRefundApply::where($this->searchWhere)->where($where)
|
||||
->field('id,refund_code,project_id,contract_id,refund_date,reason,amount,refund_type,refund_user,remark,collection_bank,collection_account,bank_account_id')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code')->where('id',$data['contract_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['refund_type'] = $data->refund_type_text;
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return FinanceRefundApply::where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '退款申请列表';
|
||||
}
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceRefundApply;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* FinanceRefundApply列表
|
||||
* Class FinanceRefundApplyLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class FinanceRefundApplyLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"refund_code" => "退款单号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"contract_code" => "合同编号",
|
||||
"reason" => "退款原因",
|
||||
"refund_date" => "退款日期",
|
||||
"amount" => "退款金额",
|
||||
"refund_type" => "退款方式",
|
||||
"refund_user" => "退款人",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_id', 'refund_type'],
|
||||
'%like%' => ['refund_user']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return FinanceRefundApply::where($this->searchWhere)->where($where)
|
||||
->field('id,refund_code,project_id,contract_id,refund_date,reason,amount,refund_type,refund_user,remark,collection_bank,collection_account,bank_account_id')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code')->where('id', $data['contract_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['refund_type'] = $data->refund_type_text;
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id', $data['bank_account_id'])->findOrEmpty();
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return FinanceRefundApply::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",
|
||||
"refund_code" => "退款单号",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"contract_code" => "合同编号",
|
||||
"reason" => "退款原因",
|
||||
"refund_date" => "退款日期",
|
||||
"amount" => "退款金额",
|
||||
"refund_type" => "退款方式",
|
||||
"refund_user" => "退款人",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,118 +11,117 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\finance\FinanceRefundRecord;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* FinanceRefundRecord列表
|
||||
* Class FinanceRefundRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class FinanceRefundRecordLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id', 'contract_type', 'contract_id', 'refund_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return FinanceRefundRecord::where($this->searchWhere)
|
||||
->field('id,supplier_id,project_id,contract_type,contract_id,refund_amount,refund_date,refund_type,reason,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$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();
|
||||
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['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['contract_no'] = $contract['contract_no'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['refund_type_text'] = $data->refund_type_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return FinanceRefundRecord::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '退款记录列表';
|
||||
}
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\finance\FinanceRefundRecord;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* FinanceRefundRecord列表
|
||||
* Class FinanceRefundRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class FinanceRefundRecordLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"supplier_name" => "供应商名称",
|
||||
"supplier_code" => "供应商编码",
|
||||
"project_name" => "项目名称",
|
||||
"contract_no" => "合同编号",
|
||||
"contract_type_text" => "合同类型",
|
||||
"refund_date" => "退款日期",
|
||||
"refund_amount" => "退款金额",
|
||||
"reason" => "退款原因",
|
||||
"refund_type_text" => "退款方式",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['supplier_id', 'project_id', 'contract_type', 'contract_id', 'refund_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return FinanceRefundRecord::where($this->searchWhere)
|
||||
->field('id,supplier_id,project_id,contract_type,contract_id,refund_amount,refund_date,refund_type,reason,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$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();
|
||||
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['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['contract_no'] = $contract['contract_no'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['refund_type_text'] = $data->refund_type_text;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return FinanceRefundRecord::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",
|
||||
"supplier_name" => "供应商名称",
|
||||
"supplier_code" => "供应商编码",
|
||||
"project_name" => "项目名称",
|
||||
"contract_no" => "合同编号",
|
||||
"contract_type_text" => "合同类型",
|
||||
"refund_date" => "退款日期",
|
||||
"refund_amount" => "退款金额",
|
||||
"reason" => "退款原因",
|
||||
"refund_type_text" => "退款方式",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,134 +11,134 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\finance\FinanceReturnedMoney;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceReturnedMoney列表
|
||||
* Class FinanceReturnedMoneyLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class FinanceReturnedMoneyLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:38
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_id', 'return_status', 'period'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:38
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return FinanceReturnedMoney::where($this->searchWhere)->where($where)
|
||||
->field('id,project_id,contract_id,return_date,period,amount,return_status,return_duty_id,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code,contract_type')->where('id',$data['contract_id'])->findOrEmpty();
|
||||
$return_duty = Admin::field('name')->where('id',$data['return_duty_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['contract_type'] = $contract->contract_type_text;
|
||||
$data['period'] = $data->period_text;
|
||||
$data['return_status'] = $data->return_status_text;
|
||||
$data['return_duty'] = $return_duty['name'];
|
||||
$data['has_return_amount'] = FinanceReturnedRecord::where('finance_returned_money_id',$data['id'])->sum('amount');
|
||||
$data['not_return_amount'] = $data['amount'] - $data['has_return_amount'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:38
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return FinanceReturnedMoney::where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '回款计划列表';
|
||||
}
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceReturnedMoney;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* FinanceReturnedMoney列表
|
||||
* Class FinanceReturnedMoneyLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class FinanceReturnedMoneyLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"contract_code" => "合同编号",
|
||||
"contract_type" => "合同类型",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"period" => "期次",
|
||||
"return_date" => "计划回款日期",
|
||||
"return_status" => "状态",
|
||||
"amount" => "金额",
|
||||
"has_return_amount" => "已回款",
|
||||
"not_return_amount" => "未回款",
|
||||
"return_duty" => "回款责任人",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:38
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_id', 'return_status', 'period'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:38
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return FinanceReturnedMoney::where($this->searchWhere)->where($where)
|
||||
->field('id,project_id,contract_id,return_date,period,amount,return_status,return_duty_id,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code,contract_type')->where('id', $data['contract_id'])->findOrEmpty();
|
||||
$return_duty = Admin::field('name')->where('id', $data['return_duty_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['contract_type'] = $contract->contract_type_text;
|
||||
$data['period'] = $data->period_text;
|
||||
$data['return_status'] = $data->return_status_text;
|
||||
$data['return_duty'] = $return_duty['name'];
|
||||
$data['has_return_amount'] = FinanceReturnedRecord::where('finance_returned_money_id', $data['id'])->sum('amount');
|
||||
$data['not_return_amount'] = $data['amount'] - $data['has_return_amount'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:38
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return FinanceReturnedMoney::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",
|
||||
"contract_code" => "合同编号",
|
||||
"contract_type" => "合同类型",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"period" => "期次",
|
||||
"return_date" => "计划回款日期",
|
||||
"return_status" => "状态",
|
||||
"amount" => "金额",
|
||||
"has_return_amount" => "已回款",
|
||||
"not_return_amount" => "未回款",
|
||||
"return_duty" => "回款责任人",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,130 +11,130 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceReturnedMoney;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* FinanceReturnedRecord列表
|
||||
* Class FinanceReturnedRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class FinanceReturnedRecordLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 16:28
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_id', 'finance_returned_money_id', 'collection_type', 'invoice_status', 'pay_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 16:28
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return FinanceReturnedRecord::where($this->searchWhere)->where($where)
|
||||
->field('id,project_id,contract_id,finance_returned_money_id,return_date,amount,collection_type,invoice_status,pay_type,receiver,bank_account_id')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code')->where('id',$data['contract_id'])->findOrEmpty();
|
||||
$finance_returned_money = FinanceReturnedMoney::field('period')->where('id',$data['finance_returned_money_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['period'] = $finance_returned_money->period_text;
|
||||
$data['collection_type'] = $data->collection_type_text;
|
||||
$data['invoice_status'] = $data->invoice_status_text;
|
||||
$data['pay_type'] = $data->pay_type_text;
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 16:28
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if(isset($params['custom_id']) && $params['custom_id'] != ''){
|
||||
$project_ids = Project::where('custom_id',$params['custom_id'])->column('id');
|
||||
$where[] = ['project_id','in',$project_ids];
|
||||
}
|
||||
return FinanceReturnedRecord::where($this->searchWhere)->where($where)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '回款记录列表';
|
||||
}
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceReturnedMoney;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* FinanceReturnedRecord列表
|
||||
* Class FinanceReturnedRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class FinanceReturnedRecordLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"contract_code" => "合同编号",
|
||||
"return_date" => "日期",
|
||||
"period" => "期次",
|
||||
"amount" => "金额",
|
||||
"invoice_status" => "开票状态",
|
||||
"pay_type" => "付款方式",
|
||||
"collection_type" => "收款性质",
|
||||
"receiver" => "收款人",
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 16:28
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'contract_id', 'finance_returned_money_id', 'collection_type', 'invoice_status', 'pay_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 16:28
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return FinanceReturnedRecord::where($this->searchWhere)->where($where)
|
||||
->field('id,project_id,contract_id,finance_returned_money_id,return_date,amount,collection_type,invoice_status,pay_type,receiver,bank_account_id')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code')->where('id', $data['contract_id'])->findOrEmpty();
|
||||
$finance_returned_money = FinanceReturnedMoney::field('period')->where('id', $data['finance_returned_money_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['period'] = $finance_returned_money->period_text;
|
||||
$data['collection_type'] = $data->collection_type_text;
|
||||
$data['invoice_status'] = $data->invoice_status_text;
|
||||
$data['pay_type'] = $data->pay_type_text;
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id', $data['bank_account_id'])->findOrEmpty();
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 16:28
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$params = $this->request->get(['custom_id']);
|
||||
$where = [];
|
||||
if (isset($params['custom_id']) && $params['custom_id'] != '') {
|
||||
$project_ids = Project::where('custom_id', $params['custom_id'])->column('id');
|
||||
$where[] = ['project_id', 'in', $project_ids];
|
||||
}
|
||||
return FinanceReturnedRecord::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",
|
||||
"custom_name" => "客户名称",
|
||||
"project_name" => "项目名称",
|
||||
"contract_code" => "合同编号",
|
||||
"return_date" => "日期",
|
||||
"period" => "期次",
|
||||
"amount" => "金额",
|
||||
"invoice_status" => "开票状态",
|
||||
"pay_type" => "付款方式",
|
||||
"collection_type" => "收款性质",
|
||||
"receiver" => "收款人",
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -11,74 +11,75 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\material;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\material\MaterialPurchaseRequest;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* 材料采购申请列表
|
||||
* Class MaterialPurchaseRequestLists
|
||||
* @package app\adminapi\listsmaterial
|
||||
*/
|
||||
class MaterialPurchaseRequestLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/09 13:47
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['material_purchase_request_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取材料采购申请列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/09 13:47
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return MaterialPurchaseRequest::where($this->searchWhere)
|
||||
->field('id,project_id,material_purchase_request_code,apply_date,arrival_date,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取材料采购申请数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/09 13:47
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return MaterialPurchaseRequest::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace app\adminapi\lists\material;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\material\MaterialPurchaseRequest;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
* 材料采购申请列表
|
||||
* Class MaterialPurchaseRequestLists
|
||||
* @package app\adminapi\listsmaterial
|
||||
*/
|
||||
class MaterialPurchaseRequestLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/09 13:47
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['material_purchase_request_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取材料采购申请列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/09 13:47
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return MaterialPurchaseRequest::where($this->searchWhere)
|
||||
->field('id,project_id,material_purchase_request_code,apply_date,arrival_date,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取材料采购申请数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/09 13:47
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return MaterialPurchaseRequest::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -11,97 +11,98 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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\ProjectCostAdjustment;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 成本调整列表
|
||||
* Class ProjectCostAdjustmentLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectCostAdjustmentLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取成本调整列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectCostAdjustment::where($this->searchWhere)
|
||||
->field(['id', 'project_id', 'adjust_date', 'adjust_amount', 'remark', 'annex'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取成本调整数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectCostAdjustment::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '成本调整列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
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\ProjectCostAdjustment;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 成本调整列表
|
||||
* Class ProjectCostAdjustmentLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectCostAdjustmentLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"adjust_date" => "调整日期",
|
||||
"adjust_amount" => "调整金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取成本调整列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectCostAdjustment::where($this->searchWhere)
|
||||
->field(['id', 'project_id', 'adjust_date', 'adjust_amount', 'remark', 'annex'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取成本调整数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectCostAdjustment::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",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"adjust_date" => "调整日期",
|
||||
"adjust_amount" => "调整金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,100 +11,101 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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\ProjectCostBudget;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\ProjectCostBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* 费用预算列表
|
||||
* Class ProjectCostBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectCostBudgetLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['cost_budget_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectCostBudget::where($this->searchWhere)
|
||||
->field('id,org_id,dept_id,project_id,cost_budget_code,remark,annex')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectCostBudgetDetail::where('cost_budget_id',$data['id'])->sum('amount');
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectCostBudget::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '费用预算列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
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\ProjectCostBudget;
|
||||
use app\common\model\project\ProjectCostBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 费用预算列表
|
||||
* Class ProjectCostBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectCostBudgetLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"project_name" => "项目名称",
|
||||
"cost_budget_code" => "费用预算单号",
|
||||
"total_amount" => "金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['cost_budget_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectCostBudget::where($this->searchWhere)
|
||||
->field('id,org_id,dept_id,project_id,cost_budget_code,remark,annex')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectCostBudgetDetail::where('cost_budget_id', $data['id'])->sum('amount');
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectCostBudget::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",
|
||||
"project_name" => "项目名称",
|
||||
"cost_budget_code" => "费用预算单号",
|
||||
"total_amount" => "金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,102 +11,103 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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\ProjectEquipmentBudget;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\ProjectEquipmentBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* 机具预算列表
|
||||
* Class ProjectEquipmentBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectEquipmentBudgetLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['equipment_budget_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取机具预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectEquipmentBudget::where($this->searchWhere)
|
||||
->field(['id', 'project_id', 'equipment_budget_code', 'remark', 'annex'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总量
|
||||
$data['total_num'] = ProjectEquipmentBudgetDetail::where('equipment_budget_id',$data['id'])->sum('num');
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectEquipmentBudgetDetail::where('equipment_budget_id',$data['id'])->sum('amount');
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取机具预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectEquipmentBudget::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '机具预算列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
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\ProjectEquipmentBudget;
|
||||
use app\common\model\project\ProjectEquipmentBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 机具预算列表
|
||||
* Class ProjectEquipmentBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectEquipmentBudgetLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"project_name" => "项目名称",
|
||||
"equipment_budget_code" => "机具预算单号",
|
||||
"total_amount" => "金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['equipment_budget_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取机具预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectEquipmentBudget::where($this->searchWhere)
|
||||
->field(['id', 'project_id', 'equipment_budget_code', 'remark', 'annex'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总量
|
||||
$data['total_num'] = ProjectEquipmentBudgetDetail::where('equipment_budget_id', $data['id'])->sum('num');
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectEquipmentBudgetDetail::where('equipment_budget_id', $data['id'])->sum('amount');
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取机具预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectEquipmentBudget::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",
|
||||
"project_name" => "项目名称",
|
||||
"equipment_budget_code" => "机具预算单号",
|
||||
"total_amount" => "金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,113 +11,114 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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\lists\ListsSearchInterface;
|
||||
use app\common\model\project\ProjectExpenseReimbursementDetail;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
|
||||
|
||||
/**
|
||||
* 费用报销列表
|
||||
* Class ProjectExpenseReimbursementLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectExpenseReimbursementLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/19 13:44
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'reimbursement_type'],
|
||||
'%like%' => ['expense_reimbursement_code', 'apply_user', 'payee_name'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
return ProjectExpenseReimbursement::where($this->searchWhere)
|
||||
->field('id,expense_reimbursement_code,project_id,apply_user,apply_date,reimbursement_type,loan_apply_id,offset_loan_amount,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$loan_apply = ProjectLoanApply::field('loan_apply_code,loan_amount')->where('id',$data['loan_apply_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['loan_apply_code'] = !$loan_apply->isEmpty() ? $loan_apply['loan_apply_code'] : '---';
|
||||
$data['loan_amount'] = !$loan_apply->isEmpty() ? $loan_apply['loan_amount'] : '---';
|
||||
$data['total_amount'] = ProjectExpenseReimbursementDetail::where('expense_reimbursement_id',$data['id'])->sum('amount');
|
||||
$data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount'];
|
||||
$data['reimbursement_type'] = $data->reimbursement_type_text;
|
||||
unset($data['project_id'],$data['loan_apply_id']);
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用报销数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/19 13:44
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectExpenseReimbursement::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '费用报销列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
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\ProjectExpenseReimbursementDetail;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 费用报销列表
|
||||
* Class ProjectExpenseReimbursementLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectExpenseReimbursementLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"expense_reimbursement_code" => "费用报销单号",
|
||||
"project_name" => "项目名称",
|
||||
"apply_user" => "报销人",
|
||||
"apply_date" => "报销日期",
|
||||
"reimbursement_type" => "报销类型",
|
||||
"loan_apply_code" => "借款单编号",
|
||||
"loan_amount" => "借款金额",
|
||||
"total_amount" => "报销金额",
|
||||
"pay_amount" => "付款金额",
|
||||
"offset_loan_amount" => "本次冲抵借款金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/19 13:44
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'reimbursement_type'],
|
||||
'%like%' => ['expense_reimbursement_code', 'apply_user', 'payee_name'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
return ProjectExpenseReimbursement::where($this->searchWhere)
|
||||
->field('id,expense_reimbursement_code,project_id,apply_user,apply_date,reimbursement_type,loan_apply_id,offset_loan_amount,remark')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$loan_apply = ProjectLoanApply::field('loan_apply_code,loan_amount')->where('id', $data['loan_apply_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['loan_apply_code'] = !$loan_apply->isEmpty() ? $loan_apply['loan_apply_code'] : '---';
|
||||
$data['loan_amount'] = !$loan_apply->isEmpty() ? $loan_apply['loan_amount'] : '---';
|
||||
$data['total_amount'] = ProjectExpenseReimbursementDetail::where('expense_reimbursement_id', $data['id'])->sum('amount');
|
||||
$data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount'];
|
||||
$data['reimbursement_type'] = $data->reimbursement_type_text;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
unset($data['project_id'], $data['loan_apply_id']);
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用报销数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/19 13:44
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectExpenseReimbursement::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",
|
||||
"expense_reimbursement_code" => "费用报销单号",
|
||||
"project_name" => "项目名称",
|
||||
"apply_user" => "报销人",
|
||||
"apply_date" => "报销日期",
|
||||
"reimbursement_type" => "报销类型",
|
||||
"loan_apply_code" => "借款单编号",
|
||||
"loan_amount" => "借款金额",
|
||||
"total_amount" => "报销金额",
|
||||
"pay_amount" => "付款金额",
|
||||
"offset_loan_amount" => "本次冲抵借款金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,103 +11,104 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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\ProjectLaborBudget;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\ProjectLaborBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* 人工预算列表
|
||||
* Class ProjectLaborBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectLaborBudgetLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['labor_budget_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取人工预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectLaborBudget::where($this->searchWhere)
|
||||
->field(['id', 'project_id', 'labor_budget_code', 'remark', 'annex'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总工作量
|
||||
$data['total_num'] = ProjectLaborBudgetDetail::where('labor_budget_id',$data['id'])->sum('num');
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectLaborBudgetDetail::where('labor_budget_id',$data['id'])->sum('amount');
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取人工预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectLaborBudget::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '人工预算列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
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\ProjectLaborBudget;
|
||||
use app\common\model\project\ProjectLaborBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 人工预算列表
|
||||
* Class ProjectLaborBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectLaborBudgetLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"labor_budget_code" => "人工预算单号",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"total_num" => "数量",
|
||||
"total_amount" => "金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['labor_budget_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取人工预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectLaborBudget::where($this->searchWhere)
|
||||
->field(['id', 'project_id', 'labor_budget_code', 'remark', 'annex'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总工作量
|
||||
$data['total_num'] = ProjectLaborBudgetDetail::where('labor_budget_id', $data['id'])->sum('num');
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectLaborBudgetDetail::where('labor_budget_id', $data['id'])->sum('amount');
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取人工预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectLaborBudget::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",
|
||||
"labor_budget_code" => "人工预算单号",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"total_num" => "数量",
|
||||
"total_amount" => "金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,110 +11,111 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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\ProjectLoanApply;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\ProjectTravelReimbursement;
|
||||
|
||||
|
||||
/**
|
||||
* 借款申请列表
|
||||
* Class ProjectLoanApplyLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectLoanApplyLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['loan_apply_code', 'apply_user', 'payee_name'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取借款申请列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectLoanApply::where($this->searchWhere)
|
||||
->field(['id', 'loan_apply_code', 'project_id', 'apply_user', 'loan_date', 'loan_amount', 'payee_name', 'payee_bank', 'payee_account', 'remark'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//差旅报销抵扣
|
||||
$trip_deduction = ProjectTravelReimbursement::where('loan_apply_id',$data['id'])->sum('offset_loan_amount');
|
||||
//费用报销抵扣
|
||||
$expense_deduction = ProjectExpenseReimbursement::where('loan_apply_id',$data['id'])->sum('offset_loan_amount');
|
||||
$data['has_return_amount'] = $trip_deduction + $expense_deduction;
|
||||
$data['not_return_amount'] = $data['loan_amount'] - $data['has_return_amount'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取借款申请数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectLoanApply::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '借款申请列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
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\ProjectLoanApply;
|
||||
use app\common\model\project\ProjectTravelReimbursement;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 借款申请列表
|
||||
* Class ProjectLoanApplyLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectLoanApplyLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"loan_apply_code" => "借款单号",
|
||||
"project_name" => "项目名称",
|
||||
"apply_user" => "借款人",
|
||||
"loan_date" => "借款申请日期",
|
||||
"loan_amount" => "借款金额",
|
||||
"payee_name" => "收款人姓名",
|
||||
"payee_bank" => "收款银行",
|
||||
"payee_account" => "收款账号",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['loan_apply_code', 'apply_user', 'payee_name'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取借款申请列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectLoanApply::where($this->searchWhere)
|
||||
->field(['id', 'loan_apply_code', 'project_id', 'apply_user', 'loan_date', 'loan_amount', 'payee_name', 'payee_bank', 'payee_account', 'remark'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//差旅报销抵扣
|
||||
$trip_deduction = ProjectTravelReimbursement::where('loan_apply_id', $data['id'])->sum('offset_loan_amount');
|
||||
//费用报销抵扣
|
||||
$expense_deduction = ProjectExpenseReimbursement::where('loan_apply_id', $data['id'])->sum('offset_loan_amount');
|
||||
$data['has_return_amount'] = $trip_deduction + $expense_deduction;
|
||||
$data['not_return_amount'] = $data['loan_amount'] - $data['has_return_amount'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取借款申请数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectLoanApply::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",
|
||||
"loan_apply_code" => "借款单号",
|
||||
"project_name" => "项目名称",
|
||||
"apply_user" => "借款人",
|
||||
"loan_date" => "借款申请日期",
|
||||
"loan_amount" => "借款金额",
|
||||
"payee_name" => "收款人姓名",
|
||||
"payee_bank" => "收款银行",
|
||||
"payee_account" => "收款账号",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,112 +11,113 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\material\MaterialPurchaseRequestDetail;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectMaterialBudget;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\ProjectMaterialBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* 材料预算列表
|
||||
* Class ProjectMaterialBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectMaterialBudgetLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/08 16:30
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'material_id', 'budget_type'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取材料预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/08 16:30
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectMaterialBudget::where($this->searchWhere)
|
||||
->field('id,project_id,material_budget_code,remark,annex')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总数量
|
||||
$data['total_num'] = ProjectMaterialBudgetDetail::where('material_budget_id',$data['id'])->sum('num');
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectMaterialBudgetDetail::where('material_budget_id',$data['id'])->sum('amount');
|
||||
//申购总数量
|
||||
$ProjectMaterialBudgetDetailIds = ProjectMaterialBudgetDetail::where('material_budget_id',$data['id'])->column('id');
|
||||
$data['total_apply_num'] = MaterialPurchaseRequestDetail::where('project_material_budget_detail_id','in',$ProjectMaterialBudgetDetailIds)->sum('num');
|
||||
//剩余预算总数量
|
||||
$data['total_residual_num'] = $data['total_num'] - $data['total_apply_num'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取材料预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/08 16:30
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectMaterialBudget::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '材料预算列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\material\MaterialPurchaseRequestDetail;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectMaterialBudget;
|
||||
use app\common\model\project\ProjectMaterialBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 材料预算列表
|
||||
* Class ProjectMaterialBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectMaterialBudgetLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"material_budget_code" => "预算单号",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"total_num" => "预算总数量",
|
||||
"total_apply_num" => "申请总数量",
|
||||
"total_residual_num" => "剩余预算数量",
|
||||
"total_amount" => "预算金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/08 16:30
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'material_id', 'budget_type'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取材料预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/08 16:30
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectMaterialBudget::where($this->searchWhere)
|
||||
->field('id,project_id,material_budget_code,remark,annex')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总数量
|
||||
$data['total_num'] = ProjectMaterialBudgetDetail::where('material_budget_id', $data['id'])->sum('num');
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectMaterialBudgetDetail::where('material_budget_id', $data['id'])->sum('amount');
|
||||
//申购总数量
|
||||
$ProjectMaterialBudgetDetailIds = ProjectMaterialBudgetDetail::where('material_budget_id', $data['id'])->column('id');
|
||||
$data['total_apply_num'] = MaterialPurchaseRequestDetail::where('project_material_budget_detail_id', 'in', $ProjectMaterialBudgetDetailIds)->sum('num');
|
||||
//剩余预算总数量
|
||||
$data['total_residual_num'] = $data['total_num'] - $data['total_apply_num'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取材料预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/08 16:30
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectMaterialBudget::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",
|
||||
"material_budget_code" => "预算单号",
|
||||
"project_name" => "项目名称",
|
||||
"project_code" => "项目编码",
|
||||
"total_num" => "预算总数量",
|
||||
"total_apply_num" => "申请总数量",
|
||||
"total_residual_num" => "剩余预算数量",
|
||||
"total_amount" => "预算金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,117 +11,118 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectSettlement;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 甲方结算列表
|
||||
* Class ProjectSettlementLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectSettlementLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 10:22
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['settlement_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取甲方结算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 10:22
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectSettlement::where($this->searchWhere)
|
||||
->field(['id','settlement_code','project_id','contract_id','settlement_amount','settlement_date','add_user'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
$project = Project::field('name')->where('id',$item['project_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code,amount')->where('id',$item['contract_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id',$item['add_user'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['contract_name'] = $contract['contract_name'];
|
||||
$item['contract_code'] = $contract['contract_code'];
|
||||
//合同金额
|
||||
$item['contract_amount'] = $contract['amount'];
|
||||
//洽商金额
|
||||
$item['negotiation_amount'] = ContractNegotiation::where('contract_id',$item['contract_id'])->sum('negotiation_amount');
|
||||
//结算差异
|
||||
$item['settlement_difference'] = bcsub(($item['contract_amount']+$item['negotiation_amount']),$item['settlement_amount']);
|
||||
$item['add_user_name'] = $admin['name'];
|
||||
unset($item['project_id'],$item['contract_id'],$item['add_user']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取甲方结算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 10:22
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectSettlement::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '甲方结算列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectSettlement;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 甲方结算列表
|
||||
* Class ProjectSettlementLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectSettlementLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"settlement_code" => "结算单号",
|
||||
"project_name" => "项目名称",
|
||||
"contract_name" => "合同名称",
|
||||
"contract_code" => "合同编号",
|
||||
"settlement_date" => "结算日期",
|
||||
"contract_amount" => "合同金额",
|
||||
"negotiation_amount" => "洽商金额",
|
||||
"settlement_amount" => "结算金额",
|
||||
"settlement_difference" => "结算差异",
|
||||
"add_user_name" => "添加人",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 10:22
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['settlement_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取甲方结算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 10:22
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectSettlement::where($this->searchWhere)
|
||||
->field(['id', 'settlement_code', 'project_id', 'contract_id', 'settlement_amount', 'settlement_date', 'add_user'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) {
|
||||
$project = Project::field('name')->where('id', $item['project_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code,amount')->where('id', $item['contract_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id', $item['add_user'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['contract_name'] = $contract['contract_name'];
|
||||
$item['contract_code'] = $contract['contract_code'];
|
||||
//合同金额
|
||||
$item['contract_amount'] = $contract['amount'];
|
||||
//洽商金额
|
||||
$item['negotiation_amount'] = ContractNegotiation::where('contract_id', $item['contract_id'])->sum('negotiation_amount');
|
||||
//结算差异
|
||||
$item['settlement_difference'] = bcsub(($item['contract_amount'] + $item['negotiation_amount']), $item['settlement_amount']);
|
||||
$item['add_user_name'] = $admin['name'];
|
||||
$item['approve_check_status_text'] = $item->approve_check_status_text;
|
||||
unset($item['project_id'], $item['contract_id'], $item['add_user']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取甲方结算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 10:22
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectSettlement::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",
|
||||
"settlement_code" => "结算单号",
|
||||
"project_name" => "项目名称",
|
||||
"contract_name" => "合同名称",
|
||||
"contract_code" => "合同编号",
|
||||
"settlement_date" => "结算日期",
|
||||
"contract_amount" => "合同金额",
|
||||
"negotiation_amount" => "洽商金额",
|
||||
"settlement_amount" => "结算金额",
|
||||
"settlement_difference" => "结算差异",
|
||||
"add_user_name" => "添加人",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,120 +11,121 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectSubcontractSettlement;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
|
||||
/**
|
||||
* 分包结算列表
|
||||
* Class ProjectSubcontractSettlementLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectSubcontractSettlementLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 13:59
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['settlement_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取分包结算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 13:59
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectSubcontractSettlement::where($this->searchWhere)
|
||||
->field(['id', 'settlement_code', 'project_id', 'contract_id', 'settlement_amount', 'settlement_date', 'remark', 'add_user'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
$project = Project::field('name')->where('id',$item['project_id'])->findOrEmpty();
|
||||
$contract = SubcontractingContract::field('supplier_id,contract_no')->where('id',$item['contract_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_code,supplier_name')->where('id',$contract['supplier_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id',$item['add_user'])->findOrEmpty();
|
||||
$item['supplier_name'] = $supplier['supplier_name'];
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['contract_code'] = $contract['contract_no'];
|
||||
//合同金额
|
||||
$item['contract_amount'] = SubcontractingContractDetail::where('contract_id',$item['contract_id'])->sum('amount_including_tax');
|
||||
//洽商金额
|
||||
$item['negotiation_amount'] = ContractNegotiation::where('contract_id',$item['contract_id'])->sum('negotiation_amount');
|
||||
//结算差异
|
||||
$item['settlement_difference'] = bcsub(($item['contract_amount']+$item['negotiation_amount']),$item['settlement_amount']);
|
||||
$item['add_user_name'] = $admin['name'];
|
||||
unset($item['project_id'],$item['contract_id'],$item['add_user']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取分包结算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 13:59
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectSubcontractSettlement::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '分包结算列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectSubcontractSettlement;
|
||||
use app\common\model\supplier\Supplier;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 分包结算列表
|
||||
* Class ProjectSubcontractSettlementLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectSubcontractSettlementLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"settlement_code" => "结算单号",
|
||||
"supplier_name" => "供应商名称",
|
||||
"project_name" => "项目名称",
|
||||
"contract_code" => "合同编号",
|
||||
"settlement_date" => "结算日期",
|
||||
"contract_amount" => "合同金额",
|
||||
"negotiation_amount" => "洽商金额",
|
||||
"settlement_amount" => "结算金额",
|
||||
"settlement_difference" => "结算差异",
|
||||
"add_user_name" => "添加人",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 13:59
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
'%like%' => ['settlement_code'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取分包结算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 13:59
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectSubcontractSettlement::where($this->searchWhere)
|
||||
->field(['id', 'settlement_code', 'project_id', 'contract_id', 'settlement_amount', 'settlement_date', 'remark', 'add_user'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) {
|
||||
$project = Project::field('name')->where('id', $item['project_id'])->findOrEmpty();
|
||||
$contract = SubcontractingContract::field('supplier_id,contract_no')->where('id', $item['contract_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_code,supplier_name')->where('id', $contract['supplier_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id', $item['add_user'])->findOrEmpty();
|
||||
$item['supplier_name'] = $supplier['supplier_name'];
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['contract_code'] = $contract['contract_no'];
|
||||
//合同金额
|
||||
$item['contract_amount'] = SubcontractingContractDetail::where('contract_id', $item['contract_id'])->sum('amount_including_tax');
|
||||
//洽商金额
|
||||
$item['negotiation_amount'] = ContractNegotiation::where('contract_id', $item['contract_id'])->sum('negotiation_amount');
|
||||
//结算差异
|
||||
$item['settlement_difference'] = bcsub(($item['contract_amount'] + $item['negotiation_amount']), $item['settlement_amount']);
|
||||
$item['add_user_name'] = $admin['name'];
|
||||
$item['approve_check_status_text'] = $item->approve_check_status_text;
|
||||
unset($item['project_id'], $item['contract_id'], $item['add_user']);
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取分包结算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/29 13:59
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectSubcontractSettlement::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",
|
||||
"settlement_code" => "结算单号",
|
||||
"supplier_name" => "供应商名称",
|
||||
"project_name" => "项目名称",
|
||||
"contract_code" => "合同编号",
|
||||
"settlement_date" => "结算日期",
|
||||
"contract_amount" => "合同金额",
|
||||
"negotiation_amount" => "洽商金额",
|
||||
"settlement_amount" => "结算金额",
|
||||
"settlement_difference" => "结算差异",
|
||||
"add_user_name" => "添加人",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,109 +11,110 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectSubpackageBudget;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\ProjectSubpackageBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* 分包预算列表
|
||||
* Class ProjectSubpackageBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectSubpackageBudgetLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/10 15:19
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取分包预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/10 15:19
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectSubpackageBudget::where($this->searchWhere)
|
||||
->field('id,project_id,subpackage_budget_code,remark,annex')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总工作量
|
||||
$data['total_num'] = ProjectSubpackageBudgetDetail::where('subpackage_budget_id',$data['id'])->sum('num');
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectSubpackageBudgetDetail::where('subpackage_budget_id',$data['id'])->sum('amount');
|
||||
//已分包工作量
|
||||
$project_subpackage_budget_detail_ids = ProjectSubpackageBudgetDetail::where('subpackage_budget_id',$data['id'])->column('id');
|
||||
$data['has_subcontract_num'] = SubcontractingContractDetail::where('subpackage_budget_detail_id','in',$project_subpackage_budget_detail_ids)->sum('num');
|
||||
//剩余工作量
|
||||
$data['residue_num'] = $data['total_num'] - $data['has_subcontract_num'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取分包预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/10 15:19
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectSubpackageBudget::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '分包预算列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectSubpackageBudget;
|
||||
use app\common\model\project\ProjectSubpackageBudgetDetail;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 分包预算列表
|
||||
* Class ProjectSubpackageBudgetLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectSubpackageBudgetLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"subpackage_budget_code" => "预算单号",
|
||||
"project_name" => "项目名称",
|
||||
"total_num" => "预算总工作量",
|
||||
"residue_num" => "剩余预算工作量",
|
||||
"total_amount" => "预算总金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/10 15:19
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取分包预算列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/10 15:19
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectSubpackageBudget::where($this->searchWhere)
|
||||
->field('id,project_id,subpackage_budget_code,remark,annex')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
//预算总工作量
|
||||
$data['total_num'] = ProjectSubpackageBudgetDetail::where('subpackage_budget_id', $data['id'])->sum('num');
|
||||
//预算总金额
|
||||
$data['total_amount'] = ProjectSubpackageBudgetDetail::where('subpackage_budget_id', $data['id'])->sum('amount');
|
||||
//已分包工作量
|
||||
$project_subpackage_budget_detail_ids = ProjectSubpackageBudgetDetail::where('subpackage_budget_id', $data['id'])->column('id');
|
||||
$data['has_subcontract_num'] = SubcontractingContractDetail::where('subpackage_budget_detail_id', 'in', $project_subpackage_budget_detail_ids)->sum('num');
|
||||
//剩余工作量
|
||||
$data['residue_num'] = $data['total_num'] - $data['has_subcontract_num'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取分包预算数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/10 15:19
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectSubpackageBudget::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",
|
||||
"subpackage_budget_code" => "预算单号",
|
||||
"project_name" => "项目名称",
|
||||
"total_num" => "预算总工作量",
|
||||
"residue_num" => "剩余预算工作量",
|
||||
"total_amount" => "预算总金额",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -72,6 +72,7 @@
|
||||
$data['profit'] = $data['contract_amount'] - $data['total_cost'];
|
||||
//利润率
|
||||
$data['profit_rate'] = !empty((float)$data['contract_amount']) ? ($data['profit'] / $data['contract_amount']) : 0;
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
|
@ -11,126 +11,127 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
use app\common\model\project\ProjectManagerAppointment;
|
||||
use app\common\model\project\ProjectTravelReimbursement;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\ProjectTravelReimbursementDetail;
|
||||
use app\common\model\project\ProjectTripApply;
|
||||
|
||||
|
||||
/**
|
||||
* 差旅报销列表
|
||||
* Class ProjectTravelReimbursementLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectTravelReimbursementLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/18 13:57
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['trip_apply_id', 'project_id', 'reimbursement_type'],
|
||||
'%like%' => ['trip_reimbursement_code','apply_user'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
$field = 'id,trip_apply_id,project_id,trip_reimbursement_code,reimbursement_type,loan_apply_id,offset_loan_amount,apply_user,apply_date,remark';
|
||||
return ProjectTravelReimbursement::where($this->searchWhere)
|
||||
->field($field)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$trip_apply = ProjectTripApply::field('trip_apply_code')->where('id',$data['trip_apply_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$manager = ProjectManagerAppointment::field('project_manager')->where('project_id',$data['project_id'])->findOrEmpty();
|
||||
$loan_apply = ProjectLoanApply::field('loan_apply_code,loan_amount')->where('id',$data['loan_apply_id'])->findOrEmpty();
|
||||
$data['trip_apply_code'] = $trip_apply['trip_apply_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
if($manager->isEmpty()){
|
||||
$data['project_manager'] = '';
|
||||
}else{
|
||||
$admin = Admin::field('name')->where('id',$manager['project_manager'])->findOrEmpty();
|
||||
$data['project_manager'] = $admin['name'];
|
||||
}
|
||||
$data['loan_apply_code'] = !$loan_apply->isEmpty() ? $loan_apply['loan_apply_code'] : '---';
|
||||
$data['loan_amount'] = !$loan_apply->isEmpty() ? $loan_apply['loan_amount'] : '---';
|
||||
$data['reimbursement_type'] = $data->reimbursement_type_text;
|
||||
unset($data['trip_apply_id'],$data['loan_apply_id']);
|
||||
$data['total_amount'] = ProjectTravelReimbursementDetail::where('travel_reimbursement_id',$data['id'])->sum('total_amount');
|
||||
$data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount'];
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取差旅报销数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/18 13:57
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectTravelReimbursement::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '差旅报销列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
use app\common\model\project\ProjectManagerAppointment;
|
||||
use app\common\model\project\ProjectTravelReimbursement;
|
||||
use app\common\model\project\ProjectTravelReimbursementDetail;
|
||||
use app\common\model\project\ProjectTripApply;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 差旅报销列表
|
||||
* Class ProjectTravelReimbursementLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectTravelReimbursementLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"trip_reimbursement_code" => "出差申请单编号",
|
||||
"project_name" => "项目名称",
|
||||
"reimbursement_type" => "报销类型",
|
||||
"loan_apply_code" => "借款单编号",
|
||||
"loan_amount" => "借款金额",
|
||||
"total_amount" => "报销金额",
|
||||
"offset_loan_amount" => "冲抵借款金额",
|
||||
"pay_amount" => "付款金额",
|
||||
"apply_user" => "报销人",
|
||||
"apply_date" => "报销日期",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/18 13:57
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['trip_apply_id', 'project_id', 'reimbursement_type'],
|
||||
'%like%' => ['trip_reimbursement_code', 'apply_user'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
$field = 'id,trip_apply_id,project_id,trip_reimbursement_code,reimbursement_type,loan_apply_id,offset_loan_amount,apply_user,apply_date,remark';
|
||||
return ProjectTravelReimbursement::where($this->searchWhere)
|
||||
->field($field)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$trip_apply = ProjectTripApply::field('trip_apply_code')->where('id', $data['trip_apply_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$manager = ProjectManagerAppointment::field('project_manager')->where('project_id', $data['project_id'])->findOrEmpty();
|
||||
$loan_apply = ProjectLoanApply::field('loan_apply_code,loan_amount')->where('id', $data['loan_apply_id'])->findOrEmpty();
|
||||
$data['trip_apply_code'] = $trip_apply['trip_apply_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
if ($manager->isEmpty()) {
|
||||
$data['project_manager'] = '';
|
||||
} else {
|
||||
$admin = Admin::field('name')->where('id', $manager['project_manager'])->findOrEmpty();
|
||||
$data['project_manager'] = $admin['name'];
|
||||
}
|
||||
$data['loan_apply_code'] = !$loan_apply->isEmpty() ? $loan_apply['loan_apply_code'] : '---';
|
||||
$data['loan_amount'] = !$loan_apply->isEmpty() ? $loan_apply['loan_amount'] : '---';
|
||||
$data['reimbursement_type'] = $data->reimbursement_type_text;
|
||||
unset($data['trip_apply_id'], $data['loan_apply_id']);
|
||||
$data['total_amount'] = ProjectTravelReimbursementDetail::where('travel_reimbursement_id', $data['id'])->sum('total_amount');
|
||||
$data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount'];
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取差旅报销数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/18 13:57
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectTravelReimbursement::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",
|
||||
"trip_reimbursement_code" => "出差申请单编号",
|
||||
"project_name" => "项目名称",
|
||||
"reimbursement_type" => "报销类型",
|
||||
"loan_apply_code" => "借款单编号",
|
||||
"loan_amount" => "借款金额",
|
||||
"total_amount" => "报销金额",
|
||||
"offset_loan_amount" => "冲抵借款金额",
|
||||
"pay_amount" => "付款金额",
|
||||
"apply_user" => "报销人",
|
||||
"apply_date" => "报销日期",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -11,113 +11,114 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectManagerAppointment;
|
||||
use app\common\model\project\ProjectTripApply;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 出差申请列表
|
||||
* Class ProjectTripApplyLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
class ProjectTripApplyLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'traffic'],
|
||||
'%like%' => ['trip_apply_code', 'origin_address', 'target_address'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取出差申请列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectTripApply::where($this->searchWhere)
|
||||
->field(['id', 'project_id', 'trip_apply_code', 'origin_address', 'target_address', 'traffic', 'start_date', 'end_date', 'reason', 'days', 'remark'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$manager = ProjectManagerAppointment::field('project_manager')->where('project_id',$data['project_id'])->findOrEmpty();
|
||||
$data['traffic_text'] = $data->traffic_text;
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
if($manager->isEmpty()){
|
||||
$data['project_manager'] = '';
|
||||
}else{
|
||||
$admin = Admin::field('name')->where('id',$manager['project_manager'])->findOrEmpty();
|
||||
$data['project_manager'] = $admin['name'];
|
||||
}
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取出差申请数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectTripApply::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '出差申请列表';
|
||||
}
|
||||
namespace app\adminapi\lists\project;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectManagerAppointment;
|
||||
use app\common\model\project\ProjectTripApply;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
* 出差申请列表
|
||||
* Class ProjectTripApplyLists
|
||||
* @package app\adminapi\listsproject
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
class ProjectTripApplyLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
return [
|
||||
"id" => "id",
|
||||
"project_name" => "项目名称",
|
||||
"trip_apply_code" => "申请单号",
|
||||
"origin_address" => "出差起始地",
|
||||
"target_address" => "出差目的地",
|
||||
"traffic_text" => "交通工具",
|
||||
"start_date" => "出差时间",
|
||||
"end_date" => "结束时间",
|
||||
"reason" => "出差事由",
|
||||
"days" => "历时天数",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'traffic'],
|
||||
'%like%' => ['trip_apply_code', 'origin_address', 'target_address'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取出差申请列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectTripApply::where($this->searchWhere)
|
||||
->field(['id', 'project_id', 'trip_apply_code', 'origin_address', 'target_address', 'traffic', 'start_date', 'end_date', 'reason', 'days', 'remark'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($data) {
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$manager = ProjectManagerAppointment::field('project_manager')->where('project_id', $data['project_id'])->findOrEmpty();
|
||||
$data['traffic_text'] = $data->traffic_text;
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
if ($manager->isEmpty()) {
|
||||
$data['project_manager'] = '';
|
||||
} else {
|
||||
$admin = Admin::field('name')->where('id', $manager['project_manager'])->findOrEmpty();
|
||||
$data['project_manager'] = $admin['name'];
|
||||
}
|
||||
$data['approve_check_status_text'] = $data->approve_check_status_text;
|
||||
return $data;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取出差申请数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ProjectTripApply::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",
|
||||
"project_name" => "项目名称",
|
||||
"trip_apply_code" => "申请单号",
|
||||
"origin_address" => "出差起始地",
|
||||
"target_address" => "出差目的地",
|
||||
"traffic_text" => "交通工具",
|
||||
"start_date" => "出差时间",
|
||||
"end_date" => "结束时间",
|
||||
"reason" => "出差事由",
|
||||
"days" => "历时天数",
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -160,7 +160,7 @@
|
||||
{
|
||||
$data = BidBiddingDecision::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -11,171 +11,172 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 购买标书逻辑
|
||||
* Class BidBuyBiddingDocumentLogic
|
||||
* @package app\adminapi\logic\bid
|
||||
*/
|
||||
class BidBuyBiddingDocumentLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加购买标书
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidBuyBiddingDocument::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'bid_decision_id' => $params['bid_decision_id'],
|
||||
'bid_document_no' => data_unique_code('购买标书'),
|
||||
'invite_tenders_company_name' => $params['invite_tenders_company_name'],
|
||||
'bid_company_name' => $params['bid_company_name'],
|
||||
'buyer' => $params['buyer'] ?? 0,
|
||||
'amount' => $params['amount'] ?? 0,
|
||||
'buy_date' => !empty($params['buy_date']) ? strtotime($params['buy_date']) : 0,
|
||||
]);
|
||||
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/11/27 18:22
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidBuyBiddingDocument::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'bid_decision_id' => $params['bid_decision_id'],
|
||||
'invite_tenders_company_name' => $params['invite_tenders_company_name'],
|
||||
'bid_company_name' => $params['bid_company_name'],
|
||||
'buyer' => $params['buyer'] ?? 0,
|
||||
'amount' => $params['amount'] ?? 0,
|
||||
'buy_date' => !empty($params['buy_date']) ? strtotime($params['buy_date']) : 0,
|
||||
'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 2023/11/27 18:22
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$data = BidDocumentExamination::where('buy_bidding_document_id',$params['id'])->findOrEmpty();
|
||||
if(!$data->isEmpty()){
|
||||
self::setError('此数据关联了标书审查信息,需删除标书审查信息');
|
||||
return false;
|
||||
}
|
||||
return BidBuyBiddingDocument::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取购买标书详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidBuyBiddingDocument::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$bid_decision = BidBiddingDecision::field('code,bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount,bid_opening_date,margin_amount_return_date,bid_project_overview,project_desc,annex')->where('id',$data['bid_decision_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id',$data['buyer'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_decision_code'] = $bid_decision['code'];
|
||||
$data['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$data['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text;
|
||||
$data['bid_type'] = $bid_decision->bid_type_text;
|
||||
$data['is_margin'] = $bid_decision->is_margin_text;
|
||||
$data['margin_amount'] = $bid_decision['margin_amount'];
|
||||
$data['bid_opening_date'] = $bid_decision['bid_opening_date'];
|
||||
$data['margin_amount_return_date'] = $bid_decision['margin_amount_return_date'];
|
||||
$data['bid_project_overview'] = $bid_decision['bid_project_overview'];
|
||||
$data['project_desc'] = $bid_decision['project_desc'];
|
||||
$data['buyer_name'] = $admin['name'];
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = BidBuyBiddingDocument::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'购买标书',
|
||||
$params['id'],
|
||||
'app\common\model\bid\BidBuyBiddingDocument',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
BidBuyBiddingDocument::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 购买标书逻辑
|
||||
* Class BidBuyBiddingDocumentLogic
|
||||
* @package app\adminapi\logic\bid
|
||||
*/
|
||||
class BidBuyBiddingDocumentLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加购买标书
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidBuyBiddingDocument::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'bid_decision_id' => $params['bid_decision_id'],
|
||||
'bid_document_no' => data_unique_code('购买标书'),
|
||||
'invite_tenders_company_name' => $params['invite_tenders_company_name'],
|
||||
'bid_company_name' => $params['bid_company_name'],
|
||||
'buyer' => $params['buyer'] ?? 0,
|
||||
'amount' => $params['amount'] ?? 0,
|
||||
'buy_date' => !empty($params['buy_date']) ? strtotime($params['buy_date']) : 0,
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/11/27 18:22
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidBuyBiddingDocument::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'bid_decision_id' => $params['bid_decision_id'],
|
||||
'invite_tenders_company_name' => $params['invite_tenders_company_name'],
|
||||
'bid_company_name' => $params['bid_company_name'],
|
||||
'buyer' => $params['buyer'] ?? 0,
|
||||
'amount' => $params['amount'] ?? 0,
|
||||
'buy_date' => !empty($params['buy_date']) ? strtotime($params['buy_date']) : 0,
|
||||
'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 2023/11/27 18:22
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$data = BidDocumentExamination::where('buy_bidding_document_id', $params['id'])->findOrEmpty();
|
||||
if (!$data->isEmpty()) {
|
||||
self::setError('此数据关联了标书审查信息,需删除标书审查信息');
|
||||
return false;
|
||||
}
|
||||
return BidBuyBiddingDocument::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取购买标书详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/11/27 18:22
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidBuyBiddingDocument::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$bid_decision = BidBiddingDecision::field('code,bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount,bid_opening_date,margin_amount_return_date,bid_project_overview,project_desc,annex')->where('id', $data['bid_decision_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id', $data['buyer'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_decision_code'] = $bid_decision['code'];
|
||||
$data['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$data['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text;
|
||||
$data['bid_type'] = $bid_decision->bid_type_text;
|
||||
$data['is_margin'] = $bid_decision->is_margin_text;
|
||||
$data['margin_amount'] = $bid_decision['margin_amount'];
|
||||
$data['bid_opening_date'] = $bid_decision['bid_opening_date'];
|
||||
$data['margin_amount_return_date'] = $bid_decision['margin_amount_return_date'];
|
||||
$data['bid_project_overview'] = $bid_decision['bid_project_overview'];
|
||||
$data['project_desc'] = $bid_decision['project_desc'];
|
||||
$data['buyer_name'] = $admin['name'];
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = BidBuyBiddingDocument::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'购买标书',
|
||||
$params['id'],
|
||||
'app\common\model\bid\BidBuyBiddingDocument',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
BidBuyBiddingDocument::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,121 +11,61 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\bid\BidDocumentExaminationDetail;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bid\BidResult;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 标书审查逻辑
|
||||
* Class BidDocumentExaminationLogic
|
||||
* @package app\adminapi\logic\bid
|
||||
*/
|
||||
class BidDocumentExaminationLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加标书审查
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id',$params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$bidDocumentExamination = BidDocumentExamination::create([
|
||||
'code' => data_unique_code('标书审查'),
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'buy_bidding_document_id' => $params['buy_bidding_document_id'],
|
||||
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
|
||||
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
|
||||
'technical_review_annex' => $params['technical_review_annex'] ? json_encode($params['technical_review_annex']) : null,
|
||||
'tax_rate' => $params['tax_rate'] ?? 0,
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'pay_rate' => $params['pay_rate'] ?? '',
|
||||
'business_contract_deviation' => $params['business_contract_deviation'] ?? '',
|
||||
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'] ?? '',
|
||||
'business_contract_deviation_annex' => $params['business_contract_deviation_annex'] ? json_encode($params['business_contract_deviation_annex']) : null,
|
||||
]);
|
||||
if(!empty($params['quotation_detail'])){
|
||||
foreach ($params['quotation_detail'] as $item)
|
||||
{
|
||||
BidDocumentExaminationDetail::create([
|
||||
'bid_document_examination_id' => $bidDocumentExamination->id,
|
||||
'product_id' => $item['product_id'],
|
||||
'num' => $item['num'],
|
||||
'points' => $item['points'] ?? 0,
|
||||
'cost_price' => $item['cost_price'],
|
||||
'sale_price' => $item['sale_price'],
|
||||
'cost_amount' => $item['cost_price'] * $item['num'],
|
||||
'sale_amount' => $item['sale_price'] * $item['num'],
|
||||
'add_user' => $admin_id,
|
||||
'update_user' => $admin_id
|
||||
]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function edit(array $params,$admin_id): bool
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\bid\BidDocumentExamination;
|
||||
use app\common\model\bid\BidDocumentExaminationDetail;
|
||||
use app\common\model\bid\BidResult;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 标书审查逻辑
|
||||
* Class BidDocumentExaminationLogic
|
||||
* @package app\adminapi\logic\bid
|
||||
*/
|
||||
class BidDocumentExaminationLogic extends BaseLogic
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id',$params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidDocumentExamination::where('id',$params['id'])->update([
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'buy_bidding_document_id' => $params['buy_bidding_document_id'],
|
||||
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
|
||||
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
|
||||
'technical_review_annex' => $params['technical_review_annex'] ? json_encode($params['technical_review_annex']) : null,
|
||||
'tax_rate' => $params['tax_rate'] ?? 0,
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'pay_rate' => $params['pay_rate'] ?? '',
|
||||
'business_contract_deviation' => $params['business_contract_deviation'] ?? '',
|
||||
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'] ?? '',
|
||||
'business_contract_deviation_annex' => $params['business_contract_deviation_annex'] ? json_encode($params['business_contract_deviation_annex']) : null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
if(!empty($params['quotation_detail'])){
|
||||
foreach ($params['quotation_detail'] as $item)
|
||||
{
|
||||
if(!empty($item['id'])){
|
||||
BidDocumentExaminationDetail::where('id',$item['id'])->update([
|
||||
'bid_document_examination_id' => $params['id'],
|
||||
'product_id' => $item['product_id'],
|
||||
'num' => $item['num'],
|
||||
'points' => $item['points'] ?? 0,
|
||||
'cost_price' => $item['cost_price'],
|
||||
'sale_price' => $item['sale_price'],
|
||||
'cost_amount' => $item['cost_price'] * $item['num'],
|
||||
'sale_amount' => $item['sale_price'] * $item['num'],
|
||||
'update_user' => $admin_id,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}else{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加标书审查
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public static function add(array $params, $admin_id): bool
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id', $params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$bidDocumentExamination = BidDocumentExamination::create([
|
||||
'code' => data_unique_code('标书审查'),
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'buy_bidding_document_id' => $params['buy_bidding_document_id'],
|
||||
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
|
||||
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
|
||||
'technical_review_annex' => $params['technical_review_annex'] ? json_encode($params['technical_review_annex']) : null,
|
||||
'tax_rate' => $params['tax_rate'] ?? 0,
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'pay_rate' => $params['pay_rate'] ?? '',
|
||||
'business_contract_deviation' => $params['business_contract_deviation'] ?? '',
|
||||
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'] ?? '',
|
||||
'business_contract_deviation_annex' => $params['business_contract_deviation_annex'] ? json_encode($params['business_contract_deviation_annex']) : null,
|
||||
]);
|
||||
if (!empty($params['quotation_detail'])) {
|
||||
foreach ($params['quotation_detail'] as $item) {
|
||||
BidDocumentExaminationDetail::create([
|
||||
'bid_document_examination_id' => $params['id'],
|
||||
'bid_document_examination_id' => $bidDocumentExamination->id,
|
||||
'product_id' => $item['product_id'],
|
||||
'num' => $item['num'],
|
||||
'points' => $item['points'] ?? 0,
|
||||
@ -138,98 +78,157 @@ class BidDocumentExaminationLogic extends BaseLogic
|
||||
]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$detail = BidDocumentExaminationDetail::where('bid_document_examination_id',$params['id'])->findOrEmpty();
|
||||
if(!$detail->isEmpty()){
|
||||
self::setError('此数据关联了审查明细信息,需删除审查明细信息');
|
||||
return false;
|
||||
}
|
||||
$result = BidResult::where('bid_document_examination_id',$params['id'])->findOrEmpty();
|
||||
if(!$result->isEmpty()){
|
||||
self::setError('此数据关联了投标结果信息,需删除投标结果信息');
|
||||
return false;
|
||||
}
|
||||
return BidDocumentExamination::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取标书审查详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidDocumentExamination::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$bid_buy_doc = BidBuyBiddingDocument::field('bid_decision_id,bid_document_no,buyer,invite_tenders_company_name,bid_company_name,amount,buy_date')->where('id',$data['buy_bidding_document_id'])->findOrEmpty();
|
||||
$buyer = Admin::field('name')->where('id',$bid_buy_doc['buyer'])->findOrEmpty();
|
||||
$bid_decision = BidBiddingDecision::field('bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount,bid_opening_date,margin_amount_return_date,bid_project_overview,project_desc,annex')->where('id',$bid_buy_doc['bid_decision_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_document_no'] = $bid_buy_doc['bid_document_no'];
|
||||
$data['buyer'] = $buyer['name'];
|
||||
$data['invite_tenders_company_name'] = $bid_buy_doc['invite_tenders_company_name'];
|
||||
$data['bid_company_name'] = $bid_buy_doc['bid_company_name'];
|
||||
$data['bid_document_amount'] = $bid_buy_doc['amount'];
|
||||
$data['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text;
|
||||
$data['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$data['buy_date'] = $bid_buy_doc['buy_date'];
|
||||
$data['bid_type'] = $bid_decision->bid_type_text;
|
||||
$data['is_margin'] = $bid_decision->is_margin_text;
|
||||
$data['margin_amount'] = $bid_decision['margin_amount'];
|
||||
$data['bid_opening_date'] = $bid_decision['bid_opening_date'];
|
||||
$data['margin_amount_return_date'] = $bid_decision['margin_amount_return_date'];
|
||||
$data['bid_project_overview'] = $bid_decision['bid_project_overview'];
|
||||
$data['project_desc'] = $bid_decision['project_desc'];
|
||||
$data['total_amount'] = BidDocumentExaminationDetail::where('bid_document_examination_id',$data['id'])->sum('sale_amount');
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = BidDocumentExamination::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'标书审查',
|
||||
$params['id'],
|
||||
'app\common\model\bid\BidDocumentExamination',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
BidDocumentExamination::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
|
||||
public static function edit(array $params, $admin_id): bool
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id', $params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidDocumentExamination::where('id', $params['id'])->update([
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'buy_bidding_document_id' => $params['buy_bidding_document_id'],
|
||||
'technical_protocol_deviation' => $params['technical_protocol_deviation'] ?? '',
|
||||
'protocol_deviation_handling_plan' => $params['protocol_deviation_handling_plan'] ?? '',
|
||||
'technical_review_annex' => $params['technical_review_annex'] ? json_encode($params['technical_review_annex']) : null,
|
||||
'tax_rate' => $params['tax_rate'] ?? 0,
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'pay_rate' => $params['pay_rate'] ?? '',
|
||||
'business_contract_deviation' => $params['business_contract_deviation'] ?? '',
|
||||
'business_contract_deviation_handling_plan' => $params['business_contract_deviation_handling_plan'] ?? '',
|
||||
'business_contract_deviation_annex' => $params['business_contract_deviation_annex'] ? json_encode($params['business_contract_deviation_annex']) : null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
if (!empty($params['quotation_detail'])) {
|
||||
foreach ($params['quotation_detail'] as $item) {
|
||||
if (!empty($item['id'])) {
|
||||
BidDocumentExaminationDetail::where('id', $item['id'])->update([
|
||||
'bid_document_examination_id' => $params['id'],
|
||||
'product_id' => $item['product_id'],
|
||||
'num' => $item['num'],
|
||||
'points' => $item['points'] ?? 0,
|
||||
'cost_price' => $item['cost_price'],
|
||||
'sale_price' => $item['sale_price'],
|
||||
'cost_amount' => $item['cost_price'] * $item['num'],
|
||||
'sale_amount' => $item['sale_price'] * $item['num'],
|
||||
'update_user' => $admin_id,
|
||||
'update_time' => time()
|
||||
]);
|
||||
} else {
|
||||
BidDocumentExaminationDetail::create([
|
||||
'bid_document_examination_id' => $params['id'],
|
||||
'product_id' => $item['product_id'],
|
||||
'num' => $item['num'],
|
||||
'points' => $item['points'] ?? 0,
|
||||
'cost_price' => $item['cost_price'],
|
||||
'sale_price' => $item['sale_price'],
|
||||
'cost_amount' => $item['cost_price'] * $item['num'],
|
||||
'sale_amount' => $item['sale_price'] * $item['num'],
|
||||
'add_user' => $admin_id,
|
||||
'update_user' => $admin_id
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$detail = BidDocumentExaminationDetail::where('bid_document_examination_id', $params['id'])->findOrEmpty();
|
||||
if (!$detail->isEmpty()) {
|
||||
self::setError('此数据关联了审查明细信息,需删除审查明细信息');
|
||||
return false;
|
||||
}
|
||||
$result = BidResult::where('bid_document_examination_id', $params['id'])->findOrEmpty();
|
||||
if (!$result->isEmpty()) {
|
||||
self::setError('此数据关联了投标结果信息,需删除投标结果信息');
|
||||
return false;
|
||||
}
|
||||
return BidDocumentExamination::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取标书审查详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 09:52
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidDocumentExamination::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$bid_buy_doc = BidBuyBiddingDocument::field('bid_decision_id,bid_document_no,buyer,invite_tenders_company_name,bid_company_name,amount,buy_date')->where('id', $data['buy_bidding_document_id'])->findOrEmpty();
|
||||
$buyer = Admin::field('name')->where('id', $bid_buy_doc['buyer'])->findOrEmpty();
|
||||
$bid_decision = BidBiddingDecision::field('bidding_project_fund_source,bidding_time,bid_type,is_margin,margin_amount,bid_opening_date,margin_amount_return_date,bid_project_overview,project_desc,annex')->where('id', $bid_buy_doc['bid_decision_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_document_no'] = $bid_buy_doc['bid_document_no'];
|
||||
$data['buyer'] = $buyer['name'];
|
||||
$data['invite_tenders_company_name'] = $bid_buy_doc['invite_tenders_company_name'];
|
||||
$data['bid_company_name'] = $bid_buy_doc['bid_company_name'];
|
||||
$data['bid_document_amount'] = $bid_buy_doc['amount'];
|
||||
$data['bidding_project_fund_source'] = $bid_decision->bidding_project_fund_source_text;
|
||||
$data['bidding_time'] = $bid_decision['bidding_time'];
|
||||
$data['buy_date'] = $bid_buy_doc['buy_date'];
|
||||
$data['bid_type'] = $bid_decision->bid_type_text;
|
||||
$data['is_margin'] = $bid_decision->is_margin_text;
|
||||
$data['margin_amount'] = $bid_decision['margin_amount'];
|
||||
$data['bid_opening_date'] = $bid_decision['bid_opening_date'];
|
||||
$data['margin_amount_return_date'] = $bid_decision['margin_amount_return_date'];
|
||||
$data['bid_project_overview'] = $bid_decision['bid_project_overview'];
|
||||
$data['project_desc'] = $bid_decision['project_desc'];
|
||||
$data['total_amount'] = BidDocumentExaminationDetail::where('bid_document_examination_id', $data['id'])->sum('sale_amount');
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = BidDocumentExamination::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'标书审查',
|
||||
$params['id'],
|
||||
'app\common\model\bid\BidDocumentExamination',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
BidDocumentExamination::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,164 +11,165 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* BidSecurityApply逻辑
|
||||
* Class BidSecurityApplyLogic
|
||||
* @package app\adminapi\logic\bid
|
||||
*/
|
||||
class BidSecurityApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$bidding_decision = BidBiddingDecision::field('project_id')->where('id',$params['bidding_decision_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityApply::create([
|
||||
'security_apply_code' => data_unique_code('投标保证金'),
|
||||
'project_id' => $bidding_decision['project_id'],
|
||||
'bidding_decision_id' => $params['bidding_decision_id'],
|
||||
'applier' => $params['applier'],
|
||||
'pay_type' => $params['pay_type'],
|
||||
'refund_date' => !empty($params['refund_date']) ? strtotime($params['refund_date']) : 0,
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'deposit_bank' => $params['deposit_bank'],
|
||||
'account_name' => $params['account_name'],
|
||||
'account' => $params['account'],
|
||||
]);
|
||||
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/16 10:46
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$bidding_decision = BidBiddingDecision::field('project_id')->where('id',$params['bidding_decision_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityApply::where('id', $params['id'])->update([
|
||||
'security_apply_code' => data_unique_code('投标保证金'),
|
||||
'project_id' => $bidding_decision['project_id'],
|
||||
'bidding_decision_id' => $params['bidding_decision_id'],
|
||||
'applier' => $params['applier'],
|
||||
'pay_type' => $params['pay_type'],
|
||||
'refund_date' => !empty($params['refund_date']) ? strtotime($params['refund_date']) : 0,
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'deposit_bank' => $params['deposit_bank'],
|
||||
'account_name' => $params['account_name'],
|
||||
'account' => $params['account'],
|
||||
]);
|
||||
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/16 10:46
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return BidSecurityApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidSecurityApply::field('id,security_apply_code,project_id,bidding_decision_id,applier,pay_type,refund_date,remark,annex,deposit_bank,account_name,account,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$bidding_decision = BidBiddingDecision::field('code,margin_amount,bidding_time')->where('id',$data['bidding_decision_id'])->findOrEmpty();
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$data['bidding_decision_code'] = $bidding_decision['code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['pay_type_text'] = $data->pay_type_text;
|
||||
$data['margin_amount'] = $bidding_decision['margin_amount'];
|
||||
$data['bidding_time'] = $bidding_decision['bidding_time'];
|
||||
$data['payment_account_info'] = [];
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = BidSecurityApply::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'投标保证金',
|
||||
$params['id'],
|
||||
'app\common\model\bid\BidSecurityApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
BidSecurityApply::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* BidSecurityApply逻辑
|
||||
* Class BidSecurityApplyLogic
|
||||
* @package app\adminapi\logic\bid
|
||||
*/
|
||||
class BidSecurityApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$bidding_decision = BidBiddingDecision::field('project_id')->where('id', $params['bidding_decision_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityApply::create([
|
||||
'security_apply_code' => data_unique_code('投标保证金'),
|
||||
'project_id' => $bidding_decision['project_id'],
|
||||
'bidding_decision_id' => $params['bidding_decision_id'],
|
||||
'applier' => $params['applier'],
|
||||
'pay_type' => $params['pay_type'],
|
||||
'refund_date' => !empty($params['refund_date']) ? strtotime($params['refund_date']) : 0,
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'deposit_bank' => $params['deposit_bank'],
|
||||
'account_name' => $params['account_name'],
|
||||
'account' => $params['account'],
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$bidding_decision = BidBiddingDecision::field('project_id')->where('id', $params['bidding_decision_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityApply::where('id', $params['id'])->update([
|
||||
'security_apply_code' => data_unique_code('投标保证金'),
|
||||
'project_id' => $bidding_decision['project_id'],
|
||||
'bidding_decision_id' => $params['bidding_decision_id'],
|
||||
'applier' => $params['applier'],
|
||||
'pay_type' => $params['pay_type'],
|
||||
'refund_date' => !empty($params['refund_date']) ? strtotime($params['refund_date']) : 0,
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'deposit_bank' => $params['deposit_bank'],
|
||||
'account_name' => $params['account_name'],
|
||||
'account' => $params['account'],
|
||||
]);
|
||||
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/16 10:46
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return BidSecurityApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/16 10:46
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidSecurityApply::field('id,security_apply_code,project_id,bidding_decision_id,applier,pay_type,refund_date,remark,annex,deposit_bank,account_name,account,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$bidding_decision = BidBiddingDecision::field('code,margin_amount,bidding_time')->where('id', $data['bidding_decision_id'])->findOrEmpty();
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$data['bidding_decision_code'] = $bidding_decision['code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['pay_type_text'] = $data->pay_type_text;
|
||||
$data['margin_amount'] = $bidding_decision['margin_amount'];
|
||||
$data['bidding_time'] = $bidding_decision['bidding_time'];
|
||||
$data['payment_account_info'] = [];
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = BidSecurityApply::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'投标保证金',
|
||||
$params['id'],
|
||||
'app\common\model\bid\BidSecurityApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
BidSecurityApply::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
@ -11,160 +11,161 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\model\bid\BidSecurityRefund;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\custom\Custom;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* BidSecurityRefund逻辑
|
||||
* Class BidSecurityRefundLogic
|
||||
* @package app\adminapi\logic\bid
|
||||
*/
|
||||
class BidSecurityRefundLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$bid_security_apply = BidSecurityApply::field('project_id')->where('id',$params['bid_security_apply_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityRefund::create([
|
||||
'project_id' => $bid_security_apply['project_id'],
|
||||
'bid_security_apply_id' => $params['bid_security_apply_id'],
|
||||
'refund_amount' => $params['refund_amount'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'] ?? 0,
|
||||
]);
|
||||
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/18 10:29
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$bid_security_apply = BidSecurityApply::field('project_id')->where('id',$params['bid_security_apply_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityRefund::where('id', $params['id'])->update([
|
||||
'project_id' => $bid_security_apply['project_id'],
|
||||
'bid_security_apply_id' => $params['bid_security_apply_id'],
|
||||
'refund_amount' => $params['refund_amount'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'] ?? 0,
|
||||
]);
|
||||
|
||||
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/18 10:29
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return BidSecurityRefund::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidSecurityRefund::field('id,project_id,bid_security_apply_id,refund_amount,refund_date,remark,annex,bank_account_id,approve_id')->findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$bid_security_apply = BidSecurityApply::field('bidding_decision_id,deposit_bank,account_name,account')->where('id',$data['bid_security_apply_id'])->findOrEmpty();
|
||||
$bidding_decision = BidBiddingDecision::field('code,bidding_time')->where('id',$bid_security_apply['bidding_decision_id'])->findOrEmpty();
|
||||
$data['bidding_decision_code'] = $bidding_decision['code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['bidding_time'] = $bidding_decision['bidding_time'];
|
||||
$data['deposit_bank'] = $bid_security_apply['deposit_bank'];
|
||||
$data['account_name'] = $bid_security_apply['account_name'];
|
||||
$data['account'] = $bid_security_apply['account'];
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = BidSecurityRefund::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'退投标保证金',
|
||||
$params['id'],
|
||||
'app\common\model\bid\BidSecurityRefund',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
BidSecurityRefund::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\bid;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\bid\BidBiddingDecision;
|
||||
use app\common\model\bid\BidSecurityApply;
|
||||
use app\common\model\bid\BidSecurityRefund;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* BidSecurityRefund逻辑
|
||||
* Class BidSecurityRefundLogic
|
||||
* @package app\adminapi\logic\bid
|
||||
*/
|
||||
class BidSecurityRefundLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$bid_security_apply = BidSecurityApply::field('project_id')->where('id', $params['bid_security_apply_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityRefund::create([
|
||||
'project_id' => $bid_security_apply['project_id'],
|
||||
'bid_security_apply_id' => $params['bid_security_apply_id'],
|
||||
'refund_amount' => $params['refund_amount'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'] ?? 0,
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$bid_security_apply = BidSecurityApply::field('project_id')->where('id', $params['bid_security_apply_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
BidSecurityRefund::where('id', $params['id'])->update([
|
||||
'project_id' => $bid_security_apply['project_id'],
|
||||
'bid_security_apply_id' => $params['bid_security_apply_id'],
|
||||
'refund_amount' => $params['refund_amount'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'] ?? 0,
|
||||
]);
|
||||
|
||||
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/18 10:29
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return BidSecurityRefund::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 10:29
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = BidSecurityRefund::field('id,project_id,bid_security_apply_id,refund_amount,refund_date,remark,annex,bank_account_id,approve_id')->findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$bid_security_apply = BidSecurityApply::field('bidding_decision_id,deposit_bank,account_name,account')->where('id', $data['bid_security_apply_id'])->findOrEmpty();
|
||||
$bidding_decision = BidBiddingDecision::field('code,bidding_time')->where('id', $bid_security_apply['bidding_decision_id'])->findOrEmpty();
|
||||
$data['bidding_decision_code'] = $bidding_decision['code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['bidding_time'] = $bidding_decision['bidding_time'];
|
||||
$data['deposit_bank'] = $bid_security_apply['deposit_bank'];
|
||||
$data['account_name'] = $bid_security_apply['account_name'];
|
||||
$data['account'] = $bid_security_apply['account'];
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id', $data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = BidSecurityRefund::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'退投标保证金',
|
||||
$params['id'],
|
||||
'app\common\model\bid\BidSecurityRefund',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
BidSecurityRefund::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
@ -11,156 +11,75 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\contract;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\finance\FinanceReturnedMoney;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\custom\Custom;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 项目合同逻辑
|
||||
* Class ContractLogic
|
||||
* @package app\adminapi\logic\contract
|
||||
*/
|
||||
class ContractLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加项目合同
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id',$params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$contractRes = Contract::create([
|
||||
"project_id" => $buy_bidding_document['project_id'],
|
||||
"buy_bidding_document_id" => $params['buy_bidding_document_id'],
|
||||
"contract_name" =>$params['contract_name'],
|
||||
'contract_code' => data_unique_code('PHT'),
|
||||
"contract_type" => $params['contract_type'],
|
||||
"contract_pricing_method" => $params['contract_pricing_method'],
|
||||
"party_a" => $params['party_a'],
|
||||
"party_a_contact_address" => $params['party_a_contact_address'] ?? '',
|
||||
"party_a_diretor" => $params['party_a_diretor'] ?? '',
|
||||
"party_a_phone" => $params['party_a_phone'] ?? '',
|
||||
"party_a_mobile" => $params['party_a_mobile'] ?? '',
|
||||
"party_a_email" => $params['party_a_email'] ?? '',
|
||||
"party_b" => $params['party_b'],
|
||||
"party_b_contact_address" => $params['party_b_contact_address'] ?? '',
|
||||
"party_b_diretor" => $params['party_b_diretor'] ?? '',
|
||||
"party_b_phone" => $params['party_b_phone'] ?? '',
|
||||
"party_b_mobile" => $params['party_b_mobile'] ?? '',
|
||||
"party_b_email" => $params['party_b_email'] ?? '',
|
||||
"amount" => $params['amount'],
|
||||
"business_director" => $params['business_director'],
|
||||
"contract_status" => $params['contract_status'],
|
||||
"expire" => strtotime($params['expire']),
|
||||
"contract_date" => strtotime($params['contract_date']),
|
||||
"main_content" => $params['main_content'] ?? '',
|
||||
"remark" => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['returned_money'] as $item)
|
||||
{
|
||||
FinanceReturnedMoney::create([
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'contract_id' => $contractRes->id,
|
||||
'return_date' => strtotime($item['return_date']),
|
||||
'period' => $item['period'],
|
||||
'amount' => $item['amount'],
|
||||
'return_status' => 2,
|
||||
'return_duty_id' => 0,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'annex' => null,
|
||||
]);
|
||||
}
|
||||
Project::where('id',$buy_bidding_document['project_id'])->update([
|
||||
'status' => 3,
|
||||
'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 2023/12/02 17:19
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id',$params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
Contract::where('id', $params['id'])->update([
|
||||
"project_id" => $buy_bidding_document['project_id'],
|
||||
"buy_bidding_document_id" => $params['buy_bidding_document_id'],
|
||||
"contract_name" =>$params['contract_name'],
|
||||
"contract_type" => $params['contract_type'],
|
||||
"contract_pricing_method" => $params['contract_pricing_method'],
|
||||
"party_a" => $params['party_a'],
|
||||
"party_a_contact_address" => $params['party_a_contact_address'] ?? '',
|
||||
"party_a_diretor" => $params['party_a_diretor'] ?? '',
|
||||
"party_a_phone" => $params['party_a_phone'] ?? '',
|
||||
"party_a_mobile" => $params['party_a_mobile'] ?? '',
|
||||
"party_a_email" => $params['party_a_email'] ?? '',
|
||||
"party_b" => $params['party_b'],
|
||||
"party_b_contact_address" => $params['party_b_contact_address'] ?? '',
|
||||
"party_b_diretor" => $params['party_b_diretor'] ?? '',
|
||||
"party_b_phone" => $params['party_b_phone'] ?? '',
|
||||
"party_b_mobile" => $params['party_b_mobile'] ?? '',
|
||||
"party_b_email" => $params['party_b_email'] ?? '',
|
||||
"amount" => $params['amount'],
|
||||
"business_director" => $params['business_director'],
|
||||
"contract_status" => $params['contract_status'],
|
||||
"expire" => strtotime($params['expire']),
|
||||
"contract_date" => strtotime($params['contract_date']),
|
||||
"main_content" => $params['main_content'] ?? '',
|
||||
"remark" => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['returned_money'] as $item)
|
||||
{
|
||||
if(isset($item['id']) && $item['id'] != ''){
|
||||
FinanceReturnedMoney::where('id',$item['id'])->update([
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'return_date' => strtotime($item['return_date']),
|
||||
'period' => $item['period'],
|
||||
'amount' => $item['amount'],
|
||||
'return_status' => 2,
|
||||
'return_duty_id' => 0,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'annex' => null,
|
||||
]);
|
||||
}else{
|
||||
|
||||
namespace app\adminapi\logic\contract;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bid\BidBuyBiddingDocument;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceReturnedMoney;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 项目合同逻辑
|
||||
* Class ContractLogic
|
||||
* @package app\adminapi\logic\contract
|
||||
*/
|
||||
class ContractLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加项目合同
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id', $params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
$contractRes = Contract::create([
|
||||
"project_id" => $buy_bidding_document['project_id'],
|
||||
"buy_bidding_document_id" => $params['buy_bidding_document_id'],
|
||||
"contract_name" => $params['contract_name'],
|
||||
'contract_code' => data_unique_code('PHT'),
|
||||
"contract_type" => $params['contract_type'],
|
||||
"contract_pricing_method" => $params['contract_pricing_method'],
|
||||
"party_a" => $params['party_a'],
|
||||
"party_a_contact_address" => $params['party_a_contact_address'] ?? '',
|
||||
"party_a_diretor" => $params['party_a_diretor'] ?? '',
|
||||
"party_a_phone" => $params['party_a_phone'] ?? '',
|
||||
"party_a_mobile" => $params['party_a_mobile'] ?? '',
|
||||
"party_a_email" => $params['party_a_email'] ?? '',
|
||||
"party_b" => $params['party_b'],
|
||||
"party_b_contact_address" => $params['party_b_contact_address'] ?? '',
|
||||
"party_b_diretor" => $params['party_b_diretor'] ?? '',
|
||||
"party_b_phone" => $params['party_b_phone'] ?? '',
|
||||
"party_b_mobile" => $params['party_b_mobile'] ?? '',
|
||||
"party_b_email" => $params['party_b_email'] ?? '',
|
||||
"amount" => $params['amount'],
|
||||
"business_director" => $params['business_director'],
|
||||
"contract_status" => $params['contract_status'],
|
||||
"expire" => strtotime($params['expire']),
|
||||
"contract_date" => strtotime($params['contract_date']),
|
||||
"main_content" => $params['main_content'] ?? '',
|
||||
"remark" => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['returned_money'] as $item) {
|
||||
FinanceReturnedMoney::create([
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'contract_id' => $contractRes->id,
|
||||
'return_date' => strtotime($item['return_date']),
|
||||
'period' => $item['period'],
|
||||
'amount' => $item['amount'],
|
||||
@ -170,95 +89,175 @@ class ContractLogic extends BaseLogic
|
||||
'annex' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
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/02 17:19
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return Contract::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取项目合同详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = Contract::findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('id,name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('bid_document_no')->where('id',$data['buy_bidding_document_id'])->findOrEmpty();
|
||||
$business_director = Admin::field('name')->where('id',$data['business_director'])->findOrEmpty();
|
||||
$data['custom_id'] = $custom['id'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_document_no'] = $buy_bidding_document['bid_document_no'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['contract_pricing_method_text'] = $data->contract_pricing_method_text;
|
||||
$data['contract_status_text'] = $data->contract_status_text;
|
||||
$data['contract_pricing_method_text'] = $data->contract_pricing_method_text;
|
||||
$data['business_director_name'] = $business_director['name'];
|
||||
$data['returned_amount'] = FinanceReturnedRecord::where('contract_id',$data['id'])->sum('amount');
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = Contract::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'项目合同',
|
||||
$params['id'],
|
||||
'app\common\model\contract\Contract',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
Contract::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
Project::where('id', $buy_bidding_document['project_id'])->update([
|
||||
'status' => 3,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function datas()
|
||||
{
|
||||
return Contract::field(['id','contract_name'])->order(['id' => 'desc'])->select()->each(function($data){
|
||||
$data['projectinfo'] = 'ID:' . $data['id'] . ' / 名称:' . $data['contract_name'];
|
||||
})->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑项目合同
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('project_id')->where('id', $params['buy_bidding_document_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
Contract::where('id', $params['id'])->update([
|
||||
"project_id" => $buy_bidding_document['project_id'],
|
||||
"buy_bidding_document_id" => $params['buy_bidding_document_id'],
|
||||
"contract_name" => $params['contract_name'],
|
||||
"contract_type" => $params['contract_type'],
|
||||
"contract_pricing_method" => $params['contract_pricing_method'],
|
||||
"party_a" => $params['party_a'],
|
||||
"party_a_contact_address" => $params['party_a_contact_address'] ?? '',
|
||||
"party_a_diretor" => $params['party_a_diretor'] ?? '',
|
||||
"party_a_phone" => $params['party_a_phone'] ?? '',
|
||||
"party_a_mobile" => $params['party_a_mobile'] ?? '',
|
||||
"party_a_email" => $params['party_a_email'] ?? '',
|
||||
"party_b" => $params['party_b'],
|
||||
"party_b_contact_address" => $params['party_b_contact_address'] ?? '',
|
||||
"party_b_diretor" => $params['party_b_diretor'] ?? '',
|
||||
"party_b_phone" => $params['party_b_phone'] ?? '',
|
||||
"party_b_mobile" => $params['party_b_mobile'] ?? '',
|
||||
"party_b_email" => $params['party_b_email'] ?? '',
|
||||
"amount" => $params['amount'],
|
||||
"business_director" => $params['business_director'],
|
||||
"contract_status" => $params['contract_status'],
|
||||
"expire" => strtotime($params['expire']),
|
||||
"contract_date" => strtotime($params['contract_date']),
|
||||
"main_content" => $params['main_content'] ?? '',
|
||||
"remark" => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['returned_money'] as $item) {
|
||||
if (isset($item['id']) && $item['id'] != '') {
|
||||
FinanceReturnedMoney::where('id', $item['id'])->update([
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'return_date' => strtotime($item['return_date']),
|
||||
'period' => $item['period'],
|
||||
'amount' => $item['amount'],
|
||||
'return_status' => 2,
|
||||
'return_duty_id' => 0,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'annex' => null,
|
||||
]);
|
||||
} else {
|
||||
FinanceReturnedMoney::create([
|
||||
'project_id' => $buy_bidding_document['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'return_date' => strtotime($item['return_date']),
|
||||
'period' => $item['period'],
|
||||
'amount' => $item['amount'],
|
||||
'return_status' => 2,
|
||||
'return_duty_id' => 0,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'annex' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
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/02 17:19
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return Contract::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取项目合同详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = Contract::findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('id,name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$buy_bidding_document = BidBuyBiddingDocument::field('bid_document_no')->where('id', $data['buy_bidding_document_id'])->findOrEmpty();
|
||||
$business_director = Admin::field('name')->where('id', $data['business_director'])->findOrEmpty();
|
||||
$data['custom_id'] = $custom['id'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['bid_document_no'] = $buy_bidding_document['bid_document_no'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['contract_pricing_method_text'] = $data->contract_pricing_method_text;
|
||||
$data['contract_status_text'] = $data->contract_status_text;
|
||||
$data['contract_pricing_method_text'] = $data->contract_pricing_method_text;
|
||||
$data['business_director_name'] = $business_director['name'];
|
||||
$data['returned_amount'] = FinanceReturnedRecord::where('contract_id', $data['id'])->sum('amount');
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = Contract::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'项目合同',
|
||||
$params['id'],
|
||||
'app\common\model\contract\Contract',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
Contract::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function datas()
|
||||
{
|
||||
return Contract::field(['id', 'contract_name'])->order(['id' => 'desc'])->select()->each(function ($data) {
|
||||
$data['projectinfo'] = 'ID:' . $data['id'] . ' / 名称:' . $data['contract_name'];
|
||||
})->toArray();
|
||||
}
|
||||
}
|
@ -163,7 +163,7 @@
|
||||
{
|
||||
$data = ContractNegotiation::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -11,182 +11,82 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\contract;
|
||||
|
||||
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\ProcurementContractDetail;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinancePaymentPlan;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 采购合同逻辑
|
||||
* Class ProcurementContractLogic
|
||||
* @package app\adminapi\logic\contract
|
||||
*/
|
||||
class ProcurementContractLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加采购合同
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
//税率字典值
|
||||
$tax_rate_dict = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
//合同金额\不含税金额
|
||||
$contract_amount = 0;
|
||||
foreach($params['procurement_contract_detail'] as $v){
|
||||
$contract_amount += $v['price']*$v['num'];
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$procurementContract = ProcurementContract::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_no' => data_unique_code('CGHT'),
|
||||
'contract_name' => $params['contract_name'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => strtotime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
//质保金
|
||||
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
|
||||
//质保金比例
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['procurement_contract_detail'] as $v)
|
||||
{
|
||||
ProcurementContractDetail::create([
|
||||
'contract_id' => $procurementContract->id,
|
||||
'material_purchase_request_detail_id' => $v['material_purchase_request_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1- $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
]);
|
||||
}
|
||||
foreach ($params['payment_plan'] as $v)
|
||||
{
|
||||
FinancePaymentPlan::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $procurementContract->id,
|
||||
'contract_type' => 1,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
namespace app\adminapi\logic\contract;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\ProcurementContractDetail;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinancePaymentPlan;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑采购合同
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
* 采购合同逻辑
|
||||
* Class ProcurementContractLogic
|
||||
* @package app\adminapi\logic\contract
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
class ProcurementContractLogic extends BaseLogic
|
||||
{
|
||||
//税率字典值
|
||||
$tax_rate_dict = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
//合同金额\不含税金额
|
||||
$contract_amount = 0;
|
||||
foreach($params['procurement_contract_detail'] as $v){
|
||||
$contract_amount += $v['price']*$v['num'];
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProcurementContract::where('id',$params['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_name' => $params['contract_name'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => strtotime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
//质保金
|
||||
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
|
||||
//质保金比例
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['procurement_contract_detail'] as $v)
|
||||
{
|
||||
if(isset($v['id']) && $v != ''){
|
||||
ProcurementContractDetail::where('id',$v['id'])->update([
|
||||
'contract_id' => $params['id'],
|
||||
'material_purchase_request_detail_id' => $v['material_purchase_request_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1- $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
]);
|
||||
}else{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加采购合同
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
//税率字典值
|
||||
$tax_rate_dict = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
//合同金额\不含税金额
|
||||
$contract_amount = 0;
|
||||
foreach ($params['procurement_contract_detail'] as $v) {
|
||||
$contract_amount += $v['price'] * $v['num'];
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$procurementContract = ProcurementContract::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_no' => data_unique_code('CGHT'),
|
||||
'contract_name' => $params['contract_name'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => strtotime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
//质保金
|
||||
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
|
||||
//质保金比例
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['procurement_contract_detail'] as $v) {
|
||||
ProcurementContractDetail::create([
|
||||
'contract_id' => $params['id'],
|
||||
'contract_id' => $procurementContract->id,
|
||||
'material_purchase_request_detail_id' => $v['material_purchase_request_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1- $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1 - $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach ($params['payment_plan'] as $v)
|
||||
{
|
||||
if(isset($v['id']) && $v != ''){
|
||||
FinancePaymentPlan::where('id',$v['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'contract_type' => 1,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}else{
|
||||
foreach ($params['payment_plan'] as $v) {
|
||||
FinancePaymentPlan::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'contract_id' => $procurementContract->id,
|
||||
'contract_type' => 1,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
@ -195,92 +95,190 @@ class ProcurementContractLogic extends BaseLogic
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$detail = ProcurementContractDetail::where('contract_id','in',$params['id'])->findOrEmpty();
|
||||
if(!$detail->isEmpty()){
|
||||
self::setError('此数据关联了采购明细信息,需删除采购明细信息');
|
||||
return false;
|
||||
}
|
||||
$payment_plan = FinancePaymentPlan::where('contract_id','in',$params['id'])->where('contract_type',1)->findOrEmpty();
|
||||
if(!$payment_plan->isEmpty()){
|
||||
self::setError('此数据关联了付款计划信息,需删除付款计划信息');
|
||||
return false;
|
||||
}
|
||||
return ProcurementContract::destroy($params['id']);
|
||||
}
|
||||
/**
|
||||
* @notes 获取采购合同详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProcurementContract::findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id',$data['supplier_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['pay_type_text'] = $data->pay_type_text;
|
||||
$data['account_period_text'] = $data->account_period_text;
|
||||
$data['amount_excluding_tax'] = ProcurementContractDetail::where('contract_id',$data['id'])->sum('amount_excluding_tax');
|
||||
$data['contract_amount'] = ProcurementContractDetail::where('contract_id',$data['id'])->sum('amount_including_tax');
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = ProcurementContract::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'采购合同',
|
||||
$params['id'],
|
||||
'app\common\model\contract\ProcurementContract',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
ProcurementContract::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑采购合同
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/02 17:19
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
//税率字典值
|
||||
$tax_rate_dict = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
//合同金额\不含税金额
|
||||
$contract_amount = 0;
|
||||
foreach ($params['procurement_contract_detail'] as $v) {
|
||||
$contract_amount += $v['price'] * $v['num'];
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProcurementContract::where('id', $params['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_name' => $params['contract_name'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => strtotime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
//质保金
|
||||
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
|
||||
//质保金比例
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['procurement_contract_detail'] as $v) {
|
||||
if (isset($v['id']) && $v != '') {
|
||||
ProcurementContractDetail::where('id', $v['id'])->update([
|
||||
'contract_id' => $params['id'],
|
||||
'material_purchase_request_detail_id' => $v['material_purchase_request_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1 - $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
]);
|
||||
} else {
|
||||
ProcurementContractDetail::create([
|
||||
'contract_id' => $params['id'],
|
||||
'material_purchase_request_detail_id' => $v['material_purchase_request_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1 - $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach ($params['payment_plan'] as $v) {
|
||||
if (isset($v['id']) && $v != '') {
|
||||
FinancePaymentPlan::where('id', $v['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'contract_type' => 1,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
} else {
|
||||
FinancePaymentPlan::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'contract_type' => 1,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function datas()
|
||||
{
|
||||
return ProcurementContract::field(['id','contract_name'])->order(['id' => 'desc'])->select()->each(function($data){
|
||||
$data['projectinfo'] = 'ID:' . $data['id'] . ' / 名称:' . $data['contract_name'];
|
||||
})->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$detail = ProcurementContractDetail::where('contract_id', 'in', $params['id'])->findOrEmpty();
|
||||
if (!$detail->isEmpty()) {
|
||||
self::setError('此数据关联了采购明细信息,需删除采购明细信息');
|
||||
return false;
|
||||
}
|
||||
$payment_plan = FinancePaymentPlan::where('contract_id', 'in', $params['id'])->where('contract_type', 1)->findOrEmpty();
|
||||
if (!$payment_plan->isEmpty()) {
|
||||
self::setError('此数据关联了付款计划信息,需删除付款计划信息');
|
||||
return false;
|
||||
}
|
||||
return ProcurementContract::destroy($params['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取采购合同详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/04 22:08
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProcurementContract::findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id', $data['supplier_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['pay_type_text'] = $data->pay_type_text;
|
||||
$data['account_period_text'] = $data->account_period_text;
|
||||
$data['amount_excluding_tax'] = ProcurementContractDetail::where('contract_id', $data['id'])->sum('amount_excluding_tax');
|
||||
$data['contract_amount'] = ProcurementContractDetail::where('contract_id', $data['id'])->sum('amount_including_tax');
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = ProcurementContract::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'采购合同',
|
||||
$params['id'],
|
||||
'app\common\model\contract\ProcurementContract',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
ProcurementContract::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function datas()
|
||||
{
|
||||
return ProcurementContract::field(['id', 'contract_name'])->order(['id' => 'desc'])->select()->each(function ($data) {
|
||||
$data['projectinfo'] = 'ID:' . $data['id'] . ' / 名称:' . $data['contract_name'];
|
||||
})->toArray();
|
||||
}
|
||||
}
|
@ -11,281 +11,277 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\contract;
|
||||
|
||||
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinancePaymentPlan;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* SubcontractingContract逻辑
|
||||
* Class SubcontractingContractLogic
|
||||
* @package app\adminapi\logic\contract
|
||||
*/
|
||||
class SubcontractingContractLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
//税率字典值
|
||||
$tax_rate_dict = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
//合同金额\不含税金额
|
||||
$contract_amount = 0;
|
||||
foreach($params['subcontracting_contract_detail'] as $v){
|
||||
$contract_amount += $v['price']*$v['num'];
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = SubcontractingContract::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_no' => data_unique_code('FBHT'),
|
||||
'contract_name' => $params['contract_name'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => strtotime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
//质保金
|
||||
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
|
||||
//质保金比例
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['subcontracting_contract_detail'] as $v)
|
||||
{
|
||||
SubcontractingContractDetail::create([
|
||||
'contract_id' => $res->id,
|
||||
'subpackage_budget_detail_id' => $v['subpackage_budget_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1- $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
foreach ($params['payment_plan'] as $v)
|
||||
{
|
||||
FinancePaymentPlan::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $res->id,
|
||||
'contract_type' => 2,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['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/12 17:15
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
//税率字典值
|
||||
$tax_rate_dict = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
//合同金额\不含税金额
|
||||
$contract_amount = 0;
|
||||
foreach($params['subcontracting_contract_detail'] as $v){
|
||||
$contract_amount += $v['price']*$v['num'];
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
SubcontractingContract::where('id',$params['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_name' => $params['contract_name'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => strtotime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
//质保金
|
||||
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
|
||||
//质保金比例
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['subcontracting_contract_detail'] as $v)
|
||||
{
|
||||
if(isset($v['id']) && $v != ''){
|
||||
SubcontractingContractDetail::where('id',$v['id'])->update([
|
||||
'contract_id' => $params['id'],
|
||||
'subpackage_budget_detail_id' => $v['subpackage_budget_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1- $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}else{
|
||||
SubcontractingContractDetail::create([
|
||||
'contract_id' => $params['id'],
|
||||
'subpackage_budget_detail_id' => $v['subpackage_budget_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1- $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach ($params['payment_plan'] as $v)
|
||||
{
|
||||
if(isset($v['id']) && $v != ''){
|
||||
FinancePaymentPlan::where('id',$v['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'contract_type' => 2,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}else{
|
||||
FinancePaymentPlan::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'contract_type' => 2,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function delete(array $params): bool
|
||||
namespace app\adminapi\logic\contract;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinancePaymentPlan;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* SubcontractingContract逻辑
|
||||
* Class SubcontractingContractLogic
|
||||
* @package app\adminapi\logic\contract
|
||||
*/
|
||||
class SubcontractingContractLogic extends BaseLogic
|
||||
{
|
||||
$detail = SubcontractingContractDetail::where('contract_id','in',$params['id'])->findOrEmpty();
|
||||
if(!$detail->isEmpty()){
|
||||
self::setError('此数据关联了分包明细信息,需删除分包明细信息');
|
||||
return false;
|
||||
}
|
||||
$payment_plan = FinancePaymentPlan::where('contract_id','in',$params['id'])->where('contract_type',2)->findOrEmpty();
|
||||
if(!$payment_plan->isEmpty()){
|
||||
self::setError('此数据关联了付款计划信息,需删除付款计划信息');
|
||||
return false;
|
||||
}
|
||||
return SubcontractingContract::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = SubcontractingContract::findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id',$data['supplier_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['pay_type_text'] = $data->pay_type_text;
|
||||
$data['account_period_text'] = $data->account_period_text;
|
||||
$data['contract_amount'] = SubcontractingContractDetail::where('contract_id',$data['id'])->sum('amount_including_tax');
|
||||
$data['amount_excluding_tax'] = SubcontractingContractDetail::where('contract_id',$data['id'])->sum('amount_excluding_tax');
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = SubcontractingContract::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'分包合同',
|
||||
$params['id'],
|
||||
'app\common\model\contract\SubcontractingContract',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
SubcontractingContract::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
//税率字典值
|
||||
$tax_rate_dict = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
//合同金额\不含税金额
|
||||
$contract_amount = 0;
|
||||
foreach ($params['subcontracting_contract_detail'] as $v) {
|
||||
$contract_amount += $v['price'] * $v['num'];
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = SubcontractingContract::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_no' => data_unique_code('FBHT'),
|
||||
'contract_name' => $params['contract_name'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => strtotime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
//质保金
|
||||
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
|
||||
//质保金比例
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['subcontracting_contract_detail'] as $v) {
|
||||
SubcontractingContractDetail::create([
|
||||
'contract_id' => $res->id,
|
||||
'subpackage_budget_detail_id' => $v['subpackage_budget_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1 - $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
foreach ($params['payment_plan'] as $v) {
|
||||
FinancePaymentPlan::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $res->id,
|
||||
'contract_type' => 2,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function datas()
|
||||
{
|
||||
return SubcontractingContract::field(['id','contract_name'])->order(['id' => 'desc'])->select()->each(function($data){
|
||||
$data['projectinfo'] = 'ID:' . $data['id'] . ' / 名称:' . $data['contract_name'];
|
||||
})->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
//税率字典值
|
||||
$tax_rate_dict = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
//合同金额\不含税金额
|
||||
$contract_amount = 0;
|
||||
foreach ($params['subcontracting_contract_detail'] as $v) {
|
||||
$contract_amount += $v['price'] * $v['num'];
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
SubcontractingContract::where('id', $params['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_name' => $params['contract_name'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => strtotime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
//质保金
|
||||
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
|
||||
//质保金比例
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['subcontracting_contract_detail'] as $v) {
|
||||
if (isset($v['id']) && $v != '') {
|
||||
SubcontractingContractDetail::where('id', $v['id'])->update([
|
||||
'contract_id' => $params['id'],
|
||||
'subpackage_budget_detail_id' => $v['subpackage_budget_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1 - $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
} else {
|
||||
SubcontractingContractDetail::create([
|
||||
'contract_id' => $params['id'],
|
||||
'subpackage_budget_detail_id' => $v['subpackage_budget_detail_id'],
|
||||
'num' => $v['num'],
|
||||
'price' => $v['price'],
|
||||
'tax_rate' => $v['tax_rate'],
|
||||
//不含税金额
|
||||
'amount_excluding_tax' => $v['num'] * $v['price'] * (1 - $tax_rate_dict[$v['tax_rate']] / 100),
|
||||
//含税金额
|
||||
'amount_including_tax' => $v['num'] * $v['price'],
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach ($params['payment_plan'] as $v) {
|
||||
if (isset($v['id']) && $v != '') {
|
||||
FinancePaymentPlan::where('id', $v['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'contract_type' => 2,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
} else {
|
||||
FinancePaymentPlan::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['id'],
|
||||
'contract_type' => 2,
|
||||
'period' => $v['period'],
|
||||
'pay_date' => strtotime($v['pay_date']),
|
||||
'amount' => $v['amount'],
|
||||
'status' => 1,
|
||||
'remark' => $v['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$detail = SubcontractingContractDetail::where('contract_id', 'in', $params['id'])->findOrEmpty();
|
||||
if (!$detail->isEmpty()) {
|
||||
self::setError('此数据关联了分包明细信息,需删除分包明细信息');
|
||||
return false;
|
||||
}
|
||||
$payment_plan = FinancePaymentPlan::where('contract_id', 'in', $params['id'])->where('contract_type', 2)->findOrEmpty();
|
||||
if (!$payment_plan->isEmpty()) {
|
||||
self::setError('此数据关联了付款计划信息,需删除付款计划信息');
|
||||
return false;
|
||||
}
|
||||
return SubcontractingContract::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/12 17:15
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = SubcontractingContract::findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id', $data['supplier_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['pay_type_text'] = $data->pay_type_text;
|
||||
$data['account_period_text'] = $data->account_period_text;
|
||||
$data['contract_amount'] = SubcontractingContractDetail::where('contract_id', $data['id'])->sum('amount_including_tax');
|
||||
$data['amount_excluding_tax'] = SubcontractingContractDetail::where('contract_id', $data['id'])->sum('amount_excluding_tax');
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = SubcontractingContract::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'分包合同',
|
||||
$params['id'],
|
||||
'app\common\model\contract\SubcontractingContract',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
SubcontractingContract::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function datas()
|
||||
{
|
||||
return SubcontractingContract::field(['id', 'contract_name'])->order(['id' => 'desc'])->select()->each(function ($data) {
|
||||
$data['projectinfo'] = 'ID:' . $data['id'] . ' / 名称:' . $data['contract_name'];
|
||||
})->toArray();
|
||||
}
|
||||
}
|
@ -149,7 +149,7 @@
|
||||
{
|
||||
$data = SubcontractingContractNegotiation::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -11,206 +11,207 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\finance;
|
||||
|
||||
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinanceInvoiceApply;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\custom\Custom;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceInvoiceApply逻辑
|
||||
* Class FinanceInvoiceApplyLogic
|
||||
* @package app\adminapi\logic\finance
|
||||
*/
|
||||
class FinanceInvoiceApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$contract = Contract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty();
|
||||
$tax_rate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceInvoiceApply::create([
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'invoicing_code' => data_unique_code('开票申请'),
|
||||
'invoicing_date' => strtotime($params['invoicing_date']),
|
||||
'period' => $params['period'],
|
||||
'tax_rate' => $params['tax_rate'],
|
||||
'invoice_type' => $params['invoice_type'],
|
||||
'invoicing_amount' => $params['invoicing_amount'],
|
||||
'tax_amount' => ($tax_rate[$params['tax_rate']] / 100) * $params['invoicing_amount'],
|
||||
'amount_including_tax' => (1 - $tax_rate[$params['tax_rate']] / 100) * $params['invoicing_amount'],
|
||||
'content' => $params['content'] ?? '',
|
||||
'invoice_no' => $params['invoice_no'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'invoicing_company_name' => $params['invoicing_company_name'] ?? '',
|
||||
'taxpayer_identification_number' => $params['taxpayer_identification_number'] ?? '',
|
||||
'deposit_bank' => $params['deposit_bank'] ?? '',
|
||||
'bank_accnout' => $params['bank_accnout'] ?? '',
|
||||
'address_phone' => $params['address_phone'] ?? '',
|
||||
'receiving_address' => $params['receiving_address'] ?? '',
|
||||
'contacts' => $params['contacts'] ?? '',
|
||||
'phone' => $params['phone'] ?? '',
|
||||
'mailing_time' => !empty($params['mailing_time']) ? strtotime($params['mailing_time']) : 0,
|
||||
'mailing_type' => $params['mailing_type'] ?? '',
|
||||
'mailing_no' => $params['mailing_no'] ?? '',
|
||||
]);
|
||||
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/13 15:01
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$contract = Contract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty();
|
||||
$tax_rate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceInvoiceApply::where('id', $params['id'])->update([
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'invoicing_date' => strtotime($params['invoicing_date']),
|
||||
'period' => $params['period'],
|
||||
'tax_rate' => $params['tax_rate'],
|
||||
'invoice_type' => $params['invoice_type'],
|
||||
'invoicing_amount' => $params['invoicing_amount'],
|
||||
'tax_amount' => ($tax_rate[$params['tax_rate']] / 100) * $params['invoicing_amount'],
|
||||
'amount_including_tax' => (1 - $tax_rate[$params['tax_rate']] / 100) * $params['invoicing_amount'],
|
||||
'content' => $params['content'] ?? '',
|
||||
'invoice_no' => $params['invoice_no'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'invoicing_company_name' => $params['invoicing_company_name'] ?? '',
|
||||
'taxpayer_identification_number' => $params['taxpayer_identification_number'] ?? '',
|
||||
'deposit_bank' => $params['deposit_bank'] ?? '',
|
||||
'bank_accnout' => $params['bank_accnout'] ?? '',
|
||||
'address_phone' => $params['address_phone'] ?? '',
|
||||
'receiving_address' => $params['receiving_address'] ?? '',
|
||||
'contacts' => $params['contacts'] ?? '',
|
||||
'phone' => $params['phone'] ?? '',
|
||||
'mailing_time' => !empty($params['mailing_time']) ? strtotime($params['mailing_time']) : 0,
|
||||
'mailing_type' => $params['mailing_type'] ?? '',
|
||||
'mailing_no' => $params['mailing_no'] ?? '',
|
||||
'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 2023/12/13 15:01
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinanceInvoiceApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinanceInvoiceApply::findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_code,contract_name,amount')->where('id',$data['contract_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
//合同洽商金额
|
||||
$contract_negotiation_amount = ContractNegotiation::where('contract_id',$data['contract_id'])->sum('negotiation_amount');
|
||||
//合同金额 = 合同金额 + 合同洽商金额
|
||||
$data['contract_amount'] = $contract['amount'] + $contract_negotiation_amount;
|
||||
//回款金额
|
||||
$data['returned_amount'] = FinanceReturnedRecord::where('contract_id',$data['contract_id'])->sum('amount');
|
||||
//累计开票金额
|
||||
$data['total_invoicing_amount'] = FinanceInvoiceApply::where('contract_id',$data['contract_id'])->where('id','<>',$data['id'])->sum('invoicing_amount');
|
||||
$data['period_text'] = $data->period_text;
|
||||
$data['tax_rate_text'] = $data->tax_rate_text;
|
||||
$data['invoice_type_text'] = $data->invoice_type_text;
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = FinanceInvoiceApply::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'开票申请',
|
||||
$params['id'],
|
||||
'app\common\model\finance\FinanceInvoiceApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
FinanceInvoiceApply::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\finance;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinanceInvoiceApply;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceInvoiceApply逻辑
|
||||
* Class FinanceInvoiceApplyLogic
|
||||
* @package app\adminapi\logic\finance
|
||||
*/
|
||||
class FinanceInvoiceApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$contract = Contract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty();
|
||||
$tax_rate = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceInvoiceApply::create([
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'invoicing_code' => data_unique_code('开票申请'),
|
||||
'invoicing_date' => strtotime($params['invoicing_date']),
|
||||
'period' => $params['period'],
|
||||
'tax_rate' => $params['tax_rate'],
|
||||
'invoice_type' => $params['invoice_type'],
|
||||
'invoicing_amount' => $params['invoicing_amount'],
|
||||
'tax_amount' => ($tax_rate[$params['tax_rate']] / 100) * $params['invoicing_amount'],
|
||||
'amount_including_tax' => (1 - $tax_rate[$params['tax_rate']] / 100) * $params['invoicing_amount'],
|
||||
'content' => $params['content'] ?? '',
|
||||
'invoice_no' => $params['invoice_no'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'invoicing_company_name' => $params['invoicing_company_name'] ?? '',
|
||||
'taxpayer_identification_number' => $params['taxpayer_identification_number'] ?? '',
|
||||
'deposit_bank' => $params['deposit_bank'] ?? '',
|
||||
'bank_accnout' => $params['bank_accnout'] ?? '',
|
||||
'address_phone' => $params['address_phone'] ?? '',
|
||||
'receiving_address' => $params['receiving_address'] ?? '',
|
||||
'contacts' => $params['contacts'] ?? '',
|
||||
'phone' => $params['phone'] ?? '',
|
||||
'mailing_time' => !empty($params['mailing_time']) ? strtotime($params['mailing_time']) : 0,
|
||||
'mailing_type' => $params['mailing_type'] ?? '',
|
||||
'mailing_no' => $params['mailing_no'] ?? '',
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/13 15:01
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$contract = Contract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty();
|
||||
$tax_rate = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceInvoiceApply::where('id', $params['id'])->update([
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'invoicing_date' => strtotime($params['invoicing_date']),
|
||||
'period' => $params['period'],
|
||||
'tax_rate' => $params['tax_rate'],
|
||||
'invoice_type' => $params['invoice_type'],
|
||||
'invoicing_amount' => $params['invoicing_amount'],
|
||||
'tax_amount' => ($tax_rate[$params['tax_rate']] / 100) * $params['invoicing_amount'],
|
||||
'amount_including_tax' => (1 - $tax_rate[$params['tax_rate']] / 100) * $params['invoicing_amount'],
|
||||
'content' => $params['content'] ?? '',
|
||||
'invoice_no' => $params['invoice_no'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'invoicing_company_name' => $params['invoicing_company_name'] ?? '',
|
||||
'taxpayer_identification_number' => $params['taxpayer_identification_number'] ?? '',
|
||||
'deposit_bank' => $params['deposit_bank'] ?? '',
|
||||
'bank_accnout' => $params['bank_accnout'] ?? '',
|
||||
'address_phone' => $params['address_phone'] ?? '',
|
||||
'receiving_address' => $params['receiving_address'] ?? '',
|
||||
'contacts' => $params['contacts'] ?? '',
|
||||
'phone' => $params['phone'] ?? '',
|
||||
'mailing_time' => !empty($params['mailing_time']) ? strtotime($params['mailing_time']) : 0,
|
||||
'mailing_type' => $params['mailing_type'] ?? '',
|
||||
'mailing_no' => $params['mailing_no'] ?? '',
|
||||
'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 2023/12/13 15:01
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinanceInvoiceApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/13 15:01
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinanceInvoiceApply::findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_code,contract_name,amount')->where('id', $data['contract_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
//合同洽商金额
|
||||
$contract_negotiation_amount = ContractNegotiation::where('contract_id', $data['contract_id'])->sum('negotiation_amount');
|
||||
//合同金额 = 合同金额 + 合同洽商金额
|
||||
$data['contract_amount'] = $contract['amount'] + $contract_negotiation_amount;
|
||||
//回款金额
|
||||
$data['returned_amount'] = FinanceReturnedRecord::where('contract_id', $data['contract_id'])->sum('amount');
|
||||
//累计开票金额
|
||||
$data['total_invoicing_amount'] = FinanceInvoiceApply::where('contract_id', $data['contract_id'])->where('id', '<>', $data['id'])->sum('invoicing_amount');
|
||||
$data['period_text'] = $data->period_text;
|
||||
$data['tax_rate_text'] = $data->tax_rate_text;
|
||||
$data['invoice_type_text'] = $data->invoice_type_text;
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = FinanceInvoiceApply::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'开票申请',
|
||||
$params['id'],
|
||||
'app\common\model\finance\FinanceInvoiceApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
FinanceInvoiceApply::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -207,7 +207,7 @@
|
||||
{
|
||||
$data = FinancePaymentApply::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@
|
||||
{
|
||||
$data = FinancePaymentPlan::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -11,198 +11,199 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\finance;
|
||||
|
||||
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinanceReceiptRecord;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceReceiptRecord逻辑
|
||||
* Class FinanceReceiptRecordLogic
|
||||
* @package app\adminapi\logic\finance
|
||||
*/
|
||||
class FinanceReceiptRecordLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
if($params['contract_cate'] == 1){
|
||||
$contract = ProcurementContract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty()->toArray();
|
||||
}elseif($params['contract_cate'] == 2){
|
||||
$contract = SubcontractingContract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty()->toArray();
|
||||
}else{
|
||||
self::setError('合同信息不存在');
|
||||
return false;
|
||||
}
|
||||
$tax_rate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceReceiptRecord::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'contract_type' => $params['contract_cate'],
|
||||
'invoicing_date' => strtotime($params['invoicing_date']),
|
||||
'commitor' => $params['commitor'] ?? '',
|
||||
'invoice_type' => $params['invoice_type'],
|
||||
'invoice_no' => $params['invoice_no'] ?? '',
|
||||
'invoice_amount' => $params['invoice_amount'],
|
||||
'invoice_tax_rate' => $params['invoice_tax_rate'],
|
||||
'tax_amount' => $params['invoice_amount'] * ($tax_rate[$params['invoice_tax_rate']] / 100),
|
||||
'amount_excluding_tax' => $params['invoice_amount'] * (1 - $tax_rate[$params['invoice_tax_rate']] / 100),
|
||||
'receipt_date' => strtotime($params['receipt_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
]);
|
||||
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/15 10:20
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
if($params['contract_cate'] == 1){
|
||||
$contract = ProcurementContract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty()->toArray();
|
||||
}elseif($params['contract_cate'] == 2){
|
||||
$contract = SubcontractingContract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty()->toArray();
|
||||
}else{
|
||||
self::setError('合同信息不存在');
|
||||
return false;
|
||||
}
|
||||
$tax_rate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceReceiptRecord::where('id', $params['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'contract_type' => $params['contract_cate'],
|
||||
'invoicing_date' => strtotime($params['invoicing_date']),
|
||||
'commitor' => $params['commitor'] ?? '',
|
||||
'invoice_type' => $params['invoice_type'],
|
||||
'invoice_no' => $params['invoice_no'] ?? '',
|
||||
'invoice_amount' => $params['invoice_amount'],
|
||||
'invoice_tax_rate' => $params['invoice_tax_rate'],
|
||||
'tax_amount' => $params['invoice_amount'] * ($tax_rate[$params['invoice_tax_rate']] / 100),
|
||||
'amount_excluding_tax' => $params['invoice_amount'] * (1 - $tax_rate[$params['invoice_tax_rate']] / 100),
|
||||
'receipt_date' => strtotime($params['receipt_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
]);
|
||||
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/15 10:20
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinanceReceiptRecord::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinanceReceiptRecord::field('id,supplier_id,project_id,contract_id,contract_type,invoicing_date,commitor,invoice_type,invoice_no,invoice_amount,invoice_tax_rate,tax_amount,amount_excluding_tax,receipt_date,remark,annex,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$data['invoice_type_text'] = $data->invoice_type_text;
|
||||
$data['invoice_tax_rate_text'] = $data->invoice_tax_rate_text;
|
||||
$data['contract_type_text'] = $data->contract_type_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();
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
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['contract_cate'] = $data['contract_type'];
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = FinanceReceiptRecord::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'收票记录',
|
||||
$params['id'],
|
||||
'app\common\model\finance\FinanceReceiptRecord',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
FinanceReceiptRecord::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
namespace app\adminapi\logic\finance;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\finance\FinanceReceiptRecord;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceReceiptRecord逻辑
|
||||
* Class FinanceReceiptRecordLogic
|
||||
* @package app\adminapi\logic\finance
|
||||
*/
|
||||
class FinanceReceiptRecordLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
if ($params['contract_cate'] == 1) {
|
||||
$contract = ProcurementContract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty()->toArray();
|
||||
} elseif ($params['contract_cate'] == 2) {
|
||||
$contract = SubcontractingContract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty()->toArray();
|
||||
} else {
|
||||
self::setError('合同信息不存在');
|
||||
return false;
|
||||
}
|
||||
$tax_rate = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceReceiptRecord::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'contract_type' => $params['contract_cate'],
|
||||
'invoicing_date' => strtotime($params['invoicing_date']),
|
||||
'commitor' => $params['commitor'] ?? '',
|
||||
'invoice_type' => $params['invoice_type'],
|
||||
'invoice_no' => $params['invoice_no'] ?? '',
|
||||
'invoice_amount' => $params['invoice_amount'],
|
||||
'invoice_tax_rate' => $params['invoice_tax_rate'],
|
||||
'tax_amount' => $params['invoice_amount'] * ($tax_rate[$params['invoice_tax_rate']] / 100),
|
||||
'amount_excluding_tax' => $params['invoice_amount'] * (1 - $tax_rate[$params['invoice_tax_rate']] / 100),
|
||||
'receipt_date' => strtotime($params['receipt_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/15 10:20
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
if ($params['contract_cate'] == 1) {
|
||||
$contract = ProcurementContract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty()->toArray();
|
||||
} elseif ($params['contract_cate'] == 2) {
|
||||
$contract = SubcontractingContract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty()->toArray();
|
||||
} else {
|
||||
self::setError('合同信息不存在');
|
||||
return false;
|
||||
}
|
||||
$tax_rate = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceReceiptRecord::where('id', $params['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'contract_type' => $params['contract_cate'],
|
||||
'invoicing_date' => strtotime($params['invoicing_date']),
|
||||
'commitor' => $params['commitor'] ?? '',
|
||||
'invoice_type' => $params['invoice_type'],
|
||||
'invoice_no' => $params['invoice_no'] ?? '',
|
||||
'invoice_amount' => $params['invoice_amount'],
|
||||
'invoice_tax_rate' => $params['invoice_tax_rate'],
|
||||
'tax_amount' => $params['invoice_amount'] * ($tax_rate[$params['invoice_tax_rate']] / 100),
|
||||
'amount_excluding_tax' => $params['invoice_amount'] * (1 - $tax_rate[$params['invoice_tax_rate']] / 100),
|
||||
'receipt_date' => strtotime($params['receipt_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
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/15 10:20
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinanceReceiptRecord::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 10:20
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinanceReceiptRecord::field('id,supplier_id,project_id,contract_id,contract_type,invoicing_date,commitor,invoice_type,invoice_no,invoice_amount,invoice_tax_rate,tax_amount,amount_excluding_tax,receipt_date,remark,annex,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$data['invoice_type_text'] = $data->invoice_type_text;
|
||||
$data['invoice_tax_rate_text'] = $data->invoice_tax_rate_text;
|
||||
$data['contract_type_text'] = $data->contract_type_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();
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
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['contract_cate'] = $data['contract_type'];
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = FinanceReceiptRecord::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'收票记录',
|
||||
$params['id'],
|
||||
'app\common\model\finance\FinanceReceiptRecord',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
FinanceReceiptRecord::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,170 +11,171 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\finance;
|
||||
|
||||
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceRefundApply;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceRefundApply逻辑
|
||||
* Class FinanceRefundApplyLogic
|
||||
* @package app\adminapi\logic\finance
|
||||
*/
|
||||
class FinanceRefundApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$contract = Contract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceRefundApply::create([
|
||||
'refund_code' => data_unique_code('退款申请'),
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'reason' => $params['reason'],
|
||||
'amount' => $params['amount'],
|
||||
'refund_type' => $params['refund_type'],
|
||||
'refund_user' => $params['refund_user'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'collection_bank' => $params['collection_bank'],
|
||||
'collection_account' => $params['collection_account'],
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
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/14 16:58
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$contract = Contract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceRefundApply::where('id',$params['id'])->update([
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'reason' => $params['reason'],
|
||||
'amount' => $params['amount'],
|
||||
'refund_type' => $params['refund_type'],
|
||||
'refund_user' => $params['refund_user'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'collection_bank' => $params['collection_bank'],
|
||||
'collection_account' => $params['collection_account'],
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'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 2023/12/14 16:58
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinanceRefundApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinanceRefundApply::field('id,refund_code,project_id,contract_id,refund_date,reason,amount,refund_type,refund_user,remark,annex,collection_bank,collection_account,bank_account_id,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code')->where('id',$data['contract_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['refund_type_text'] = $data->refund_type_text;
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = FinanceRefundApply::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'退款申请',
|
||||
$params['id'],
|
||||
'app\common\model\finance\FinanceRefundApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
FinanceRefundApply::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\finance;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\finance\FinanceRefundApply;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceRefundApply逻辑
|
||||
* Class FinanceRefundApplyLogic
|
||||
* @package app\adminapi\logic\finance
|
||||
*/
|
||||
class FinanceRefundApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$contract = Contract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceRefundApply::create([
|
||||
'refund_code' => data_unique_code('退款申请'),
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'reason' => $params['reason'],
|
||||
'amount' => $params['amount'],
|
||||
'refund_type' => $params['refund_type'],
|
||||
'refund_user' => $params['refund_user'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'collection_bank' => $params['collection_bank'],
|
||||
'collection_account' => $params['collection_account'],
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/14 16:58
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$contract = Contract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceRefundApply::where('id', $params['id'])->update([
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'reason' => $params['reason'],
|
||||
'amount' => $params['amount'],
|
||||
'refund_type' => $params['refund_type'],
|
||||
'refund_user' => $params['refund_user'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'collection_bank' => $params['collection_bank'],
|
||||
'collection_account' => $params['collection_account'],
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'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 2023/12/14 16:58
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinanceRefundApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/14 16:58
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinanceRefundApply::field('id,refund_code,project_id,contract_id,refund_date,reason,amount,refund_type,refund_user,remark,annex,collection_bank,collection_account,bank_account_id,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$project = Project::field('custom_id,name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||
$contract = Contract::field('contract_name,contract_code')->where('id', $data['contract_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['custom_name'] = $custom['name'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_code'] = $contract['contract_code'];
|
||||
$data['refund_type_text'] = $data->refund_type_text;
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id', $data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = FinanceRefundApply::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'退款申请',
|
||||
$params['id'],
|
||||
'app\common\model\finance\FinanceRefundApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
FinanceRefundApply::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,189 +11,190 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\finance;
|
||||
|
||||
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\finance\FinanceRefundRecord;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceRefundRecord逻辑
|
||||
* Class FinanceRefundRecordLogic
|
||||
* @package app\adminapi\logic\finance
|
||||
*/
|
||||
class FinanceRefundRecordLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
if($params['contract_cate'] == 1){
|
||||
$contract = ProcurementContract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty()->toArray();
|
||||
}elseif($params['contract_cate'] == 2){
|
||||
$contract = SubcontractingContract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty()->toArray();
|
||||
}else{
|
||||
self::setError('合同信息不存在');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceRefundRecord::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_type' => $params['contract_cate'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'refund_amount' => $params['refund_amount'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'refund_type' => $params['refund_type'],
|
||||
'reason' => $params['reason'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
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/15 14:41
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
if($params['contract_cate'] == 1){
|
||||
$contract = ProcurementContract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty()->toArray();
|
||||
}elseif($params['contract_cate'] == 2){
|
||||
$contract = SubcontractingContract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty()->toArray();
|
||||
}else{
|
||||
self::setError('合同信息不存在');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceRefundRecord::where('id', $params['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_type' => $params['contract_cate'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'refund_amount' => $params['refund_amount'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'refund_type' => $params['refund_type'],
|
||||
'reason' => $params['reason'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'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 2023/12/15 14:41
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinanceRefundRecord::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinanceRefundRecord::field('id,supplier_id,project_id,contract_type,contract_id,refund_amount,refund_date,refund_type,reason,remark,annex,bank_account_id,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$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();
|
||||
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['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['contract_no'] = $contract['contract_no'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_cate'] = $data['contract_type'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['refund_type_text'] = $data->refund_type_text;
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = FinanceRefundRecord::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'退款记录',
|
||||
$params['id'],
|
||||
'app\common\model\finance\FinanceRefundRecord',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
FinanceRefundRecord::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
namespace app\adminapi\logic\finance;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\contract\ProcurementContract;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\finance\FinanceRefundRecord;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* FinanceRefundRecord逻辑
|
||||
* Class FinanceRefundRecordLogic
|
||||
* @package app\adminapi\logic\finance
|
||||
*/
|
||||
class FinanceRefundRecordLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
if ($params['contract_cate'] == 1) {
|
||||
$contract = ProcurementContract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty()->toArray();
|
||||
} elseif ($params['contract_cate'] == 2) {
|
||||
$contract = SubcontractingContract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty()->toArray();
|
||||
} else {
|
||||
self::setError('合同信息不存在');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceRefundRecord::create([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_type' => $params['contract_cate'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'refund_amount' => $params['refund_amount'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'refund_type' => $params['refund_type'],
|
||||
'reason' => $params['reason'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/15 14:41
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
if ($params['contract_cate'] == 1) {
|
||||
$contract = ProcurementContract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty()->toArray();
|
||||
} elseif ($params['contract_cate'] == 2) {
|
||||
$contract = SubcontractingContract::field('project_id')->where('id', $params['contract_id'])->findOrEmpty()->toArray();
|
||||
} else {
|
||||
self::setError('合同信息不存在');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinanceRefundRecord::where('id', $params['id'])->update([
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'project_id' => $contract['project_id'],
|
||||
'contract_type' => $params['contract_cate'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'refund_amount' => $params['refund_amount'],
|
||||
'refund_date' => strtotime($params['refund_date']),
|
||||
'refund_type' => $params['refund_type'],
|
||||
'reason' => $params['reason'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'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 2023/12/15 14:41
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return FinanceRefundRecord::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/15 14:41
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = FinanceRefundRecord::field('id,supplier_id,project_id,contract_type,contract_id,refund_amount,refund_date,refund_type,reason,remark,annex,bank_account_id,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$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();
|
||||
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['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['contract_no'] = $contract['contract_no'];
|
||||
$data['contract_name'] = $contract['contract_name'];
|
||||
$data['contract_cate'] = $data['contract_type'];
|
||||
$data['contract_type_text'] = $data->contract_type_text;
|
||||
$data['refund_type_text'] = $data->refund_type_text;
|
||||
$data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id', $data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = FinanceRefundRecord::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'退款记录',
|
||||
$params['id'],
|
||||
'app\common\model\finance\FinanceRefundRecord',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
FinanceRefundRecord::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -142,7 +142,7 @@
|
||||
{
|
||||
$data = FinanceReturnedMoney::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@
|
||||
{
|
||||
$data = FinanceReturnedRecord::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@
|
||||
{
|
||||
$data = MarketingBidEvaluation::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@
|
||||
{
|
||||
$data = MarketingContract::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@
|
||||
{
|
||||
$data = MarketingContract::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@
|
||||
{
|
||||
$data = MarketingContract::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@
|
||||
{
|
||||
$data = MaterialPurchaseRequest::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -11,149 +11,150 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectCostAdjustment;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 成本调整逻辑
|
||||
* Class ProjectCostAdjustmentLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectCostAdjustmentLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加成本调整
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectCostAdjustment::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'adjust_date' => strtotime($params['adjust_date']),
|
||||
'adjust_amount' => $params['adjust_amount'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'add_user' => $admin_id,
|
||||
'update_user' => $admin_id,
|
||||
]);
|
||||
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/01/17 13:43
|
||||
*/
|
||||
public static function edit(array $params,$admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectCostAdjustment::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'adjust_date' => strtotime($params['adjust_date']),
|
||||
'adjust_amount' => $params['adjust_amount'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'update_user' => $admin_id,
|
||||
'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/01/17 13:43
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectCostAdjustment::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取成本调整详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectCostAdjustment::field('id,project_id,adjust_date,adjust_amount,remark,annex,add_user,update_user,create_time,update_time,approve_id')->findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$admin = Admin::where('id','in',[$data['add_user'],$data['update_user']])->column('name','id');
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['add_user'] = $admin[$data['add_user']];
|
||||
$data['update_user'] = $admin[$data['update_user']];
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = ProjectCostAdjustment::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'成本调整',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectCostAdjustment',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
ProjectCostAdjustment::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectCostAdjustment;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 成本调整逻辑
|
||||
* Class ProjectCostAdjustmentLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectCostAdjustmentLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加成本调整
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public static function add(array $params, $admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectCostAdjustment::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'adjust_date' => strtotime($params['adjust_date']),
|
||||
'adjust_amount' => $params['adjust_amount'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'add_user' => $admin_id,
|
||||
'update_user' => $admin_id,
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/01/17 13:43
|
||||
*/
|
||||
public static function edit(array $params, $admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectCostAdjustment::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'adjust_date' => strtotime($params['adjust_date']),
|
||||
'adjust_amount' => $params['adjust_amount'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'update_user' => $admin_id,
|
||||
'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/01/17 13:43
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectCostAdjustment::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取成本调整详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 13:43
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectCostAdjustment::field('id,project_id,adjust_date,adjust_amount,remark,annex,add_user,update_user,create_time,update_time,approve_id')->findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$admin = Admin::where('id', 'in', [$data['add_user'], $data['update_user']])->column('name', 'id');
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['add_user'] = $admin[$data['add_user']];
|
||||
$data['update_user'] = $admin[$data['update_user']];
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = ProjectCostAdjustment::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'成本调整',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectCostAdjustment',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
ProjectCostAdjustment::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,186 +11,185 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectCostBudget;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\project\ProjectCostBudgetDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 费用预算逻辑
|
||||
* Class ProjectCostBudgetLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectCostBudgetLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加费用预算
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectCostBudget::create([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_code' => data_unique_code('项目费用预算'),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['cost_budget_detail'] as $item)
|
||||
{
|
||||
ProjectCostBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_id' => $res->id,
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'unit' => $item['unit'],
|
||||
'amount' => $item['amount'],
|
||||
'standard' => $item['standard'] ?? '',
|
||||
'remark' => $item['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 2024/01/16 14:32
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectCostBudget::where('id', $params['id'])->update([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_code' => data_unique_code('项目费用预算'),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['cost_budget_detail'] as $item)
|
||||
{
|
||||
if(isset($item['id']) && $item['id'] != ''){
|
||||
ProjectCostBudgetDetail::where('id',$item['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'unit' => $item['unit'],
|
||||
'amount' => $item['amount'],
|
||||
'standard' => $item['standard'] ?? '',
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}else{
|
||||
ProjectCostBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'unit' => $item['unit'],
|
||||
'amount' => $item['amount'],
|
||||
'standard' => $item['standard'] ?? '',
|
||||
'remark' => $item['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 2024/01/16 14:32
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectCostBudget::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用预算详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectCostBudget::field('id,org_id,dept_id,project_id,cost_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']);
|
||||
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
|
||||
$dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['org_name'] = $org['name'];
|
||||
$data['dept_name'] = $dept['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = ProjectCostBudget::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'费用预算',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectCostBudget',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
ProjectCostBudget::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectCostBudget;
|
||||
use app\common\model\project\ProjectCostBudgetDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 费用预算逻辑
|
||||
* Class ProjectCostBudgetLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectCostBudgetLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加费用预算
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public static function add(array $params, $admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectCostBudget::create([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_code' => data_unique_code('项目费用预算'),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['cost_budget_detail'] as $item) {
|
||||
ProjectCostBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_id' => $res->id,
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'unit' => $item['unit'],
|
||||
'amount' => $item['amount'],
|
||||
'standard' => $item['standard'] ?? '',
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/01/16 14:32
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectCostBudget::where('id', $params['id'])->update([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_code' => data_unique_code('项目费用预算'),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['cost_budget_detail'] as $item) {
|
||||
if (isset($item['id']) && $item['id'] != '') {
|
||||
ProjectCostBudgetDetail::where('id', $item['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'unit' => $item['unit'],
|
||||
'amount' => $item['amount'],
|
||||
'standard' => $item['standard'] ?? '',
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
} else {
|
||||
ProjectCostBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'cost_budget_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'unit' => $item['unit'],
|
||||
'amount' => $item['amount'],
|
||||
'standard' => $item['standard'] ?? '',
|
||||
'remark' => $item['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 2024/01/16 14:32
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectCostBudget::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用预算详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 14:32
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectCostBudget::field('id,org_id,dept_id,project_id,cost_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']);
|
||||
$org = Orgs::field('name')->where('id', $data['org_id'])->findOrEmpty();
|
||||
$dept = Dept::field('name')->where('id', $data['dept_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['org_name'] = $org['name'];
|
||||
$data['dept_name'] = $dept['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = ProjectCostBudget::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'费用预算',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectCostBudget',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
ProjectCostBudget::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,194 +11,193 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectEquipmentBudget;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\project\ProjectEquipmentBudgetDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 机具预算逻辑
|
||||
* Class ProjectEquipmentBudgetLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectEquipmentBudgetLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加机具预算
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectEquipmentBudget::create([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'equipment_budget_code' => data_unique_code('项目机具预算'),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['equipment_budget_detail'] as $item)
|
||||
{
|
||||
ProjectEquipmentBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'equipment_budget_id' => $res->id,
|
||||
'type' => $item['type'],
|
||||
'name' => $item['name'],
|
||||
'spec' => $item['spec'] ?? '',
|
||||
'unit' => $item['unit'],
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['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 2024/01/16 11:40
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectEquipmentBudget::where('id', $params['id'])->update([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['equipment_budget_detail'] as $item)
|
||||
{
|
||||
if(isset($item['id']) && $item['id'] != ''){
|
||||
ProjectEquipmentBudgetDetail::where('id',$item['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'equipment_budget_id' => $params['id'],
|
||||
'type' => $item['type'],
|
||||
'name' => $item['name'],
|
||||
'spec' => $item['spec'] ?? '',
|
||||
'unit' => $item['unit'],
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}else{
|
||||
ProjectEquipmentBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'equipment_budget_id' => $params['id'],
|
||||
'type' => $item['type'],
|
||||
'name' => $item['name'],
|
||||
'spec' => $item['spec'] ?? '',
|
||||
'unit' => $item['unit'],
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['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 2024/01/16 11:40
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectEquipmentBudget::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取机具预算详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectEquipmentBudget::field('id,org_id,dept_id,project_id,equipment_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']);
|
||||
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
|
||||
$dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['org_name'] = $org['name'];
|
||||
$data['dept_name'] = $dept['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = ProjectEquipmentBudget::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'机具预算',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectEquipmentBudget',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
ProjectEquipmentBudget::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectEquipmentBudget;
|
||||
use app\common\model\project\ProjectEquipmentBudgetDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 机具预算逻辑
|
||||
* Class ProjectEquipmentBudgetLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectEquipmentBudgetLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加机具预算
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public static function add(array $params, $admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectEquipmentBudget::create([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'equipment_budget_code' => data_unique_code('项目机具预算'),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['equipment_budget_detail'] as $item) {
|
||||
ProjectEquipmentBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'equipment_budget_id' => $res->id,
|
||||
'type' => $item['type'],
|
||||
'name' => $item['name'],
|
||||
'spec' => $item['spec'] ?? '',
|
||||
'unit' => $item['unit'],
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/01/16 11:40
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectEquipmentBudget::where('id', $params['id'])->update([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['equipment_budget_detail'] as $item) {
|
||||
if (isset($item['id']) && $item['id'] != '') {
|
||||
ProjectEquipmentBudgetDetail::where('id', $item['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'equipment_budget_id' => $params['id'],
|
||||
'type' => $item['type'],
|
||||
'name' => $item['name'],
|
||||
'spec' => $item['spec'] ?? '',
|
||||
'unit' => $item['unit'],
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
} else {
|
||||
ProjectEquipmentBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'equipment_budget_id' => $params['id'],
|
||||
'type' => $item['type'],
|
||||
'name' => $item['name'],
|
||||
'spec' => $item['spec'] ?? '',
|
||||
'unit' => $item['unit'],
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['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 2024/01/16 11:40
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectEquipmentBudget::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取机具预算详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 11:40
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectEquipmentBudget::field('id,org_id,dept_id,project_id,equipment_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']);
|
||||
$org = Orgs::field('name')->where('id', $data['org_id'])->findOrEmpty();
|
||||
$dept = Dept::field('name')->where('id', $data['dept_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['org_name'] = $org['name'];
|
||||
$data['dept_name'] = $dept['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = ProjectEquipmentBudget::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'机具预算',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectEquipmentBudget',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
ProjectEquipmentBudget::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,254 +11,255 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectExpenseReimbursement;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\project\ProjectExpenseReimbursementDetail;
|
||||
use app\common\model\project\ProjectExpenseReimbursementInvoiceDetail;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 费用报销逻辑
|
||||
* Class ProjectExpenseReimbursementLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectExpenseReimbursementLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加费用报销
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/19 13:44
|
||||
*/
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
//获取税率
|
||||
$tax_rate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectExpenseReimbursement::create([
|
||||
'expense_reimbursement_code' => data_unique_code('项目费用报销'),
|
||||
'project_id' => $params['project_id'],
|
||||
'apply_user' => $params['apply_user'],
|
||||
'apply_date' => strtotime($params['apply_date']),
|
||||
'reimbursement_type' => $params['reimbursement_type'],
|
||||
'loan_apply_id' => $params['loan_apply_id'] ?? 0,
|
||||
'offset_loan_amount' => $params['offset_loan_amount'] ?? 0,
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
foreach($params['reimbursement_detail'] as $item){
|
||||
ProjectExpenseReimbursementDetail::create([
|
||||
'expense_reimbursement_id' => $res->id,
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'amount' => $item['amount'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
foreach($params['invoice_detail'] as $item){
|
||||
ProjectExpenseReimbursementInvoiceDetail::create([
|
||||
'expense_reimbursement_id' => $res->id,
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['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 2024/01/19 13:44
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
//获取税率
|
||||
$tax_rate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectExpenseReimbursement::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'apply_user' => $params['apply_user'],
|
||||
'apply_date' => strtotime($params['apply_date']),
|
||||
'reimbursement_type' => $params['reimbursement_type'],
|
||||
'loan_apply_id' => $params['loan_apply_id'] ?? 0,
|
||||
'offset_loan_amount' => $params['offset_loan_amount'] ?? 0,
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'update_time' => time(),
|
||||
]);
|
||||
foreach($params['reimbursement_detail'] as $item){
|
||||
if(isset($item['id']) && $item['id'] != ''){
|
||||
ProjectExpenseReimbursementDetail::where('id',$item['id'])->update([
|
||||
'expense_reimbursement_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'amount' => $item['amount'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
}else{
|
||||
ProjectExpenseReimbursementDetail::create([
|
||||
'expense_reimbursement_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'amount' => $item['amount'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach($params['invoice_detail'] as $item){
|
||||
if(isset($item['id']) && $item['id'] != ''){
|
||||
ProjectExpenseReimbursementInvoiceDetail::where('id',$item['id'])->update([
|
||||
'expense_reimbursement_id' => $params['id'],
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
}else{
|
||||
ProjectExpenseReimbursementInvoiceDetail::create([
|
||||
'expense_reimbursement_id' => $params['id'],
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['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 2024/01/19 13:44
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$expense_reimbursement_detail_ids = ProjectExpenseReimbursementDetail::where('expense_reimbursement_id',$params['id'])->column('id');
|
||||
$expense_reimbursement_invoice_detail_ids = ProjectExpenseReimbursementInvoiceDetail::where('expense_reimbursement_id',$params['id'])->column('id');
|
||||
ProjectExpenseReimbursement::destroy($params['id']);
|
||||
ProjectExpenseReimbursementDetail::destroy($expense_reimbursement_detail_ids);
|
||||
ProjectExpenseReimbursementInvoiceDetail::destroy($expense_reimbursement_invoice_detail_ids);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用报销详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/19 13:44
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectExpenseReimbursement::field('id,expense_reimbursement_code,project_id,apply_user,apply_date,reimbursement_type,loan_apply_id,offset_loan_amount,payee_name,payee_bank,payee_account,remark,annex,bank_account_id,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$loan_apply = ProjectLoanApply::field('loan_apply_code,loan_amount')->where('id',$data['loan_apply_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['loan_apply_code'] = !$loan_apply->isEmpty() ? $loan_apply['loan_apply_code'] : '---';
|
||||
$data['loan_amount'] = !$loan_apply->isEmpty() ? $loan_apply['loan_amount'] : '---';
|
||||
$data['total_amount'] = ProjectExpenseReimbursementDetail::where('expense_reimbursement_id',$data['id'])->sum('amount');
|
||||
$data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount'];
|
||||
$data['reimbursement_type_text'] = $data->reimbursement_type_text;
|
||||
$data['bank_account'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = ProjectExpenseReimbursement::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'费用报销',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectExpenseReimbursement',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
ProjectExpenseReimbursement::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectExpenseReimbursement;
|
||||
use app\common\model\project\ProjectExpenseReimbursementDetail;
|
||||
use app\common\model\project\ProjectExpenseReimbursementInvoiceDetail;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 费用报销逻辑
|
||||
* Class ProjectExpenseReimbursementLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectExpenseReimbursementLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加费用报销
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/19 13:44
|
||||
*/
|
||||
public static function add(array $params, $admin_id): bool
|
||||
{
|
||||
//获取税率
|
||||
$tax_rate = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectExpenseReimbursement::create([
|
||||
'expense_reimbursement_code' => data_unique_code('项目费用报销'),
|
||||
'project_id' => $params['project_id'],
|
||||
'apply_user' => $params['apply_user'],
|
||||
'apply_date' => strtotime($params['apply_date']),
|
||||
'reimbursement_type' => $params['reimbursement_type'],
|
||||
'loan_apply_id' => $params['loan_apply_id'] ?? 0,
|
||||
'offset_loan_amount' => $params['offset_loan_amount'] ?? 0,
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
foreach ($params['reimbursement_detail'] as $item) {
|
||||
ProjectExpenseReimbursementDetail::create([
|
||||
'expense_reimbursement_id' => $res->id,
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'amount' => $item['amount'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
foreach ($params['invoice_detail'] as $item) {
|
||||
ProjectExpenseReimbursementInvoiceDetail::create([
|
||||
'expense_reimbursement_id' => $res->id,
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/01/19 13:44
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
//获取税率
|
||||
$tax_rate = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectExpenseReimbursement::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'apply_user' => $params['apply_user'],
|
||||
'apply_date' => strtotime($params['apply_date']),
|
||||
'reimbursement_type' => $params['reimbursement_type'],
|
||||
'loan_apply_id' => $params['loan_apply_id'] ?? 0,
|
||||
'offset_loan_amount' => $params['offset_loan_amount'] ?? 0,
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'update_time' => time(),
|
||||
]);
|
||||
foreach ($params['reimbursement_detail'] as $item) {
|
||||
if (isset($item['id']) && $item['id'] != '') {
|
||||
ProjectExpenseReimbursementDetail::where('id', $item['id'])->update([
|
||||
'expense_reimbursement_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'amount' => $item['amount'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
} else {
|
||||
ProjectExpenseReimbursementDetail::create([
|
||||
'expense_reimbursement_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'amount' => $item['amount'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach ($params['invoice_detail'] as $item) {
|
||||
if (isset($item['id']) && $item['id'] != '') {
|
||||
ProjectExpenseReimbursementInvoiceDetail::where('id', $item['id'])->update([
|
||||
'expense_reimbursement_id' => $params['id'],
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
} else {
|
||||
ProjectExpenseReimbursementInvoiceDetail::create([
|
||||
'expense_reimbursement_id' => $params['id'],
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['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 2024/01/19 13:44
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$expense_reimbursement_detail_ids = ProjectExpenseReimbursementDetail::where('expense_reimbursement_id', $params['id'])->column('id');
|
||||
$expense_reimbursement_invoice_detail_ids = ProjectExpenseReimbursementInvoiceDetail::where('expense_reimbursement_id', $params['id'])->column('id');
|
||||
ProjectExpenseReimbursement::destroy($params['id']);
|
||||
ProjectExpenseReimbursementDetail::destroy($expense_reimbursement_detail_ids);
|
||||
ProjectExpenseReimbursementInvoiceDetail::destroy($expense_reimbursement_invoice_detail_ids);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取费用报销详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/19 13:44
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectExpenseReimbursement::field('id,expense_reimbursement_code,project_id,apply_user,apply_date,reimbursement_type,loan_apply_id,offset_loan_amount,payee_name,payee_bank,payee_account,remark,annex,bank_account_id,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$loan_apply = ProjectLoanApply::field('loan_apply_code,loan_amount')->where('id', $data['loan_apply_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['loan_apply_code'] = !$loan_apply->isEmpty() ? $loan_apply['loan_apply_code'] : '---';
|
||||
$data['loan_amount'] = !$loan_apply->isEmpty() ? $loan_apply['loan_amount'] : '---';
|
||||
$data['total_amount'] = ProjectExpenseReimbursementDetail::where('expense_reimbursement_id', $data['id'])->sum('amount');
|
||||
$data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount'];
|
||||
$data['reimbursement_type_text'] = $data->reimbursement_type_text;
|
||||
$data['bank_account'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id', $data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = ProjectExpenseReimbursement::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'费用报销',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectExpenseReimbursement',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
ProjectExpenseReimbursement::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,190 +11,189 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectLaborBudget;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\project\ProjectLaborBudgetDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 人工预算逻辑
|
||||
* Class ProjectLaborBudgetLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectLaborBudgetLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加人工预算
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectLaborBudget::create([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'labor_budget_code' => data_unique_code('项目人工预算'),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['labor_budget_detail'] as $item)
|
||||
{
|
||||
ProjectLaborBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'labor_budget_id' => $res->id,
|
||||
'job_type_id' => $item['job_type_id'],
|
||||
'desc' => $item['desc'] ?? '',
|
||||
'unit' => $item['unit'] ?? '',
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['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 2024/01/16 09:26
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectLaborBudget::where('id', $params['id'])->update([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'update_time' =>time(),
|
||||
]);
|
||||
foreach ($params['labor_budget_detail'] as $item)
|
||||
{
|
||||
if(isset($item['id']) && $item['id'] != ''){
|
||||
ProjectLaborBudgetDetail::where('id',$item['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'job_type_id' => $item['job_type_id'],
|
||||
'desc' => $item['desc'] ?? '',
|
||||
'unit' => $item['unit'] ?? '',
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}else{
|
||||
ProjectLaborBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'labor_budget_id' => $params['id'],
|
||||
'job_type_id' => $item['job_type_id'],
|
||||
'desc' => $item['desc'] ?? '',
|
||||
'unit' => $item['unit'] ?? '',
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['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 2024/01/16 09:26
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectLaborBudget::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取人工预算详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectLaborBudget::field('id,org_id,dept_id,project_id,labor_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']);
|
||||
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
|
||||
$dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['org_name'] = $org['name'];
|
||||
$data['dept_name'] = $dept['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = ProjectLaborBudget::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'人工预算',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectLaborBudget',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
ProjectLaborBudget::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Orgs;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectLaborBudget;
|
||||
use app\common\model\project\ProjectLaborBudgetDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 人工预算逻辑
|
||||
* Class ProjectLaborBudgetLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectLaborBudgetLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加人工预算
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public static function add(array $params, $admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectLaborBudget::create([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'labor_budget_code' => data_unique_code('项目人工预算'),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($params['labor_budget_detail'] as $item) {
|
||||
ProjectLaborBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'labor_budget_id' => $res->id,
|
||||
'job_type_id' => $item['job_type_id'],
|
||||
'desc' => $item['desc'] ?? '',
|
||||
'unit' => $item['unit'] ?? '',
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/01/16 09:26
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectLaborBudget::where('id', $params['id'])->update([
|
||||
'org_id' => $params['org_id'],
|
||||
'dept_id' => $params['dept_id'],
|
||||
'project_id' => $params['project_id'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
foreach ($params['labor_budget_detail'] as $item) {
|
||||
if (isset($item['id']) && $item['id'] != '') {
|
||||
ProjectLaborBudgetDetail::where('id', $item['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'job_type_id' => $item['job_type_id'],
|
||||
'desc' => $item['desc'] ?? '',
|
||||
'unit' => $item['unit'] ?? '',
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
} else {
|
||||
ProjectLaborBudgetDetail::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'labor_budget_id' => $params['id'],
|
||||
'job_type_id' => $item['job_type_id'],
|
||||
'desc' => $item['desc'] ?? '',
|
||||
'unit' => $item['unit'] ?? '',
|
||||
'price' => $item['price'],
|
||||
'num' => $item['num'],
|
||||
'amount' => $item['price'] * $item['num'],
|
||||
'remark' => $item['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 2024/01/16 09:26
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectLaborBudget::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取人工预算详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/16 09:26
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectLaborBudget::field('id,org_id,dept_id,project_id,labor_budget_code,remark,annex,approve_id')->findOrEmpty($params['id']);
|
||||
$org = Orgs::field('name')->where('id', $data['org_id'])->findOrEmpty();
|
||||
$dept = Dept::field('name')->where('id', $data['dept_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['org_name'] = $org['name'];
|
||||
$data['dept_name'] = $dept['name'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = ProjectLaborBudget::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'人工预算',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectLaborBudget',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
ProjectLaborBudget::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,156 +11,157 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 借款申请逻辑
|
||||
* Class ProjectLoanApplyLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectLoanApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加借款申请
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectLoanApply::create([
|
||||
'loan_apply_code' => data_unique_code('项目借款'),
|
||||
'project_id' => $params['project_id'],
|
||||
'apply_user' => $params['apply_user'],
|
||||
'loan_date' => strtotime($params['loan_date']),
|
||||
'loan_amount' => $params['loan_amount'],
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
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/01/17 11:05
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectLoanApply::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'apply_user' => $params['apply_user'],
|
||||
'loan_date' => strtotime($params['loan_date']),
|
||||
'loan_amount' => $params['loan_amount'],
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'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/01/17 11:05
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectLoanApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取借款申请详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectLoanApply::field('id,project_id,loan_apply_code,apply_user,loan_date,loan_amount,payee_name,payee_bank,payee_account,remark,annex,bank_account_id,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['bank_account'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = ProjectLoanApply::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'借款申请',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectLoanApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
ProjectLoanApply::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 借款申请逻辑
|
||||
* Class ProjectLoanApplyLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectLoanApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加借款申请
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public static function add(array $params, $admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectLoanApply::create([
|
||||
'loan_apply_code' => data_unique_code('项目借款'),
|
||||
'project_id' => $params['project_id'],
|
||||
'apply_user' => $params['apply_user'],
|
||||
'loan_date' => strtotime($params['loan_date']),
|
||||
'loan_amount' => $params['loan_amount'],
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/01/17 11:05
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectLoanApply::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'apply_user' => $params['apply_user'],
|
||||
'loan_date' => strtotime($params['loan_date']),
|
||||
'loan_amount' => $params['loan_amount'],
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'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/01/17 11:05
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectLoanApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取借款申请详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectLoanApply::field('id,project_id,loan_apply_code,apply_user,loan_date,loan_amount,payee_name,payee_bank,payee_account,remark,annex,bank_account_id,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
$data['bank_account'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id', $data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = ProjectLoanApply::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'借款申请',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectLoanApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
ProjectLoanApply::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -173,7 +173,7 @@
|
||||
{
|
||||
$data = ProjectMaterialBudget::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@
|
||||
{
|
||||
$data = ProjectSettlement::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@
|
||||
{
|
||||
$data = ProjectSubcontractSettlement::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@
|
||||
{
|
||||
$data = ProjectSubpackageBudget::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@
|
||||
{
|
||||
$data = ProjectTotalBudget::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
|
@ -11,147 +11,67 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
use app\common\model\project\ProjectManagerAppointment;
|
||||
use app\common\model\project\ProjectTravelReimbursement;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\project\ProjectTravelReimbursementDetail;
|
||||
use app\common\model\project\ProjectTravelReimbursementInvoiceDetail;
|
||||
use app\common\model\project\ProjectTripApply;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 差旅报销逻辑
|
||||
* Class ProjectTravelReimbursementLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectTravelReimbursementLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加差旅报销
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/18 13:57
|
||||
*/
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
$trip_apply = ProjectTripApply::field('project_id')->where('id',$params['trip_apply_id'])->findOrEmpty();
|
||||
//获取税率
|
||||
$tax_rate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectTravelReimbursement::create([
|
||||
'trip_reimbursement_code' => data_unique_code('项目差旅报销'),
|
||||
'trip_apply_id' => $params['trip_apply_id'],
|
||||
'project_id' => $trip_apply['project_id'],
|
||||
'reimbursement_type' => $params['reimbursement_type'],
|
||||
'loan_apply_id' => $params['loan_apply_id'] ?? 0,
|
||||
'offset_loan_amount' => $params['offset_loan_amount'] ?? 0,//冲抵借款金额
|
||||
'apply_user' => $params['apply_user'],
|
||||
'apply_date' => strtotime($params['apply_date']),
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
foreach($params['reimbursement_detail'] as $item){
|
||||
ProjectTravelReimbursementDetail::create([
|
||||
'travel_reimbursement_id' => $res->id,
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'traffic_fee' => $item['traffic_fee'] ?? 0,
|
||||
'stay_fee' => $item['stay_fee'] ?? 0,
|
||||
'restaurant_fee' => $item['restaurant_fee'] ?? 0,
|
||||
'subsidy_fee' => $item['subsidy_fee'] ?? 0,
|
||||
'other_fee' => $item['other_fee'] ?? 0,
|
||||
'total_amount' => $item['traffic_fee'] + $item['stay_fee'] + $item['restaurant_fee'] + $item['subsidy_fee'] + $item['other_fee'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\bank\BankAccount;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectLoanApply;
|
||||
use app\common\model\project\ProjectManagerAppointment;
|
||||
use app\common\model\project\ProjectTravelReimbursement;
|
||||
use app\common\model\project\ProjectTravelReimbursementDetail;
|
||||
use app\common\model\project\ProjectTravelReimbursementInvoiceDetail;
|
||||
use app\common\model\project\ProjectTripApply;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 差旅报销逻辑
|
||||
* Class ProjectTravelReimbursementLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectTravelReimbursementLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加差旅报销
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/18 13:57
|
||||
*/
|
||||
public static function add(array $params, $admin_id): bool
|
||||
{
|
||||
$trip_apply = ProjectTripApply::field('project_id')->where('id', $params['trip_apply_id'])->findOrEmpty();
|
||||
//获取税率
|
||||
$tax_rate = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectTravelReimbursement::create([
|
||||
'trip_reimbursement_code' => data_unique_code('项目差旅报销'),
|
||||
'trip_apply_id' => $params['trip_apply_id'],
|
||||
'project_id' => $trip_apply['project_id'],
|
||||
'reimbursement_type' => $params['reimbursement_type'],
|
||||
'loan_apply_id' => $params['loan_apply_id'] ?? 0,
|
||||
'offset_loan_amount' => $params['offset_loan_amount'] ?? 0,//冲抵借款金额
|
||||
'apply_user' => $params['apply_user'],
|
||||
'apply_date' => strtotime($params['apply_date']),
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
}
|
||||
foreach($params['invoice_detail'] as $item){
|
||||
ProjectTravelReimbursementInvoiceDetail::create([
|
||||
'travel_reimbursement_id' => $res->id,
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['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 2024/01/18 13:57
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$trip_apply = ProjectTripApply::field('project_id')->where('id',$params['trip_apply_id'])->findOrEmpty();
|
||||
//获取税率
|
||||
$tax_rate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectTravelReimbursement::where('id', $params['id'])->update([
|
||||
'trip_apply_id' => $params['trip_apply_id'],
|
||||
'project_id' => $trip_apply['project_id'],
|
||||
'reimbursement_type' => $params['reimbursement_type'],
|
||||
'loan_apply_id' => $params['loan_apply_id'] ?? 0,
|
||||
'offset_loan_amount' => $params['offset_loan_amount'] ?? 0,//冲抵借款金额
|
||||
'apply_user' => $params['apply_user'],
|
||||
'apply_date' => strtotime($params['apply_date']),
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'update_time' => time(),
|
||||
]);
|
||||
foreach($params['reimbursement_detail'] as $item){
|
||||
if(isset($item['id']) && $item['id'] != ''){
|
||||
ProjectTravelReimbursementDetail::where('id',$item['id'])->update([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'traffic_fee' => $item['traffic_fee'] ?? 0,
|
||||
'stay_fee' => $item['stay_fee'] ?? 0,
|
||||
'restaurant_fee' => $item['restaurant_fee'] ?? 0,
|
||||
'subsidy_fee' => $item['subsidy_fee'] ?? 0,
|
||||
'other_fee' => $item['other_fee'] ?? 0,
|
||||
'total_amount' => $item['traffic_fee'] + $item['stay_fee'] + $item['restaurant_fee'] + $item['subsidy_fee'] + $item['other_fee'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
}else{
|
||||
foreach ($params['reimbursement_detail'] as $item) {
|
||||
ProjectTravelReimbursementDetail::create([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'travel_reimbursement_id' => $res->id,
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'traffic_fee' => $item['traffic_fee'] ?? 0,
|
||||
'stay_fee' => $item['stay_fee'] ?? 0,
|
||||
@ -162,135 +82,216 @@ class ProjectTravelReimbursementLogic extends BaseLogic
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach($params['invoice_detail'] as $item){
|
||||
if(isset($item['id']) && $item['id'] != ''){
|
||||
ProjectTravelReimbursementInvoiceDetail::where('id',$item['id'])->update([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
}else{
|
||||
ProjectTravelReimbursementInvoiceDetail::create([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['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 2024/01/18 13:57
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$travel_reimbursement_detail_ids = ProjectTravelReimbursementDetail::where('travel_reimbursement_id',$params['id'])->column('id');
|
||||
$travel_reimbursement_invoice_detail_ids = ProjectTravelReimbursementInvoiceDetail::where('travel_reimbursement_id',$params['id'])->column('id');
|
||||
ProjectTravelReimbursement::destroy($params['id']);
|
||||
ProjectTravelReimbursementDetail::destroy($travel_reimbursement_detail_ids);
|
||||
ProjectTravelReimbursementInvoiceDetail::destroy($travel_reimbursement_invoice_detail_ids);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取差旅报销详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/18 13:57
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$field = 'id,trip_apply_id,project_id,trip_reimbursement_code,reimbursement_type,loan_apply_id,offset_loan_amount,apply_user,apply_date,payee_name,payee_bank,payee_account,remark,annex,bank_account_id,approve_id';
|
||||
$data = ProjectTravelReimbursement::field($field)
|
||||
->findOrEmpty($params['id']);
|
||||
$trip_apply = ProjectTripApply::field('trip_apply_code')->where('id',$data['trip_apply_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$manager = ProjectManagerAppointment::field('project_manager')->where('project_id',$data['project_id'])->findOrEmpty();
|
||||
$loan_apply = ProjectLoanApply::field('loan_apply_code,loan_amount')->where('id',$data['loan_apply_id'])->findOrEmpty();
|
||||
$data['trip_apply_code'] = $trip_apply['trip_apply_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
if($manager->isEmpty()){
|
||||
$data['project_manager'] = '';
|
||||
}else{
|
||||
$admin = Admin::field('name')->where('id',$manager['project_manager'])->findOrEmpty();
|
||||
$data['project_manager'] = $admin['name'];
|
||||
}
|
||||
$data['loan_apply_code'] = !$loan_apply->isEmpty() ? $loan_apply['loan_apply_code'] : '---';
|
||||
$data['loan_amount'] = !$loan_apply->isEmpty() ? $loan_apply['loan_amount'] : '---';
|
||||
$data['reimbursement_type_text'] = $data->reimbursement_type_text;
|
||||
$data['total_amount'] = ProjectTravelReimbursementDetail::where('travel_reimbursement_id',$data['id'])->sum('total_amount');
|
||||
$data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount'];
|
||||
$data['bank_account'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = ProjectTravelReimbursement::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'差旅报销',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectTravelReimbursement',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
ProjectTravelReimbursement::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
foreach ($params['invoice_detail'] as $item) {
|
||||
ProjectTravelReimbursementInvoiceDetail::create([
|
||||
'travel_reimbursement_id' => $res->id,
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/01/18 13:57
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$trip_apply = ProjectTripApply::field('project_id')->where('id', $params['trip_apply_id'])->findOrEmpty();
|
||||
//获取税率
|
||||
$tax_rate = DictData::where('type_value', 'tax_rate')->column('name', 'value');
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectTravelReimbursement::where('id', $params['id'])->update([
|
||||
'trip_apply_id' => $params['trip_apply_id'],
|
||||
'project_id' => $trip_apply['project_id'],
|
||||
'reimbursement_type' => $params['reimbursement_type'],
|
||||
'loan_apply_id' => $params['loan_apply_id'] ?? 0,
|
||||
'offset_loan_amount' => $params['offset_loan_amount'] ?? 0,//冲抵借款金额
|
||||
'apply_user' => $params['apply_user'],
|
||||
'apply_date' => strtotime($params['apply_date']),
|
||||
'payee_name' => $params['payee_name'],
|
||||
'payee_bank' => $params['payee_bank'],
|
||||
'payee_account' => $params['payee_account'],
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
'update_time' => time(),
|
||||
]);
|
||||
foreach ($params['reimbursement_detail'] as $item) {
|
||||
if (isset($item['id']) && $item['id'] != '') {
|
||||
ProjectTravelReimbursementDetail::where('id', $item['id'])->update([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'traffic_fee' => $item['traffic_fee'] ?? 0,
|
||||
'stay_fee' => $item['stay_fee'] ?? 0,
|
||||
'restaurant_fee' => $item['restaurant_fee'] ?? 0,
|
||||
'subsidy_fee' => $item['subsidy_fee'] ?? 0,
|
||||
'other_fee' => $item['other_fee'] ?? 0,
|
||||
'total_amount' => $item['traffic_fee'] + $item['stay_fee'] + $item['restaurant_fee'] + $item['subsidy_fee'] + $item['other_fee'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
} else {
|
||||
ProjectTravelReimbursementDetail::create([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'project_cost_temp_id' => $item['project_cost_temp_id'],
|
||||
'traffic_fee' => $item['traffic_fee'] ?? 0,
|
||||
'stay_fee' => $item['stay_fee'] ?? 0,
|
||||
'restaurant_fee' => $item['restaurant_fee'] ?? 0,
|
||||
'subsidy_fee' => $item['subsidy_fee'] ?? 0,
|
||||
'other_fee' => $item['other_fee'] ?? 0,
|
||||
'total_amount' => $item['traffic_fee'] + $item['stay_fee'] + $item['restaurant_fee'] + $item['subsidy_fee'] + $item['other_fee'],
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach ($params['invoice_detail'] as $item) {
|
||||
if (isset($item['id']) && $item['id'] != '') {
|
||||
ProjectTravelReimbursementInvoiceDetail::where('id', $item['id'])->update([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['remark'] ?? '',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
} else {
|
||||
ProjectTravelReimbursementInvoiceDetail::create([
|
||||
'travel_reimbursement_id' => $params['id'],
|
||||
'invoice_type' => $item['invoice_type'],
|
||||
'invoice_sn' => $item['invoice_sn'],
|
||||
'tax_rate' => $item['tax_rate'],
|
||||
'invoice_form' => $item['invoice_form'],
|
||||
'invoice_amount' => $item['invoice_amount'],
|
||||
'tax_amount' => $tax_rate[$item['tax_rate']] / 100 * $item['invoice_amount'],
|
||||
'annex' => !empty($item['annex']) ? json_encode($item['annex']) : null,
|
||||
'remark' => $item['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 2024/01/18 13:57
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$travel_reimbursement_detail_ids = ProjectTravelReimbursementDetail::where('travel_reimbursement_id', $params['id'])->column('id');
|
||||
$travel_reimbursement_invoice_detail_ids = ProjectTravelReimbursementInvoiceDetail::where('travel_reimbursement_id', $params['id'])->column('id');
|
||||
ProjectTravelReimbursement::destroy($params['id']);
|
||||
ProjectTravelReimbursementDetail::destroy($travel_reimbursement_detail_ids);
|
||||
ProjectTravelReimbursementInvoiceDetail::destroy($travel_reimbursement_invoice_detail_ids);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取差旅报销详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/18 13:57
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$field = 'id,trip_apply_id,project_id,trip_reimbursement_code,reimbursement_type,loan_apply_id,offset_loan_amount,apply_user,apply_date,payee_name,payee_bank,payee_account,remark,annex,bank_account_id,approve_id';
|
||||
$data = ProjectTravelReimbursement::field($field)
|
||||
->findOrEmpty($params['id']);
|
||||
$trip_apply = ProjectTripApply::field('trip_apply_code')->where('id', $data['trip_apply_id'])->findOrEmpty();
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$manager = ProjectManagerAppointment::field('project_manager')->where('project_id', $data['project_id'])->findOrEmpty();
|
||||
$loan_apply = ProjectLoanApply::field('loan_apply_code,loan_amount')->where('id', $data['loan_apply_id'])->findOrEmpty();
|
||||
$data['trip_apply_code'] = $trip_apply['trip_apply_code'];
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
if ($manager->isEmpty()) {
|
||||
$data['project_manager'] = '';
|
||||
} else {
|
||||
$admin = Admin::field('name')->where('id', $manager['project_manager'])->findOrEmpty();
|
||||
$data['project_manager'] = $admin['name'];
|
||||
}
|
||||
$data['loan_apply_code'] = !$loan_apply->isEmpty() ? $loan_apply['loan_apply_code'] : '---';
|
||||
$data['loan_amount'] = !$loan_apply->isEmpty() ? $loan_apply['loan_amount'] : '---';
|
||||
$data['reimbursement_type_text'] = $data->reimbursement_type_text;
|
||||
$data['total_amount'] = ProjectTravelReimbursementDetail::where('travel_reimbursement_id', $data['id'])->sum('total_amount');
|
||||
$data['pay_amount'] = $data['total_amount'] - $data['offset_loan_amount'];
|
||||
$data['bank_account'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id', $data['bank_account_id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = ProjectTravelReimbursement::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'差旅报销',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectTravelReimbursement',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
ProjectTravelReimbursement::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,164 +11,165 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectManagerAppointment;
|
||||
use app\common\model\project\ProjectTripApply;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 出差申请逻辑
|
||||
* Class ProjectTripApplyLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectTripApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加出差申请
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectTripApply::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'trip_apply_code' => data_unique_code('项目出差'),
|
||||
'origin_address' => $params['origin_address'],
|
||||
'target_address' => $params['target_address'],
|
||||
'traffic' => $params['traffic'],
|
||||
'start_date' => strtotime($params['start_date']),
|
||||
'end_date' => strtotime($params['end_date']),
|
||||
'reason' => $params['reason'] ?? '',
|
||||
'days' => daysBetweenDates($params['start_date'],$params['end_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
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/01/17 09:22
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectTripApply::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'origin_address' => $params['origin_address'],
|
||||
'target_address' => $params['target_address'],
|
||||
'traffic' => $params['traffic'],
|
||||
'start_date' => strtotime($params['start_date']),
|
||||
'end_date' => strtotime($params['end_date']),
|
||||
'reason' => $params['reason'] ?? '',
|
||||
'days' => daysBetweenDates($params['start_date'],$params['end_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'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/01/17 09:22
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectTripApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取出差申请详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectTripApply::field('id,project_id,trip_apply_code,origin_address,target_address,traffic,start_date,end_date,reason,days,remark,annex,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$manager = ProjectManagerAppointment::field('project_manager')->where('project_id',$data['project_id'])->findOrEmpty();
|
||||
$data['traffic_text'] = $data->traffic_text;
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
if($manager->isEmpty()){
|
||||
$data['project_manager'] = '';
|
||||
}else{
|
||||
$admin = Admin::field('name')->where('id',$manager['project_manager'])->findOrEmpty();
|
||||
$data['project_manager'] = $admin['name'];
|
||||
}
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params,$admin_id): bool{
|
||||
$data = ProjectTripApply::where('id',$params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id',$data['approve_id'])->findOrEmpty();
|
||||
if(!empty($data['approve_id']) && $approve_data['check_status'] != 3){
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'出差申请',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectTripApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if($res){
|
||||
ProjectTripApply::where('id',$params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
namespace app\adminapi\logic\project;
|
||||
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\oa\FlowApprove;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectManagerAppointment;
|
||||
use app\common\model\project\ProjectTripApply;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 出差申请逻辑
|
||||
* Class ProjectTripApplyLogic
|
||||
* @package app\adminapi\logic\project
|
||||
*/
|
||||
class ProjectTripApplyLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加出差申请
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public static function add(array $params, $admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = ProjectTripApply::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'trip_apply_code' => data_unique_code('项目出差'),
|
||||
'origin_address' => $params['origin_address'],
|
||||
'target_address' => $params['target_address'],
|
||||
'traffic' => $params['traffic'],
|
||||
'start_date' => strtotime($params['start_date']),
|
||||
'end_date' => strtotime($params['end_date']),
|
||||
'reason' => $params['reason'] ?? '',
|
||||
'days' => daysBetweenDates($params['start_date'], $params['end_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
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/01/17 09:22
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectTripApply::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'origin_address' => $params['origin_address'],
|
||||
'target_address' => $params['target_address'],
|
||||
'traffic' => $params['traffic'],
|
||||
'start_date' => strtotime($params['start_date']),
|
||||
'end_date' => strtotime($params['end_date']),
|
||||
'reason' => $params['reason'] ?? '',
|
||||
'days' => daysBetweenDates($params['start_date'], $params['end_date']),
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'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/01/17 09:22
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return ProjectTripApply::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取出差申请详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectTripApply::field('id,project_id,trip_apply_code,origin_address,target_address,traffic,start_date,end_date,reason,days,remark,annex,approve_id')
|
||||
->findOrEmpty($params['id']);
|
||||
$project = Project::field('name,project_code')->where('id', $data['project_id'])->findOrEmpty();
|
||||
$manager = ProjectManagerAppointment::field('project_manager')->where('project_id', $data['project_id'])->findOrEmpty();
|
||||
$data['traffic_text'] = $data->traffic_text;
|
||||
$data['project_name'] = $project['name'];
|
||||
$data['project_code'] = $project['project_code'];
|
||||
if ($manager->isEmpty()) {
|
||||
$data['project_manager'] = '';
|
||||
} else {
|
||||
$admin = Admin::field('name')->where('id', $manager['project_manager'])->findOrEmpty();
|
||||
$data['project_manager'] = $admin['name'];
|
||||
}
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
$data['approve_check_status'] = $approve_data['check_status'];
|
||||
return $data->toArray();
|
||||
}
|
||||
|
||||
public static function approve($params, $admin_id): bool
|
||||
{
|
||||
$data = ProjectTripApply::where('id', $params['id'])->findOrEmpty();
|
||||
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
|
||||
if ((!empty($data['approve_id']) && $approve_data['check_status'] != 3) || (!empty($data['approve_id']) && $approve_data['check_status'] != 4)) {
|
||||
self::setError('当前内容存在审核信息,请勿重复提交');
|
||||
return false;
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = addApprove(
|
||||
'出差申请',
|
||||
$params['id'],
|
||||
'app\common\model\project\ProjectTripApply',
|
||||
$params['path'],
|
||||
$params['flow_id'],
|
||||
$admin_id
|
||||
);
|
||||
if ($res) {
|
||||
ProjectTripApply::where('id', $params['id'])->update([
|
||||
'approve_id' => $res,
|
||||
]);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user