This commit is contained in:
weiz 2024-01-24 11:09:28 +08:00
parent 2f3c1eddb4
commit d07a4da30f
2 changed files with 7 additions and 7 deletions

View File

@ -18,6 +18,7 @@ namespace app\adminapi\lists\project;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\auth\Admin;
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;
@ -65,13 +66,13 @@ class ProjectSubcontractSettlementLists extends BaseAdminDataLists implements Li
->order(['id' => 'desc'])
->select()->each(function($item){
$project = Project::field('name')->where('id',$item['project_id'])->findOrEmpty();
$contract = SubcontractingContract::field('supplier_id,contract_amount,contract_no')->where('id',$item['contract_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'] = $contract['contract_amount'];
$item['contract_amount'] = SubcontractingContractDetail::where('contract_id',$item['contract_id'])->sum('amount_including_tax');
$item['add_user_name'] = $admin['name'];
unset($item['project_id'],$item['contract_id'],$item['add_user']);
return $item;

View File

@ -14,8 +14,8 @@
namespace app\adminapi\logic\project;
use app\common\model\contract\ProcurementContract;
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\logic\BaseLogic;
@ -123,7 +123,7 @@ class ProjectSubcontractSettlementLogic extends BaseLogic
{
$data = ProjectSubcontractSettlement::field('id,settlement_code,project_id,contract_id,settlement_amount,settlement_amount_uppercase,remaining_amount,settlement_date,remark,annex')->findOrEmpty($params['id'])->toArray();
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
$contract = ProcurementContract::field('supplier_id,amount,amount_daxie,contract_no,contract_name')->where('id',$data['contract_id'])->findOrEmpty();
$contract = SubcontractingContract::field('supplier_id,contract_no,contract_name')->where('id',$data['contract_id'])->findOrEmpty();
$supplier = Supplier::field('supplier_code,supplier_name')->where('id',$contract['supplier_id'])->findOrEmpty();
$data['project_name'] = $project['name'];
$data['project_code'] = $project['project_code'];
@ -131,8 +131,7 @@ class ProjectSubcontractSettlementLogic extends BaseLogic
$data['contract_code'] = $contract['contract_no'];
$data['supplier_name'] = $supplier['supplier_name'];
$data['supplier_code'] = $supplier['supplier_code'];
$data['contract_amount'] = $contract['amount'];
$data['contract_amount_uppercase'] = $contract['amount_daxie'];
$data['contract_amount'] = SubcontractingContractDetail::where('contract_id',$data['contract_id'])->sum('amount_including_tax');
return $data;
}
}