| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Http\Controllers;
- use App\Interfaces\SettlementBillControllerInterface;
- use App\Owner;
- use App\Services\OwnerBillReportArchiveService;
- use App\Services\OwnerWaybillSettlementBillService;
- use App\Traits\SettlementBillTrait;
- use Illuminate\Http\Request;
- use Oursdreams\Export\Export;
- class SettlementBillLogisticFeeController extends Controller implements SettlementBillControllerInterface
- {
- use SettlementBillTrait;
- /**
- * @var $service OwnerWaybillSettlementBillService
- */
- private $service;
- /**
- * @var $archiveService OwnerBillReportArchiveService
- */
- private $archiveService;
- //
- /**
- * SettlementBillLogisticFeeController constructor.
- */
- public function __construct()
- {
- $this->service = app('OwnerWaybillSettlementBillService');
- $this->archiveService = app('OwnerBillReportArchiveService');
- }
- 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([
- 'counting_month' => $counting_month,
- 'owner_id' => $owner_id,
- 'type' => $this->service::TYPE,
- ]);
- $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
- $owner = Owner::query()->selectRaw("name,id")->find($owner_id);
- $isArchived = $this->archiveService->isArchived($counting_month, $owner_id, $this->service::TYPE);
- $request = $this->buildRequest($request, $counting_month);
- return view('finance.settlementBills.logisticFee.index', compact('details', 'paginateParams', 'owners', 'owner', 'request', 'isArchived'));
- }
- 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 = $query->get();
- $json = $this->service->buildExport($details);
- $row = ['承运商', '订单号', '收件人姓名', '收件人电话', '重量/体积', '计数单位', '计数区间', '省份', '市', '单价', '送货费', '提货费', '燃油附加费', '信息费', '其它费用', '备注', '起始计费', '起始计数', '运费合计'];
- return Export::make($row, $json, "物流费");
- }
- }
|