fix
This commit is contained in:
@@ -265,7 +265,7 @@ class ShowClientes extends Component
|
|||||||
|
|
||||||
public function renovar($id)
|
public function renovar($id)
|
||||||
{
|
{
|
||||||
$historiale = Historiale::with('tarifa','cuentas')->find($id);
|
$historiale = Historiale::with('tarifa', 'cuentas')->find($id);
|
||||||
|
|
||||||
if (!$historiale) {
|
if (!$historiale) {
|
||||||
return;
|
return;
|
||||||
@@ -274,11 +274,11 @@ class ShowClientes extends Component
|
|||||||
$tarifa = $historiale->tarifa;
|
$tarifa = $historiale->tarifa;
|
||||||
$diasTarifa = $tarifa->dias;
|
$diasTarifa = $tarifa->dias;
|
||||||
$valorTarifa = $tarifa->valor;
|
$valorTarifa = $tarifa->valor;
|
||||||
|
|
||||||
$cuenta = $historiale->cuentas->first();
|
$cuenta = $historiale->cuentas->first();
|
||||||
$vencimientoCuenta = Carbon::parse($cuenta->vencimiento);
|
$vencimientoCuenta = Carbon::parse($cuenta->vencimiento);
|
||||||
$nuevaFechaVencimiento = $vencimientoCuenta->addDays($diasTarifa);
|
$nuevaFechaVencimiento = $vencimientoCuenta->addDays($diasTarifa);
|
||||||
|
|
||||||
$newFechaInicio = Carbon::parse($historiale->fecha_inicio)->addDays($diasTarifa);
|
$newFechaInicio = Carbon::parse($historiale->fecha_inicio)->addDays($diasTarifa);
|
||||||
$newFechaFinal = Carbon::parse($historiale->fecha_final)->addDays($diasTarifa);
|
$newFechaFinal = Carbon::parse($historiale->fecha_final)->addDays($diasTarifa);
|
||||||
|
|
||||||
@@ -288,17 +288,14 @@ class ShowClientes extends Component
|
|||||||
$nuevoHistorial->save();
|
$nuevoHistorial->save();
|
||||||
|
|
||||||
$pantallas = $cuenta->servicio->completa;
|
$pantallas = $cuenta->servicio->completa;
|
||||||
//dd($pantallas);
|
//dd($pantallas);
|
||||||
for ($i=1; $i <= $pantallas ; $i++) {
|
for ($i = 1; $i <= $pantallas; $i++) {
|
||||||
$historial_cuenta = new Historial_cuenta;
|
$historial_cuenta = new Historial_cuenta;
|
||||||
$historial_cuenta->historial_id = $nuevoHistorial->id;
|
$historial_cuenta->historial_id = $nuevoHistorial->id;
|
||||||
$historial_cuenta->cuenta_id = $cuenta->id;
|
$historial_cuenta->cuenta_id = $cuenta->id;
|
||||||
$historial_cuenta->perfil = $i;
|
$historial_cuenta->perfil = $i;
|
||||||
$historial_cuenta->save();
|
$historial_cuenta->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$cuenta->vencimiento = $nuevaFechaVencimiento;
|
$cuenta->vencimiento = $nuevaFechaVencimiento;
|
||||||
$cuenta->save();
|
$cuenta->save();
|
||||||
|
|||||||
Reference in New Issue
Block a user