mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/problemas_presu_admin' into 'main'
Fix/problemas presu admin See merge request jjimenez/safekat!599
This commit is contained in:
@ -208,6 +208,11 @@ class Facturas extends \App\Controllers\BaseResourceController
|
|||||||
['title' => lang("Facturas.facturaList"), 'route' => route_to('facturasList'), 'active' => true]
|
['title' => lang("Facturas.facturaList"), 'route' => route_to('facturasList'), 'active' => true]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$userModel = model('App\Models\UserModel');
|
||||||
|
$factura->created_by = $userModel->getFullName($factura->user_created_id);
|
||||||
|
$factura->updated_by = $userModel->getFullName($factura->user_updated_id);
|
||||||
|
$factura->created_at_footer = $factura->created_at ? date(' H:i d/m/Y', strtotime($factura->created_at)) : '';
|
||||||
|
$factura->updated_at_footer = $factura->updated_at ? date(' H:i d/m/Y', strtotime($factura->updated_at)) : '';
|
||||||
$this->viewData['facturaEntity'] = $factura;
|
$this->viewData['facturaEntity'] = $factura;
|
||||||
|
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Facturas.factura') . ' ' . lang('Basic.global.edit3');
|
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Facturas.factura') . ' ' . lang('Basic.global.edit3');
|
||||||
|
|||||||
@ -273,8 +273,8 @@ class Pedido extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$this->obtenerDatosFormulario($pedidoEntity);
|
$this->obtenerDatosFormulario($pedidoEntity);
|
||||||
|
|
||||||
$this->viewData['pedidoEntity'] = $pedidoEntity;
|
|
||||||
|
|
||||||
|
$this->viewData['pedidoEntity'] = $pedidoEntity;
|
||||||
|
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Pedidos.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Pedidos.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||||
|
|
||||||
@ -382,6 +382,12 @@ class Pedido extends \App\Controllers\BaseResourceController
|
|||||||
$pedidoEntity->fecha_impresion_text = $pedidoEntity->fecha_impresion ? date('d/m/Y', strtotime($pedidoEntity->fecha_impresion)) : '';
|
$pedidoEntity->fecha_impresion_text = $pedidoEntity->fecha_impresion ? date('d/m/Y', strtotime($pedidoEntity->fecha_impresion)) : '';
|
||||||
$pedidoEntity->fecha_encuadernado_text = $pedidoEntity->fecha_encuadernado ? date('d/m/Y', strtotime($pedidoEntity->fecha_encuadernado)) : '';
|
$pedidoEntity->fecha_encuadernado_text = $pedidoEntity->fecha_encuadernado ? date('d/m/Y', strtotime($pedidoEntity->fecha_encuadernado)) : '';
|
||||||
$pedidoEntity->fecha_entrega_externo_text = $pedidoEntity->fecha_entrega_externo ? date('d/m/Y', strtotime($pedidoEntity->fecha_entrega_externo)) : '';
|
$pedidoEntity->fecha_entrega_externo_text = $pedidoEntity->fecha_entrega_externo ? date('d/m/Y', strtotime($pedidoEntity->fecha_entrega_externo)) : '';
|
||||||
|
|
||||||
|
$userModel = model('App\Models\UserModel');
|
||||||
|
$pedidoEntity->created_by = $userModel->getFullName($pedidoEntity->user_created_id);
|
||||||
|
$pedidoEntity->updated_by = $userModel->getFullName($pedidoEntity->user_updated_id);
|
||||||
|
$pedidoEntity->created_at_footer = $pedidoEntity->created_at ? date(' H:i d/m/Y', strtotime($pedidoEntity->created_at)) : '';
|
||||||
|
$pedidoEntity->updated_at_footer = $pedidoEntity->updated_at ? date(' H:i d/m/Y', strtotime($pedidoEntity->updated_at)) : '';
|
||||||
}
|
}
|
||||||
public function get_xml_pedido($pedido_id)
|
public function get_xml_pedido($pedido_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -201,7 +201,7 @@ class Importadorpresupuestos extends \App\Controllers\BaseResourceController
|
|||||||
'libroFresadoTapaDura' => 'Tapa Dura al Cromo Fresada',
|
'libroFresadoTapaDura' => 'Tapa Dura al Cromo Fresada',
|
||||||
'libroFresadoTapaBlanda' => 'Rústica Fresada',
|
'libroFresadoTapaBlanda' => 'Rústica Fresada',
|
||||||
'libroCosidoTapaDura' => 'Tapa Dura al Cromo Cosida Hilo',
|
'libroCosidoTapaDura' => 'Tapa Dura al Cromo Cosida Hilo',
|
||||||
'libroCosidoTapaBlanda' => 'Rústica Cosida Hilo vegetal',
|
'libroCosidoTapaBlanda' => 'Rústica Cosido Hilo vegetal',
|
||||||
'libroEspiralTapaDura' => 'Espiral',
|
'libroEspiralTapaDura' => 'Espiral',
|
||||||
'libroGrapado' => 'Cosido a caballete 2 grapas'
|
'libroGrapado' => 'Cosido a caballete 2 grapas'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -614,6 +614,14 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
$data['resumen']['total_precio_unidad'] = $presupuesto->total_precio_unidad;
|
$data['resumen']['total_precio_unidad'] = $presupuesto->total_precio_unidad;
|
||||||
$data['resumen']['total_factor'] = is_numeric($presupuesto->total_factor) ? $presupuesto->total_factor : 0;
|
$data['resumen']['total_factor'] = is_numeric($presupuesto->total_factor) ? $presupuesto->total_factor : 0;
|
||||||
$data['resumen']['total_factor_ponderado'] = is_numeric($presupuesto->total_factor_ponderado) ? $presupuesto->total_factor_ponderado : 0;
|
$data['resumen']['total_factor_ponderado'] = is_numeric($presupuesto->total_factor_ponderado) ? $presupuesto->total_factor_ponderado : 0;
|
||||||
|
|
||||||
|
$data['resumen']['iva_reducido'] = $presupuesto->iva_reducido;
|
||||||
|
|
||||||
|
$data['created_by'] = model('App\Models\UserModel')->getFullName($presupuesto->user_created_id);
|
||||||
|
$data['updated_by'] = model('App\Models\UserModel')->getFullName($presupuesto->user_update_id);
|
||||||
|
$data['created_at'] = date(' H:i d/m/Y', strtotime($presupuesto->created_at));
|
||||||
|
$data['updated_at'] = date(' H:i d/m/Y', strtotime($presupuesto->updated_at));
|
||||||
|
|
||||||
if ($presupuesto->estado_id == 2) {
|
if ($presupuesto->estado_id == 2) {
|
||||||
$data['resumen']['total_aceptado'] = $presupuesto->total_aceptado;
|
$data['resumen']['total_aceptado'] = $presupuesto->total_aceptado;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -478,7 +478,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$direcciones = $reqData['direcciones'] ?? [];
|
$direcciones = $reqData['direcciones'] ?? [];
|
||||||
|
|
||||||
$tipo_impresion_id = intval($reqData['tipo_presupuesto_id'] ?? 0) == 0?
|
$tipo_impresion_id = intval($reqData['tipo_presupuesto_id'] ?? 0) == 0 ?
|
||||||
$this->getTipoImpresion($tipo, $cubierta['tipoCubierta']) : intval($reqData['tipo_presupuesto_id']);
|
$this->getTipoImpresion($tipo, $cubierta['tipoCubierta']) : intval($reqData['tipo_presupuesto_id']);
|
||||||
$lomoRedondo = $cubierta['lomoRedondo'] ?? 0;
|
$lomoRedondo = $cubierta['lomoRedondo'] ?? 0;
|
||||||
|
|
||||||
@ -1002,7 +1002,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$direcciones = $reqData['direcciones'] ?? [];
|
$direcciones = $reqData['direcciones'] ?? [];
|
||||||
|
|
||||||
if($tipo != "")
|
if ($tipo != "")
|
||||||
$tipo_impresion_id = $this->getTipoImpresion($tipo, $cubierta['tipoCubierta']);
|
$tipo_impresion_id = $this->getTipoImpresion($tipo, $cubierta['tipoCubierta']);
|
||||||
else
|
else
|
||||||
$tipo_impresion_id = $reqData['tipo_presupuesto_id'] ?? 0;
|
$tipo_impresion_id = $reqData['tipo_presupuesto_id'] ?? 0;
|
||||||
@ -1087,19 +1087,28 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$errors = $resultado_presupuesto['errors'];
|
$errors = $resultado_presupuesto['errors'];
|
||||||
foreach ($errors as $error) {
|
foreach ($errors as $error) {
|
||||||
if (!empty($error)) {
|
if (!empty($error)) {
|
||||||
return $this->respond([
|
if ($this->request) {
|
||||||
'error' => $error,
|
return $this->respond([
|
||||||
]);
|
'error' => $error,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return $error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (isset($resultado_presupuesto['exception'])) {
|
} else if (isset($resultado_presupuesto['exception'])) {
|
||||||
return $this->respond([
|
if($this->request) {
|
||||||
'error' => $resultado_presupuesto['exception'],
|
return $this->respond([
|
||||||
'file' => $resultado_presupuesto['file'],
|
'error' => $resultado_presupuesto['exception'],
|
||||||
'line' => $resultado_presupuesto['line'],
|
'file' => $resultado_presupuesto['file'],
|
||||||
]);
|
'line' => $resultado_presupuesto['line'],
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return $resultado_presupuesto['exception'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// seleccionamos el peso de la tirada seleccionada
|
// seleccionamos el peso de la tirada seleccionada
|
||||||
$peso_libro = $resultado_presupuesto['peso'][array_search($selected_tirada, $tirada)];
|
$peso_libro = $resultado_presupuesto['peso'][array_search($selected_tirada, $tirada)];
|
||||||
|
|
||||||
@ -1893,14 +1902,14 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
return $current->precio < $previous->precio ? $current : $previous;
|
return $current->precio < $previous->precio ? $current : $previous;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (count($tarifas_envio) > 0){
|
if (count($tarifas_envio) > 0) {
|
||||||
$tarifa_envio_final = $tarifas_envio[0];
|
$tarifa_envio_final = $tarifas_envio[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$coste = $tarifa_envio_final->precio;
|
$coste = $tarifa_envio_final->precio;
|
||||||
$margen = $tarifa_envio_final->margen;
|
$margen = $tarifa_envio_final->margen;
|
||||||
|
|
||||||
if(!isset($return_data['id'])){
|
if (!isset($return_data['id'])) {
|
||||||
$return_data['id'] = $tarifa_envio_final->id;
|
$return_data['id'] = $tarifa_envio_final->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -378,14 +378,16 @@ class Presupuestotiradasalternativas extends \App\Controllers\BaseResourceContro
|
|||||||
$json_data_extra = json_decode($json_data_extra, true);
|
$json_data_extra = json_decode($json_data_extra, true);
|
||||||
if (count($json_data_extra) > 0) {
|
if (count($json_data_extra) > 0) {
|
||||||
$extra = new Presupuestoserviciosextra();
|
$extra = new Presupuestoserviciosextra();
|
||||||
$POD = (new \App\Models\Configuracion\ConfigVariableModel())->getVariable('POD')->value;
|
$json_data_extra = array_map(function($item) {
|
||||||
$result = $extra->getServiciosExtra($json_data_extra, $reqData['tirada'], $POD);
|
return $item['tarifa_id'];
|
||||||
|
}, $json_data_extra);
|
||||||
|
$result = $extra->getServiciosExtra($json_data_extra);
|
||||||
if (count($result) > 0) {
|
if (count($result) > 0) {
|
||||||
foreach ($result as $servicio) {
|
foreach ($result as $servicio) {
|
||||||
$servicios->coste += round(floatval($servicio->total), 2);
|
$servicios->coste += round(floatval($servicio->precio), 2);
|
||||||
$base = round(floatval($servicio->total / (1 + $servicio->margen / 100.0)), 2);
|
$base = round(floatval($servicio->precio / (1 + floatval($servicio->margen) / 100.0)), 2);
|
||||||
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
$base = round(floatval($base / $datosPedido->tirada) , 2)* $datosPedido->tirada;
|
||||||
$servicios->margen += round(floatval($servicio->total - $base), 2);
|
$servicios->margen += round(floatval($servicio->precio - $base), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -264,6 +264,9 @@ return [
|
|||||||
|
|
||||||
'totalAceptado' => 'Total aceptado',
|
'totalAceptado' => 'Total aceptado',
|
||||||
|
|
||||||
|
'created_by_at' => 'Creado: ',
|
||||||
|
'updated_by_at' => 'Actualizado: ',
|
||||||
|
|
||||||
// Placeholders
|
// Placeholders
|
||||||
'formatoLibro' => "Formato libro",
|
'formatoLibro' => "Formato libro",
|
||||||
'selectCliente' => "Seleccione cliente",
|
'selectCliente' => "Seleccione cliente",
|
||||||
|
|||||||
@ -61,6 +61,22 @@
|
|||||||
]
|
]
|
||||||
) ?>
|
) ?>
|
||||||
</div><!-- /.card-footer -->
|
</div><!-- /.card-footer -->
|
||||||
|
<div class="container-fluid d-flex flex-md-row flex-column justify-content-between align-items-md-center gap-1 container-p-x py-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p>
|
||||||
|
<strong><?= lang("Presupuestos.created_by_at") ?></strong>
|
||||||
|
<span id="created_by"><?= $facturaEntity->created_by ?></span>,
|
||||||
|
<span id="created_at"><?= $facturaEntity->created_at_footer ?></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p>
|
||||||
|
<strong><?= lang("Presupuestos.updated_by_at") ?></strong>
|
||||||
|
<span id="updated_by"><?= $facturaEntity->updated_by ?></span>,
|
||||||
|
<span id="updated_at_footer"><?= $facturaEntity->updated_at_footer ?></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div><!-- //.card -->
|
</div><!-- //.card -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
|
|||||||
@ -251,7 +251,23 @@ $("#fecha_entrega_externo").flatpickr({
|
|||||||
|
|
||||||
<?php if ($pedidoEntity->estado !== 'finalizado' && $pedidoEntity->estado !== 'cancelado'): ?>
|
<?php if ($pedidoEntity->estado !== 'finalizado' && $pedidoEntity->estado !== 'cancelado'): ?>
|
||||||
$('.buton-estado').on('click', function() {
|
$('.buton-estado').on('click', function() {
|
||||||
var id = <?=$pedidoEntity->id ?>;
|
Swal.fire({
|
||||||
|
title: '¿Estás seguro?',
|
||||||
|
text: "Esta acción no se puede deshacer",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
cancelButtonColor: '#d33',
|
||||||
|
confirmButtonText: 'Sí',
|
||||||
|
cancelButtonText: 'Cancelar',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary me-1',
|
||||||
|
cancelButton: 'btn btn-label-secondary'
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
var id = <?=$pedidoEntity->id ?>;
|
||||||
var estado = $(this).attr('id').split('_')[1];
|
var estado = $(this).attr('id').split('_')[1];
|
||||||
var url = '<?= route_to('cambiarEstadoPedido') ?>';
|
var url = '<?= route_to('cambiarEstadoPedido') ?>';
|
||||||
var data = {
|
var data = {
|
||||||
@ -273,6 +289,10 @@ $('.buton-estado').on('click', function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
@ -36,7 +36,22 @@
|
|||||||
<button type="button" class="btn btn-primary btn-md" id="button-pedido-to-prod" data-id="<?= $pedidoEntity->id ?>"><span> <i class="ti ti-building-factory-2 ti-xs"></i> <?= lang("Produccion.btn_pedido_produccion_accion") ?> </span></button>
|
<button type="button" class="btn btn-primary btn-md" id="button-pedido-to-prod" data-id="<?= $pedidoEntity->id ?>"><span> <i class="ti ti-building-factory-2 ti-xs"></i> <?= lang("Produccion.btn_pedido_produccion_accion") ?> </span></button>
|
||||||
</div><!-- /.card-footer -->
|
</div><!-- /.card-footer -->
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid d-flex flex-md-row flex-column justify-content-between align-items-md-center gap-1 container-p-x py-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p>
|
||||||
|
<strong><?= lang("Presupuestos.created_by_at") ?></strong>
|
||||||
|
<span id="created_by"><?= $pedidoEntity->created_by ?></span>,
|
||||||
|
<span id="created_at"><?= $pedidoEntity->created_at_footer ?></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p>
|
||||||
|
<strong><?= lang("Presupuestos.updated_by_at") ?></strong>
|
||||||
|
<span id="updated_by"><?= $pedidoEntity->updated_by ?></span>,
|
||||||
|
<span id="updated_at_footer"><?= $pedidoEntity->updated_at_footer ?></span>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- //.card -->
|
</div><!-- //.card -->
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
<div class="card accordion-item active">
|
<div class="card accordion-item active">
|
||||||
<h2 class="accordion-header" id="headingOne">
|
<h2 class="accordion-header" id="headingOne">
|
||||||
<button type="button" class="accordion-button" data-bs-toggle="collapse"
|
<button type="button" class="accordion-button" data-bs-toggle="collapse"
|
||||||
data-bs-target="#accordionResumenTip" aria-expanded="false"
|
data-bs-target="#accordionResumenTip" aria-expanded="false"
|
||||||
aria-controls="accordionResumenTip">
|
aria-controls="accordionResumenTip">
|
||||||
<h4><?= lang("Presupuestos.resumen") ?></h4>
|
<h4><?= lang("Presupuestos.resumen") ?></h4>
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div id="accordionResumenTip" class="accordion-collapse collapse show"
|
<div id="accordionResumenTip" class="accordion-collapse collapse show"
|
||||||
data-bs-parent="#accordionResumen">
|
data-bs-parent="#accordionResumen">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
|
|
||||||
<div class="col-xl-12">
|
<div class="col-xl-12">
|
||||||
@ -36,9 +36,9 @@
|
|||||||
<dd id="margenServicios" class="col-3 text-end py-1"></dd>
|
<dd id="margenServicios" class="col-3 text-end py-1"></dd>
|
||||||
|
|
||||||
<dt class="col-5 fw-normal text-end">Coste de envío</dt>
|
<dt class="col-5 fw-normal text-end">Coste de envío</dt>
|
||||||
<dd id="costeEnvios"class="col-6 text-end py-1"></dd>
|
<dd id="costeEnvios" class="col-6 text-end py-1"></dd>
|
||||||
<dt class="col-5 fw-normal text-end">Precio de envío</dt>
|
<dt class="col-5 fw-normal text-end">Precio de envío</dt>
|
||||||
<dd id="totalEnvios"class="col-6 text-end py-1"></dd>
|
<dd id="totalEnvios" class="col-6 text-end py-1"></dd>
|
||||||
<dt class="col-5 fw-normal text-end">Margen envío</dt>
|
<dt class="col-5 fw-normal text-end">Margen envío</dt>
|
||||||
<dd id="margenEnvios" class="col-6 text-end py-1"></dd>
|
<dd id="margenEnvios" class="col-6 text-end py-1"></dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -79,13 +79,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-2 mb-md-0 mb-2">
|
||||||
|
<label for="ivaReducido" class="form-label">I.V.A. reducido</label>
|
||||||
|
<select id="ivaReducido" name="iva_reducido" class="form-control select2bs2 calcular-presupuesto"
|
||||||
|
style="width: 100%;">
|
||||||
|
<option value="1" selected>
|
||||||
|
<p><?= lang('SI') ?></p>
|
||||||
|
</option>
|
||||||
|
<option value="0">
|
||||||
|
<p><?= lang('NO') ?></p>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php if ($presupuestoEntity->estado_id == 2): ?>
|
<?php if ($presupuestoEntity->estado_id == 2): ?>
|
||||||
<div class="row mt-5">
|
<div class="row mt-5">
|
||||||
<div class="mb-1">
|
<div class="mb-1">
|
||||||
<label for="totalAceptado" class="form-label">
|
<label for="totalAceptado" class="form-label">
|
||||||
<?= lang('Presupuestos.totalAceptado') ?>
|
<?= lang('Presupuestos.totalAceptado') ?>
|
||||||
</label>
|
</label>
|
||||||
<input disabled type="text" id="totalAceptado" name="totalAceptado" class="form-control" value="" <?php echo ($tipo_impresion_id == 21)?' max=80':'' ?>>
|
<input disabled type="text" id="totalAceptado" name="totalAceptado" class="form-control" value="" <?php echo ($tipo_impresion_id == 21) ? ' max=80' : '' ?>>
|
||||||
</div><!--//.mb-3 -->
|
</div><!--//.mb-3 -->
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@ -94,7 +107,3 @@
|
|||||||
</div> <!-- //.accordion-collapse -->
|
</div> <!-- //.accordion-collapse -->
|
||||||
</div> <!-- //.accordion-item -->
|
</div> <!-- //.accordion-item -->
|
||||||
</div> <!-- //.accordion -->
|
</div> <!-- //.accordion -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,23 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?= anchor(route_to("presupuestoAdminList", $tipo_impresion_id), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
<?= anchor(route_to("presupuestoAdminList", $tipo_impresion_id), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid d-flex flex-md-row flex-column justify-content-between align-items-md-center gap-1 container-p-x py-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p>
|
||||||
|
<strong><?= lang("Presupuestos.created_by_at") ?></strong>
|
||||||
|
<span id="created_by"></span>,
|
||||||
|
<span id="created_at"></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p>
|
||||||
|
<strong><?= lang("Presupuestos.updated_by_at") ?></strong>
|
||||||
|
<span id="updated_by"></span>,
|
||||||
|
<span id="updated_at_footer"></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||||
|
|
||||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||||
|
|
||||||
|
|
||||||
@ -370,33 +369,31 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3 mb-3">
|
<div class="col-md-3 mb-3">
|
||||||
<button id="makeImport" class="btn btn-primary waves-effect waves-light mt-auto w-100">
|
<button id="makeImport" class="btn btn-primary waves-effect waves-light mt-auto w-100" disabled>
|
||||||
Importar presupuesto
|
Importar presupuesto
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div><!--//.card -->
|
</div><!--//.card -->
|
||||||
|
|
||||||
</div><!--//.card-body -->
|
</div><!--//.card-body -->
|
||||||
|
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
</div><!--//.card-footer -->
|
</div><!--//.card-footer -->
|
||||||
|
|
||||||
</div><!--//.card -->
|
</div><!--//.card -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
</div><!--//.row -->
|
</div><!--//.row -->
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('css') ?>
|
||||||
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section('additionalExternalJs') ?>
|
||||||
<?= $this->section('css') ?>
|
<script type="module"
|
||||||
|
src="<?= site_url('assets/js/safekat/pages/importadorPresupuestos/importador.js') ?>"></script>
|
||||||
<?= $this->endSection() ?>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
<?= $this->section('additionalExternalJs') ?>
|
|
||||||
<script type="module"
|
|
||||||
src="<?= site_url('assets/js/safekat/pages/importadorPresupuestos/importador.js') ?>"></script>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
@ -126,7 +126,7 @@ class Importador {
|
|||||||
this.makeImport.on('click', this.importPresupuesto.bind(this));
|
this.makeImport.on('click', this.importPresupuesto.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
importPresupuesto(){
|
importPresupuesto() {
|
||||||
|
|
||||||
if ($("#clienteId").val() != '' && $("#presupuesto").val() != '') {
|
if ($("#clienteId").val() != '' && $("#presupuesto").val() != '') {
|
||||||
let data = this.collectData();
|
let data = this.collectData();
|
||||||
@ -137,11 +137,45 @@ class Importador {
|
|||||||
(response) => {
|
(response) => {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
const urlObj = new URL(window.location.href);
|
const urlObj = new URL(window.location.href);
|
||||||
window.open(`${urlObj.origin}` + '/presupuestoadmin/edit/' + response.id);
|
Swal.fire({
|
||||||
|
title: 'Atención!',
|
||||||
|
text: 'Esto es una importación básica, por favor revisa los datos para comprobar que no hay errores. ' +
|
||||||
|
'Tenga en cuenta que no todos los servicios se pueden importar.',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: false,
|
||||||
|
confirmButtonColor: '#3085d6',
|
||||||
|
confirmButtonText: 'Ok',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary me-1',
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
}).then(() => {
|
||||||
|
window.open(`${urlObj.origin}` + '/presupuestoadmin/edit/' + response.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error',
|
||||||
|
text: 'No ha sido posible importar el presupuesto. Póngase en contacto con el administrador.',
|
||||||
|
icon: 'error',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary'
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
console.error(error);
|
Swal.fire({
|
||||||
|
title: 'Error',
|
||||||
|
text: 'Ha habido un error al intentar importar el presupuesto. Asegúrese de que están todos los campos rellenos.',
|
||||||
|
icon: 'error',
|
||||||
|
customClass: {
|
||||||
|
confirmButton: 'btn btn-primary'
|
||||||
|
},
|
||||||
|
buttonsStyling: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
).post();
|
).post();
|
||||||
}
|
}
|
||||||
@ -158,7 +192,7 @@ class Importador {
|
|||||||
data.paginas = $('#paginas').val();
|
data.paginas = $('#paginas').val();
|
||||||
data.tirada = $('#tirada').val();
|
data.tirada = $('#tirada').val();
|
||||||
data.papel_formato_id = $('#tamanio').val();
|
data.papel_formato_id = $('#tamanio').val();
|
||||||
data.papel_formato_personalizado = $('#papelFormatoPersonalizado').prop('checked')?1:0;
|
data.papel_formato_personalizado = $('#papelFormatoPersonalizado').prop('checked') ? 1 : 0;
|
||||||
data.papel_formato_ancho = $('#papelFormatoAncho').val();
|
data.papel_formato_ancho = $('#papelFormatoAncho').val();
|
||||||
data.papel_formato_alto = $('#papelFormatoAlto').val();
|
data.papel_formato_alto = $('#papelFormatoAlto').val();
|
||||||
|
|
||||||
@ -186,17 +220,17 @@ class Importador {
|
|||||||
data.acabado_sobrecubierta = this.acabadosSobrecubierta.getVal();
|
data.acabado_sobrecubierta = this.acabadosSobrecubierta.getVal();
|
||||||
|
|
||||||
data.servicios = {
|
data.servicios = {
|
||||||
marcapaginas: $('#marcapaginas').prop('checked')?1:0,
|
marcapaginas: $('#marcapaginas').prop('checked') ? 1 : 0,
|
||||||
serviciosExtra: []
|
serviciosExtra: []
|
||||||
};
|
};
|
||||||
|
|
||||||
if($('#ferro').prop('checked')){
|
if ($('#ferro').prop('checked')) {
|
||||||
data.servicios.serviciosExtra.push(30);
|
data.servicios.serviciosExtra.push(30);
|
||||||
}
|
}
|
||||||
if($('#ferroDigital').prop('checked')){
|
if ($('#ferroDigital').prop('checked')) {
|
||||||
data.servicios.serviciosExtra.push(29);
|
data.servicios.serviciosExtra.push(29);
|
||||||
}
|
}
|
||||||
if($('#prototipo').prop('checked')){
|
if ($('#prototipo').prop('checked')) {
|
||||||
data.servicios.serviciosExtra.push(9);
|
data.servicios.serviciosExtra.push(9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +276,6 @@ class Importador {
|
|||||||
|
|
||||||
fillInitialData(data) {
|
fillInitialData(data) {
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
$('#paginas').val(data.datosGenerales.paginas);
|
$('#paginas').val(data.datosGenerales.paginas);
|
||||||
$('#tirada').val(data.datosGenerales.tirada);
|
$('#tirada').val(data.datosGenerales.tirada);
|
||||||
if (data.datosGenerales.papel_formato_personalizado) {
|
if (data.datosGenerales.papel_formato_personalizado) {
|
||||||
@ -386,8 +419,8 @@ class Importador {
|
|||||||
$('#prototipo').prop('checked', false);
|
$('#prototipo').prop('checked', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.makeImport.prop('disabled', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|||||||
@ -370,6 +370,11 @@ class PresupuestoAdminEdit {
|
|||||||
self.tipo_impresion.val(response.data.tipo_impresion);
|
self.tipo_impresion.val(response.data.tipo_impresion);
|
||||||
self.POD.val(response.data.POD);
|
self.POD.val(response.data.POD);
|
||||||
|
|
||||||
|
$('#created_by').html(response.data.created_by);
|
||||||
|
$('#updated_by').html(response.data.updated_by);
|
||||||
|
$('#created_at').html(response.data.created_at);
|
||||||
|
$('#updated_at_footer').html(response.data.updated_at);
|
||||||
|
|
||||||
self.calcularPresupuesto = false;
|
self.calcularPresupuesto = false;
|
||||||
|
|
||||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||||
@ -392,6 +397,7 @@ class PresupuestoAdminEdit {
|
|||||||
self.tiradasAlternativas.cargar(response.data.tiradasAlternativas);
|
self.tiradasAlternativas.cargar(response.data.tiradasAlternativas);
|
||||||
|
|
||||||
self.resumen.cargar(response.data.resumen);
|
self.resumen.cargar(response.data.resumen);
|
||||||
|
|
||||||
self.datosLibro.calcular_mermas();
|
self.datosLibro.calcular_mermas();
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@ -56,6 +56,8 @@ class Resumen {
|
|||||||
$("#totalAceptado").val(resumen.total_aceptado.toString().replace('.', ',') + "€" || "0€");
|
$("#totalAceptado").val(resumen.total_aceptado.toString().replace('.', ',') + "€" || "0€");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#ivaReducido').val(resumen.iva_reducido ? 1: 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
@ -208,9 +210,10 @@ class Resumen {
|
|||||||
$('#tableOfServiciosPreimpresion').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
$('#tableOfServiciosPreimpresion').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
let rowData = this.data();
|
let rowData = this.data();
|
||||||
let total_servicio = self.roundToTwoDecimals(parseFloat(rowData.precio));
|
let total_servicio = self.roundToTwoDecimals(parseFloat(rowData.precio));
|
||||||
let coste_servicio = self.roundToTwoDecimals(parseFloat(rowData.coste));
|
let base = (parseFloat(rowData.precio / (1 + parseFloat(rowData.margen) / 100.0)).toFixed(2));
|
||||||
|
base = self.roundToTwoDecimals(base / parseInt($('#tirada').val()))*parseInt($('#tirada').val());
|
||||||
|
margenServicios += self.roundToTwoDecimals(parseFloat(total_servicio - base));
|
||||||
totalServicios += total_servicio
|
totalServicios += total_servicio
|
||||||
margenServicios += total_servicio - coste_servicio;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,9 +221,10 @@ class Resumen {
|
|||||||
$('#tableOfServiciosExtra').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
$('#tableOfServiciosExtra').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
let rowData = this.data();
|
let rowData = this.data();
|
||||||
let total_servicio = self.roundToTwoDecimals(parseFloat(rowData.precio));
|
let total_servicio = self.roundToTwoDecimals(parseFloat(rowData.precio));
|
||||||
let coste_servicio = self.roundToTwoDecimals(parseFloat(rowData.margen));
|
let base = (parseFloat(rowData.precio / (1 + parseFloat(rowData.margen) / 100.0)).toFixed(2));
|
||||||
totalServicios += total_servicio
|
base = self.roundToTwoDecimals(base / parseInt($('#tirada').val()))*parseInt($('#tirada').val());
|
||||||
margenServicios += total_servicio - coste_servicio;
|
margenServicios += self.roundToTwoDecimals(parseFloat(total_servicio - base));
|
||||||
|
totalServicios += total_servicio;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +349,9 @@ class Resumen {
|
|||||||
'total_precio_unidad': $('#precioUnidadPresupuesto').text().replace('€', '').replace(',', '.'),
|
'total_precio_unidad': $('#precioUnidadPresupuesto').text().replace('€', '').replace(',', '.'),
|
||||||
|
|
||||||
'total_factor': $('#factor').text().replace(/,/g, '.'),
|
'total_factor': $('#factor').text().replace(/,/g, '.'),
|
||||||
'total_factor_ponderado': $('#factor_ponderado').text().replace(/,/g, '.')
|
'total_factor_ponderado': $('#factor_ponderado').text().replace(/,/g, '.'),
|
||||||
|
|
||||||
|
'iva_reducido': $('#ivaReducido').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
if($('#confirmar_presupuesto').prop('checked')){
|
if($('#confirmar_presupuesto').prop('checked')){
|
||||||
|
|||||||
@ -172,7 +172,7 @@ class TiradasAlernativas {
|
|||||||
|
|
||||||
let datos = {
|
let datos = {
|
||||||
id: id,
|
id: id,
|
||||||
tirada: this.tirada.val(),
|
tirada: tirada,
|
||||||
peso_libro: this.get_peso_libro(),
|
peso_libro: this.get_peso_libro(),
|
||||||
tirada_base: $('#tirada').val(),
|
tirada_base: $('#tirada').val(),
|
||||||
paginas: $('#paginas').val(),
|
paginas: $('#paginas').val(),
|
||||||
@ -225,18 +225,6 @@ class TiradasAlernativas {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#tableOfServiciosPreimpresion').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
|
||||||
var rowData = this.data();
|
|
||||||
costes_servicios += parseFloat(rowData.coste);
|
|
||||||
margen_servicios += parseFloat(rowData.precio) - parseFloat(rowData.coste);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#tableOfServiciosExtra').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
|
||||||
var rowData = this.data();
|
|
||||||
costes_servicios += parseFloat(rowData.coste);
|
|
||||||
margen_servicios += parseFloat(rowData.precio) - parseFloat(rowData.coste);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (data.envios) {
|
if (data.envios) {
|
||||||
coste_envio += data.envios.coste;
|
coste_envio += data.envios.coste;
|
||||||
margen_envio += data.envios.margen;
|
margen_envio += data.envios.margen;
|
||||||
|
|||||||
Reference in New Issue
Block a user