This commit is contained in:
weiz 2024-04-06 11:04:53 +08:00
parent 80202c29f6
commit 91d1ed8686
11 changed files with 1416 additions and 1407 deletions

View File

@ -1,27 +1,26 @@
<?php
namespace app\adminapi\controller;
namespace app\adminapi\controller;
use app\common\model\auth\Admin;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\cost_project\CostProjectPerson;
use app\common\model\DataReception;
use app\common\model\dept\Dept;
use app\common\model\GeoCity;
use app\common\model\GeoProvince;
use app\common\model\project_process_management\JianliProjectProgressReport;
use app\common\model\ProjectCommission;
use app\common\model\ProjectCommissionDetail;
use app\common\model\task\TaskAllocation;
use app\common\model\TaskHandlingThreeLevelReview;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\common\model\zjzx_finance\ZjzxSettlement;
use think\facade\Db;
use app\common\model\auth\Admin;
use app\common\model\cost_project\CostProject;
use app\common\model\cost_project\CostProjectPerson;
use app\common\model\DataReception;
use app\common\model\dept\Dept;
use app\common\model\GeoCity;
use app\common\model\GeoProvince;
use app\common\model\marketing\MarketingContract;
use app\common\model\project_process_management\JianliProjectProgressReport;
use app\common\model\ProjectCommission;
use app\common\model\ProjectCommissionDetail;
use app\common\model\task\TaskAllocation;
use app\common\model\TaskHandlingThreeLevelReview;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\common\model\zjzx_finance\ZjzxSettlement;
class CostConsultationReportController extends BaseAdminController
{
class CostConsultationReportController extends BaseAdminController
{
// 造价报表控制器
// 造价合同台账
@ -31,40 +30,41 @@ class CostConsultationReportController extends BaseAdminController
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['contract_name'])){
$contract_ids1 = CostApprovedProject::where('contract_name','like','%'.$params['contract_name'].'%')->column('id');
$where[] = ['contract_id','in',$contract_ids1];
if (!empty($params['contract_name'])) {
$contract_ids1 = MarketingContract::where('contract_name', 'like', '%' . $params['contract_name'] . '%')->column('id');
$where[] = ['contract_id', 'in', $contract_ids1];
}
if(!empty($params['contract_num'])){
$contract_ids2 = CostApprovedProject::where('contract_num','like','%'.$params['contract_num'].'%')->column('id');
$where[] = ['contract_id','in',$contract_ids2];
if (!empty($params['contract_num'])) {
$contract_ids2 = MarketingContract::where('contract_code', 'like', '%' . $params['contract_num'] . '%')->column('id');
$where[] = ['contract_id', 'in', $contract_ids2];
}
if(!empty($params['part_a'])){
$contract_ids3 = CostApprovedProject::where('part_a','like','%'.$params['part_a'].'%')->column('id');
$where[] = ['contract_id','in',$contract_ids3];
if (!empty($params['part_a'])) {
$contract_ids3 = MarketingContract::where('part_a', 'like', '%' . $params['part_a'] . '%')->column('id');
$where[] = ['contract_id', 'in', $contract_ids3];
}
$lists = CostProject::field('id,contract_id')->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$contract = CostApprovedProject::field('contract_name,contract_num,contract_type,part_a,part_b,create_time,start_date,end_date,project_money,money')
->where('id',$data['contract_id'])->findOrEmpty();
$lists = CostProject::field('id,contract_id')->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function ($data) {
$contract = MarketingContract::field('contract_name,contract_code,contract_type,part_a,part_b,create_time,start_date,end_date,project_money,signed_amount')
->where('id', $data['contract_id'])->findOrEmpty();
$admin = Admin::field('name')->where('id', $contract['part_a'])->findOrEmpty();
$data['contract_name'] = $contract['contract_name'];
$data['contract_num'] = $contract['contract_num'];
$data['contract_type'] = $contract->contract_type_text;
$data['part_a'] = $contract['part_a'];
$data['contract_num'] = $contract['contract_code'];
$data['contract_type'] = !$contract->isEmpty() ? $contract->contract_type_text : '';
$data['part_a'] = $admin['name'];
$data['part_b'] = $contract['part_b'];
$data['create_time'] = $contract['create_time'];
$data['start_date'] = $contract['start_date'];
$data['end_date'] = $contract['end_date'];
$data['project_money'] = $contract['project_money'];
$data['sign_money'] = $contract['money'];
$data['sign_money'] = $contract['signed_amount'];
//开票金额
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id',$data['id'])->sum('apply_amount');
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id', $data['id'])->sum('apply_amount');
//到账金额
$data['total_refund_amount'] = ZjzxRefund::where('project_id',$data['id'])->sum('amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id', $data['id'])->sum('amount');
//结算金额
$data['total_settlement_amount'] = ZjzxSettlement::where('project_id',$data['id'])->sum('amount');
$data['total_settlement_amount'] = ZjzxSettlement::where('project_id', $data['id'])->sum('amount');
//应收账款
$data['total_collection_amount'] = $contract['money'] - $data['total_refund_amount'];
unset($data['contract_id'],$data['id']);
unset($data['contract_id'], $data['id']);
})->toArray();
$count = CostProject::where($where)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
@ -77,24 +77,24 @@ class CostConsultationReportController extends BaseAdminController
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['contract_name'])){
$contract_ids1 = CostApprovedProject::where('contract_name','like','%'.$params['contract_name'].'%')->column('id');
$where[] = ['contract_id','in',$contract_ids1];
if (!empty($params['contract_name'])) {
$contract_ids1 = MarketingContract::where('contract_name', 'like', '%' . $params['contract_name'] . '%')->column('id');
$where[] = ['contract_id', 'in', $contract_ids1];
}
if(!empty($params['project_name'])){
$where[] = ['project_name','like','%'.$params['project_name'].'%'];
if (!empty($params['project_name'])) {
$where[] = ['project_name', 'like', '%' . $params['project_name'] . '%'];
}
$lists = CostProject::field('id,contract_id,project_num,project_name,starting,endtime,types,invest')
->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$contract = CostApprovedProject::field('contract_name')->where('id',$data['contract_id'])->findOrEmpty();
->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function ($data) {
$contract = MarketingContract::field('contract_name')->where('id', $data['contract_id'])->findOrEmpty();
$data['contract_name'] = $contract['contract_name'];
$data['types'] = $data->types_text;
//开票金额
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id',$data['id'])->sum('apply_amount');
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id', $data['id'])->sum('apply_amount');
//到账金额
$data['total_refund_amount'] = ZjzxRefund::where('project_id',$data['id'])->sum('amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id', $data['id'])->sum('amount');
//提成金额
$data['total_commission_amount'] = ProjectCommission::where('project_id',$data['id'])->sum('bczfze');
$data['total_commission_amount'] = ProjectCommission::where('project_id', $data['id'])->sum('bczfze');
})->toArray();
$count = CostProject::where($where)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
@ -107,19 +107,20 @@ class CostConsultationReportController extends BaseAdminController
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['contract_name'])){
$contract_ids1 = CostApprovedProject::where('contract_name','like','%'.$params['contract_name'].'%')->column('id');
$where[] = ['contract_id','in',$contract_ids1];
if (!empty($params['contract_name'])) {
$contract_ids1 = MarketingContract::where('contract_name', 'like', '%' . $params['contract_name'] . '%')->column('id');
$where[] = ['contract_id', 'in', $contract_ids1];
}
if(!empty($params['project_name'])){
$where[] = ['project_name','like','%'.$params['project_name'].'%'];
if (!empty($params['project_name'])) {
$where[] = ['project_name', 'like', '%' . $params['project_name'] . '%'];
}
$lists = CostProject::field('id,contract_id,project_num,project_name,depar')
->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$contract = CostApprovedProject::field('contract_name,project_director')->where('id',$data['contract_id'])->findOrEmpty();
->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function ($data) {
$contract = MarketingContract::field('contract_name,project_manager')->where('id', $data['contract_id'])->findOrEmpty();
$dept = Dept::field('name')->where('id', $data['depar'])->findOrEmpty();
$admin = Admin::field('name')->where('id', $contract['project_manager'])->findOrEmpty();
$data['contract_name'] = $contract['contract_name'];
$data['project_director'] = $contract['project_director'];
$data['project_director'] = $admin['name'];
$data['dept_name'] = $dept['name'];
//任务分配状态
$task_allocation_status = TaskAllocation::where('cost_project_id', $data['id'])->count();
@ -131,11 +132,11 @@ class CostConsultationReportController extends BaseAdminController
$data_reception_status = DataReception::where('project_id', $data['id'])->count();
$data['data_reception_status'] = $data_reception_status > 0 ? 1 : 0;
//开票金额
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id',$data['id'])->sum('apply_amount');
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id', $data['id'])->sum('apply_amount');
//到账金额
$data['total_refund_amount'] = ZjzxRefund::where('project_id',$data['id'])->sum('amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id', $data['id'])->sum('amount');
//提成金额
$data['total_commission_amount'] = ProjectCommission::where('project_id',$data['id'])->sum('bczfze');
$data['total_commission_amount'] = ProjectCommission::where('project_id', $data['id'])->sum('bczfze');
})->toArray();
$count = CostProject::where($where)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
@ -150,24 +151,25 @@ class CostConsultationReportController extends BaseAdminController
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['contract_name'])){
$contract_ids1 = CostApprovedProject::where('contract_name','like','%'.$params['contract_name'].'%')->column('id');
$where[] = ['contract_id','in',$contract_ids1];
if (!empty($params['contract_name'])) {
$contract_ids1 = MarketingContract::where('contract_name', 'like', '%' . $params['contract_name'] . '%')->column('id');
$where[] = ['contract_id', 'in', $contract_ids1];
}
if(!empty($params['project_name'])){
$where[] = ['project_name','like','%'.$params['project_name'].'%'];
if (!empty($params['project_name'])) {
$where[] = ['project_name', 'like', '%' . $params['project_name'] . '%'];
}
$lists = CostProject::field('id,contract_id,project_num,project_name,depar')
->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$contract = CostApprovedProject::field('contract_name,project_director')->where('id',$data['contract_id'])->findOrEmpty();
->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function ($data) {
$contract = MarketingContract::field('contract_name,project_manager')->where('id', $data['contract_id'])->findOrEmpty();
$dept = Dept::field('name')->where('id', $data['depar'])->findOrEmpty();
$admin = Admin::field('name')->where('id', $contract['project_manager'])->findOrEmpty();
$data['contract_name'] = $contract['contract_name'];
$data['project_director'] = $contract['project_director'];
$data['project_director'] = $admin['name'];
$data['dept_name'] = $dept['name'];
//开票金额
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id',$data['id'])->sum('apply_amount');
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id', $data['id'])->sum('apply_amount');
//到账金额
$data['total_refund_amount'] = ZjzxRefund::where('project_id',$data['id'])->sum('amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id', $data['id'])->sum('amount');
})->toArray();
$count = CostProject::where($where)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
@ -217,26 +219,27 @@ class CostConsultationReportController extends BaseAdminController
}
//项目提成统计
public function project_commission_statistics(){
public function project_commission_statistics()
{
$params = $this->request->get();
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['project_name'])){
$where[] = ['project_name','like','%'.$params['project_name'].'%'];
if (!empty($params['project_name'])) {
$where[] = ['project_name', 'like', '%' . $params['project_name'] . '%'];
}
if(!empty($params['date'])){
$date = explode(',',$params['date']);
$where[] = ['apptime','between',[strtotime($date[0].' 00:00:00'),strtotime($date[1].' 23:59:59')]];
if (!empty($params['date'])) {
$date = explode(',', $params['date']);
$where[] = ['apptime', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]];
}
$lists = ProjectCommission::field('id,project_id,apptime')->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$project = CostProject::field('project_name,project_num,contract_id')->where('id',$data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name')->where('id',$project['contract_id'])->findOrEmpty();
$lists = ProjectCommission::field('id,project_id,apptime')->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function ($data) {
$project = CostProject::field('project_name,project_num,contract_id')->where('id', $data['project_id'])->findOrEmpty();
$contract = MarketingContract::field('contract_name')->where('id', $project['contract_id'])->findOrEmpty();
$data['project_num'] = $project['project_num'];
$data['project_name'] = $project['project_name'];
$data['contract_name'] = $contract['contract_name'];
$data['children'] = ProjectCommissionDetail::withoutField('engineer_id,remark,create_time,update_time,delete_time')
->where('project_commission_id',$data['id'])->select()->each(function($data){
->where('project_commission_id', $data['id'])->select()->each(function ($data) {
$data['task_type'] = $data->task_type_text;
$data['professional_type'] = $data->professional_type_text;
})->toArray();
@ -246,29 +249,31 @@ class CostConsultationReportController extends BaseAdminController
}
//项目进度统计
public function project_schedule_statistics(){
public function project_schedule_statistics()
{
$params = $this->request->get();
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
$where = [];
if(!empty($params['contract_name'])){
$contract_ids1 = CostApprovedProject::where('contract_name','like','%'.$params['contract_name'].'%')->column('id');
$where[] = ['contract_id','in',$contract_ids1];
if (!empty($params['contract_name'])) {
$contract_ids1 = MarketingContract::where('contract_name', 'like', '%' . $params['contract_name'] . '%')->column('id');
$where[] = ['contract_id', 'in', $contract_ids1];
}
if(!empty($params['project_name'])){
$where[] = ['project_name','like','%'.$params['project_name'].'%'];
if (!empty($params['project_name'])) {
$where[] = ['project_name', 'like', '%' . $params['project_name'] . '%'];
}
$lists = CostProject::field('id,contract_id,project_num,project_name,types,aunit,province,city,starting,endtime,jhgq')
->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
$contract = CostApprovedProject::field('contract_name,industry_nature,project_director')->where('id',$data['contract_id'])->findOrEmpty();
$province = GeoProvince::field('province_name')->where('province_code',$data['province'])->findOrEmpty();
$city = GeoCity::field('city_name')->where('city_code',$data['city'])->findOrEmpty();
$schedule = JianliProjectProgressReport::field('start_date,end_date,duration,done_progress')->where('project_id',$data['id'])->findOrEmpty();
->where($where)->page($page_no, $page_size)->order('id desc')->select()->each(function ($data) {
$contract = MarketingContract::field('contract_name,industry_nature,project_manager')->where('id', $data['contract_id'])->findOrEmpty();
$province = GeoProvince::field('province_name')->where('province_code', $data['province'])->findOrEmpty();
$city = GeoCity::field('city_name')->where('city_code', $data['city'])->findOrEmpty();
$schedule = JianliProjectProgressReport::field('start_date,end_date,duration,done_progress')->where('project_id', $data['id'])->findOrEmpty();
$admin = Admin::field('name')->where('id', $contract['project_manager'])->findOrEmpty();
$data['contract_name'] = $contract['contract_name'];
$data['project_director'] = $contract['project_director'];
$data['types'] = $data->types_text;
$data['industry_nature'] = $contract->industry_nature_text;
$data['project_director'] = $contract['project_director'];
$data['project_director'] = $admin['name'];
$data['province'] = $province['province_name'];
$data['city'] = $city['city_name'];
$data['actual_starting'] = $schedule['start_date'];
@ -279,4 +284,4 @@ class CostConsultationReportController extends BaseAdminController
$count = CostProject::where($where)->count();
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
}
}
}

View File

@ -12,26 +12,25 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists;
namespace app\adminapi\lists;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\ProjectCommission;
use app\common\lists\ListsSearchInterface;
use app\common\model\ProjectCommissionDetail;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\common\lists\ListsExcelInterface;
use app\common\lists\ListsSearchInterface;
use app\common\model\cost_project\CostProject;
use app\common\model\marketing\MarketingContract;
use app\common\model\ProjectCommission;
use app\common\model\ProjectCommissionDetail;
use app\common\model\zjzx_finance\ZjzxRefund;
/**
/**
* ProjectCommission列表
* Class ProjectCommissionLists
* @package app\adminapi\lists
*/
class ProjectCommissionLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
{
class ProjectCommissionLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
{
/**
@ -63,18 +62,17 @@ class ProjectCommissionLists extends BaseAdminDataLists implements ListsSearchIn
return ProjectCommission::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$project = CostProject::field('project_name,project_num,contract_id')->where('id',$data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name,project_director,industry_nature')->where('id',$project['contract_id'])->findOrEmpty();
->select()->each(function ($data) {
$project = CostProject::field('project_name,project_num,contract_id')->where('id', $data['project_id'])->findOrEmpty();
$contract = MarketingContract::field('contract_name,industry_nature')->where('id', $project['contract_id'])->findOrEmpty();
$data['project_name'] = $project['project_name'];
$data['project_num'] = $project['project_num'];
$data['contract_name'] = $contract['contract_name'];
$data['project_director'] = $contract['project_director'];
$data['industry_nature'] = $contract->industry_nature_text;
//到账金额
$data['total_refund_amount'] = ZjzxRefund::where('project_id',$data['project_id'])->sum('amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id', $data['project_id'])->sum('amount');
//已支付总额
$data['total_pay_amount'] = ProjectCommission::where('project_id',$data['project_id'])->sum('bczfze');
$data['total_pay_amount'] = ProjectCommission::where('project_id', $data['project_id'])->sum('bczfze');
//应提成总金额
$data['total_commission_amount'] = $data['total_refund_amount'] * ($data['rate'] / 100);
$data['children'] = ProjectCommissionDetail::field('id,engineer,task_name,task_type,professional_type,zj_amount,sk_amount,tc_rate,tc_amount,pay_amount,other_fee')->where('project_commission_id', $data['id'])->select()->toArray();
@ -124,4 +122,4 @@ class ProjectCommissionLists extends BaseAdminDataLists implements ListsSearchIn
];
}
}
}

View File

@ -12,24 +12,24 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\cost_project;
namespace app\adminapi\lists\cost_project;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\model\cost_project\CostProject;
use app\common\lists\ListsSearchInterface;
use app\common\model\ProjectCommission;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\lists\ListsSearchInterface;
use app\common\model\cost_project\CostProject;
use app\common\model\ProjectCommission;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
/**
/**
* 造价项目台账列表
* Class CostProjectLists
* @package app\adminapi\listscost_project
*/
class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
{
class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
{
/**
@ -41,7 +41,7 @@ class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterfac
public function setSearch(): array
{
return [
'=' => ['cost_project_id','types','industry'],
'=' => ['cost_project_id', 'types', 'industry'],
'%like%' => ['project_num', 'project_name'],
];
}
@ -69,12 +69,11 @@ class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterfac
->with(['contract'])
->order(['id' => 'desc'])
->select()
->each(function($item){
->each(function ($item) {
$item['person_text'] = $item->person_text;
$item['contract']['contract_type_text'] = $item['contract']->contract_type_text;
$item['total_invoice_amount'] = ZjzxInvoice::where('project_id',$item['id'])->sum('apply_amount');
$item['total_refund_amount'] = ZjzxRefund::where('project_id',$item['id'])->sum('amount');
$item['total_pay_amount'] = ProjectCommission::where('project_id',$item['id'])->sum('bczfze');
$item['total_invoice_amount'] = ZjzxInvoice::where('project_id', $item['id'])->sum('apply_amount');
$item['total_refund_amount'] = ZjzxRefund::where('project_id', $item['id'])->sum('amount');
$item['total_pay_amount'] = ProjectCommission::where('project_id', $item['id'])->sum('bczfze');
})
->toArray();
}
@ -83,12 +82,11 @@ class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterfac
->with(['contract'])
->order(['id' => 'desc'])
->select()
->each(function($item){
->each(function ($item) {
$item['person_text'] = $item->person_text;
$item['contract']['contract_type_text'] = $item['contract']->contract_type_text;
$item['total_invoice_amount'] = ZjzxInvoice::where('project_id',$item['id'])->sum('apply_amount');
$item['total_refund_amount'] = ZjzxRefund::where('project_id',$item['id'])->sum('amount');
$item['total_pay_amount'] = ProjectCommission::where('project_id',$item['id'])->sum('bczfze');
$item['total_invoice_amount'] = ZjzxInvoice::where('project_id', $item['id'])->sum('apply_amount');
$item['total_refund_amount'] = ZjzxRefund::where('project_id', $item['id'])->sum('amount');
$item['total_pay_amount'] = ProjectCommission::where('project_id', $item['id'])->sum('bczfze');
})
->toArray();
@ -154,4 +152,4 @@ class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterfac
];
}
}
}

View File

@ -12,23 +12,22 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\project_process_management;
namespace app\adminapi\lists\project_process_management;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\project_process_management\ApplyWithSeal;
use app\common\lists\ListsSearchInterface;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\lists\ListsSearchInterface;
use app\common\model\project_process_management\ApplyWithSeal;
/**
/**
* ApplyWithSeal列表
* Class ApplyWithSealLists
* @package app\adminapi\listsproject_process_management
*/
class ApplyWithSealLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
{
class ApplyWithSealLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
{
/**
@ -41,7 +40,7 @@ class ApplyWithSealLists extends BaseAdminDataLists implements ListsSearchInterf
{
return [
'=' => ['project_id'],
'%like%' => ['num','stampman','applicant']
'%like%' => ['num', 'stampman', 'applicant']
];
}
@ -60,10 +59,7 @@ class ApplyWithSealLists extends BaseAdminDataLists implements ListsSearchInterf
return ApplyWithSeal::with(['projectInfo', 'dept'])->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$contract = CostApprovedProject::field('project_director')->where('id',$data['projectInfo']['contract_id'])->findOrEmpty();
$data['project_director'] = $contract['project_director'];
})
->select()
->toArray();
}
@ -118,4 +114,4 @@ class ApplyWithSealLists extends BaseAdminDataLists implements ListsSearchInterf
];
}
}
}

View File

@ -1,21 +1,23 @@
<?php
namespace app\adminapi\lists\zjzx_finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\lists\ListsSearchInterface;
use app\common\model\zjzx_finance\ZjzxRefund;
namespace app\adminapi\lists\zjzx_finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\cost_project\CostProject;
use app\common\model\marketing\MarketingContract;
use app\common\model\marketing\MarketingCustom;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
/**
/**
* 造价咨询--开票台账列表
* Class ZjzxInvoiceLists
* @package app\adminapi\listszjzx_finance
*/
class ZjzxInvoiceLists extends BaseAdminDataLists implements ListsSearchInterface
{
class ZjzxInvoiceLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
@ -48,21 +50,22 @@ class ZjzxInvoiceLists extends BaseAdminDataLists implements ListsSearchInterfac
->field(['id', 'project_id', 'invoice_code', 'invoice_type', 'apply_amount', 'create_user', 'create_time'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$project = CostProject::field('project_num,project_name,contract_id')->where('id',$data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name,contract_type,part_a,part_b,money,create_time')->where('id',$project['contract_id'])->findOrEmpty();
->select()->each(function ($data) {
$project = CostProject::field('project_num,project_name,contract_id')->where('id', $data['project_id'])->findOrEmpty();
$contract = MarketingContract::field('contract_name,contract_type,part_a,part_b,signed_amount,create_time')->where('id', $project['contract_id'])->findOrEmpty();
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
$data['project_num'] = $project['project_num'];
$data['project_name'] = $project['project_name'];
$data['contract_name'] = $contract['contract_name'];
$data['contract_type'] = $contract->contract_type_text;
$data['part_a'] = $contract['part_a'];
$data['contract_type'] = !$contract->isEmpty() ? $contract->contract_type_text : '';
$data['part_a'] = $part_a['name'];
$data['part_b'] = $contract['part_b'];
$data['sign_money'] = $contract['money'];
$data['sign_money'] = $contract['signed_amount'];
$data['sign_time'] = $contract['create_time'];
$data['invoice_type_text'] = $data->invoice_type_text;
$refund = ZjzxRefund::where('invoice_id',$data['id'])->findOrEmpty();
$refund = ZjzxRefund::where('invoice_id', $data['id'])->findOrEmpty();
$data['is_refund'] = !$refund->isEmpty() ? '已到账' : '未到账';
$data['refund_amount'] = !$refund->isEmpty() ? ZjzxRefund::where('invoice_id',$data['id'])->sum('amount') : 0.00;
$data['refund_amount'] = !$refund->isEmpty() ? ZjzxRefund::where('invoice_id', $data['id'])->sum('amount') : 0.00;
})
->toArray();
}
@ -79,4 +82,4 @@ class ZjzxInvoiceLists extends BaseAdminDataLists implements ListsSearchInterfac
return ZjzxInvoice::where($this->searchWhere)->count();
}
}
}

View File

@ -1,21 +1,23 @@
<?php
namespace app\adminapi\lists\zjzx_finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\common\lists\ListsSearchInterface;
namespace app\adminapi\lists\zjzx_finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\cost_project\CostProject;
use app\common\model\marketing\MarketingContract;
use app\common\model\marketing\MarketingCustom;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
/**
/**
* 造价咨询--到账台账列表
* Class ZjzxRefundLists
* @package app\adminapi\listszjzx_finance
*/
class ZjzxRefundLists extends BaseAdminDataLists implements ListsSearchInterface
{
class ZjzxRefundLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
@ -48,15 +50,16 @@ class ZjzxRefundLists extends BaseAdminDataLists implements ListsSearchInterface
->field(['id', 'project_id', 'invoice_id', 'amount', 'date'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$project = CostProject::field('project_num,project_name,contract_id')->where('id',$data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name,contract_type,part_a,part_b')->where('id',$project['contract_id'])->findOrEmpty();
$invoice = ZjzxInvoice::field('invoice_code,apply_amount')->where('id',$data['invoice_id'])->findOrEmpty();
->select()->each(function ($data) {
$project = CostProject::field('project_num,project_name,contract_id')->where('id', $data['project_id'])->findOrEmpty();
$contract = MarketingContract::field('contract_name,contract_type,part_a,part_b')->where('id', $project['contract_id'])->findOrEmpty();
$invoice = ZjzxInvoice::field('invoice_code,apply_amount')->where('id', $data['invoice_id'])->findOrEmpty();
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
$data['project_num'] = $project['project_num'];
$data['project_name'] = $project['project_name'];
$data['contract_name'] = $contract['contract_name'];
$data['contract_type'] = $contract->contract_type_text;
$data['part_a'] = $contract['part_a'];
$data['contract_type'] = !$contract->isEmpty() ? $contract->contract_type_text : '';
$data['part_a'] = $part_a['name'];
$data['part_b'] = $contract['part_b'];
$data['invoice_code'] = $invoice['invoice_code'];
$data['apply_amount'] = $invoice['apply_amount'];
@ -76,4 +79,4 @@ class ZjzxRefundLists extends BaseAdminDataLists implements ListsSearchInterface
return ZjzxRefund::where($this->searchWhere)->count();
}
}
}

View File

@ -1,22 +1,24 @@
<?php
namespace app\adminapi\lists\zjzx_finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\common\model\zjzx_finance\ZjzxSettlement;
use app\common\lists\ListsSearchInterface;
namespace app\adminapi\lists\zjzx_finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\cost_project\CostProject;
use app\common\model\marketing\MarketingContract;
use app\common\model\marketing\MarketingCustom;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\common\model\zjzx_finance\ZjzxSettlement;
/**
/**
* 造价咨询--项目结算列表
* Class ZjzxSettlementLists
* @package app\adminapi\listszjzx_finance
*/
class ZjzxSettlementLists extends BaseAdminDataLists implements ListsSearchInterface
{
class ZjzxSettlementLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
@ -48,20 +50,21 @@ class ZjzxSettlementLists extends BaseAdminDataLists implements ListsSearchInter
->field(['id', 'project_id', 'amount', 'date'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$project = CostProject::field('project_num,project_name,contract_id')->where('id',$data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name,contract_type,part_a,part_b,money,create_time')->where('id',$project['contract_id'])->findOrEmpty();
->select()->each(function ($data) {
$project = CostProject::field('project_num,project_name,contract_id')->where('id', $data['project_id'])->findOrEmpty();
$contract = MarketingContract::field('contract_name,contract_type,part_a,part_b,signed_amount,create_time')->where('id', $project['contract_id'])->findOrEmpty();
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
$data['invoice_type_text'] = $data->invoice_type_text;
$data['project_num'] = $project['project_num'];
$data['project_name'] = $project['project_name'];
$data['contract_name'] = $contract['contract_name'];
$data['contract_type'] = $contract->contract_type_text;
$data['part_a'] = $contract['part_a'];
$data['part_a'] = $part_a['name'];
$data['part_b'] = $contract['part_b'];
$data['sign_money'] = $contract['money'];
$data['sign_money'] = $contract['signed_amount'];
$data['sign_time'] = $contract['create_time'];
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id',$data['project_id'])->sum('apply_amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id',$data['project_id'])->sum('amount');
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id', $data['project_id'])->sum('apply_amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id', $data['project_id'])->sum('amount');
})
->toArray();
}
@ -78,4 +81,4 @@ class ZjzxSettlementLists extends BaseAdminDataLists implements ListsSearchInter
return ZjzxSettlement::where($this->searchWhere)->count();
}
}
}

View File

@ -12,24 +12,22 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\project_process_management;
namespace app\adminapi\logic\project_process_management;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\dept\Dept;
use app\common\model\dept\Orgs;
use app\common\model\project_process_management\ApplyWithSeal;
use app\common\logic\BaseLogic;
use think\facade\Db;
use app\common\logic\BaseLogic;
use app\common\model\dept\Dept;
use app\common\model\project_process_management\ApplyWithSeal;
use think\facade\Db;
/**
/**
* ApplyWithSeal逻辑
* Class ApplyWithSealLogic
* @package app\adminapi\logic\project_process_management
*/
class ApplyWithSealLogic extends BaseLogic
{
class ApplyWithSealLogic extends BaseLogic
{
/**
@ -147,11 +145,7 @@ class ApplyWithSealLogic extends BaseLogic
public static function detail($params): array
{
$data = ApplyWithSeal::with(['projectInfo'])->findOrEmpty($params['id']);
$contract = CostApprovedProject::field('project_director')->where('id',$data['projectInfo']['contract_id'])->findOrEmpty();
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
$dept = Dept::field('name')->where('id',$data['depar'])->findOrEmpty();
$data['project_director'] = $contract['project_director'];
$data['org_name'] = $org['name'];
$dept = Dept::field('name')->where('id', $data['depar'])->findOrEmpty();
$data['dept_name'] = $dept['name'];
$data['types_text'] = $data->types_text;
$data['ridingseam_text'] = $data->ridingseam_text;
@ -159,4 +153,4 @@ class ApplyWithSealLogic extends BaseLogic
$data['loan_text'] = $data->loan_text;
return $data->toArray();
}
}
}

View File

@ -1,21 +1,23 @@
<?php
namespace app\adminapi\logic\zjzx_finance;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\logic\BaseLogic;
use app\common\model\zjzx_finance\ZjzxRefund;
use think\facade\Db;
namespace app\adminapi\logic\zjzx_finance;
use app\common\logic\BaseLogic;
use app\common\model\cost_project\CostProject;
use app\common\model\marketing\MarketingContract;
use app\common\model\marketing\MarketingCustom;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use think\facade\Db;
/**
/**
* 造价咨询--开票台账逻辑
* Class ZjzxInvoiceLogic
* @package app\adminapi\logic\zjzx_finance
*/
class ZjzxInvoiceLogic extends BaseLogic
{
class ZjzxInvoiceLogic extends BaseLogic
{
/**
@ -119,26 +121,27 @@ class ZjzxInvoiceLogic extends BaseLogic
public static function detail($params): array
{
$data = ZjzxInvoice::withoutField('update_time,delete_time')->findOrEmpty($params['id']);
$project = CostProject::field('project_num,project_name,contract_id')->where('id',$data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name,contract_type,part_a,part_b,money,create_time')->where('id',$project['contract_id'])->findOrEmpty();
$project = CostProject::field('project_num,project_name,contract_id')->where('id', $data['project_id'])->findOrEmpty();
$contract = MarketingContract::field('contract_name,contract_type,part_a,part_b,signed_amount,create_time')->where('id', $project['contract_id'])->findOrEmpty();
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
$data['invoice_type_text'] = $data->invoice_type_text;
$data['project_num'] = $project['project_num'];
$data['project_name'] = $project['project_name'];
$data['contract_name'] = $contract['contract_name'];
$data['contract_type'] = $contract->contract_type_text;
$data['part_a'] = $contract['part_a'];
$data['contract_type'] = !$contract->isEmpty() ? $contract->contract_type_text : '';
$data['part_a'] = $part_a['name'];
$data['part_b'] = $contract['part_b'];
$data['sign_money'] = $contract['money'];
$data['sign_money'] = $contract['signed_amount'];
$data['sign_time'] = $contract['create_time'];
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id',$data['project_id'])->sum('apply_amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id',$data['project_id'])->sum('amount');
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id', $data['project_id'])->sum('apply_amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id', $data['project_id'])->sum('amount');
return $data->toArray();
}
public static function datas()
{
return ZjzxInvoice::field(['id','invoice_code'])->order(['id' => 'desc'])->select()->each(function($data){
return ZjzxInvoice::field(['id', 'invoice_code'])->order(['id' => 'desc'])->select()->each(function ($data) {
$data['projectinfo'] = 'ID' . $data['id'] . ' / 编号:' . $data['invoice_code'];
})->toArray();
}
}
}

View File

@ -1,21 +1,23 @@
<?php
namespace app\adminapi\logic\zjzx_finance;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\common\logic\BaseLogic;
use think\facade\Db;
namespace app\adminapi\logic\zjzx_finance;
use app\common\logic\BaseLogic;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\marketing\MarketingCustom;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use think\facade\Db;
/**
/**
* 造价咨询--到账台账逻辑
* Class ZjzxRefundLogic
* @package app\adminapi\logic\zjzx_finance
*/
class ZjzxRefundLogic extends BaseLogic
{
class ZjzxRefundLogic extends BaseLogic
{
/**
@ -102,21 +104,22 @@ class ZjzxRefundLogic extends BaseLogic
public static function detail($params): array
{
$data = ZjzxRefund::withoutField('update_time,delete_time')->findOrEmpty($params['id']);
$project = CostProject::field('project_num,project_name,contract_id')->where('id',$data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name,contract_type,part_a,part_b,money,create_time')->where('id',$project['contract_id'])->findOrEmpty();
$invoice = ZjzxInvoice::field('invoice_code,apply_amount')->where('id',$data['invoice_id'])->findOrEmpty();
$project = CostProject::field('project_num,project_name,contract_id')->where('id', $data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name,contract_type,part_a,part_b,signed_amount,create_time')->where('id', $project['contract_id'])->findOrEmpty();
$invoice = ZjzxInvoice::field('invoice_code,apply_amount')->where('id', $data['invoice_id'])->findOrEmpty();
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
$data['project_num'] = $project['project_num'];
$data['project_name'] = $project['project_name'];
$data['contract_name'] = $contract['contract_name'];
$data['contract_type'] = $contract->contract_type_text;
$data['part_a'] = $contract['part_a'];
$data['contract_type'] = !$contract->isEmpty() ? $contract->contract_type_text : '';
$data['part_a'] = $part_a['name'];
$data['part_b'] = $contract['part_b'];
$data['sign_money'] = $contract['money'];
$data['sign_money'] = $contract['signed_amount'];
$data['sign_time'] = $contract['create_time'];
$data['invoice_code'] = $invoice['invoice_code'];
$data['apply_amount'] = $invoice['apply_amount'];
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id',$data['project_id'])->sum('apply_amount');//累计开票金额
$data['total_refund_amount'] = ZjzxRefund::where('project_id',$data['project_id'])->sum('amount');//累计到账金额
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id', $data['project_id'])->sum('apply_amount');//累计开票金额
$data['total_refund_amount'] = ZjzxRefund::where('project_id', $data['project_id'])->sum('amount');//累计到账金额
return $data->toArray();
}
}
}

View File

@ -1,22 +1,24 @@
<?php
namespace app\adminapi\logic\zjzx_finance;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\common\model\zjzx_finance\ZjzxSettlement;
use app\common\logic\BaseLogic;
use think\facade\Db;
namespace app\adminapi\logic\zjzx_finance;
use app\common\logic\BaseLogic;
use app\common\model\cost_project\CostApprovedProject;
use app\common\model\cost_project\CostProject;
use app\common\model\marketing\MarketingCustom;
use app\common\model\zjzx_finance\ZjzxInvoice;
use app\common\model\zjzx_finance\ZjzxRefund;
use app\common\model\zjzx_finance\ZjzxSettlement;
use think\facade\Db;
/**
/**
* 造价咨询--项目结算逻辑
* Class ZjzxSettlementLogic
* @package app\adminapi\logic\zjzx_finance
*/
class ZjzxSettlementLogic extends BaseLogic
{
class ZjzxSettlementLogic extends BaseLogic
{
/**
@ -98,19 +100,20 @@ class ZjzxSettlementLogic extends BaseLogic
public static function detail($params): array
{
$data = ZjzxSettlement::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
$project = CostProject::field('project_num,project_name,contract_id')->where('id',$data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name,contract_type,part_a,part_b,money,create_time')->where('id',$project['contract_id'])->findOrEmpty();
$project = CostProject::field('project_num,project_name,contract_id')->where('id', $data['project_id'])->findOrEmpty();
$contract = CostApprovedProject::field('contract_name,contract_type,part_a,part_b,signed_amount,create_time')->where('id', $project['contract_id'])->findOrEmpty();
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
$data['invoice_type_text'] = $data->invoice_type_text;
$data['project_num'] = $project['project_num'];
$data['project_name'] = $project['project_name'];
$data['contract_name'] = $contract['contract_name'];
$data['contract_type'] = $contract->contract_type_text;
$data['part_a'] = $contract['part_a'];
$data['part_a'] = $part_a['name'];
$data['part_b'] = $contract['part_b'];
$data['sign_money'] = $contract['money'];
$data['sign_money'] = $contract['signed_amount'];
$data['sign_time'] = $contract['create_time'];
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id',$data['project_id'])->sum('apply_amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id',$data['project_id'])->sum('amount');
$data['total_invoice_amount'] = ZjzxInvoice::where('project_id', $data['project_id'])->sum('apply_amount');
$data['total_refund_amount'] = ZjzxRefund::where('project_id', $data['project_id'])->sum('amount');
return $data->toArray();
}
}
}