| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- namespace App\Http\Controllers;
- use App\Owner;
- use App\OwnerBillReportArchive;
- use App\Services\OwnerBillReportArchiveService;
- use App\Services\SettlementBillsAreaFeeService;
- use Carbon\Carbon;
- use Illuminate\Http\RedirectResponse;
- use Illuminate\Http\Request;
- use Oursdreams\Export\Export;
- use Tightenco\Collect\Support\Collection;
- /**
- * 结算管理-结算账单-仓储费
- * Class SettlementBillOwnerAreaFeeController
- * @package App\Http\Controllers
- */
- class SettlementBillStorageFeeController extends Controller implements \App\Interfaces\SettlementBillControllerInterface
- {
- use \App\Traits\SettlementBillTrait;
- /* @var $service SettlementBillsAreaFeeService */
- private $service;
- /** @var $archiveService OwnerBillReportArchiveService */
- private $archiveService;
- /**
- * SettlementBillStorageFeeController constructor.
- */
- public function __construct()
- {
- $this->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, "仓储费");
- }
- }
|