WaybillFinancialExceptedController.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\WaybillPriceModel;
  4. use App\Events\WaybillPriceModelEvent;
  5. use App\WaybillFinancialExcepted;
  6. use Illuminate\Http\Request;
  7. use Illuminate\Support\Facades\Event;
  8. use Illuminate\Support\Facades\Gate;
  9. class WaybillFinancialExceptedController extends Controller
  10. {
  11. public function conditionQuery(Request $request,$waybillFinancialSnapshots){
  12. if ($request->input('created_at_start')){
  13. $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('created_at','>',$request->input('created_at_start'));
  14. }
  15. if ($request->input('created_at_end')){
  16. $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('created_at','<',$request->input('created_at_end'));
  17. }
  18. $waybillFinancialSnapshots=$waybillFinancialSnapshots->paginate(50);
  19. return $waybillFinancialSnapshots;
  20. }
  21. public function index(Request $request)
  22. {
  23. if(!Gate::allows('财务报表-查询')){ return redirect(url('/')); }
  24. $waybillFinancialSnapshots=WaybillFinancialExcepted::orderBy('id', 'DESC');
  25. $waybillFinancialSnapshots=$this->conditionQuery($request,$waybillFinancialSnapshots);
  26. return view('waybill.waybillFinancialSnapshot.index',['waybillFinancialSnapshots'=>$waybillFinancialSnapshots,'filterData'=>$request->input(),'type'=>'','excepted'=>true]);
  27. }
  28. public function indexZF(Request $request)
  29. {
  30. if(!Gate::allows('财务报表-查询')){ return redirect(url('/')); }
  31. $waybillFinancialSnapshots=WaybillFinancialExcepted::orderBy('id', 'DESC')->where('json_content','like','%直发车%');
  32. $waybillFinancialSnapshots=$this->conditionQuery($request,$waybillFinancialSnapshots);
  33. return view('waybill.waybillFinancialSnapshot.index',['waybillFinancialSnapshots'=>$waybillFinancialSnapshots,'filterData'=>$request->input(),'type'=>'ZF','excepted'=>true]);
  34. }
  35. public function indexZX(Request $request)
  36. {
  37. if(!Gate::allows('财务报表-查询')){ return redirect(url('/')); }
  38. $waybillFinancialSnapshots=WaybillFinancialExcepted::orderBy('id', 'DESC')->where('json_content','like','%专线%');
  39. $waybillFinancialSnapshots=$this->conditionQuery($request,$waybillFinancialSnapshots);
  40. return view('waybill.waybillFinancialSnapshot.index',['waybillFinancialSnapshots'=>$waybillFinancialSnapshots,'filterData'=>$request->input(),'type'=>'ZX','excepted'=>true]);
  41. }
  42. }