Se reparo error en el buscador
This commit is contained in:
@@ -5,9 +5,12 @@ namespace App\Http\Livewire;
|
|||||||
use App\Models\Movimiento;
|
use App\Models\Movimiento;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
use Livewire\WithPagination;
|
||||||
|
|
||||||
class CancelacionController extends Component
|
class CancelacionController extends Component
|
||||||
{
|
{
|
||||||
|
use WithPagination;
|
||||||
|
|
||||||
const CODIGO_CANCELACION = 3;
|
const CODIGO_CANCELACION = 3;
|
||||||
public $buscador = '' , $modal = false;
|
public $buscador = '' , $modal = false;
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ class VentaController extends Component
|
|||||||
|
|
||||||
public function updated()
|
public function updated()
|
||||||
{
|
{
|
||||||
|
if(!$this->modal)
|
||||||
|
return;
|
||||||
if($this->venta->cambio()>0)
|
if($this->venta->cambio()>0)
|
||||||
{
|
{
|
||||||
$this->cambio = $this->venta->cambio();
|
$this->cambio = $this->venta->cambio();
|
||||||
@@ -83,6 +85,12 @@ class VentaController extends Component
|
|||||||
'venta.estado_movimiento_id' => 'numeric',
|
'venta.estado_movimiento_id' => 'numeric',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if($this->venta->isTotalMayorCambio())
|
||||||
|
{
|
||||||
|
session()->flash("error","Pago diferente al efectivo no pueden superar el total de venta.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->venta->ajusteCambio();
|
$this->venta->ajusteCambio();
|
||||||
|
|
||||||
$this->venta->user_id = Auth::user()->id;
|
$this->venta->user_id = Auth::user()->id;
|
||||||
|
|||||||
@@ -129,10 +129,14 @@ class VentaEspecialController extends Component
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
if(($this->calcularTotalPagar($this->ventaEspecial) - $this->ventaAnterior->totalAbono()) >0){
|
if(($this->calcularTotalPagar($this->ventaEspecial) - $this->ventaAnterior->totalAbono()) >0){
|
||||||
// session()->flash("message_abono",($this->calcularTotalPagar($this->ventaEspecial) - $this->ventaAnterior->totalAbono()));
|
|
||||||
session()->flash("message_abono","Debes liquidar la deuda para cerrarla.");
|
session()->flash("message_abono","Debes liquidar la deuda para cerrarla.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if($this->ventaEspecial->isTotalMayorCambio())
|
||||||
|
{
|
||||||
|
session()->flash("error","Pago diferente al efectivo no pueden superar el total de venta.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->ventaAnterior->is_liquidado = true;
|
$this->ventaAnterior->is_liquidado = true;
|
||||||
$this->ventaAnterior->save();
|
$this->ventaAnterior->save();
|
||||||
|
|||||||
@@ -65,9 +65,20 @@ class Movimiento extends Model
|
|||||||
|
|
||||||
public function ajusteCambio()
|
public function ajusteCambio()
|
||||||
{
|
{
|
||||||
if(((float)$this->pago_efectivo) - $this->cambio()>0)
|
if(((float)$this->pago_efectivo) - $this->cambio()>=0)
|
||||||
{
|
{
|
||||||
$this->pago_efectivo-= $this->cambio();
|
$this->pago_efectivo-= $this->cambio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Eloquent model instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function isTotalMayorCambio() : bool
|
||||||
|
{
|
||||||
|
|
||||||
|
return ($this->pago_tarjeta + $this->pago_vales + $this->pago_transferencia)>$this->precio_venta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'timezone' => 'UTC',
|
'timezone' => 'America/Tijuana',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($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 }}</th>
|
<th>{{ $venta->pago_tarjeta }}</th>
|
||||||
@@ -58,7 +58,13 @@
|
|||||||
@endif
|
@endif
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
|
||||||
|
@empty
|
||||||
|
<div class="alert alert-info my-4 max-w-3xl mx-auto">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||||
|
<span>No hay ventas registradas en el sistema.</span>
|
||||||
|
</div>
|
||||||
|
@endforelse
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{{$ventas->links()}}
|
{{$ventas->links()}}
|
||||||
@@ -123,7 +129,7 @@
|
|||||||
</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="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>
|
||||||
</div>
|
</div>
|
||||||
@@ -197,6 +203,9 @@
|
|||||||
@if (session()->has('message_abono'))
|
@if (session()->has('message_abono'))
|
||||||
<span class="block text-lg mx-auto text-error">{{ session('message_abono') }}</span>
|
<span class="block text-lg mx-auto text-error">{{ session('message_abono') }}</span>
|
||||||
@endif
|
@endif
|
||||||
|
@if (session()->has('error'))
|
||||||
|
<span class="block text-lg mx-auto text-error">{{ session('error') }}</span>
|
||||||
|
@endif
|
||||||
<div class="flex gap-3">
|
<div class="flex gap-3">
|
||||||
<button wire:click="saveLiquidar()" class="btn btn-success btn-block">Guardar</button>
|
<button wire:click="saveLiquidar()" class="btn btn-success btn-block">Guardar</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -123,6 +123,10 @@
|
|||||||
</div>
|
</div>
|
||||||
@error('venta.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
@error('venta.pago_vales')<span class="block text-sm mx-2 text-error">{{ $message }}</span>@enderror
|
||||||
|
|
||||||
|
@if (session()->has('error'))
|
||||||
|
<span class="block text-lg mx-auto text-error">{{ session('error') }}</span>
|
||||||
|
@endif
|
||||||
|
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user