| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Http\Controllers;
- use App\Interfaces\SettlementBillControllerInterface;
- use App\Owner;
- use App\OwnerBillReport;
- use App\OwnerBillReportArchive;
- use App\Services\OwnerBillReportArchiveService;
- use App\Services\OwnerStoreOutFeeDetailService;
- use App\Traits\SettlementBillTrait;
- use Illuminate\Http\Request;
- use Oursdreams\Export\Export;
- class SettlementBillStoreOutFeeDetailController extends Controller implements SettlementBillControllerInterface
- {
- use SettlementBillTrait;
- /** @var OwnerStoreOutFeeDetailService $service */
- private $service;
- /** @var OwnerBillReportArchiveService $archiveService */
- private $archiveService;
- public function __construct()
- {
- $this->service = app('OwnerStoreOutFeeDetailService');
- $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,
- 'paginateParams' => $paginateParams,
- ]);
- $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
- $owner = Owner::query()->selectRaw("name,id")->find($owner_id);
- $request = $this->buildRequest($request, $counting_month,$owner_id);
- return view('finance.settlementBills.storeOutFee.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 = $query->get();
- $json = $this->service->buildExport($details);
- $row = ['作业时间', '作业名称', '上游单号', '订单号', '商家编码', '商品条码', '商品名称', '商品数量', '单价', '价格描述', '合计'];
- return Export::make($row, $json, "出库费明细");
- }
- }
|