| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace App\Http\Controllers;
- use App\Interfaces\SettlementBillControllerInterface;
- use App\Owner;
- use App\OwnerBillReportArchive;
- use App\Services\OwnerBillReportArchiveService;
- use App\Services\OwnerLogisticFeeDetailService;
- use App\Traits\SettlementBillTrait;
- use Illuminate\Http\Request;
- use Oursdreams\Export\Export;
- class SettlementBillExpressFeeDetailController extends Controller implements SettlementBillControllerInterface
- {
- use SettlementBillTrait;
- /** @var $service OwnerLogisticFeeDetailService */
- private $service;
- /** @var $archiveService OwnerBillReportArchiveService */
- private $archiveService;
- /**
- * OwnerLogisticFeeDetailController constructor.
- */
- public function __construct()
- {
- $this->service = app('OwnerLogisticFeeDetailService');
- $this->archiveService = app('OwnerBillReportArchiveService');
- }
- /**
- * Display a listing of the resource.
- *
- */
- public function index(Request $request)
- {
- $paginateParams = $request->input();
- list($permittingOwnerIds, $counting_month, $owner_id) = $this->getRequestParams($request->year, $request->month,$request->owner_id);
- $details = $this->service->get([
- 'owner_id' => $owner_id,
- 'counting_month' => $counting_month,
- 'paginateParams' => $paginateParams,
- ]);
- $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
- $owner = Owner::query()->selectRaw("name,id")->find($owner_id);
- $this->archiveService = app('OwnerBillReportArchiveService');
- $request = $this->buildRequest($request, $counting_month,$owner_id);
- return view('finance.settlementBills.expressFee.detail.index', compact('details', 'paginateParams', 'owners', 'owner', 'request'));
- }
- public function export(Request $request)
- {
- list($permittingOwnerIds, $counting_month, $owner_id) = $this->getRequestParams($request->year, $request->month,$request->owner_id );
- $query = $this->service->getSql($owner_id, $counting_month);
- if (!$request->exists('checkAllSign')) {
- $query->whereIn('id', explode(',', $request['data']));
- }
- $details = $this->service->buildExport($query->get());
- $json = [];
- foreach ($details as $detail) {
- $json[] = array_values($detail);
- }
- $row = ['主键', '快递公司', '省份', '快递单号', '重量', '首重价格', '续重价格', '快递费',];
- return Export::make($row, $json, "快递费用详情");
- }
- }
|