mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into mod/importe_fijo_margen
This commit is contained in:
@ -119,6 +119,7 @@ return [
|
|||||||
//IMPRESION
|
//IMPRESION
|
||||||
"impresion_bn" => "Impresión BN",
|
"impresion_bn" => "Impresión BN",
|
||||||
"cubierta" => "Cubierta/Portada",
|
"cubierta" => "Cubierta/Portada",
|
||||||
|
"sobrecubierta" => "Sobrecubierta",
|
||||||
"guarda" => "Guarda",
|
"guarda" => "Guarda",
|
||||||
"encuadernacion" => "Encuadernación",
|
"encuadernacion" => "Encuadernación",
|
||||||
|
|
||||||
|
|||||||
@ -13,20 +13,22 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
|||||||
protected $useAutoIncrement = true;
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
const SORTABLE = [
|
const SORTABLE = [
|
||||||
0 => "t1.nombre",
|
0 => "t1.id",
|
||||||
1 => "t2.nombre",
|
1 => "t1.nombre",
|
||||||
2 => "t1.gramaje",
|
2 => "t2.nombre",
|
||||||
3 => "t1.interior",
|
3 => "t1.gramaje",
|
||||||
4 => "t1.bn",
|
4 => "t1.interior",
|
||||||
5 => "t1.color",
|
5 => "t1.bn",
|
||||||
6 => "t1.cubierta",
|
6 => "t1.color",
|
||||||
7 => "t1.use_for_tapa_dura",
|
7 => "t1.cubierta",
|
||||||
8 => "t1.sobrecubierta",
|
8 => "t1.use_for_tapa_dura",
|
||||||
9 => "t1.guardas",
|
9 => "t1.sobrecubierta",
|
||||||
10 => "t1.inkjet",
|
10 => "t1.guardas",
|
||||||
11 => "t1.rotativa",
|
11 => "t1.inkjet",
|
||||||
12 => "t1.isActivo",
|
12 => "t1.rotativa",
|
||||||
13 => "t1.use_in_client",
|
13 => "t1.isActivo",
|
||||||
|
14 => "t1.use_in_client",
|
||||||
|
15 => "t1.precio_tonelada",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -173,7 +175,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
|||||||
->groupStart()
|
->groupStart()
|
||||||
->like("t1.nombre", $search)
|
->like("t1.nombre", $search)
|
||||||
->orLike("t1.gramaje", $search)
|
->orLike("t1.gramaje", $search)
|
||||||
->orLike("t1.nombre", $search)
|
->orLike("t1.precio_tonelada", $search)
|
||||||
->orLike("t1.gramaje", $search)
|
->orLike("t1.gramaje", $search)
|
||||||
->orLike("t2.nombre", $search)
|
->orLike("t2.nombre", $search)
|
||||||
->groupEnd();
|
->groupEnd();
|
||||||
|
|||||||
@ -271,7 +271,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
|||||||
t1.total_presupuesto AS total_presupuesto, t1.total_presupuesto AS total_presupuesto, t6.estado AS estado"
|
t1.total_presupuesto AS total_presupuesto, t1.total_presupuesto AS total_presupuesto, t6.estado AS estado"
|
||||||
);
|
);
|
||||||
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
|
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
|
||||||
$builder->join("users t3", "t1.user_update_id = t3.id", "left");
|
$builder->join("users t3", "t2.comercial_id = t3.id", "left");
|
||||||
$builder->join("lg_paises t5", "t1.pais_id = t5.id", "left");
|
$builder->join("lg_paises t5", "t1.pais_id = t5.id", "left");
|
||||||
$builder->join("presupuesto_estados t6", "t1.estado_id = t6.id", "left");
|
$builder->join("presupuesto_estados t6", "t1.estado_id = t6.id", "left");
|
||||||
|
|
||||||
@ -508,15 +508,18 @@ class PresupuestoModel extends \App\Models\BaseModel
|
|||||||
'excluir_rotativa' => $excluir_rotativa,
|
'excluir_rotativa' => $excluir_rotativa,
|
||||||
|
|
||||||
];
|
];
|
||||||
|
/* Actualizacion */
|
||||||
if ($id != 0) {
|
if ($id != 0) {
|
||||||
$fields['id'] = $id;
|
$fields['id'] = $id;
|
||||||
$fields['updated_at'] = date('Y-m-d H:i:s', now());
|
$fields['updated_at'] = date('Y-m-d H:i:s', now());
|
||||||
}
|
$fields['user_update_id'] = auth()->id();
|
||||||
|
|
||||||
if ($id != 0) {
|
|
||||||
$this->db->table($this->table)->where('id', $id)->update($fields);
|
$this->db->table($this->table)->where('id', $id)->update($fields);
|
||||||
return $id;
|
return $id;
|
||||||
} else {
|
}
|
||||||
|
/* Inserccion */
|
||||||
|
else {
|
||||||
|
$fields['user_created_id'] = auth()->id();
|
||||||
|
$fields['user_update_id'] = auth()->id();
|
||||||
$this->db->table($this->table)->insert($fields);
|
$this->db->table($this->table)->insert($fields);
|
||||||
return $this->db->insertID();
|
return $this->db->insertID();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -228,8 +228,8 @@ class ProductionService extends BaseService
|
|||||||
$this->maquinaModel = model(MaquinaModel::class);
|
$this->maquinaModel = model(MaquinaModel::class);
|
||||||
$this->otModel = model(OrdenTrabajoModel::class);
|
$this->otModel = model(OrdenTrabajoModel::class);
|
||||||
$ot = $this->otModel->find($orden_trabajo_id);
|
$ot = $this->otModel->find($orden_trabajo_id);
|
||||||
if($ot == null){
|
if ($ot == null) {
|
||||||
throw new Exception(lang('Produccion.errors.ot_not_found',['ot_id' => $orden_trabajo_id]));
|
throw new Exception(lang('Produccion.errors.ot_not_found', ['ot_id' => $orden_trabajo_id]));
|
||||||
}
|
}
|
||||||
$this->ot = $ot;
|
$this->ot = $ot;
|
||||||
$pedido = $this->ot->pedido();
|
$pedido = $this->ot->pedido();
|
||||||
@ -610,11 +610,11 @@ class ProductionService extends BaseService
|
|||||||
}
|
}
|
||||||
return ["tareas" => $tareas];
|
return ["tareas" => $tareas];
|
||||||
}
|
}
|
||||||
public function getTareasWithMaquina(int $maquina_id,?array $tareaEstados = null) : ?array
|
public function getTareasWithMaquina(int $maquina_id, ?array $tareaEstados = null): ?array
|
||||||
{
|
{
|
||||||
return $this->otModel->queryMaquinaTareas($maquina_id, $tareaEstados)
|
return $this->otModel->queryMaquinaTareas($maquina_id, $tareaEstados)
|
||||||
->where('ordenes_trabajo.id', $this->ot->id)
|
->where('ordenes_trabajo.id', $this->ot->id)
|
||||||
->get()->getResult(OrdenTrabajoTareaEntity::class);
|
->get()->getResult(OrdenTrabajoTareaEntity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPdf()
|
public function getPdf()
|
||||||
@ -1439,6 +1439,16 @@ class ProductionService extends BaseService
|
|||||||
}
|
}
|
||||||
return $pedidoUserDates;
|
return $pedidoUserDates;
|
||||||
}
|
}
|
||||||
|
public function getTiempoEstimadoTotalTareasSeconds(): int
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$time_tareas_seconds = array_map(fn($q) => $q->tiempo_estimado ?? 0, $this->ot->tareas());
|
||||||
|
$seconds = array_sum($time_tareas_seconds);
|
||||||
|
return $seconds;
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
public function getTiempoProcesamientoHHMMSS(): ?string
|
public function getTiempoProcesamientoHHMMSS(): ?string
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -1490,33 +1500,36 @@ class ProductionService extends BaseService
|
|||||||
}
|
}
|
||||||
return $uvi;
|
return $uvi;
|
||||||
}
|
}
|
||||||
//TODO ACTUALIZAR
|
|
||||||
public function updateProgress(): bool
|
public function updateProgress(): bool
|
||||||
{
|
{
|
||||||
$userDates = $this->ordenTrabajoConfig->DATE_USER_MAPPING;
|
$progress = $this->getOtProgress();
|
||||||
$pedidoUserDates = $this->ordenTrabajoConfig->DATE_USER_MAPPING_PEDIDO;
|
|
||||||
|
|
||||||
$fill_dates = 0;
|
|
||||||
$status = false;
|
|
||||||
$total = count($userDates) + count($pedidoUserDates);
|
|
||||||
if ($this->ot->estado != "F") {
|
if ($this->ot->estado != "F") {
|
||||||
if ($this->ot->dates()) {
|
$status = $this->otModel->update($this->ot->id, ["progreso" => round($progress, 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 {
|
} else {
|
||||||
$status = $this->otModel->update($this->ot->id, ["progreso" => 100]);
|
$status = $this->otModel->update($this->ot->id, ["progreso" => 100]);
|
||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
public function getOtProgress()
|
||||||
|
{
|
||||||
|
$datesWithTime = $this->getOrdenTrabajoTareaDatesWithTiempoEstimado();
|
||||||
|
$tiempo_estimado_total = $this->getTiempoEstimadoTotalTareasSeconds();
|
||||||
|
$progress = 0;
|
||||||
|
$otDates = $this->ot->dates();
|
||||||
|
foreach ($datesWithTime as $key => $dateWithTime) {
|
||||||
|
["date" => $date, "tiempo_estimado" => $tiempo_estimado] = $dateWithTime;
|
||||||
|
try {
|
||||||
|
if ($otDates->{$date}) {
|
||||||
|
$progress += $tiempo_estimado / $tiempo_estimado_total * 100;
|
||||||
|
}
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
//throw $th;
|
||||||
|
$progress += 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $progress;
|
||||||
|
}
|
||||||
public function getOtColorStatus(): string
|
public function getOtColorStatus(): string
|
||||||
{
|
{
|
||||||
if ($this->ot->dates()) {
|
if ($this->ot->dates()) {
|
||||||
@ -2194,6 +2207,15 @@ class ProductionService extends BaseService
|
|||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
public function getOrdenTrabajoTareaDatesWithTiempoEstimado(): array
|
||||||
|
{
|
||||||
|
$dates = [];
|
||||||
|
foreach ($this->ot->tareas() as $key => $tarea) {
|
||||||
|
$dates[$tarea->id]["date"] = $this->getOrdenTrabajoTareaDate($tarea);
|
||||||
|
$dates[$tarea->id]["tiempo_estimado"] = $tarea->tiempo_estimado;
|
||||||
|
}
|
||||||
|
return $dates;
|
||||||
|
}
|
||||||
public function getOrdenTrabajoTareaDates(): array
|
public function getOrdenTrabajoTareaDates(): array
|
||||||
{
|
{
|
||||||
$dates = [];
|
$dates = [];
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
<table id="tableOfPapelesimpresion" class="table table-striped table-hover" style="width: 100%;">
|
<table id="tableOfPapelesimpresion" class="table table-striped table-hover" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th><?= lang('PapelImpresion.id') ?></th>
|
||||||
<th><?= lang('PapelImpresion.nombre') ?></th>
|
<th><?= lang('PapelImpresion.nombre') ?></th>
|
||||||
<th><?= lang('PapelGenerico.papelGenerico') ?></th>
|
<th><?= lang('PapelGenerico.papelGenerico') ?></th>
|
||||||
<th><?= lang('PapelImpresion.gramaje') ?></th>
|
<th><?= lang('PapelImpresion.gramaje') ?></th>
|
||||||
@ -32,6 +33,7 @@
|
|||||||
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
<th><?= lang('PapelImpresion.rotativa') ?></th>
|
||||||
<th><?= lang('PapelImpresion.activo') ?></th>
|
<th><?= lang('PapelImpresion.activo') ?></th>
|
||||||
<th><?= lang('PapelImpresion.useInClient') ?></th>
|
<th><?= lang('PapelImpresion.useInClient') ?></th>
|
||||||
|
<th><?= lang('PapelImpresion.precioTonelada') ?></th>
|
||||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -80,7 +82,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
stateSave: true,
|
stateSave: true,
|
||||||
order: [[1, 'asc']],
|
order: [[2, 'asc']],
|
||||||
language: {
|
language: {
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
@ -98,6 +100,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
columns : [
|
columns : [
|
||||||
|
{ 'data': 'id' },
|
||||||
{ 'data': 'nombre' },
|
{ 'data': 'nombre' },
|
||||||
{ 'data': 'papel_generico_id' },
|
{ 'data': 'papel_generico_id' },
|
||||||
{ 'data': 'gramaje', render : (d) => `<span class="autonumeric">${d}</span>`},
|
{ 'data': 'gramaje', render : (d) => `<span class="autonumeric">${d}</span>`},
|
||||||
@ -112,13 +115,14 @@
|
|||||||
{ 'data': 'rotativa' },
|
{ 'data': 'rotativa' },
|
||||||
{ 'data': 'isActivo' },
|
{ 'data': 'isActivo' },
|
||||||
{ 'data': 'use_in_client' },
|
{ 'data': 'use_in_client' },
|
||||||
|
{ 'data': 'precio_tonelada' },
|
||||||
{ 'data': actionBtns }
|
{ 'data': actionBtns }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
theTable.on( 'draw.dt', function () {
|
theTable.on( 'draw.dt', function () {
|
||||||
const boolCols = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
const boolCols = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
|
||||||
for (let coln of boolCols) {
|
for (let coln of boolCols) {
|
||||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||||
|
|||||||
@ -16,14 +16,14 @@ class OrdenTrabajoDatatable {
|
|||||||
|
|
||||||
this.datatableColumns = [
|
this.datatableColumns = [
|
||||||
{ data: 'pdf_check', searchable: false, sortable: false, render: d => `<input class="form-check-input pdf-check" data-id="${d}" type="checkbox">` },
|
{ data: 'pdf_check', searchable: false, sortable: false, render: d => `<input class="form-check-input pdf-check" data-id="${d}" type="checkbox">` },
|
||||||
{ data: 'id', searchable: false, sortable: true },
|
{ data: 'id', searchable: true, sortable: true },
|
||||||
{ data: 'pedido_id', searchable: false, sortable: false },
|
{ data: 'pedido_id', searchable: true, sortable: true },
|
||||||
{ data: 'fecha_encuadernado_at', searchable: false, sortable: false },
|
{ data: 'fecha_encuadernado_at',name:"pedidos.fecha_encuadernado", searchable: true, sortable: true },
|
||||||
{ data: 'cliente_nombre', searchable: false, sortable: false },
|
{ data: 'cliente_nombre', name:"clientes.nombre", searchable: true, sortable: false },
|
||||||
{ data: 'presupuesto_titulo', searchable: false, sortable: false },
|
{ data: 'presupuesto_titulo', name:"presupuestos.titulo", searchable: true, sortable: true },
|
||||||
{ data: 'ubicacion_nombre', searchable: false, sortable: false },
|
{ data: 'ubicacion_nombre', name:"ubicaciones.nombre", searchable: true, sortable: true },
|
||||||
{ data: 'total_tirada', searchable: false, sortable: false, render: (d) => `<span class="autonumeric">${d}</span>` },
|
{ data: 'total_tirada', name:"pedidos.total_tirada",searchable: true, sortable: true, render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||||
{ data: 'tipo_presupuesto_impresion', searchable: false, sortable: false },
|
{ data: 'tipo_presupuesto_impresion', name:"tipos_presupuestos.codigo", searchable: true, sortable: true },
|
||||||
{
|
{
|
||||||
data: 'logo', searchable: false, sortable: false, render: (d, t) => {
|
data: 'logo', searchable: false, sortable: false, render: (d, t) => {
|
||||||
return `<div class="logo-container">
|
return `<div class="logo-container">
|
||||||
@ -33,7 +33,7 @@ class OrdenTrabajoDatatable {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
data: 'progreso', searchable: false, sortable: false, render: (d, t) => {
|
data: 'progreso',name:"ordenes_trabajo.progreso", searchable: false, sortable: true, render: (d, t) => {
|
||||||
return `<div class="progress border rounded-2" style="height: 1rem;">
|
return `<div class="progress border rounded-2" style="height: 1rem;">
|
||||||
<div id="ot-progress-bar" class="progress-bar" role="progressbar" style="width: ${parseInt(d)}%;" aria-valuenow="${d}" aria-valuemin="0" aria-valuemax="100">${d}%</div>
|
<div id="ot-progress-bar" class="progress-bar" role="progressbar" style="width: ${parseInt(d)}%;" aria-valuenow="${d}" aria-valuemin="0" aria-valuemax="100">${d}%</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user