forked from nathalie/pedi2
Formato
This commit is contained in:
parent
f909a78e74
commit
ead7483e19
1 changed files with 52 additions and 48 deletions
|
@ -103,7 +103,8 @@ class Subpedido extends Model
|
|||
}
|
||||
|
||||
//Actualiza el pedido, agregando o quitando del subpedido según sea necesario. Debe ser llamado desde el controlador de subpedidos, luego de validar que los parámetros $producto y $cantidad son correctos. También calcula el subtotal por producto.
|
||||
public function syncProducto(Producto $producto, Int $cantidad, string $notas) {
|
||||
public function syncProducto(Producto $producto, int $cantidad, string $notas)
|
||||
{
|
||||
if ($cantidad) {
|
||||
//si la cantidad es 1 o más se agrega el producto o actualiza la cantidad
|
||||
$this->productos()->syncWithoutDetaching([
|
||||
|
@ -119,17 +120,20 @@ class Subpedido extends Model
|
|||
}
|
||||
}
|
||||
|
||||
public function toggleAprobacion(bool $aprobacion) {
|
||||
public function toggleAprobacion(bool $aprobacion)
|
||||
{
|
||||
$this->aprobado = $aprobacion;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function generarHTML() {
|
||||
public function generarHTML()
|
||||
{
|
||||
$view = view("pdfgen.subpedido_tabla", ["subpedido" => $this]);
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
public function syncDevoluciones(float $total, string $notas) {
|
||||
public function syncDevoluciones(float $total, string $notas)
|
||||
{
|
||||
$this->devoluciones_total = $total;
|
||||
$this->devoluciones_notas = $notas;
|
||||
$this->save();
|
||||
|
|
Loading…
Add table
Reference in a new issue