dias completos
This commit is contained in:
@@ -143,7 +143,6 @@ class ShowServicios extends Component
|
||||
//$prueba1 = $this->cuentas_creadas->count() * $this->servicio_t->pantallas ;
|
||||
//$prueba2 = $this->cuentas_tomadas ;
|
||||
|
||||
//dd($prueba1, $prueba2 , $prueba1-$prueba2);
|
||||
|
||||
$this->servicio_id = $this->servicio_t->id;
|
||||
$this->tarifa_id = $id;
|
||||
@@ -264,9 +263,9 @@ class ShowServicios extends Component
|
||||
$historial->utilidad = $utilidad_total;
|
||||
$historial->save();
|
||||
|
||||
|
||||
|
||||
$pantallas = Tarifas::where('id', $this->tarifa_id)->with('servicio')->first();
|
||||
|
||||
|
||||
$servicioNombre = $pantallas->servicio->nombre;
|
||||
$servicio_id = $pantallas->servicio_id;
|
||||
$pantalla_servicio_completa = $pantallas->servicio->completa;
|
||||
@@ -274,12 +273,16 @@ class ShowServicios extends Component
|
||||
|
||||
$pantallas = $pantallas->pantallas ?? null;
|
||||
|
||||
|
||||
if ((int) $pantalla_servicio >= (int) $cantidad_solicitada && (int) $pantalla_servicio_completa != (int) $this->pantallas_tarjetaPlan) {
|
||||
$suma = $pantalla_servicio - $cantidad_solicitada;
|
||||
|
||||
|
||||
$cantidad_necesaria = $this->cantidad_tarjetaPlan;
|
||||
$cuenta = Cuentas::where('servicio_id', $this->servicio_id)->whereDate('inicio', '>=', $this->fecha)->Orderby('created_at', 'ASC')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', $suma)->get();
|
||||
$cuenta = Cuentas::where('servicio_id', $this->servicio_id)->whereDate('inicio', '>=', $this->fecha)->whereDate('vencimiento','>=', $this->fechaFinal)->Orderby('created_at', 'ASC')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', $suma)->get();
|
||||
// dd($cuenta);
|
||||
} elseif ((int) $pantalla_servicio_completa == (int) $this->pantallas_tarjetaPlan) {
|
||||
//Cuentas completas
|
||||
//Cuentas completas
|
||||
$cantidad_necesaria = $this->cantidad_tarjetaPlan;
|
||||
$cuenta = Cuentas::where('servicio_id', $this->servicio_id)->whereDate('inicio', '>=', $this->fecha)->whereDate('vencimiento', '>=', $this->fecha_final_1)
|
||||
->whereDate('vencimiento', '<=', $this->fecha_final_2)
|
||||
@@ -292,9 +295,9 @@ class ShowServicios extends Component
|
||||
$cuenta = null;
|
||||
$cantidad_necesaria = null;
|
||||
}
|
||||
//dd($cuenta, $cantidad_necesaria);
|
||||
|
||||
|
||||
for ($h = 0; $h < (int) $cantidad_necesaria; $h++) {
|
||||
//dd($h);
|
||||
if (!empty($cuenta)) {
|
||||
|
||||
$cuentasMostar = '';
|
||||
@@ -319,11 +322,9 @@ class ShowServicios extends Component
|
||||
]);
|
||||
}
|
||||
}
|
||||
//dd($historial->cuentas);
|
||||
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
|
||||
|
||||
$saldo_anterior = $descuento->valor;
|
||||
//dd($saldo_anterior);
|
||||
$nuevo_saldo = $saldo_anterior - $total_valor;
|
||||
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
|
||||
if ($cobro) {
|
||||
|
||||
Reference in New Issue
Block a user