Se agrega editar Bono Pie

This commit is contained in:
2021-04-05 16:15:54 -04:00
parent fa0395bc7b
commit 18986c6e17
2 changed files with 40 additions and 1 deletions

View File

@ -52,6 +52,16 @@ class Bonos
}
public static function do_edit()
{
d(post());
$id_venta = get('venta');
$venta = model(Venta::class)->findOne($id_venta);
$bono = $venta->bonoPie();
$valor = post('valor') * $bono->pago()->uf();
$pago = $bono->pago();
if ($valor != $bono->pago()->valor()) {
$pago->valor = $valor;
$pago->save();
}
header('Location: ' . nUrl('ventas', 'show', ['venta' => $venta->id]));
exit();
}
}