Finalizacion de la primera version del proyecto
This commit is contained in:
@@ -67,5 +67,6 @@ class Kernel extends HttpKernel
|
|||||||
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
|
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
|
||||||
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
|
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
|
||||||
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
|
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
|
||||||
|
'cajaValidate' => \App\Http\Middleware\CajaValidate::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\Venta;
|
use App\Models\Movimiento;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
@@ -16,11 +16,8 @@ class CancelacionController extends Component
|
|||||||
protected $rules = [
|
protected $rules = [
|
||||||
'cancelacion.codigo' => 'min:0',
|
'cancelacion.codigo' => 'min:0',
|
||||||
'cancelacion.pago_efectivo' => 'numeric',
|
'cancelacion.pago_efectivo' => 'numeric',
|
||||||
'cancelacion.pago_tarjeta_debito' => 'numeric',
|
'cancelacion.estado_movimiento_id' => 'numeric',
|
||||||
'cancelacion.pago_tarjeta_credito' => 'numeric',
|
'cancelacion.motivo' => 'required',
|
||||||
'cancelacion.pago_vales' => 'numeric',
|
|
||||||
'cancelacion.precio_venta' => 'numeric',
|
|
||||||
'cancelacion.estado_venta_id' => 'numeric',
|
|
||||||
'cancelacion.user_id',
|
'cancelacion.user_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -31,7 +28,7 @@ class CancelacionController extends Component
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$cancelaciones = Venta::where([['codigo','like','%'.$this->buscador.'%'],['estado_venta_id','=',CancelacionController::CODIGO_CANCELACION]])->paginate(10);
|
$cancelaciones = Movimiento::where([['codigo','like','%'.$this->buscador.'%'],['estado_movimiento_id','=',CancelacionController::CODIGO_CANCELACION]])->paginate(10);
|
||||||
return view('venta.cancelacion',[
|
return view('venta.cancelacion',[
|
||||||
'cancelaciones' => $cancelaciones
|
'cancelaciones' => $cancelaciones
|
||||||
]);
|
]);
|
||||||
@@ -41,14 +38,14 @@ class CancelacionController extends Component
|
|||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$this->clearInputs();
|
$this->clearInputs();
|
||||||
$this->cancelacion = new Venta([
|
$this->cancelacion = new Movimiento([
|
||||||
'codigo' => 0,
|
'codigo' => 0,
|
||||||
'pago_efectivo' => 0,
|
'pago_efectivo' => 0,
|
||||||
'pago_tarjeta_debito' => 0,
|
'pago_tarjeta_debito' => 0,
|
||||||
'pago_tarjeta_credito' => 0,
|
'pago_tarjeta_credito' => 0,
|
||||||
'pago_vales' => 0,
|
'pago_vales' => 0,
|
||||||
'precio_venta' => 0,
|
'precio_venta' => 0,
|
||||||
'estado_venta_id' => 3,
|
'estado_movimiento_id' => 3,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->showModal();
|
$this->showModal();
|
||||||
@@ -57,12 +54,9 @@ class CancelacionController extends Component
|
|||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'cancelacion.pago_efectivo' => 'numeric',
|
'cancelacion.pago_efectivo' => 'numeric|required|gte:1',
|
||||||
'cancelacion.pago_tarjeta_debito' => 'numeric',
|
'cancelacion.estado_movimiento_id' => 'numeric',
|
||||||
'cancelacion.pago_tarjeta_credito' => 'numeric',
|
'cancelacion.motivo' => 'required',
|
||||||
'cancelacion.pago_vales' => 'numeric',
|
|
||||||
'cancelacion.precio_venta' => 'numeric',
|
|
||||||
'cancelacion.estado_venta_id' => 'numeric',
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->cancelacion->user_id = Auth::user()->id;
|
$this->cancelacion->user_id = Auth::user()->id;
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\Venta;
|
use App\Models\CajaMovimiento;
|
||||||
|
use App\Models\Movimiento;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@@ -10,36 +11,74 @@ use Livewire\Component;
|
|||||||
class DashboardController extends Component
|
class DashboardController extends Component
|
||||||
{
|
{
|
||||||
const ESTADO_VENTA =1, ESTADO_ABONO = 2, ESTADO_CANCELACION = 3;
|
const ESTADO_VENTA =1, ESTADO_ABONO = 2, ESTADO_CANCELACION = 3;
|
||||||
|
public $cajaModal = false, $cajaInicial;
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$venta = $this->totalDiaTipoVenta(DashboardController::ESTADO_VENTA);
|
// dd(Movimiento::where([
|
||||||
$abono = $this->totalDiaTipoVenta(DashboardController::ESTADO_ABONO);
|
// ['estado_movimiento_id','=', DashboardController::ESTADO_VENTA],
|
||||||
$cancelacion = $this->totalDiaTipoVenta(DashboardController::ESTADO_CANCELACION);
|
// [DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')]
|
||||||
|
// ])->count());
|
||||||
|
$movimiento = $this->totalDiaTipoMovimiento(DashboardController::ESTADO_VENTA);
|
||||||
|
$abono = $this->totalDiaTipoMovimiento(DashboardController::ESTADO_ABONO);
|
||||||
|
$cancelacion = $this->totalDiaTipoMovimiento(DashboardController::ESTADO_CANCELACION);
|
||||||
|
|
||||||
|
$this->validarCaja();
|
||||||
|
|
||||||
return view('dashboard',[
|
return view('dashboard',[
|
||||||
'venta' => $venta,
|
'movimiento' => $movimiento,
|
||||||
'abono' => $abono,
|
'abono' => $abono,
|
||||||
'cancelacion' => $cancelacion
|
'cancelacion' => $cancelacion,
|
||||||
|
'num_movimiento' => Movimiento::where([
|
||||||
|
['estado_movimiento_id','=', DashboardController::ESTADO_VENTA],
|
||||||
|
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')]
|
||||||
|
])->count(),
|
||||||
|
'num_abono' => Movimiento::where([
|
||||||
|
['estado_movimiento_id','=', DashboardController::ESTADO_ABONO],
|
||||||
|
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')]
|
||||||
|
])->count(),
|
||||||
|
'num_cancelacion' => Movimiento::where([
|
||||||
|
['estado_movimiento_id','=', DashboardController::ESTADO_CANCELACION],
|
||||||
|
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')]
|
||||||
|
])->count(),
|
||||||
|
'caja' => CajaMovimiento::cajaInicial(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function totalDiaTipoVenta($tipo_venta)
|
public function totalDiaTipoMovimiento($tipo_movimiento)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
Venta::where([
|
Movimiento::where([
|
||||||
['estado_venta_id','=', $tipo_venta],
|
['estado_movimiento_id','=', $tipo_movimiento],
|
||||||
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')],
|
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')],
|
||||||
])->sum('pago_efectivo') +
|
])->sum('pago_efectivo') +
|
||||||
Venta::where([
|
Movimiento::where([
|
||||||
['estado_venta_id','=', $tipo_venta],
|
['estado_movimiento_id','=', $tipo_movimiento],
|
||||||
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')],
|
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')],
|
||||||
])->sum('pago_tarjeta_debito') +
|
])->sum('pago_tarjeta') +
|
||||||
Venta::where([
|
Movimiento::where([
|
||||||
['estado_venta_id','=', $tipo_venta],
|
['estado_movimiento_id','=', $tipo_movimiento],
|
||||||
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')],
|
|
||||||
])->sum('pago_tarjeta_credito') +
|
|
||||||
Venta::where([
|
|
||||||
['estado_venta_id','=', $tipo_venta],
|
|
||||||
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')],
|
[DB::raw('DATE(created_at)'),'=',Carbon::now()->format('Y-m-d')],
|
||||||
])->sum('pago_vales');
|
])->sum('pago_vales');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function validarCaja()
|
||||||
|
{
|
||||||
|
if(!CajaMovimiento::cajaInicial()->count())
|
||||||
|
{
|
||||||
|
$this->cajaModal = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save()
|
||||||
|
{
|
||||||
|
$this->validate([
|
||||||
|
'cajaInicial' => 'required|numeric',
|
||||||
|
]);
|
||||||
|
CajaMovimiento::create([
|
||||||
|
'cantidad' => $this->cajaInicial,
|
||||||
|
'estado_caja_movimiento_id' => CajaMovimiento::CODIGO_CAJA,
|
||||||
|
'user_id' => auth()->user()->id,
|
||||||
|
]);
|
||||||
|
$this->cajaModal = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Exports\VentasExport;
|
use App\Exports\VentasExport;
|
||||||
|
use App\Models\Movimiento;
|
||||||
use App\Models\Venta;
|
use App\Models\Venta;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@@ -11,20 +12,31 @@ use Maatwebsite\Excel\Facades\Excel;
|
|||||||
class ReporteController extends Component
|
class ReporteController extends Component
|
||||||
{
|
{
|
||||||
public $fecha_inicio, $fecha_final;
|
public $fecha_inicio, $fecha_final;
|
||||||
|
public $fn_inicio, $fn_final;
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('venta.reporte',[
|
return view('venta.reporte',[
|
||||||
'ventas' => Venta::whereBetween('created_at',[$this->fecha_inicio,$this->fecha_final])->get()
|
'movimientos' => Movimiento::whereBetween('created_at',[$this->fn_inicio,$this->fn_final])->get(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updatedFechaInicio()
|
||||||
|
{
|
||||||
|
$this->fn_inicio= Carbon::parse($this->fecha_inicio)->startOfDay();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatedFechaFinal()
|
||||||
|
{
|
||||||
|
$this->fn_final= Carbon::parse($this->fecha_final)->endOfDay();
|
||||||
|
}
|
||||||
|
|
||||||
public function export()
|
public function export()
|
||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'fecha_inicio' => 'required|date',
|
'fecha_inicio' => 'required|date',
|
||||||
'fecha_final' => 'required|date',
|
'fecha_final' => 'required|date',
|
||||||
]);
|
]);
|
||||||
return Excel::download(new VentasExport($this->fecha_inicio, $this->fecha_final),'venta-'.Carbon::now()->format('Y-m-d').'.xlsx');
|
return Excel::download(new VentasExport($this->fn_inicio, $this->fn_final),'venta-'.Carbon::now()->format('Y-m-d').'.xlsx');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,14 @@ class UserController extends Component
|
|||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
|
if(!isset($this->user->id))
|
||||||
|
{
|
||||||
|
$this->validate([
|
||||||
|
'user.email' => 'required|min:3|unique:users,email',
|
||||||
|
]);
|
||||||
|
}
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'user.name' => 'required|min:3',
|
'user.name' => 'required|min:3',
|
||||||
'user.email' => 'required|min:3|unique:users,email',
|
|
||||||
'password' => 'required|min:6'
|
'password' => 'required|min:6'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\EstadoVenta;
|
use App\Models\EstadoMovimiento;
|
||||||
use App\Models\Venta;
|
use App\Models\Movimiento;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
@@ -15,16 +15,16 @@ class VentaController extends Component
|
|||||||
const CODIGO_VENTA = 1;
|
const CODIGO_VENTA = 1;
|
||||||
|
|
||||||
public $buscador = '', $modal = false;
|
public $buscador = '', $modal = false;
|
||||||
public $venta;
|
public $venta, $cambio, $faltante;
|
||||||
|
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'venta.codigo' => 'min:0',
|
'venta.codigo' => 'min:0',
|
||||||
'venta.pago_efectivo' => 'numeric',
|
'venta.pago_efectivo' => 'numeric',
|
||||||
'venta.pago_tarjeta_debito' => 'numeric',
|
'venta.pago_tarjeta' => 'numeric',
|
||||||
'venta.pago_tarjeta_credito' => 'numeric',
|
|
||||||
'venta.pago_vales' => 'numeric',
|
'venta.pago_vales' => 'numeric',
|
||||||
'venta.precio_venta' => 'numeric',
|
'venta.precio_venta' => 'required|numeric|gte:1',
|
||||||
'venta.estado_venta_id' => 'numeric',
|
'venta.pago_transferencia' => 'numeric',
|
||||||
|
'venta.estado_movimiento_id' => 'numeric',
|
||||||
'venta.user_id',
|
'venta.user_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -35,39 +35,55 @@ class VentaController extends Component
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$ventas = Venta::where([['codigo','like','%'.$this->buscador.'%'],['estado_venta_id','=',VentaController::CODIGO_VENTA]])->paginate(10);
|
$ventas = Movimiento::where([['codigo','like','%'.$this->buscador.'%'],['estado_movimiento_id','=',VentaController::CODIGO_VENTA]])->paginate(10);
|
||||||
return view('venta.venta',[
|
return view('venta.venta',[
|
||||||
'ventas' => $ventas,
|
'ventas' => $ventas,
|
||||||
'estadoVentas' => EstadoVenta::all(),
|
'estadoVentas' => EstadoMovimiento::all(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$this->clearInputs();
|
$this->clearInputs();
|
||||||
$this->venta = new Venta([
|
$this->venta = new Movimiento([
|
||||||
'codigo' => 0,
|
'codigo' => 0,
|
||||||
'pago_efectivo' => 0,
|
|
||||||
'pago_tarjeta_debito' => 0,
|
|
||||||
'pago_tarjeta_credito' => 0,
|
|
||||||
'pago_vales' => 0,
|
|
||||||
'precio_venta' => 0,
|
'precio_venta' => 0,
|
||||||
'estado_venta_id' => 1,
|
'pago_efectivo' => 0,
|
||||||
|
'pago_tarjeta' => 0,
|
||||||
|
'pago_vales' => 0,
|
||||||
|
'pago_transferencia' => 0,
|
||||||
|
'estado_movimiento_id' => 1,
|
||||||
]);
|
]);
|
||||||
|
$this->cambio;
|
||||||
$this->showModal();
|
$this->showModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updated()
|
||||||
|
{
|
||||||
|
if($this->venta->cambio()>0)
|
||||||
|
{
|
||||||
|
$this->cambio = $this->venta->cambio();
|
||||||
|
$this->faltante = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->faltante = $this->venta->faltante();
|
||||||
|
$this->cambio = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'venta.pago_efectivo' => 'numeric',
|
'venta.pago_efectivo' => 'numeric',
|
||||||
'venta.pago_tarjeta_debito' => 'numeric',
|
'venta.precio_venta' => 'required|numeric|gte:1',
|
||||||
'venta.pago_tarjeta_credito' => 'numeric',
|
'venta.pago_tarjeta' => 'required|numeric',
|
||||||
'venta.pago_vales' => 'numeric',
|
'venta.pago_vales' => 'numeric',
|
||||||
'venta.precio_venta' => 'numeric',
|
'venta.pago_transferencia' => 'numeric',
|
||||||
'venta.estado_venta_id' => 'numeric',
|
'venta.estado_movimiento_id' => 'numeric',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->venta->ajusteCambio();
|
||||||
|
|
||||||
$this->venta->user_id = Auth::user()->id;
|
$this->venta->user_id = Auth::user()->id;
|
||||||
$this->venta->save();
|
$this->venta->save();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\Venta;
|
use App\Models\Movimiento;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
@@ -13,21 +13,21 @@ class VentaEspecialController extends Component
|
|||||||
|
|
||||||
const CODIGO_VENTA_ESPECIAL = 2;
|
const CODIGO_VENTA_ESPECIAL = 2;
|
||||||
public $buscador = '', $modal = false, $modalLiquidar;
|
public $buscador = '', $modal = false, $modalLiquidar;
|
||||||
public $ventaEspecial, $total_pagar, $abonado, $ventaAnterior;
|
public $ventaEspecial, $total_pagar, $ventaAnterior, $abonado, $cambio, $faltante;
|
||||||
|
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'ventaEspecial.codigo' => 'min:0',
|
'ventaEspecial.codigo' => 'min:0',
|
||||||
'ventaEspecial.pago_efectivo' => 'numeric',
|
'ventaEspecial.pago_efectivo' => 'numeric',
|
||||||
'ventaEspecial.pago_tarjeta_debito' => 'numeric',
|
'ventaEspecial.pago_tarjeta' => 'numeric',
|
||||||
'ventaEspecial.pago_tarjeta_credito' => 'numeric',
|
|
||||||
'ventaEspecial.pago_vales' => 'numeric',
|
'ventaEspecial.pago_vales' => 'numeric',
|
||||||
'ventaEspecial.precio_venta' => 'numeric',
|
'ventaEspecial.precio_venta' => 'numeric',
|
||||||
'ventaEspecial.estado_venta_id' => 'numeric',
|
'ventaEspecial.pago_transferencia' => 'numeric',
|
||||||
|
'ventaEspecial.estado_movimiento_id' => 'numeric',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$ventas = Venta::where([['codigo','like','%'.$this->buscador.'%'],['estado_venta_id','=',VentaEspecialController::CODIGO_VENTA_ESPECIAL]])->paginate(10);
|
$ventas = Movimiento::where([['codigo','like','%'.$this->buscador.'%'],['estado_movimiento_id','=',VentaEspecialController::CODIGO_VENTA_ESPECIAL]])->paginate(10);
|
||||||
return view('venta.venta-especial',[
|
return view('venta.venta-especial',[
|
||||||
'ventas' => $ventas,
|
'ventas' => $ventas,
|
||||||
]);
|
]);
|
||||||
@@ -41,41 +41,59 @@ class VentaEspecialController extends Component
|
|||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$this->clearInputs();
|
$this->clearInputs();
|
||||||
$this->ventaEspecial = new Venta([
|
$this->ventaEspecial = new Movimiento([
|
||||||
'codigo' => 0,
|
'codigo' => 0,
|
||||||
'pago_efectivo' => 0,
|
'pago_efectivo' => 0,
|
||||||
'pago_tarjeta_debito' => 0,
|
'pago_tarjeta' => 0,
|
||||||
'pago_tarjeta_credito' => 0,
|
|
||||||
'pago_vales' => 0,
|
'pago_vales' => 0,
|
||||||
|
'pago_transferencia' => 0,
|
||||||
'precio_venta' => 0,
|
'precio_venta' => 0,
|
||||||
'estado_venta_id' => VentaEspecialController::CODIGO_VENTA_ESPECIAL,
|
'estado_movimiento_id' => VentaEspecialController::CODIGO_VENTA_ESPECIAL,
|
||||||
|
|
||||||
]);
|
]);
|
||||||
$this->showModal();
|
$this->showModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function liquidar(Venta $venta)
|
public function liquidar(Movimiento $venta)
|
||||||
{
|
{
|
||||||
$this->ventaAnterior = $venta;
|
$this->ventaAnterior = $venta;
|
||||||
|
|
||||||
$this->ventaEspecial = new Venta([
|
$this->ventaEspecial = new Movimiento([
|
||||||
'codigo' => $venta->codigo,
|
'codigo' => $venta->codigo,
|
||||||
'pago_efectivo' => 0,
|
'pago_efectivo' => 0,
|
||||||
'pago_tarjeta_debito' => 0,
|
'pago_tarjeta' => 0,
|
||||||
'pago_tarjeta_credito' => 0,
|
|
||||||
'pago_vales' => 0,
|
'pago_vales' => 0,
|
||||||
'precio_venta' => $venta->precio_venta,
|
'pago_transferencia' => 0,
|
||||||
'estado_venta_id' => VentaEspecialController::CODIGO_VENTA_ESPECIAL,
|
'precio_venta' => $this->ventaAnterior->faltante(),
|
||||||
|
'estado_movimiento_id' => VentaEspecialController::CODIGO_VENTA_ESPECIAL,
|
||||||
]);
|
]);
|
||||||
$this->total_pagar = $this->calcularTotalPagar($venta);
|
$this->total_pagar = $this->calcularTotalPagar($venta);
|
||||||
$this->abonado = $venta->precio_venta - $this->total_pagar;
|
$this->abonado = $venta->precio_venta - $this->total_pagar;
|
||||||
|
|
||||||
|
$this->updated();
|
||||||
|
|
||||||
$this->showModalLiquidar();
|
$this->showModalLiquidar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updated()
|
||||||
|
{
|
||||||
|
if(!isset($this->ventaAnterior) || !isset($this->ventaEspecial)) return;
|
||||||
|
|
||||||
|
if($this->ventaEspecial->cambio()>0)
|
||||||
|
{
|
||||||
|
$this->cambio = $this->ventaEspecial->cambio();
|
||||||
|
$this->faltante = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->faltante = $this->ventaEspecial->faltante();
|
||||||
|
$this->cambio = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function calcularTotalPagar($venta)
|
public function calcularTotalPagar($venta)
|
||||||
{
|
{
|
||||||
return ($venta->precio_venta - $venta->pago_efectivo - $venta->pago_tarjeta_credito - $venta->pago_tarjeta_debito - $venta->pago_vales);
|
return ($venta->precio_venta - $venta->pago_efectivo - $venta->pago_tarjeta - $venta->pago_vales - $venta->pago_transferencia);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -83,11 +101,11 @@ class VentaEspecialController extends Component
|
|||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'ventaEspecial.pago_efectivo' => 'numeric',
|
'ventaEspecial.pago_efectivo' => 'numeric',
|
||||||
'ventaEspecial.pago_tarjeta_debito' => 'numeric',
|
'ventaEspecial.pago_tarjeta' => 'numeric',
|
||||||
'ventaEspecial.pago_tarjeta_credito' => 'numeric',
|
|
||||||
'ventaEspecial.pago_vales' => 'numeric',
|
'ventaEspecial.pago_vales' => 'numeric',
|
||||||
|
'ventaEspecial.pago_transferencia' => 'numeric',
|
||||||
'ventaEspecial.precio_venta' => 'numeric|gte:2',
|
'ventaEspecial.precio_venta' => 'numeric|gte:2',
|
||||||
'ventaEspecial.estado_venta_id' => 'numeric',
|
'ventaEspecial.estado_movimiento_id' => 'numeric',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->ventaEspecial->user_id = Auth::user()->id;
|
$this->ventaEspecial->user_id = Auth::user()->id;
|
||||||
@@ -103,11 +121,11 @@ class VentaEspecialController extends Component
|
|||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'ventaEspecial.pago_efectivo' => 'numeric',
|
'ventaEspecial.pago_efectivo' => 'numeric',
|
||||||
'ventaEspecial.pago_tarjeta_debito' => 'numeric',
|
'ventaEspecial.pago_tarjeta' => 'numeric',
|
||||||
'ventaEspecial.pago_tarjeta_credito' => 'numeric',
|
|
||||||
'ventaEspecial.pago_vales' => 'numeric',
|
'ventaEspecial.pago_vales' => 'numeric',
|
||||||
|
'ventaEspecial.pago_transferencia' => 'numeric',
|
||||||
'ventaEspecial.precio_venta' => 'numeric|gte:2',
|
'ventaEspecial.precio_venta' => 'numeric|gte:2',
|
||||||
'ventaEspecial.estado_venta_id' => 'numeric',
|
'ventaEspecial.estado_movimiento_id' => 'numeric',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if(($this->calcularTotalPagar($this->ventaEspecial) - $this->ventaAnterior->totalAbono()) >0){
|
if(($this->calcularTotalPagar($this->ventaEspecial) - $this->ventaAnterior->totalAbono()) >0){
|
||||||
@@ -121,6 +139,11 @@ class VentaEspecialController extends Component
|
|||||||
|
|
||||||
$this->ventaEspecial->user_id = Auth::user()->id;
|
$this->ventaEspecial->user_id = Auth::user()->id;
|
||||||
$this->ventaEspecial->is_liquidado = true;
|
$this->ventaEspecial->is_liquidado = true;
|
||||||
|
|
||||||
|
|
||||||
|
$this->ventaEspecial->ajusteCambio();
|
||||||
|
$this->ventaEspecial->precio_venta = $this->ventaAnterior->precio_venta;
|
||||||
|
|
||||||
$this->ventaEspecial->save();
|
$this->ventaEspecial->save();
|
||||||
|
|
||||||
session()->flash('message',"La venta se ha registrado correctamente!");
|
session()->flash('message',"La venta se ha registrado correctamente!");
|
||||||
|
|||||||
30
app/Http/Middleware/CajaValidate.php
Normal file
30
app/Http/Middleware/CajaValidate.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Models\CajaMovimiento;
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class CajaValidate
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
|
||||||
|
if(CajaMovimiento::cajaInicial()->count())
|
||||||
|
{
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return redirect(route('dashboard'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
app/Models/CajaMovimiento.php
Normal file
30
app/Models/CajaMovimiento.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class CajaMovimiento extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
const CODIGO_CAJA = 1, CODIGO_RETIRO = 2;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'cantidad',
|
||||||
|
'estado_caja_movimiento_id',
|
||||||
|
'user_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public static function cajaInicial()
|
||||||
|
{
|
||||||
|
return CajaMovimiento::where([
|
||||||
|
['user_id','=',auth()->user()->id],
|
||||||
|
['created_at', '>=', Carbon::now()->startOfDay()],
|
||||||
|
['created_at', '<=', Carbon::now()->endOfDay()],
|
||||||
|
])->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
13
app/Models/EstadoCajaMovimiento.php
Normal file
13
app/Models/EstadoCajaMovimiento.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class EstadoCajaMovimiento extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = ['nombre'];
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class EstadoVenta extends Model
|
class EstadoMovimiento extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
73
app/Models/Movimiento.php
Normal file
73
app/Models/Movimiento.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Movimiento extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'codigo',
|
||||||
|
'pago_efectivo',
|
||||||
|
'pago_tarjeta',
|
||||||
|
'pago_vales',
|
||||||
|
'pago_transferencia',
|
||||||
|
'precio_venta',
|
||||||
|
'estado_movimiento_id',
|
||||||
|
'user_id',
|
||||||
|
'is_liquidado',
|
||||||
|
'motivo',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public function estadoMovimiento()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(EstadoMovimiento::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function totalAbono()
|
||||||
|
{
|
||||||
|
return ((float)$this->pago_efectivo +
|
||||||
|
(float)$this->pago_tarjeta +
|
||||||
|
(float)$this->pago_vales +
|
||||||
|
(float)$this->pago_transferencia);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cambio()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
((float)$this->pago_efectivo +
|
||||||
|
(float)$this->pago_tarjeta +
|
||||||
|
(float)$this->pago_vales +
|
||||||
|
(float)$this->pago_transferencia) -
|
||||||
|
(float)$this->precio_venta
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function faltante()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
(float)$this->precio_venta -
|
||||||
|
((float)$this->pago_efectivo +
|
||||||
|
(float)$this->pago_tarjeta +
|
||||||
|
(float)$this->pago_vales +
|
||||||
|
(float)$this->pago_transferencia)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ajusteCambio()
|
||||||
|
{
|
||||||
|
if(((float)$this->pago_efectivo) - $this->cambio()>0)
|
||||||
|
{
|
||||||
|
$this->pago_efectivo-= $this->cambio();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class Venta extends Model
|
|
||||||
{
|
|
||||||
use HasFactory;
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'codigo',
|
|
||||||
'precio_venta',
|
|
||||||
'pago_efectivo',
|
|
||||||
'pago_tarjeta_debito',
|
|
||||||
'pago_tarjeta_credito',
|
|
||||||
'pago_vales',
|
|
||||||
'estado_venta_id',
|
|
||||||
'user_id',
|
|
||||||
'is_liquidado',
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
public function estadoVenta()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(EstadoVenta::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function user()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(User::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function totalAbono()
|
|
||||||
{
|
|
||||||
return ($this->pago_efectivo +
|
|
||||||
$this->pago_tarjeta_debito +
|
|
||||||
$this->pago_tarjeta_credito +
|
|
||||||
$this->pago_vales);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
namespace App\Exports;
|
namespace App\Exports;
|
||||||
|
|
||||||
use App\Invoice;
|
use App\Invoice;
|
||||||
use App\Models\Venta;
|
use App\Models\Movimiento;
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
use Maatwebsite\Excel\Concerns\FromView;
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
@@ -19,14 +19,14 @@ class VentasExport implements FromView{
|
|||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
return Venta::select(
|
return Movimiento::select(
|
||||||
'codigo',
|
'codigo',
|
||||||
'pago_efectivo',
|
'pago_efectivo',
|
||||||
'pago_tarjeta_debito',
|
'pago_tarjeta_debito',
|
||||||
'pago_tarjeta_credito',
|
'pago_tarjeta_credito',
|
||||||
'pago_vales',
|
'pago_vales',
|
||||||
'precio_venta',
|
'precio_venta',
|
||||||
'estado_venta_id as tipo_venta',
|
'estado_venta_id as tipo_movimiento',
|
||||||
'user_id as usuario',
|
'user_id as usuario',
|
||||||
)->get();
|
)->get();
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ class VentasExport implements FromView{
|
|||||||
public function view(): View
|
public function view(): View
|
||||||
{
|
{
|
||||||
return view('export.reporteExport',[
|
return view('export.reporteExport',[
|
||||||
'ventas' => Venta::whereBetween('created_at',[$this->fecha_inicio,$this->fecha_final])->get(),
|
'movimientos' => Movimiento::whereBetween('created_at',[$this->fecha_inicio,$this->fecha_final])->get(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('estado_ventas', function (Blueprint $table) {
|
Schema::create('estado_movimientos', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('nombre');
|
$table->string('nombre');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
@@ -23,6 +23,6 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('estado_ventas');
|
Schema::dropIfExists('estado_movimientos');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('movimientos', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('codigo',20);
|
||||||
|
$table->float('precio_venta',30)->nullable();
|
||||||
|
$table->float('pago_efectivo',30)->nullable();
|
||||||
|
$table->float('pago_tarjeta',30)->nullable();
|
||||||
|
$table->float('pago_vales',30)->nullable();
|
||||||
|
$table->float('pago_transferencia',30)->nullable();
|
||||||
|
$table->unsignedBigInteger('estado_movimiento_id');
|
||||||
|
$table->foreign('estado_movimiento_id')->on('estado_movimientos')->references('id');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('movimientos');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::create('ventas', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->string('codigo',20);
|
|
||||||
$table->string('pago_efectivo',30)->nullable();
|
|
||||||
$table->string('pago_tarjeta_debito',30)->nullable();
|
|
||||||
$table->string('pago_tarjeta_credito',30)->nullable();
|
|
||||||
$table->string('pago_vales',30)->nullable();
|
|
||||||
|
|
||||||
$table->string('precio_venta')->nullable();
|
|
||||||
|
|
||||||
$table->unsignedBigInteger('estado_venta_id');
|
|
||||||
$table->foreign('estado_venta_id')->on('estado_ventas')->references('id');
|
|
||||||
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('ventas');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -11,11 +11,12 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('ventas', function (Blueprint $table) {
|
Schema::table('movimientos', function (Blueprint $table) {
|
||||||
//
|
//
|
||||||
$table->unsignedBigInteger('user_id')->after('precio_venta');
|
$table->unsignedBigInteger('user_id')->after('estado_movimiento_id');
|
||||||
$table->foreign('user_id')->references('id')->on('users');
|
$table->foreign('user_id')->references('id')->on('users');
|
||||||
$table->boolean('is_liquidado')->nullable();
|
$table->boolean('is_liquidado')->nullable();
|
||||||
|
$table->string('motivo')->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('ventas', function (Blueprint $table) {
|
Schema::table('movimientos', function (Blueprint $table) {
|
||||||
//
|
//
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('estado_caja_movimientos', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('nombre');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('estado_caja_movimientos');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('caja_movimientos', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->float('cantidad');
|
||||||
|
|
||||||
|
$table->unsignedBigInteger('estado_caja_movimiento_id');
|
||||||
|
$table->foreign('estado_caja_movimiento_id')->references('id')->on('estado_caja_movimientos');
|
||||||
|
|
||||||
|
$table->unsignedBigInteger('user_id');
|
||||||
|
$table->foreign('user_id')->references('id')->on('users');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('caja_movimientos');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -14,7 +14,8 @@ class DatabaseSeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$this->call([
|
$this->call([
|
||||||
EstadoVentaSeeder::class,
|
EstadoMovimientoSeeder::class,
|
||||||
|
EstadoCajaMovimientoSeeder::class,
|
||||||
RoleSeeder::class,
|
RoleSeeder::class,
|
||||||
UserSeeder::class,
|
UserSeeder::class,
|
||||||
]);
|
]);
|
||||||
|
|||||||
30
database/seeders/EstadoCajaMovimientoSeeder.php
Normal file
30
database/seeders/EstadoCajaMovimientoSeeder.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class EstadoCajaMovimientoSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
DB::table('estado_caja_movimientos')->insert([
|
||||||
|
[
|
||||||
|
'nombre' => 'Caja Inicial',
|
||||||
|
'created_at' => Carbon::now(),
|
||||||
|
'updated_at' => Carbon::now()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nombre' => 'Retiro',
|
||||||
|
'created_at' => Carbon::now(),
|
||||||
|
'updated_at' => Carbon::now()
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ use Illuminate\Database\Seeder;
|
|||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class EstadoVentaSeeder extends Seeder
|
class EstadoMovimientoSeeder extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the database seeds.
|
* Run the database seeds.
|
||||||
@@ -16,7 +16,7 @@ class EstadoVentaSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
||||||
DB::table('estado_ventas')->insert([
|
DB::table('estado_movimientos')->insert([
|
||||||
[
|
[
|
||||||
'nombre' => 'Venta',
|
'nombre' => 'Venta',
|
||||||
'created_at' => Carbon::now(),
|
'created_at' => Carbon::now(),
|
||||||
@@ -7,15 +7,15 @@
|
|||||||
<p class="font-bold">Fecha: <span class="font-light">{{ now()}}</span></p>
|
<p class="font-bold">Fecha: <span class="font-light">{{ now()}}</span></p>
|
||||||
</div>
|
</div>
|
||||||
</x-slot>
|
</x-slot>
|
||||||
|
@role('admin')
|
||||||
<div class="py-12">
|
<div class="py-12">
|
||||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 grid grid-cols-3">
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 grid grid-cols-3">
|
||||||
|
|
||||||
<div class="overflow-hidden flex">
|
<div class="overflow-hidden flex mb-4">
|
||||||
<div class="card bg-backgroundPrimary flex flex-row items-center justify-around">
|
<div class="card bg-backgroundPrimary flex flex-row items-center justify-around">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h2 class="font-bold uppercase tracking-wide text-content3">Ventas del dia</h2>
|
<h2 class="font-bold uppercase tracking-wide text-content3">Ventas del dia</h2>
|
||||||
<p class="font-black text-4xl">$ {{ $venta }}</p>
|
<p class="font-black text-4xl text-center">$ {{ $movimiento }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-14 h-14 text-success">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-14 h-14 text-success">
|
||||||
@@ -25,11 +25,54 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="overflow-hidden flex">
|
<div class="overflow-hidden flex mb-4">
|
||||||
<div class="card bg-backgroundPrimary flex flex-row items-center justify-around">
|
<div class="card bg-backgroundPrimary flex flex-row items-center justify-around">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h2 class="font-bold uppercase tracking-wide text-content3">Abonos del dia</h2>
|
<h2 class="font-bold uppercase tracking-wide text-content3">Abonos del dia</h2>
|
||||||
<p class="font-black text-4xl">$ {{ $abono }}</p>
|
<p class="font-black text-4xl text-center">$ {{ $abono }}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-14 h-14 text-warning">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 18.75a60.07 60.07 0 0115.797 2.101c.727.198 1.453-.342 1.453-1.096V18.75M3.75 4.5v.75A.75.75 0 013 6h-.75m0 0v-.375c0-.621.504-1.125 1.125-1.125H20.25M2.25 6v9m18-10.5v.75c0 .414.336.75.75.75h.75m-1.5-1.5h.375c.621 0 1.125.504 1.125 1.125v9.75c0 .621-.504 1.125-1.125 1.125h-.375m1.5-1.5H21a.75.75 0 00-.75.75v.75m0 0H3.75m0 0h-.375a1.125 1.125 0 01-1.125-1.125V15m1.5 1.5v-.75A.75.75 0 003 15h-.75M15 10.5a3 3 0 11-6 0 3 3 0 016 0zm3 0h.008v.008H18V10.5zm-12 0h.008v.008H6V10.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="overflow-hidden flex mb-4">
|
||||||
|
<div class="card bg-backgroundPrimary flex flex-row items-center justify-around">
|
||||||
|
<div class="card-body">
|
||||||
|
<h2 class="font-bold uppercase tracking-wide text-content3">Cancelaciones del dia</h2>
|
||||||
|
<p class="font-black text-4xl text-center">$ {{ $cancelacion }}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-14 h-14 text-error">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="overflow-hidden flex">
|
||||||
|
<div class="card bg-backgroundPrimary flex flex-row items-center justify-around">
|
||||||
|
<div class="card-body">
|
||||||
|
<h2 class="font-bold uppercase tracking-wide text-content3">Numero de Ventas</h2>
|
||||||
|
<p class="font-black text-4xl text-center"> {{ $num_movimiento }}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-14 h-14 text-success">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 18L9 11.25l4.306 4.307a11.95 11.95 0 015.814-5.519l2.74-1.22m0 0l-5.94-2.28m5.94 2.28l-2.28 5.941" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="overflow-hidden flex">
|
||||||
|
<div class="card bg-backgroundPrimary flex flex-row items-center justify-around">
|
||||||
|
<div class="card-body">
|
||||||
|
<h2 class="font-bold uppercase tracking-wide text-content3">Numero de Abonos</h2>
|
||||||
|
<p class="font-black text-4xl text-center"> {{ $num_abono }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-14 h-14 text-warning">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-14 h-14 text-warning">
|
||||||
@@ -43,17 +86,41 @@
|
|||||||
<div class="overflow-hidden flex">
|
<div class="overflow-hidden flex">
|
||||||
<div class="card bg-backgroundPrimary flex flex-row items-center justify-around">
|
<div class="card bg-backgroundPrimary flex flex-row items-center justify-around">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h2 class="font-bold uppercase tracking-wide text-content3">Cancelaciones del dia</h2>
|
<h2 class="font-bold uppercase tracking-wide text-content3">Numero de Cancelaciones</h2>
|
||||||
<p class="font-black text-4xl">$ {{ $cancelacion }}</p>
|
<p class="font-black text-4xl text-center"> {{ $num_cancelacion }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-14 h-14 text-error">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="-14 h-14 text-error">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636" />
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 6L9 12.75l4.286-4.286a11.948 11.948 0 014.306 6.43l.776 2.898m0 0l3.182-5.511m-3.182 5.51l-5.511-3.181" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@endrole
|
||||||
|
|
||||||
|
<input class="modal-state" wire:model="cajaModal" value="" id="modal-1" type="checkbox" />
|
||||||
|
<div class="modal">
|
||||||
|
<label class="modal-overlay"></label>
|
||||||
|
<div class="modal-content flex flex-col gap-5 max-w-md w-1/2">
|
||||||
|
|
||||||
|
<h3 class="font-bold text-lg">Registrar Caja Inicial</h3>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-field">
|
||||||
|
<label for="caja_inicial" class="form-label font-bold">Caja inicial:</label>
|
||||||
|
<input id="caja_inicial" wire:model="cajaInicial" type="number" step="any" placeholder="Registrar dinero inicial del turno" class="input max-w-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@error('cajaInicial')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
|
<div class="flex gap-3">
|
||||||
|
<button wire:click="save()" class="btn btn-success btn-block">Guardar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,25 +3,31 @@
|
|||||||
<tr class="text-neutral">
|
<tr class="text-neutral">
|
||||||
<th>Codigo</th>
|
<th>Codigo</th>
|
||||||
<th>Pago Efectivo</th>
|
<th>Pago Efectivo</th>
|
||||||
<th>Pago Tarjeta Debito</th>
|
<th>Pago Tarjeta</th>
|
||||||
<th>Pago Tarjeta Credito</th>
|
|
||||||
<th>Pago Tarjeta Vales</th>
|
<th>Pago Tarjeta Vales</th>
|
||||||
|
<th>Pago Transferencia</th>
|
||||||
|
<th>Suma Pagos</th>
|
||||||
|
<th>Total a pagar</th>
|
||||||
<th>Registrado por</th>
|
<th>Registrado por</th>
|
||||||
<th>Tipo Venta</th>
|
<th>Tipo de Movimiento</th>
|
||||||
|
<th>Motivo</th>
|
||||||
<th>Fecha</th>
|
<th>Fecha</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($ventas as $venta)
|
@foreach ($movimientos as $movimiento)
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ $venta->codigo }}</th>
|
<th>{{ $movimiento->codigo }}</th>
|
||||||
<th>{{ $venta->pago_efectivo }}</th>
|
<th>{{ $movimiento->pago_efectivo }}</th>
|
||||||
<th>{{ $venta->pago_tarjeta_debito }}</th>
|
<th>{{ $movimiento->pago_tarjeta }}</th>
|
||||||
<th>{{ $venta->pago_tarjeta_credito }}</th>
|
<th>{{ $movimiento->pago_vales }}</th>
|
||||||
<th>{{ $venta->pago_vales }}</th>
|
<th>{{ $movimiento->pago_transferencia }}</th>
|
||||||
<th>{{ $venta->user->name }}</th>
|
<th>{{ $movimiento->totalAbono() }}</th>
|
||||||
<th>{{ $venta->estadoVenta->nombre }}</th>
|
<th>{{ $movimiento->precio_venta }}</th>
|
||||||
<th>{{ $venta->created_at }}</th>
|
<th>{{ $movimiento->user->name }}</th>
|
||||||
|
<th>{{ $movimiento->estadoMovimiento->nombre }}</th>
|
||||||
|
<th>{{ $movimiento->motivo }}</th>
|
||||||
|
<th>{{ $movimiento->created_at }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -25,10 +25,10 @@
|
|||||||
<x-nav-link href="{{ route('cancelacion') }}" :active="request()->routeIs('cancelacion')">
|
<x-nav-link href="{{ route('cancelacion') }}" :active="request()->routeIs('cancelacion')">
|
||||||
{{ __('Cancelacion') }}
|
{{ __('Cancelacion') }}
|
||||||
</x-nav-link>
|
</x-nav-link>
|
||||||
|
@role('admin')
|
||||||
<x-nav-link href="{{ route('reporte') }}" :active="request()->routeIs('reporte')">
|
<x-nav-link href="{{ route('reporte') }}" :active="request()->routeIs('reporte')">
|
||||||
{{ __('Reporte') }}
|
{{ __('Reporte') }}
|
||||||
</x-nav-link>
|
</x-nav-link>
|
||||||
@role('admin')
|
|
||||||
<x-nav-link href="{{ route('usuarios') }}" :active="request()->routeIs('usuarios')">
|
<x-nav-link href="{{ route('usuarios') }}" :active="request()->routeIs('usuarios')">
|
||||||
{{ __('Usuarios') }}
|
{{ __('Usuarios') }}
|
||||||
</x-nav-link>
|
</x-nav-link>
|
||||||
|
|||||||
@@ -29,10 +29,8 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr class="text-neutral">
|
<tr class="text-neutral">
|
||||||
<th>Codigo</th>
|
<th>Codigo</th>
|
||||||
<th>Pago Efectivo</th>
|
<th>Retorno de efectivo</th>
|
||||||
<th>Pago Tarjeta Debito</th>
|
<th>Motivo</th>
|
||||||
<th>Pago Tarjeta Credito</th>
|
|
||||||
<th>Pago Tarjeta Vales</th>
|
|
||||||
<th>Registrado por</th>
|
<th>Registrado por</th>
|
||||||
<th>Fecha</th>
|
<th>Fecha</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -42,9 +40,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>{{$cancelacion->codigo}}</th>
|
<th>{{$cancelacion->codigo}}</th>
|
||||||
<th>{{$cancelacion->pago_efectivo}}</th>
|
<th>{{$cancelacion->pago_efectivo}}</th>
|
||||||
<th>{{$cancelacion->pago_tarjeta_debito}}</th>
|
<th>{{$cancelacion->motivo}}</th>
|
||||||
<th>{{$cancelacion->pago_tarjeta_credito}}</th>
|
|
||||||
<th>{{$cancelacion->pago_vales}}</th>
|
|
||||||
<th>{{$cancelacion->user->name}}</th>
|
<th>{{$cancelacion->user->name}}</th>
|
||||||
<th>{{$cancelacion->created_at}}</th>
|
<th>{{$cancelacion->created_at}}</th>
|
||||||
|
|
||||||
@@ -90,27 +86,12 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="debito" class="form-label font-bold">Tarjeta Debito:</label>
|
<label for="motivo" class="form-label font-bold">Motivo:</label>
|
||||||
<input id="debito" wire:model="cancelacion.pago_tarjeta_debito" type="number" step="any" placeholder="Pago con tarjeta de debito" class="input max-w-full" />
|
{{-- <input id="motivo" wire:model="cancelacion.motivo" type="text" placeholder="Motivo de cancelacion" class="input max-w-full" /> --}}
|
||||||
|
<textarea id="motivo" wire:model="cancelacion.motivo" class="textarea-block textarea" placeholder="Motivo de cancelacion" ></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@error('cancelacion.pago_tarjeta_debito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('cancelacion.motivo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="form-field">
|
|
||||||
<label for="credito" class="form-label font-bold">Tarjeta Credito:</label>
|
|
||||||
<input id="credito" wire:model="cancelacion.pago_tarjeta_credito" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@error('cancelacion.pago_tarjeta_credito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="form-field">
|
|
||||||
<label for="vales" class="form-label font-bold">Tarjeta Vales:</label>
|
|
||||||
<input id="vales" wire:model="cancelacion.pago_vales" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@error('cancelacion.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
|
||||||
|
|
||||||
<div class="flex gap-3">
|
<div class="flex gap-3">
|
||||||
<button wire:click="save()" class="btn btn-success btn-block">Guardar</button>
|
<button wire:click="save()" class="btn btn-success btn-block">Guardar</button>
|
||||||
|
|||||||
@@ -34,25 +34,29 @@
|
|||||||
<tr class="text-neutral">
|
<tr class="text-neutral">
|
||||||
<th>Codigo</th>
|
<th>Codigo</th>
|
||||||
<th>Pago Efectivo</th>
|
<th>Pago Efectivo</th>
|
||||||
<th>Pago Tarjeta Debito</th>
|
<th>Pago Tarjeta</th>
|
||||||
<th>Pago Tarjeta Credito</th>
|
|
||||||
<th>Pago Tarjeta Vales</th>
|
<th>Pago Tarjeta Vales</th>
|
||||||
|
<th>Pago Transferencia</th>
|
||||||
|
<th>Suma Pagos</th>
|
||||||
|
<th>Total a pagar</th>
|
||||||
<th>Registrado por</th>
|
<th>Registrado por</th>
|
||||||
<th>Tipo Venta</th>
|
<th>Tipo Venta</th>
|
||||||
<th>Fecha</th>
|
<th>Fecha</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($ventas as $venta)
|
@foreach ($movimientos as $movimiento)
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ $venta->codigo }}</th>
|
<th>{{ $movimiento->codigo }}</th>
|
||||||
<th>{{ $venta->pago_efectivo }}</th>
|
<th>{{ $movimiento->pago_efectivo }}</th>
|
||||||
<th>{{ $venta->pago_tarjeta_debito }}</th>
|
<th>{{ $movimiento->pago_tarjeta }}</th>
|
||||||
<th>{{ $venta->pago_tarjeta_credito }}</th>
|
<th>{{ $movimiento->pago_vales }}</th>
|
||||||
<th>{{ $venta->pago_vales }}</th>
|
<th>{{ $movimiento->pago_transferencia }}</th>
|
||||||
<th>{{ $venta->user->name }}</th>
|
<th>{{ $movimiento->totalAbono() }}</th>
|
||||||
<th>{{ $venta->estadoVenta->nombre }}</th>
|
<th>{{ $movimiento->precio_venta }}</th>
|
||||||
<th>{{ $venta->created_at }}</th>
|
<th>{{ $movimiento->user->name }}</th>
|
||||||
|
<th>{{ $movimiento->estadoMovimiento->nombre }}</th>
|
||||||
|
<th>{{ $movimiento->created_at }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -31,9 +31,9 @@
|
|||||||
<tr class="text-neutral">
|
<tr class="text-neutral">
|
||||||
<th>Codigo</th>
|
<th>Codigo</th>
|
||||||
<th>Pago Efectivo</th>
|
<th>Pago Efectivo</th>
|
||||||
<th>Pago Tarjeta Debito</th>
|
<th>Pago Tarjeta</th>
|
||||||
<th>Pago Tarjeta Credito</th>
|
|
||||||
<th>Pago Tarjeta Vales</th>
|
<th>Pago Tarjeta Vales</th>
|
||||||
|
<th>Pago Transferencia</th>
|
||||||
<th>Total a pagar</th>
|
<th>Total a pagar</th>
|
||||||
<th>Registrado por</th>
|
<th>Registrado por</th>
|
||||||
<th>Fecha</th>
|
<th>Fecha</th>
|
||||||
@@ -44,9 +44,9 @@
|
|||||||
@foreach ($ventas as $venta)
|
@foreach ($ventas as $venta)
|
||||||
<th>{{ $venta->codigo }}</th>
|
<th>{{ $venta->codigo }}</th>
|
||||||
<th>{{ $venta->pago_efectivo }}</th>
|
<th>{{ $venta->pago_efectivo }}</th>
|
||||||
<th>{{ $venta->pago_tarjeta_debito }}</th>
|
<th>{{ $venta->pago_tarjeta }}</th>
|
||||||
<th>{{ $venta->pago_tarjeta_credito }}</th>
|
|
||||||
<th>{{ $venta->pago_vales }}</th>
|
<th>{{ $venta->pago_vales }}</th>
|
||||||
|
<th>{{ $venta->pago_transferencia }}</th>
|
||||||
<th>{{ $venta->precio_venta }}</th>
|
<th>{{ $venta->precio_venta }}</th>
|
||||||
<th>{{ $venta->user->name }}</th>
|
<th>{{ $venta->user->name }}</th>
|
||||||
<th>{{ $venta->created_at }}</th>
|
<th>{{ $venta->created_at }}</th>
|
||||||
@@ -84,6 +84,14 @@
|
|||||||
</div>
|
</div>
|
||||||
@error('ventaEspecial.codigo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('ventaEspecial.codigo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-field">
|
||||||
|
<label for="vales" class="form-label font-bold">Precio Total:</label>
|
||||||
|
<input id="vales" wire:model="ventaEspecial.precio_venta" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@error('ventaEspecial.precio_venta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
||||||
@@ -94,19 +102,19 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="debito" class="form-label font-bold">Tarjeta Debito:</label>
|
<label for="tarjeta" class="form-label font-bold">Tarjeta:</label>
|
||||||
<input id="debito" wire:model="ventaEspecial.pago_tarjeta_debito" type="number" step="any" placeholder="Pago con tarjeta de debito" class="input max-w-full" />
|
<input id="tarjeta" wire:model="ventaEspecial.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta de debito" class="input max-w-full" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@error('ventaEspecial.pago_tarjeta_debito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('ventaEspecial.pago_tarjeta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="credito" class="form-label font-bold">Tarjeta Credito:</label>
|
<label for="pago_transferencia" class="form-label font-bold">Transferencia:</label>
|
||||||
<input id="credito" wire:model="ventaEspecial.pago_tarjeta_credito" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
<input id="pago_transferencia" wire:model="ventaEspecial.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@error('ventaEspecial.pago_tarjeta_credito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('ventaEspecial.pago_transferencia')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
@@ -115,14 +123,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@error('ventaEspecial.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('ventaEspecial.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="form-field">
|
|
||||||
<label for="vales" class="form-label font-bold">Precio Total:</label>
|
|
||||||
<input id="vales" wire:model="ventaEspecial.precio_venta" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@error('ventaEspecial.precio_venta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
|
||||||
|
|
||||||
<div class="flex gap-3">
|
<div class="flex gap-3">
|
||||||
<button wire:click="save()" class="btn btn-success btn-block">Guardar</button>
|
<button wire:click="save()" class="btn btn-success btn-block">Guardar</button>
|
||||||
@@ -139,7 +139,12 @@
|
|||||||
<h3 class="font-bold text-lg">Liquidar Venta Especial</h3>
|
<h3 class="font-bold text-lg">Liquidar Venta Especial</h3>
|
||||||
<div class="flex gap-5 justify-center">
|
<div class="flex gap-5 justify-center">
|
||||||
<h4 class="font-bold text-sm">Saldo abonado: <span class="text-success">{{ $abonado }}</span></h4>
|
<h4 class="font-bold text-sm">Saldo abonado: <span class="text-success">{{ $abonado }}</span></h4>
|
||||||
<h4 class="font-bold text-sm">Saldo a pagar: <span class="text-error">{{ $total_pagar }}</span></h4>
|
<h4 class="font-bold text-sm"></span></h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-5 justify-evenly">
|
||||||
|
<h4 class="font-bold text-sm">Cambio: <span class="text-success">{{ $cambio }}</span></h4>
|
||||||
|
<h4 class="font-bold text-sm">Saldo a pagar: <span class="text-error">{{ $faltante }}</span></h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -160,19 +165,19 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="debito" class="form-label font-bold">Tarjeta Debito:</label>
|
<label for="tarjeta" class="form-label font-bold">Tarjeta:</label>
|
||||||
<input id="debito" wire:model="ventaEspecial.pago_tarjeta_debito" type="number" step="any" placeholder="Pago con tarjeta de debito" class="input max-w-full" />
|
<input id="tarjeta" wire:model="ventaEspecial.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta" class="input max-w-full" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@error('ventaEspecial.pago_tarjeta_debito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('ventaEspecial.pago_tarjeta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="credito" class="form-label font-bold">Tarjeta Credito:</label>
|
<label for="pago_transferencia" class="form-label font-bold">Transferencia:</label>
|
||||||
<input id="credito" wire:model="ventaEspecial.pago_tarjeta_credito" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
<input id="pago_transferencia" wire:model="ventaEspecial.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@error('ventaEspecial.pago_tarjeta_credito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('ventaEspecial.pago_transferencia')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
|
|||||||
@@ -30,9 +30,10 @@
|
|||||||
<tr class="text-neutral">
|
<tr class="text-neutral">
|
||||||
<th>Codigo</th>
|
<th>Codigo</th>
|
||||||
<th>Pago Efectivo</th>
|
<th>Pago Efectivo</th>
|
||||||
<th>Pago Tarjeta Debito</th>
|
<th>Pago Tarjeta</th>
|
||||||
<th>Pago Tarjeta Credito</th>
|
|
||||||
<th>Pago Tarjeta Vales</th>
|
<th>Pago Tarjeta Vales</th>
|
||||||
|
<th>Pago Transferencia</th>
|
||||||
|
<th>Total Venta</th>
|
||||||
<th>Registrado por</th>
|
<th>Registrado por</th>
|
||||||
<th>Fecha</th>
|
<th>Fecha</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -41,9 +42,10 @@
|
|||||||
@forelse ($ventas as $venta)
|
@forelse ($ventas as $venta)
|
||||||
<th>{{ $venta->codigo }}</th>
|
<th>{{ $venta->codigo }}</th>
|
||||||
<th>{{ $venta->pago_efectivo }}</th>
|
<th>{{ $venta->pago_efectivo }}</th>
|
||||||
<th>{{ $venta->pago_tarjeta_debito }}</th>
|
<th>{{ $venta->pago_tarjeta }}</th>
|
||||||
<th>{{ $venta->pago_tarjeta_credito }}</th>
|
|
||||||
<th>{{ $venta->pago_vales }}</th>
|
<th>{{ $venta->pago_vales }}</th>
|
||||||
|
<th>{{ $venta->pago_transferencia }}</th>
|
||||||
|
<th>{{ $venta->precio_venta }}</th>
|
||||||
<th>{{ $venta->user->name }}</th>
|
<th>{{ $venta->user->name }}</th>
|
||||||
<th>{{ $venta->created_at }}</th>
|
<th>{{ $venta->created_at }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -68,6 +70,10 @@
|
|||||||
<label for="modal-1" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
<label for="modal-1" class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</label>
|
||||||
|
|
||||||
<h3 class="font-bold text-lg">Registrar Venta</h3>
|
<h3 class="font-bold text-lg">Registrar Venta</h3>
|
||||||
|
<div class="flex gap-5 justify-evenly">
|
||||||
|
<h4 class="font-bold text-sm">Cambio: <span class="text-success">{{ $cambio }}</span></h4>
|
||||||
|
<h4 class="font-bold text-sm">Saldo a pagar: <span class="text-error">{{ $faltante }}</span></h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
@@ -77,6 +83,14 @@
|
|||||||
</div>
|
</div>
|
||||||
@error('venta.codigo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('venta.codigo')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-field">
|
||||||
|
<label for="precio_venta" class="form-label font-bold">Precio Venta:</label>
|
||||||
|
<input id="precio_venta" wire:model="venta.precio_venta" type="number" step="any" placeholder="Pago total de los productos" class="input max-w-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@error('venta.precio_venta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
<label for="efectivo" class="form-label font-bold">Efectivo:</label>
|
||||||
@@ -87,19 +101,19 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="debito" class="form-label font-bold">Tarjeta Debito:</label>
|
<label for="tarjeta" class="form-label font-bold">Tarjeta:</label>
|
||||||
<input id="debito" wire:model="venta.pago_tarjeta_debito" type="number" step="any" placeholder="Pago con tarjeta de debito" class="input max-w-full" />
|
<input id="tarjeta" wire:model="venta.pago_tarjeta" type="number" step="any" placeholder="Pago con tarjeta de credito o debito" class="input max-w-full" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@error('venta.pago_tarjeta_debito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('venta.pago_tarjeta')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="credito" class="form-label font-bold">Tarjeta Credito:</label>
|
<label for="pago_transferencia" class="form-label font-bold">Transferencia:</label>
|
||||||
<input id="credito" wire:model="venta.pago_tarjeta_credito" type="number" step="any" placeholder="Pago con tarjeta de credito" class="input max-w-full" />
|
<input id="pago_transferencia" wire:model="venta.pago_transferencia" type="number" step="any" placeholder="Pago con transferencia" class="input max-w-full" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@error('venta.pago_tarjeta_credito')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('venta.pago_transferencia')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
|
|||||||
@@ -29,22 +29,27 @@ Route::get('/', function () {
|
|||||||
Route::middleware([
|
Route::middleware([
|
||||||
'auth:sanctum',
|
'auth:sanctum',
|
||||||
config('jetstream.auth_session'),
|
config('jetstream.auth_session'),
|
||||||
'verified'
|
'verified',
|
||||||
|
'cajaValidate'
|
||||||
])->group(function () {
|
])->group(function () {
|
||||||
Route::get('/dashboard',DashboardController::class)->name('dashboard');
|
|
||||||
|
|
||||||
Route::get('/venta',VentaController::class)->name('venta');
|
Route::get('/venta',VentaController::class)->name('venta');
|
||||||
Route::get('/venta-especial',VentaEspecialController::class)->name('venta-especial');
|
Route::get('/venta-especial',VentaEspecialController::class)->name('venta-especial');
|
||||||
Route::get('/cancelacion',CancelacionController::class)->name('cancelacion');
|
Route::get('/cancelacion',CancelacionController::class)->name('cancelacion');
|
||||||
Route::get('/reporte',ReporteController::class)->name('reporte');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::middleware([
|
||||||
|
'auth:sanctum',
|
||||||
|
config('jetstream.auth_session'),
|
||||||
|
'verified',
|
||||||
|
])->get('/dashboard',DashboardController::class)->name('dashboard');
|
||||||
|
|
||||||
Route::middleware([
|
Route::middleware([
|
||||||
'auth:sanctum',
|
'auth:sanctum',
|
||||||
config('jetstream.auth_session'),
|
config('jetstream.auth_session'),
|
||||||
'verified',
|
'verified',
|
||||||
'role:admin'
|
'role:admin'
|
||||||
])->group(function(){
|
])->group(function(){
|
||||||
|
|
||||||
|
Route::get('/reporte',ReporteController::class)->name('reporte');
|
||||||
Route::get('/usuarios',UserController::class)->name('usuarios');
|
Route::get('/usuarios',UserController::class)->name('usuarios');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user