コード例 #1
0
 public function siguientePedido()
 {
     $pedidoAnterior = Factura::where('cliente_id', '=', $this->id)->orderBy('pedido', 'desc')->first();
     if ($pedidoAnterior) {
         return $pedidoAnterior->pedido + 1;
     } else {
         return 1;
     }
 }
コード例 #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $proveedores = Proveedor::find($id);
     if (is_null($proveedores)) {
         return Redirect::route('proveedores.index')->with('global', '<i class="fa fa-exclamation fa-fw x3"></i> Pagina no encontrada');
     }
     $user = DB::table('users')->where('id', '=', $proveedores->id_user)->first();
     $facturas = Factura::where('id_proveedor', '=', $proveedores->id)->orderBy('created_at', 'DESC')->paginate(10);
     $totalFacturas = Factura::where('id_proveedor', '=', $proveedores->id)->count();
     $contador = 0;
     //dd($totalFacturas);
     return View::make('proveedores.show', array('proveedores' => $proveedores, 'user' => $user))->with('facturas', $facturas)->with('totalFacturas', $totalFacturas)->with('contador', $contador);
     //return var_dump($user);
 }
コード例 #3
0
 public function getFiltroPorNotas()
 {
     try {
         $input = Input::all();
         $facturas = Factura::where('notas', 'like', '%' . $input['notas'] . '%')->orderBy('id', 'desc')->paginate(2);
         Session::flash('mensajeOk', 'Se ha realizado la búsqueda de facturas que contienen <strong>' . $input['notas'] . '</strong> en las notas.');
         return View::make('facturas.listado')->with(compact('facturas', 'input'));
     } catch (Exception $e) {
         Session::flash('mensajeError', 'Ha ocurrido un error al intentar mostrar facturas con <strong>' . $input['notas'] . '</strong> en las notas.');
         return Redirect::to('facturas/listado');
     }
 }