service = app('SettlementBillsAreaFeeService'); $this->archiveService = app('OwnerBillReportArchiveService'); } public function index(Request $request) { list($permittingOwnerIds, $counting_month, $owner_id) = $this->getRequestParams($request->year, $request->month, $request->owner_id); $isArchived = $this->archiveService->isArchived($counting_month, $owner_id, $this->service::TYPE); list($areaReports, $billReport) = $this->service->get([ 'owner_id' => $owner_id, 'counting_month' => $counting_month, 'type' => $this->service::TYPE, ]); $owners = Owner::query()->find($permittingOwnerIds); $owner = Owner::query()->find($owner_id); $request = $this->buildRequest($request, $counting_month,$owner_id); return view('finance.settlementBills.storageFee.index', compact('owner', 'owners', 'areaReports', 'billReport', 'request', 'isArchived')); } public function export(Request $request) { list($permittingOwnerIds, $counting_month, $owner_id) = $this->getRequestParams($request->year, $request->month, $request->owner_id); list($areaReports, $billReport) = $this->service->get([ 'owner_id' => $owner_id, 'counting_month' => $counting_month, 'type' => $this->service::TYPE, ]); $json = []; foreach ($areaReports as $areaReport) { $json[] = [ $areaReport['owner_storage_price_model']['using_type'] ?? $areaReport['ownerStoragePriceModel']['using_type'], '平面区', $areaReport['area_on_flat'], $areaReport['accounting_area'], $areaReport['owner_storage_price_model']['price'], $billReport['storage_fee'], ]; $json[] = [ $areaReport['owner_storage_price_model']['using_type'] ?? $areaReport['ownerStoragePriceModel']['using_type'], '整托存储', $areaReport['area_on_tray'], $areaReport['accounting_area'], $areaReport['owner_storage_price_model']['price'], $billReport['storage_fee'], ]; $json[] = [ $areaReport['owner_storage_price_model']['using_type'] ?? $areaReport['ownerStoragePriceModel']['using_type'], '半托存储', $areaReport['area_on_half_tray'], $areaReport['accounting_area'], $areaReport['owner_storage_price_model']['price'], $billReport['storage_fee'], ]; } $row = ['仓库类型', '使用区域', '数量', '合计面积', '单价', '金额',]; return Export::make($row, $json, "仓储费"); } }