/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // $caja = caja::with('usuarios', 'tiendas')->find($id); $saldo = caja::Totales($id); $movimientos = caja_detalle::with('pagos')->where('caja_id', $id)->orderBy('created_at')->get(); return view('app.cajas.caja_show', compact('caja', 'movimientos', 'saldo')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { //primero verificamos que este abierta la caja $caja_abierta = caja::CajaAbierta(); if (!isset($caja_abierta)) { Session::flash('mensaje', 'Primero debe abrir al caja para Agregar un pago a la venta'); return redirect('caja'); } $ventas = ventas::with('clientes')->whereraw('venta > pagado')->get(); return view('app.ingresos.ingresos_create', compact('ventas')); }
public static function egresoXcompra($request, $id, $caja_id) { $total = 0; foreach ($request->pagos as $pago) { $egreso = new egresos(); $egreso->compra_id = $id; $egreso->formas_pago_id = $pago['id']; $egreso->valor = $pago['valor']; $egreso->save(); $total += $pago['valor']; } $compra = compras::find($id); $compra->pagado = $compra->pagado + $total; $compra->save(); caja::EgresoXfactura($request->pagos, $caja_id, $compra->factura); }
/** * Display a listing of the resource. * * @return Response */ public function index() { // //verificar si la caja esta abierta $caja_abierta = caja::CajaAbierta(); if (!isset($caja_abierta)) { Session::flash('mensaje', 'Primero debe abrir al caja para vender'); return redirect('caja'); } $productos = Bodegas::with('productos_configurables.productos')->get()->toJson(); $clientes = clientes::all(); $categorias = categorias::orderBy('level')->get(); $tiendas = tiendas::lists('tienda', 'id'); $ciudades = ciudades::all()->toJson(); $departamentos = departamentos::lists('departamento', 'id'); return Response::view('app.ventas.ventas_pos', compact('tiendas', 'categorias', 'productos', 'clientes', 'ciudades', 'departamentos')); }
public function pagar(Request $request, $id) { //dd($request->all()); $caja_abierta = caja::CajaAbierta(); if (!isset($caja_abierta)) { Session::flash('mensaje', 'Primero debe abrir al caja para Agregar un pago a la factura'); return redirect('caja'); } egresos::egresoXcompra($request, $id, $caja_abierta->id); Session::flash('mensaje', 'Pago realizado con exito'); return redirect('compras/' . $id); }
public static function CajaAbierta() { $tienda = Auth::user()->tienda_id; $caja = caja::where('tienda_id', $tienda)->where('estado', '1')->first(); return $caja; }
public static function ingresoSimple($request) { foreach ($request->pagos as $pago) { $ingreso = new ingresos(); $ingreso->formas_pago_id = $pago['id']; $ingreso->valor = $pago['valor']; } caja::ingresoCajaSimple($request); }
public function pagar(Request $request, $id) { //verificar si la caja esta abierta $caja_abierta = caja::CajaAbierta(); if (!isset($caja_abierta)) { Session::flash('mensaje', 'Primero debe abrir al caja para Agregar un pago a la venta'); return redirect('caja'); } $lastid = ventas::pagar($id, $request); ingresos::AgregarIngreso($lastid, $request->pagos); return redirect('ventas/' . $id); }