This commit is contained in:
weiz 2024-04-15 16:28:10 +08:00
parent 3286e65cb8
commit 22910f5cea
2 changed files with 133 additions and 122 deletions

View File

@ -75,13 +75,18 @@
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select() ->select()
->each(function ($res) { ->each(function ($res) {
$contract = MarketingContract::field('contract_name')->where('id', $res['contract_id'])->findOrEmpty(); $contract = MarketingContract::field('contract_name,part_a,part_b,signed_amount,create_time')->where('id', $res['contract_id'])->findOrEmpty();
$province = GeoProvince::field('province_name')->where('province_code', $res['province'])->findOrEmpty(); $province = GeoProvince::field('province_name')->where('province_code', $res['province'])->findOrEmpty();
$city = GeoCity::field('city_name')->where('city_code', $res['city'])->findOrEmpty(); $city = GeoCity::field('city_name')->where('city_code', $res['city'])->findOrEmpty();
$dept = Dept::field('name')->where('id', $res['depar'])->findOrEmpty(); $dept = Dept::field('name')->where('id', $res['depar'])->findOrEmpty();
$admin = Admin::field('name')->where('id', $res['principal'])->findOrEmpty(); $admin = Admin::field('name')->where('id', $res['principal'])->findOrEmpty();
$custom = MarketingCustom::field('name')->where('id', $res['aunit'])->findOrEmpty(); $custom = MarketingCustom::field('name')->where('id', $res['aunit'])->findOrEmpty();
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
$res['contract_name'] = $contract?->contract_name; $res['contract_name'] = $contract?->contract_name;
$res['part_a_name'] = $part_a?->name;
$res['part_b'] = $contract?->part_b;
$res['signed_amount'] = $contract?->signed_amount;
$res['signed_date'] = $contract?->create_time;
$res['types_text'] = $res->types_text; $res['types_text'] = $res->types_text;
$res['industry_text'] = $res->industry_text; $res['industry_text'] = $res->industry_text;
$res['province_name'] = $province?->province_name; $res['province_name'] = $province?->province_name;
@ -101,13 +106,18 @@
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select() ->select()
->each(function ($res) { ->each(function ($res) {
$contract = MarketingContract::field('contract_name')->where('id', $res['contract_id'])->findOrEmpty(); $contract = MarketingContract::field('contract_name,part_a,part_b,signed_amount,create_time')->where('id', $res['contract_id'])->findOrEmpty();
$province = GeoProvince::field('province_name')->where('province_code', $res['province'])->findOrEmpty(); $province = GeoProvince::field('province_name')->where('province_code', $res['province'])->findOrEmpty();
$city = GeoCity::field('city_name')->where('city_code', $res['city'])->findOrEmpty(); $city = GeoCity::field('city_name')->where('city_code', $res['city'])->findOrEmpty();
$dept = Dept::field('name')->where('id', $res['depar'])->findOrEmpty(); $dept = Dept::field('name')->where('id', $res['depar'])->findOrEmpty();
$admin = Admin::field('name')->where('id', $res['principal'])->findOrEmpty(); $admin = Admin::field('name')->where('id', $res['principal'])->findOrEmpty();
$custom = MarketingCustom::field('name')->where('id', $res['aunit'])->findOrEmpty(); $custom = MarketingCustom::field('name')->where('id', $res['aunit'])->findOrEmpty();
$part_a = MarketingCustom::field('name')->where('id', $contract['part_a'])->findOrEmpty();
$res['contract_name'] = $contract?->contract_name; $res['contract_name'] = $contract?->contract_name;
$res['part_a_name'] = $part_a?->name;
$res['part_b'] = $contract?->part_b;
$res['signed_amount'] = $contract?->signed_amount;
$res['signed_date'] = $contract?->create_time;
$res['types_text'] = $res->types_text; $res['types_text'] = $res->types_text;
$res['industry_text'] = $res->industry_text; $res['industry_text'] = $res->industry_text;
$res['province_name'] = $province?->province_name; $res['province_name'] = $province?->province_name;

View File

@ -12,26 +12,26 @@
// | author: likeadminTeam // | author: likeadminTeam
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\adminapi\lists\quotation; namespace app\adminapi\lists\quotation;
use app\adminapi\lists\BaseAdminDataLists; use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface; use app\common\lists\ListsExcelInterface;
use app\common\model\custom\Custom; use app\common\lists\ListsSearchInterface;
use app\common\model\material\Material; use app\common\model\custom\Custom;
use app\common\model\material\MaterialClassify; use app\common\model\material\Material;
use app\common\model\quotation\Quotation; use app\common\model\material\MaterialClassify;
use app\common\model\quotation\QuotationDetail; use app\common\model\quotation\Quotation;
use app\common\lists\ListsSearchInterface; use app\common\model\quotation\QuotationDetail;
/** /**
* 报价明细列表 * 报价明细列表
* Class QuotationDetailLists * Class QuotationDetailLists
* @package app\adminapi\listsquotation * @package app\adminapi\listsquotation
*/ */
class QuotationDetailLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface class QuotationDetailLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
{ {
/** /**
@ -63,11 +63,11 @@ class QuotationDetailLists extends BaseAdminDataLists implements ListsSearchInte
->field(['id', 'quotation_id', 'product_id', 'num', 'tax_rate', 'tax_inclusive_price', 'tax_inclusive_amount', 'tax_exclusive_amount', 'remark', 'create_time']) ->field(['id', 'quotation_id', 'product_id', 'num', 'tax_rate', 'tax_inclusive_price', 'tax_inclusive_amount', 'tax_exclusive_amount', 'remark', 'create_time'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function($item){ ->select()->each(function ($item) {
$quotation = Quotation::field('custom_id,code,quotation_date,create_user')->where('id',$item['quotation_id'])->findOrEmpty(); $quotation = Quotation::field('custom_id,code,quotation_date,create_user')->where('id', $item['quotation_id'])->findOrEmpty();
$custom = Custom::field('name')->where('id',$quotation['custom_id'])->findOrEmpty(); $custom = Custom::field('name')->where('id', $quotation['custom_id'])->findOrEmpty();
$material = Material::field('first_level,second_level,three_level,name,code,specs,brand,parameter_description,unit')->where('id',$item['product_id'])->findOrEmpty(); $material = Material::field('first_level,second_level,three_level,name,code,specs,brand,parameter_description,unit,inventory')->where('id', $item['product_id'])->findOrEmpty();
$classify = MaterialClassify::where('id','in',[$material['first_level'],$material['second_level'],$material['three_level']])->column('name','id'); $classify = MaterialClassify::where('id', 'in', [$material['first_level'], $material['second_level'], $material['three_level']])->column('name', 'id');
$item['quotation_code'] = $quotation['code']; $item['quotation_code'] = $quotation['code'];
$item['quotation_date'] = $quotation['quotation_date']; $item['quotation_date'] = $quotation['quotation_date'];
$item['quotation_create_user'] = $quotation['create_user']; $item['quotation_create_user'] = $quotation['create_user'];
@ -81,6 +81,7 @@ class QuotationDetailLists extends BaseAdminDataLists implements ListsSearchInte
$item['product_brand'] = $material['brand']; $item['product_brand'] = $material['brand'];
$item['product_parameter_description'] = $material['parameter_description']; $item['product_parameter_description'] = $material['parameter_description'];
$item['product_unit'] = $material['unit']; $item['product_unit'] = $material['unit'];
$item['inventory'] = $material['inventory'];
$item['tax_rate_text'] = $item->tax_rate_text; $item['tax_rate_text'] = $item->tax_rate_text;
}) })
->toArray(); ->toArray();
@ -135,4 +136,4 @@ class QuotationDetailLists extends BaseAdminDataLists implements ListsSearchInte
]; ];
} }
} }