ANG YU 4 лет назад
Родитель
Сommit
fdc21159ec

+ 6 - 8
app/Http/Controllers/SettlementBillStoreFeeReportController.php

@@ -46,11 +46,9 @@ class SettlementBillStoreFeeReportController extends Controller
         $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
         $this->archiveService = app('OwnerBillReportArchiveService');
         $isArchived = $this->archiveService->isArchived($counting_month, $owner_id, $this->service::TYPE);
-
-        $request = $this->buildRequest($request, $counting_month,$owner_id);
-
+        $request = $this->buildRequest($request, $counting_month, $owner_id);
         return view('finance.settlementBills.storeFee.report.index',
-            compact('owners', 'owner', 'isArchived', 'request', 'reports', 'totalAmount', 'totalFee', 'owner_price_operation_fees'));
+            compact('owners', 'owner', 'isArchived', 'request', 'totalAmount', 'totalFee', 'owner_price_operation_fees'));
     }
 
     public function export(Request $request)
@@ -65,9 +63,9 @@ class SettlementBillStoreFeeReportController extends Controller
         ]);
         $json = [];
         foreach ($reports as $report) {
-            $operation = $owner_price_operation_fees->firstWhere('owner_price_operation_id',$report['owner_price_operation_id']);
+            $operation = $owner_price_operation_fees->firstWhere('owner_price_operation_id', $report['owner_price_operation_id']);
             $json[] = [
-                $operation['owner_price_operation']['name']??$operation['ownerPriceOperation']['name'],
+                $operation['owner_price_operation']['name'] ?? $operation['ownerPriceOperation']['name'],
                 $report['unit_price'],
                 $report['amount'],
                 $operation['fee'],
@@ -85,9 +83,9 @@ class SettlementBillStoreFeeReportController extends Controller
     private function buildOwnerPriceOperationFees($reports, $owner_price_operation_fees)
     {
         $result = [];
-        $reports = $reports->groupBy('owner_price_operation_id');
+        $reports = $reports->groupBy('work_name');
         foreach ($owner_price_operation_fees as $price_operation) {
-            $price_operation['data'] = $reports[$price_operation['owner_price_operation_id']];
+            $price_operation['data'] = $reports[$price_operation['work_name']];
             $result[] = $price_operation;
         }
         return collect($result);

+ 4 - 86
app/Http/Controllers/TestController.php

@@ -1309,93 +1309,11 @@ TEXT;
         }
     }
 
-    public function test_ang()
+    public function owner_store_fee_report_record_test()
     {
-        /**@var $service OwnerBillTotalService */
-        $service = app('OwnerBillTotalService');
-        $service->record();
-    }
-
-    public function test_store_record()
-    {
-        /**@var $service OwnerStoreFeeReportService */
+        \App\OwnerStoreFeeReport::query()->truncate();
+        /** @var OwnerStoreFeeReportService $service */
         $service = app('OwnerStoreFeeReportService');
-        list($reports, $totalAmount, $totalFee, $owner_price_operation_fees) = $service->get([
-            'owner_id' => 8,
-            'counting_month' => '2021-06-01',
-            'type' => '出库费-合计',
-        ]);
-        $reports = $reports->groupBy('owner_price_operation_id');
-        foreach ($owner_price_operation_fees as $price_operation) {
-            $price_operation->data = $reports[$price_operation->owner_price_operation_id];
-        }
-        return $owner_price_operation_fees;
-    }
-
-    public function test_bill_total_record()
-    {
-        /**@var $service OwnerFeeTotalService */
-        $service = app('OwnerFeeTotalService');
-        $service->record();
-    }
-
-    public function test_bill_total_get()
-    {
-        /**@var $service OwnerFeeTotalService */
-        $service = app('OwnerFeeTotalService');
-        dd($service->get([
-            'owner_id' => 8,
-            'counting_month' => now()->subMonth()->startOfMonth(),
-        ])->toArray());
-    }
-
-    public function OwnerWaybillSettlementBillServiceGet()
-    {
-        /**@var $service OwnerWaybillSettlementBillService */
-        $service = app('OwnerWaybillSettlementBillService');
-        $result = $service->get([
-            'owner_id' => 8,
-            'counting_month' => now()->subMonth()->startOfMonth()->toDateString(),
-        ]);
-        dd($result->items()[0]->toArray());
-    }
-
-    public function getUnAchieved()
-    {
-        /**@var $service OwnerBillReportArchiveService */
-        $service = app('OwnerBillReportArchiveService');
-        $service->getUnAchieved('2021-06-01', 8);
-    }
-
-    public function settlementBills_create_event_test()
-    {
-        //         'owner_fee_detail_id', //
-        //        'logistic_bill',//快递单号
-        //        'initial_weight',//首重
-        //        'initial_weight_price',//首重价格
-        //        'additional_weight',//续重
-        //        'additional_price',//续重价格
-        //        'logistic_id',//承运商
-        //        'owner_id',//货主
-        //        'additional_weigh_weight',//续重重量
-        //        'tax_fee'//税费
-        $data = [
-            'owner_fee_detail_id' => '1',
-            'logistic_bill' => '1',
-            'initial_weight' => '1',
-            'initial_weight_price' => '1',
-            'additional_weight' => '1',
-            'additional_price' => '1',
-            'logistic_id' => '1',
-            'owner_id' => '1',
-            'additional_weigh_weight' => '1',
-            'tax_fee' => '222',
-        ];
-        event(new SettlementBillCreateEvent($data, SettlementBillCreateEvent::OWNER_LOGISTIC_FEE_DETAIL));
-    }
-
-    public function test_settlement_bill_report_task()
-    {
-        SettlementBillReportTask::dispatchNow();
+        $service->recordReport();
     }
 }

+ 10 - 9
app/OwnerStoreFeeDetail.php

@@ -17,8 +17,14 @@ class OwnerStoreFeeDetail extends Model
         'unit_price', //单价
         'amount', //数量
         'owner_id', //货主
-        'store_item_id',
-        'owner_price_operation_id'
+        'fee',//费用
+        'commodity_id',
+        'packing_material_fee',//包材费
+        'tax_fee',//税费
+        'sku',//sku
+        'barcode',//条码
+        'work_name',//作业名称
+        'asn_code',//asn号
     ];
 
     public function ownerFeeDetail(): BelongsTo
@@ -42,13 +48,8 @@ class OwnerStoreFeeDetail extends Model
         return $this->belongsTo(Owner::class);
     }
 
-    public function storeItem(): BelongsTo
+    public function commodity(): BelongsTo
     {
-        return $this->belongsTo(StoreItem::class);
-    }
-
-    public function ownerPriceOperation(): BelongsTo
-    {
-        return $this->belongsTo(OwnerPriceOperation::class);
+        return $this->belongsTo(Commodity::class);
     }
 }

+ 10 - 35
app/OwnerStoreFeeReport.php

@@ -11,49 +11,24 @@ class OwnerStoreFeeReport extends Model
 {
     use ModelLogChanging;
 
-    public $fillable = ['owner_bill_report_id', 'owner_price_operation_id', 'owner_id', 'counting_month', 'unit_id', 'unit_price', 'amount', 'fee'];
+    public $fillable = [
+        'owner_bill_report_id',
+        'owner_id',
+        'counting_month', //统计月份
+        'unit_id', //单位
+        'unit_price', //单价
+        'amount', //数量
+        'fee',//费用
+        'work_name',//作业名称
+    ];
 
     public $timestamps = false;
 
-//    static public $enums = [
-//        'type' => [
-//            '' => 0,
-//            '退货入库' => 1,
-//            '新品入库' => 2,
-//        ],
-//    ];
-//
-//    function __construct(array $attributes = [])
-//    {
-//        foreach (self::$enums as &$enum) {
-//            $enum = $enum + array_flip($enum);
-//        }
-//        parent::__construct($attributes);
-//    }
-//
-//    public function getTypeAttribute($value)
-//    {
-//        if (!$value) return '';
-//        return self::$enums['type'][$value];
-//    }
-//
-//    public function setTypeAttribute($value)
-//    {
-//        if (!$value) return 0;
-//        $this->attributes['type'] = self::$enums['type'][$value];
-//    }
-
-
     public function ownerBillReport(): BelongsTo
     {
         return $this->belongsTo(OwnerBillReport::class);
     }
 
-    public function ownerPriceOperation(): BelongsTo
-    {
-        return $this->belongsTo(OwnerPriceOperation::class);
-    }
-
     public function owner(): BelongsTo
     {
         return $this->belongsTo(Owner::class);

+ 3 - 4
app/Services/OwnerStoreFeeDetailService.php

@@ -47,10 +47,9 @@ class OwnerStoreFeeDetailService
         list($start, $end) = $this->getStartAndEnd($counting_month);
         return OwnerStoreFeeDetail::query()
             ->with([
-                'ownerFeeDetail:id,work_fee,worked_at',
-                'storeItem' => function ($query) {$query->selectRaw("id,asn_line_code,sku,commodity_id")->with('commodity:id,name');},
-                'ownerPriceOperation:id,name'
-                ])
+                'ownerFeeDetail:id,worked_at',
+                'commodity:id,name',
+             ])
             ->whereBetween('created_at', [$start, $end])
             ->where('owner_id', $owner_id);
     }

+ 21 - 16
app/Services/OwnerStoreFeeReportService.php

@@ -44,17 +44,24 @@ class OwnerStoreFeeReportService implements \App\Interfaces\SettlementBillReport
         $end = Carbon::parse($this->reportDate)->endOfMonth()->toDateString();
         $details =
             DB::table('owner_store_fee_details')
-                ->leftJoin('owner_fee_details', 'owner_fee_detail_id', '=', 'owner_fee_details.id')
-                ->selectRaw("DATE_FORMAT(owner_store_fee_details.created_at,'%Y-%m') as counting_month,
+                ->selectRaw("
+                DATE_FORMAT(owner_store_fee_details.created_at,'%Y-%m') as counting_month,
                 unit_id,
                 unit_price,
+                work_name,
                 sum(amount) as amounts ,
                 owner_store_fee_details.owner_id,
                 owner_fee_detail_id,
-                sum(owner_fee_details.work_fee) as work_fee,
-                owner_store_fee_details.owner_price_operation_id")
+                sum(owner_store_fee_details.fee) as fee
+                ")
                 ->whereBetween('owner_store_fee_details.created_at', [$start, $end])
-                ->groupBy('counting_month', 'owner_store_fee_details.owner_id', 'owner_store_fee_details.owner_price_operation_id', 'unit_id', 'unit_price')
+                ->groupBy(
+                    'counting_month',
+                    'owner_id',
+                    'unit_id',
+                    'unit_price',
+                    'work_name'
+                )
                 ->get();
         $reports = [];
         foreach ($details as $detail) {
@@ -65,16 +72,16 @@ class OwnerStoreFeeReportService implements \App\Interfaces\SettlementBillReport
                 ->where('counting_month', $counting_month)->first();
             $reports[] = [
                 'owner_bill_report_id' => $ownerBillReport->id ?? null,
-                'owner_price_operation_id' => $detail->owner_price_operation_id,
                 'owner_id' => $detail->owner_id,
                 'counting_month' => $counting_month,
                 'unit_id' => $detail->unit_id,
                 'unit_price' => $detail->unit_price,
                 'amount' => $detail->amounts,
-                'fee' => $detail->work_fee,
+                'fee' => $detail->fee,
+                'work_name' => $detail->work_name,
             ];
         }
-        $reports_chunked =  array_chunk($reports,1000 );
+        $reports_chunked = array_chunk($reports, 1000);
         //保证幂等性 插入前删除该月的统计数据
         OwnerStoreFeeReport::query()->where('counting_month', $counting_month)->delete();
 
@@ -95,18 +102,16 @@ class OwnerStoreFeeReportService implements \App\Interfaces\SettlementBillReport
             $totalFee = $archived->information['totalFee'];
             $owner_price_operation_fees = collect($archived->information['owner_price_operation_fees']);
         } else {
-            $reports = $this->getSql($kvPairs['owner_id'], $kvPairs['counting_month'])->orderByDesc('owner_price_operation_id')->get();
+            $reports = $this->getSql($kvPairs['owner_id'], $kvPairs['counting_month'])->get();
             $totalAmount = $reports->sum('amount');
-            $totalFee = number_format($reports->sum('fee'),2);
-
-            $owner_price_operation_fees =   OwnerStoreFeeReport::query()
-                ->with('ownerPriceOperation:id,name')
-                ->selectRaw("sum(fee) as fee,owner_price_operation_id")
+            $totalFee = number_format($reports->sum('fee'), 2);
+            $owner_price_operation_fees = OwnerStoreFeeReport::query()
+                ->selectRaw("sum(fee) as fee,work_name")
                 ->where('owner_id', $kvPairs['owner_id'])
                 ->where('counting_month', $kvPairs['counting_month'])
-                ->groupBy('owner_price_operation_id')->get();
+                ->groupBy('work_name')->get();
         }
-        return array($reports, $totalAmount, $totalFee,$owner_price_operation_fees);
+        return array($reports, $totalAmount, $totalFee, $owner_price_operation_fees);
     }
 
     /**

+ 10 - 3
database/factories/OwnerStoreFeeDetailFactory.php

@@ -6,16 +6,23 @@ use App\OwnerStoreFeeDetail;
 use Faker\Generator as Faker;
 
 $factory->define(OwnerStoreFeeDetail::class, function (Faker $faker) {
-    //['owner_fee_detail_id', 'unit_id', 'unit_price', 'amount', 'owner_id', 'store_item_id','owner_price_operation_id']
     return [
         //
-        'owner_fee_detail_id' => random_int(1,100),
+        'owner_fee_detail_id' => random_int(1, 100),
         'owner_price_operation_id' => random_int(1, 100),
         'unit_id' => random_int(1, 11),
         'unit_price' => mt_rand(10, 100),
         'amount' => mt_rand(10, 100),
         'owner_id' => 8,
-        'store_item_id' =>random_int(1,100),
+        'store_item_id' => random_int(1, 100),
+        'fee' => random_int(1, 100),//费用
+        'commodity_id' => random_int(1, 100),
+        'packing_material_fee' => random_int(1, 100),//包材费
+        'tax_fee' => random_int(1, 100),//税费
+        'sku' => $faker->uuid,//sku
+        'barcode' => $faker->uuid,//条码
+        'work_name' => $faker->name,//条码
+        'asn_code' => $faker->uuid,//条码
         'created_at' => now()->subMonth()->startOfMonth()->addDays(random_int(0, 28)),
         'updated_at' => now()->subMonth()->startOfMonth()->addDays(random_int(0, 28)),
     ];

+ 1 - 1
database/factories/OwnerStoreFeeReportFactory.php

@@ -8,12 +8,12 @@ use Faker\Generator as Faker;
 $factory->define(OwnerStoreFeeReport::class, function (Faker $faker) {
     return [
         'owner_bill_report_id' => random_int(1, 100),
-        'owner_price_operation_id' => random_int(1, 100),
         'owner_id' => 8,
         'counting_month' => now()->subMonth()->startOfMonth()->toDateString(),
         'unit_id'=>random_int(1, 10),
         'unit_price'=>random_int(1, 100),
         'amount'=>random_int(1, 100),
         'fee'=>random_int(1, 100),
+        'work_name' => $faker->name,
     ];
 });

+ 46 - 0
database/migrations/2021_07_15_154921_add_fee_and_other_to_owner_store_fee_details_table.php

@@ -0,0 +1,46 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddFeeAndOtherToOwnerStoreFeeDetailsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owner_store_fee_details', function (Blueprint $table) {
+            $table->decimal('fee')->comment('费用');
+            $table->integer('commodity_id')->comment('');
+            $table->decimal('packing_material_fee')->comment('包材费');
+            $table->decimal('tax_fee')->comment('税费');
+            $table->string('sku')->comment('sku');
+            $table->string('barcode')->comment('条码');
+            $table->string('work_name')->comment('作业名称');
+            $table->string('asn_code')->comment('asn号');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owner_store_fee_details', function (Blueprint $table) {
+            $table->dropColumn('fee');
+            $table->dropColumn('commodity_id');
+            $table->dropColumn('packing_material_fee');
+            $table->dropColumn('tax_fee');
+            $table->dropColumn('sku');
+            $table->dropColumn('barcode');
+            $table->dropColumn('work_name');
+            $table->dropColumn('asn_code');
+        });
+    }
+}

+ 34 - 0
database/migrations/2021_07_15_163048_add_work_name_and_drop_other_to_owner_store_fee_reports_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddWorkNameAndDropOtherToOwnerStoreFeeReportsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owner_store_fee_reports', function (Blueprint $table) {
+            $table->string('work_name')->comment('作业名称');
+            $table->dropColumn('owner_price_operation_id');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owner_store_fee_reports', function (Blueprint $table) {
+            $table->dropColumn('work_name');
+            $table->integer('owner_price_operation_id');
+        });
+    }
+}

+ 2 - 8
database/seeds/OwnerStoreFeeDetailSeeder.php

@@ -18,24 +18,18 @@ class OwnerStoreFeeDetailSeeder extends Seeder
     {
         //
         OwnerStoreFeeDetail::query()->truncate();
-        StoreItem::query()->truncate();
         Commodity::query()->truncate();
-        OwnerPriceOperation::query()->truncate();
         $owners = \App\Owner::query()->limit(10)->get();
+        $commodities = factory(Commodity::class)->times(100)->create();
         foreach ($owners as $owner) {
-            $ownerPriceOperations = factory(\App\OwnerPriceOperation::class)->times(2)->create(['operation_type' => '出库']);
-            foreach ($ownerPriceOperations as $operation) {
                 $feeDetails = factory(OwnerFeeDetail::class)->times(100)->create(['owner_id' => $owner->id]);
                 foreach ($feeDetails as $feeDetail) {
                     factory(OwnerStoreFeeDetail::class)->create([
-                        'owner_price_operation_id' => $operation->id,
                         'owner_id' => $owner->id,
                         'owner_fee_detail_id' => $feeDetail->id,
+                        'commodity_id' => $commodities->random(1)[0]->id,
                     ]);
-                }
             }
-            factory(StoreItem::class)->times(100)->create();
-            factory(Commodity::class)->times(100)->create(['owner_id' => $owner->id]);
         }
 
 

+ 8 - 7
resources/views/finance/settlementBills/storeFee/detail/index.blade.php

@@ -36,13 +36,14 @@
                     <td><input class="checkItem" type="checkbox" :value="detail.id"></td>
                     <td>@{{ i+1 }}</td>
                     <td>@{{ detail.owner_fee_detail.worked_at }}</td>
-                    <td>@{{ detail.owner_price_operation?detail.owner_price_operation.name:'' }}</td>
-                    <td>@{{ detail.store_item.asn_line_code }}</td>
-                    <td>@{{ detail.store_item.sku }}</td>
-                    <td>@{{ detail.store_item.commodity?detail.store_item.commodity.name:'' }}</td>
-                    <td>@{{ detail.amount}}</td>
-                    <td>@{{ detail.unit_price}}</td>
-                    <td>@{{ detail.owner_fee_detail.work_fee }}</td>
+                    <td>@{{ detail.work_name }}</td>
+                    <td>@{{ detail.asn_code }}</td>
+                    <td>@{{ detail.sku }}</td>
+                    <td>@{{ detail.barcode }}</td>
+                    <td>@{{ detail.commodity.name }}</td>
+                    <td>@{{ detail.amount }}</td>
+                    <td>@{{ detail.unit_price }}</td>
+                    <td>@{{ detail.fee }}</td>
                 </tr>
             </table>
             <div class="text-info h5 btn btn">{{$details->count()}}/{{$details->total()}}</div>

+ 4 - 4
resources/views/finance/settlementBills/storeFee/report/index.blade.php

@@ -73,7 +73,7 @@
                     </div>
                 </div>
             </div>
-            <table class="table table-striped table-sm text-nowrap table-hover table-bordered">
+            <table class="table text-nowrap table-hover table-bordered table-striped">
                 <tr>
                     <th>名称</th>
                     <th>单价</th>
@@ -81,9 +81,9 @@
                     <th>合计</th>
                 </tr>
                 <tr v-for="(report,i) in reports">
-                    <td class="text-center pt-4 bg-light">@{{ report.owner_price_operation?report.owner_price_operation.name:'' }}</td>
+                    <td class="text-center pt-4 bg-light">@{{ report.work_name }}</td>
                     <td class="m-0 p-0">
-                        <table class="table table-striped table-sm m-0 p-0">
+                        <table class="table  m-0 p-0" style="height: 58px;">
                             <tr v-for="item in report.data">
                                 <td>@{{ item.unit_price }}/@{{ item.unit.name }}</td>
                             </tr>
@@ -91,7 +91,7 @@
 
                     </td>
                     <td class="m-0 p-0">
-                        <table class="table table-striped table-sm m-0 p-0">
+                        <table class="table  m-0 p-0" style="height: 58px;">
                             <tr v-for="item in report.data">
                                 <td>@{{ item.amount }}</td>
                             </tr>

+ 60 - 21
tests/Services/OwnerStoreFeeReportService/RecordReportTest.php

@@ -24,31 +24,70 @@ class RecordReportTest extends TestCase
     {
         parent::setUp();
         $this->service = app('OwnerStoreFeeReportService');
-//        $this->data['ownerStoreFeeReports']
-//            = factory(OwnerStoreFeeReport::class, $this->amount)
-//            ->create();
     }
 
     public function testReturned()
     {
-//        OwnerPriceOperation::query()->truncate();
-//        OwnerFeeDetail::query()->truncate();
-//        OwnerStoreFeeDetail::query()->truncate();
-//        OwnerBillReport::query()->truncate();
-//        OwnerStoreFeeReport::query()->truncate();
-//        $ownerPriceOperationIds = factory(OwnerPriceOperation::class)->times(10)->create()->pluck('id');
-//        $ownerFeeDetailIds = [];
-//        foreach ($ownerPriceOperationIds as $ownerPriceOperationId) {
-//            $ownerFeeDetailIds[] = factory(OwnerFeeDetail::class)->create(['owner_price_operation_id' => $ownerPriceOperationId]);
-//        }
-//        foreach ($ownerFeeDetailIds as $ownerFeeDetailId) {
-//            $detail =  factory(OwnerStoreFeeDetail::class)->create(['owner_fee_detail_id' => $ownerFeeDetailId]);
-//            factory(OwnerBillReport::class)->create(['owner_id'=>$detail->owner_id,'counting_month'=>$detail->created_at->startOfMonth()->toDateString()]);
-//
-//        }
-//
-//        $this->service->recordReport();
-        $this->assertTrue(true);
+        OwnerStoreFeeDetail::query()->truncate();
+        OwnerStoreFeeReport::query()->truncate();
+
+        $ownerStoreFeeDetail_xx_1_2 = factory(OwnerStoreFeeDetail::class)->times(100)
+            ->create([
+                'owner_id' => 8,
+                'work_name' => 'xx入库费',
+                'unit_price' => 1.2,
+                'unit_id' => 1,
+            ]);
+
+        $ownerStoreFeeDetail_xx_1_4 = factory(OwnerStoreFeeDetail::class)->times(100)
+            ->create([
+                'owner_id' => 8,
+                'work_name' => 'xx入库费',
+                'unit_price' => 1.4,
+                'unit_id' => 1,
+            ]);
+
+        $ownerStoreFeeDetail_xx2_1_6 = factory(OwnerStoreFeeDetail::class)->times(100)
+            ->create([
+                'owner_id' => 8,
+                'work_name' => 'xx入库费2',
+                'unit_price' => 1.2,
+                'unit_id' => 1,
+            ]);
+        $this->service->recordReport();
+
+
+
+        $report =  OwnerStoreFeeReport::query()
+            ->where('unit_price', '1.2')
+            ->where('owner_id', 8)
+            ->where('unit_id', 1)
+            ->where('work_name', 'xx入库费')
+            ->first();
+
+        $this->assertEquals($ownerStoreFeeDetail_xx_1_2->sum('amount'), $report->amount);
+        $this->assertEquals($ownerStoreFeeDetail_xx_1_2->sum('fee'), $report->fee);
+
+        $report =  OwnerStoreFeeReport::query()
+            ->where('unit_price', '1.4')
+            ->where('owner_id', 8)
+            ->where('unit_id', 1)
+            ->where('work_name', 'xx入库费')
+            ->first();
+
+        $this->assertEquals($ownerStoreFeeDetail_xx_1_4->sum('amount'), $report->amount);
+        $this->assertEquals($ownerStoreFeeDetail_xx_1_4->sum('fee'), $report->fee);
+
+
+        $report =  OwnerStoreFeeReport::query()
+            ->where('unit_price', '1.2')
+            ->where('owner_id', 8)
+            ->where('unit_id', 1)
+            ->where('work_name', 'xx入库费2')
+            ->first();
+
+        $this->assertEquals($ownerStoreFeeDetail_xx2_1_6->sum('amount'), $report->amount);
+        $this->assertEquals($ownerStoreFeeDetail_xx2_1_6->sum('fee'), $report->fee);
     }
 
     function tearDown(): void