Eliminar desistimiento y loading en editar desistimiento

This commit is contained in:
2023-12-22 12:52:04 -03:00
parent afbadd520b
commit 8492d1df2b
5 changed files with 96 additions and 18 deletions

View File

@ -384,7 +384,7 @@ class Venta
{
try {
if ($this->validarData($data, ['fecha', 'devolucion'])) {
$pago = $this->pagoService->add(['fecha' => $data['fecha'], 'valor' => $data['devolucion']]);
$pago = $this->pagoService->add(['fecha' => $data['fecha'], 'valor' => str_replace(['.', ','], ['', '.'], $data['devolucion'])]);
$this->ventaRepository->edit($venta, ['resciliacion' => $pago->id]);
}
$tipoEstado = $this->tipoEstadoVentaRepository->fetchByDescripcion('desistida');
@ -394,4 +394,18 @@ class Venta
return false;
}
}
public function insistir(Model\Venta $venta): bool
{
try {
$pago = $venta->resciliacion();
$this->pagoService->delete($pago);
$estado = $venta->currentEstado();
error_log(var_export($estado,true));
$this->estadoVentaRepository->remove($estado);
$this->ventaRepository->edit($venta, ['resciliacion' => null]);
return true;
} catch (Implement\Exception\EmptyResult) {
return false;
}
}
}