WaybillFinancialExceptedController.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. $created_at_start=$request->input('created_at_start')." 00:00:00";
  14. $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('created_at','>=',$created_at_start);
  15. }
  16. if ($request->input('created_at_end')){
  17. $created_at_end=$request->input('created_at_end')." 23:59:59";
  18. $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('created_at','<=',$created_at_end);
  19. }
  20. $waybillFinancialSnapshots=$waybillFinancialSnapshots->paginate(50);
  21. return $waybillFinancialSnapshots;
  22. }
  23. public function index(Request $request)
  24. {
  25. if(!Gate::allows('财务报表-查询')){ return redirect(url('/')); }
  26. $waybillFinancialSnapshots=WaybillFinancialExcepted::orderBy('id', 'DESC');
  27. $waybillFinancialSnapshots=$this->conditionQuery($request,$waybillFinancialSnapshots);
  28. return view('waybill.waybillFinancialSnapshot.index',['waybillFinancialSnapshots'=>$waybillFinancialSnapshots,'filterData'=>$request->input(),'type'=>'','excepted'=>true]);
  29. }
  30. public function indexZF(Request $request)
  31. {
  32. if(!Gate::allows('财务报表-查询')){ return redirect(url('/')); }
  33. $waybillFinancialSnapshots=WaybillFinancialExcepted::orderBy('id', 'DESC')->where('json_content','like','%直发车%');
  34. $waybillFinancialSnapshots=$this->conditionQuery($request,$waybillFinancialSnapshots);
  35. return view('waybill.waybillFinancialSnapshot.index',['waybillFinancialSnapshots'=>$waybillFinancialSnapshots,'filterData'=>$request->input(),'type'=>'ZF','excepted'=>true]);
  36. }
  37. public function indexZX(Request $request)
  38. {
  39. if(!Gate::allows('财务报表-查询')){ return redirect(url('/')); }
  40. $waybillFinancialSnapshots=WaybillFinancialExcepted::orderBy('id', 'DESC')->where('json_content','like','%专线%');
  41. $waybillFinancialSnapshots=$this->conditionQuery($request,$waybillFinancialSnapshots);
  42. return view('waybill.waybillFinancialSnapshot.index',['waybillFinancialSnapshots'=>$waybillFinancialSnapshots,'filterData'=>$request->input(),'type'=>'ZX','excepted'=>true]);
  43. }
  44. }