diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index 9df7e7ce..743bb5c4 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -74,7 +74,7 @@ class OrdenTrabajoEntity extends Entity $m = model(OrdenTrabajoTarea::class); return $m->where("orden_trabajo_id", $this->attributes["id"])->findAll(); } - public function tareas_impresion() : array + public function tareas_impresion(): array { $m = model(OrdenTrabajoTarea::class); return $m->where("orden_trabajo_id", $this->attributes["id"])->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll() ?? []; @@ -144,11 +144,13 @@ class OrdenTrabajoEntity extends Entity helper('filesystem'); $path = WRITEPATH . 'uploads/' . $this->attributes["portada_path"]; $portada_path = null; - if ($path) { - if (file_exists($path)) { - $portada_path = $path; - } else { - $portada_path = null; + if ($this->attributes["portada_path"]) { + if ($path) { + if (file_exists($path)) { + $portada_path = $path; + } else { + $portada_path = null; + } } } return $portada_path; diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php index 57356b8b..0a95037a 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoUserEntity.php @@ -32,6 +32,8 @@ class OrdenTrabajoUserEntity extends Entity "retractilado5_user_id" => null, "prototipo_user_id" => null, "marcapaginas_user_id" => null, + "espiral_user_id" => null, + //FERRO "pendiente_ferro_user_id" => null, "ferro_en_cliente_user_id" => null, diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php index df4d0541..443bbcd0 100644 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoUser.php @@ -36,6 +36,7 @@ class OrdenTrabajoUser extends Model "retractilado5_user_id", "prototipo_user_id", "marcapaginas_user_id", + "espiral_user_id", //FERRO "pendiente_ferro_user_id", "ferro_en_cliente_user_id", diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index 784365a7..e90f025c 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -188,6 +188,7 @@ class ProductionService extends BaseService $this->setPedido($pedido); $this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first(); $this->statusColor = $this->ordenTrabajoConfig->OT_COLORS["sin_imprimir"]; + $this->updateProgress(); return $this; } catch (\Throwable $th) { throw $th; @@ -305,6 +306,7 @@ class ProductionService extends BaseService $status = false; if ($this->otDate->where('orden_trabajo_id', $this->ot->id)->countAllResults() == 0) { $status = $this->storeOrdenTrabajoDates(); + $this->resetAllTareas(); } return $status; } @@ -1266,7 +1268,7 @@ class ProductionService extends BaseService } return $pedidoUserDates; } - public function getTiempoProcesamientoHHMM(): string + public function getTiempoProcesamientoHHMM(): ?string { $time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas()); $seconds = array_sum($time_tareas_seconds); @@ -1303,15 +1305,18 @@ class ProductionService extends BaseService $status = false; $total = count($userDates) + count($pedidoUserDates); if ($this->ot->estado != "F") { - foreach ($userDates as $key => $value) { - if ($this->ot->dates()->{$key} != null) $fill_dates++; - } - foreach ($pedidoUserDates as $key => $value) { - if ($this->pedido->{$key} != null) $fill_dates++; - } + if ($this->ot->dates()) { - $progreso = (float) $fill_dates / $total * 100; - $status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso, 2)]); + foreach ($userDates as $key => $value) { + if ($this->ot->dates()->{$key} != null) $fill_dates++; + } + foreach ($pedidoUserDates as $key => $value) { + if ($this->pedido->{$key} != null) $fill_dates++; + } + + $progreso = (float) $fill_dates / $total * 100; + $status = $this->otModel->update($this->ot->id, ["progreso" => round($progreso, 2)]); + } } else { $status = $this->otModel->update($this->ot->id, ["progreso" => 100]); } diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php index d9f0fcfd..1d2d2524 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otPreimpresionReview.php @@ -14,7 +14,7 @@ Revisar formato - + /> diff --git a/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo copy.php b/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo copy.php deleted file mode 100644 index c750a9ea..00000000 --- a/ci4/app/Views/themes/vuexy/pdfs/orden_trabajo copy.php +++ /dev/null @@ -1,356 +0,0 @@ -get('settings'); -?> - - - - - - - - - - - - - - - - - - -= $presupuesto->titulo ?>[OT:= $ot->id ?>] - - - - - - id ?>> - - = $presupuesto->titulo ?> - = Time::now()->format("d/m/Y H:i:s") ?> - - - - - portada_path)) ?>"> - - - - = $presupuesto->presupuestoLineaImpresion()->isRotativa() ? "Rotativa" : "Plana" ?> - - - = $dates->fecha_encuadernado_at ? week_day_humanize(Time::createFromFormat("Y-m-d", $dates->fecha_encuadernado_at)->getDayOfWeek(), true) : "" ?> - Comercial: = $cliente->first_name . " " . $cliente->comercial()->last_name ?> - - "> - - " id="fecha_encuadernado_at">= $dates->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $dates->fecha_encuadernado_at)?->format("d/m/Y") : "" ?> - - - - - IN - = $ubicacion ?> - - - PO - = $ubicacion ?> - - - PL - = $ubicacion ?> - - - EN - = $ubicacion ?> - - - MA - = $ubicacion ?> - - - - - - - - - RF - - - - - - - BCLF 100 - - - 0:3 - - - EM 300 - - - BRILLO - - - - - = $ot->id ?> - - - - - - - - - - - - - - - Cliente - - = $cliente->nombre ?> - - - - Titulo - - = $presupuesto->titulo ?> - - - - - ISBN - = $presupuesto->isbn ?> - - - CIF - = $cliente->cif ?> - - - - - - - - - A - - - - - A - - - - - A - - - - - A - - - - - - - Imposicion - 400x400 - - - - - - - - - - - IMP. INTERIOR - - - - Páginas - Ejemplares - Tintas - Formas - Máquina - Clics - Tiempo - - - = $presupuesto->paginas ?> - = $presupuesto->tirada ?> - ?? - = json_decode($linea_impresion->formas)->formas ?> - = $linea_impresion->maquina()->nombre ?> - = $linea_impresion->rotativa_clicks_total ?> - = float_seconds_to_hhmm_string($linea_impresion->horas_maquina * 3600) ?> - - - = $linea_impresion->papel_impresion ?> - = $linea_impresion->papel_impresion()->gramaje . " " . "gr" ?> - = number_format($linea_impresion->rotativa_metros_total, 2, ',', '.') ?> metros - - - - - Comentarios impresión interior - - - - - - - - - - - - IMP. CUBIERTA - - - - Tintas - Ejemplares - Maquina - Marcapaginas - Tiempo - - - ?? - = $presupuesto->tirada ?> - = $linea_cubierta->maquina()->nombre ?> - = $presupuesto->marcapaginas ? "SI" : "NO" ?> - = float_seconds_to_hhmm_string($linea_cubierta->horas_maquina * 3600) ?> - - - = json_decode($linea_cubierta->formas)->maquina_ancho ?>x= json_decode($linea_cubierta->formas)->maquina_alto ?> - = $papel_formato->ancho ?>x= $papel_formato->alto ?> - = $linea_cubierta->papel_impresion ?> - = $linea_cubierta->papel_impresion()->gramaje . " " . "gr" ?> - - - - - Comentarios cubierta - - - - - - - - ENCUADERNACIÓN - - - Plastificado - = $acabados[0]->tarifa()->nombre ?> - UVI - ?? - - - - - MAQUINA - = implode("/", array_map(fn($q) => $q->nombre, $acabados[0]->maquinas())) ?> - - - - - OPERARIO - = $ot->users()->plastificado_by->getFullName() ?> - - - 0): ?> - - - Encuadernacion - Solapas - Sobrecubierta - Plegado - Guardas - Retractilado - Marcapáginas - - $value): ?> - - = $value->tarifa()->nombre ?> - = $presupuesto->solapas ? "SI" : "NO" ?> - = $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?> - ______ pliegos de ______ - = $presupuesto->guardas ? "SI" : "NO" ?> - = $presupuesto->retractilado ? "SI" : "NO" ?> - = $presupuesto->marcapaginas ? "SI" : "NO" ?> - - - - - Comentarios encuadernacion: - - - - - - - - - - LOGISTICA - - - Peso Unidad - Peso Pedido - Cajas - Corte Pie - - - = number_format($peso_unidad, 2, ',', '.') ?> gr - = $peso_pedido > 1000 ? number_format($peso_pedido / 1000, 2, ',', '.') . " kg" : number_format($peso_pedido, 2, ',', '.') . " gr" ?> - - - - - - - - Comentarios logistica: - - - - - - - - - - - - - - - - - - - - - -
= $ot->id ?>
= $cliente->nombre ?>
= $presupuesto->titulo ?>
-