This commit is contained in:
amazuecos
2025-03-26 23:31:31 +01:00
14 changed files with 600 additions and 49 deletions

View File

@ -2,6 +2,7 @@
namespace App\Services;
use App\Controllers\Pedidos\Pedido;
use CodeIgniter\Config\BaseService;
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
@ -1877,7 +1878,7 @@ class PresupuestoService extends BaseService
$data_pedido = [
'total_precio' => $datos_presupuesto->total_aceptado,
'total_tirada' => $datos_presupuesto->tirada,
'estado' => $model_cliente->creditoDisponible($datos_presupuesto->cliente_id) ? "produccion" : "validacion",
'estado' => $model_cliente->creditoDisponible($datos_presupuesto->cliente_id, $datos_presupuesto->total_aceptado) ? "produccion" : "validacion",
'user_created_id' => auth()->user()->id,
'user_updated_id' => auth()->user()->id,
];
@ -1896,6 +1897,9 @@ class PresupuestoService extends BaseService
}
if ($id_linea != 0 && $pedido_id != 0) {
if($data_pedido['estado'] == "produccion"){
$response = (new Pedido())->to_produccion($pedido_id);
}
return true;
}
return false;

View File

@ -121,10 +121,10 @@ class ProductionService extends BaseService
"total_tirada" => $this->pedido->total_tirada,
"total_precio" => $this->pedido->total_precio
];
$ot_id = $this->otModel->insert($data);
$this->init($ot_id);
// $this->storeOrdenTrabajoUsers();
// $this->storeOrdenTrabajoDates();
$id = $this->otModel->insert($data);
$this->init($id);
$this->storeOrdenTrabajoUsers();
$this->storeOrdenTrabajoDates();
$this->storeAllTareas();
return $this->ot;
}