This commit is contained in:
weiz 2024-01-10 18:22:16 +08:00
parent 7d43b5393b
commit bd258b3a9e

View File

@ -16,8 +16,12 @@ namespace app\adminapi\lists\contract;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\contract\SubcontractingContract;
use app\common\model\contract\SubcontractingContractDetail;
use app\common\lists\ListsSearchInterface;
use app\common\model\project\Project;
use app\common\model\project\ProjectSubpackageBudgetDetail;
use app\common\model\supplier\Supplier;
/**
@ -55,10 +59,26 @@ class SubcontractingContractDetailLists extends BaseAdminDataLists implements Li
public function lists(): array
{
return SubcontractingContractDetail::where($this->searchWhere)
->field(['id', 'subcontracting_contract_id', 'subcontracting_budget', 'workload', 'unit_price_including_tax', 'amount_excluding_tax', 'amount_including_tax', 'remark'])
->field('id,contract_id,subpackage_budget_detail_id,num,price,tax_rate,amount_excluding_tax,amount_including_tax,remark')
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->select()->each(function($data){
$contract = SubcontractingContract::field('contract_no,project_id,supplier_id,contract_type')->where('id',$data['contract_id'])->findOrEmpty();
$project = Project::field('name,project_code')->where('id',$contract['project_id'])->findOrEmpty();
$supplier = Supplier::field('supplier_code,supplier_name')->where('id',$contract['supplier_id'])->findOrEmpty();
$subpackage_budget_detail = ProjectSubpackageBudgetDetail::field('work_type,work_content,project_features,unit')->where('id',$data['subpackage_budget_detail_id'])->findOrEmpty();
$data['project_code'] = $project['project_code'];
$data['project_name'] = $project['name'];
$data['supplier_code'] = $supplier['supplier_code'];
$data['supplier_name'] = $supplier['supplier_name'];
$data['contract_no'] = $contract['contract_no'];
$data['contract_type'] = $contract->contract_type_text;
$data['work_type'] = $subpackage_budget_detail['work_type'];
$data['work_content'] = $subpackage_budget_detail['work_content'];
$data['project_features'] = $subpackage_budget_detail['project_features'];
$data['unit'] = $subpackage_budget_detail['unit'];
return $data;
})
->toArray();
}