OwnerLogisticFeeReportController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Owner;
  4. use App\OwnerLogisticFeeReport;
  5. use App\Services\OwnerLogisticFeeReportService;
  6. use App\Services\UserService;
  7. use Illuminate\Http\Request;
  8. class OwnerLogisticFeeReportController extends Controller
  9. {
  10. /* @var OwnerLogisticFeeReportService $service */
  11. private $service;
  12. /* @var UserService $userService */
  13. private $userService;
  14. /**
  15. * Display a listing of the resource.
  16. */
  17. public function index(Request $request)
  18. {
  19. $paginateParams = $request->input();
  20. $this->service = app('OwnerLogisticFeeReportService');
  21. $this->userService = app('UserService');
  22. $permittingOwnerIds = $this->userService->getPermittingOwnerIds(auth()->user());
  23. if (is_null($request->year) || is_null($request->month)) {
  24. $date = now()->subMonth()->startOfMonth()->toDateString();
  25. } else {
  26. $date = $request->year . '-' . $request->month . '-' . '01';
  27. }
  28. if (is_null($request->owner_id)) {
  29. $owner_id = $permittingOwnerIds[0];
  30. }else{
  31. $owner_id = $request->owner_id;
  32. }
  33. $reports = $this->service->getRecordPagination($owner_id, $date, $paginateParams);
  34. $recordTotal = $this->service->getRecordTotal($owner_id, $date);
  35. $owner = Owner::query()->selectRaw("name")->find($owner_id);
  36. $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
  37. return view('finance.settlementBills.logisticFee.report.index', compact('reports', 'recordTotal', 'paginateParams', 'owners','owner'));
  38. }
  39. /**
  40. * Show the form for creating a new resource.
  41. *
  42. * @return \Illuminate\Http\Response
  43. */
  44. public function create()
  45. {
  46. //
  47. }
  48. /**
  49. * Store a newly created resource in storage.
  50. *
  51. * @param \Illuminate\Http\Request $request
  52. * @return \Illuminate\Http\Response
  53. */
  54. public function store(Request $request)
  55. {
  56. //
  57. }
  58. /**
  59. * Display the specified resource.
  60. *
  61. * @param \App\OwnerLogisticFeeReport $ownerLogisticFeeReport
  62. * @return \Illuminate\Http\Response
  63. */
  64. public function show(OwnerLogisticFeeReport $ownerLogisticFeeReport)
  65. {
  66. //
  67. }
  68. /**
  69. * Show the form for editing the specified resource.
  70. *
  71. * @param \App\OwnerLogisticFeeReport $ownerLogisticFeeReport
  72. * @return \Illuminate\Http\Response
  73. */
  74. public function edit(OwnerLogisticFeeReport $ownerLogisticFeeReport)
  75. {
  76. //
  77. }
  78. /**
  79. * Update the specified resource in storage.
  80. *
  81. * @param \Illuminate\Http\Request $request
  82. * @param \App\OwnerLogisticFeeReport $ownerLogisticFeeReport
  83. * @return \Illuminate\Http\Response
  84. */
  85. public function update(Request $request, OwnerLogisticFeeReport $ownerLogisticFeeReport)
  86. {
  87. //
  88. }
  89. /**
  90. * Remove the specified resource from storage.
  91. *
  92. * @param \App\OwnerLogisticFeeReport $ownerLogisticFeeReport
  93. * @return \Illuminate\Http\Response
  94. */
  95. public function destroy(OwnerLogisticFeeReport $ownerLogisticFeeReport)
  96. {
  97. //
  98. }
  99. }