Exemplo n.º 1
0
 /**
  * Show the form for creating a new resource.
  * GET /caja/create
  *
  * @return Response
  */
 public function getHabitacionOrder($id = NULL)
 {
     if (isset($id)) {
         $habitacion = Habitacion::find($id);
         $precios = $habitacion->precios;
         $pedido = $habitacion->pedidos()->where('pedido.estado', '=', 1)->first();
         if (count($pedido) > 0) {
             $persona = $pedido->persona()->first();
             $productos = $pedido->productos()->where('detallepedidoproductos.estado', '!=', 2)->get();
             $alquiler = $pedido->alquiler()->where('detallepedidohabitacion.estado', '!=', 2)->get();
             $pagado = $pedido->documentoventa()->sum('importe');
             $pagarpro = $pedido->productos()->where('detallepedidoproductos.estado', '=', 1)->sum('detallepedidoproductos.precio');
             $pagaralquiler = $pedido->alquiler()->where('detallepedidohabitacion.estado', '=', 1)->sum('detallepedidohabitacion.precio');
             $porpagar = $pagarpro + $pagaralquiler;
             $tiposdecomprobante = Tipodecomprobante::all()->lists('nombre', 'id');
         }
         $categorias = Categoria::with(['productos'])->where('id', '>', 1)->get();
         return View::make('cajas.habitacion', compact('habitacion', 'pedido', 'persona', 'productos', 'alquiler', 'pagado', 'porpagar', 'categorias', 'tiposdecomprobante', 'precios'));
     } else {
         return Redirect::to('/cajas');
     }
 }
Exemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  * GET /compras/{id}/edit
  *
  * @param  int  $id
  * @return Response
  */
 public function getEdit($id = NULL)
 {
     if (isset($id)) {
         $compra = Compras::select('compra.igv', 'compra.subtotal', 'compra.total', 'compra.id', 'compra.provedor_id', 'compra.tipocomprobante_id', 'compra.fecha', 'compra.created_at', 'compra.updated_at', 'compra.usuario_id', 'compra.serie', 'compra.numero', 'persona.razonsocial')->where('compra.id', '=', $id)->leftjoin('persona', 'persona.id', '=', 'compra.provedor_id')->first();
         $productos = $compra->productos;
         $tiposdecomprobante = Tipodecomprobante::all()->lists('nombre', 'id');
         return View::make('compras.edit', compact('compra', 'productos', 'tiposdecomprobante'));
     } else {
         return Redirect::to('compras');
     }
 }
Exemplo n.º 3
0
 public function run()
 {
     Tipodecomprobante::create(['descripcion' => 'No se registra comprobante', 'nombre' => 'Sin Comprobante']);
     Tipodecomprobante::create(['descripcion' => 'Boleta', 'nombre' => 'Boleta']);
     Tipodecomprobante::create(['descripcion' => 'Factura', 'nombre' => 'Factura']);
 }