mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en el comparador de las guardas
This commit is contained in:
@ -322,6 +322,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor();
|
||||
$this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
|
||||
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
|
||||
$this->viewData['papelGenericoGuardasList'] = $this->getPapelGenericoGuardas();
|
||||
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
|
||||
$this->viewData['papelGenericoRotativaNegroList'] = $this->getPapelGenericoRotativaNegro();
|
||||
$this->viewData['papelGenericoRotativaColorList'] = $this->getPapelGenericoRotativaColor();
|
||||
@ -467,7 +468,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
|
||||
|
||||
if ($type=='interior') {
|
||||
if ($type=='interior' || 'guardas') {
|
||||
|
||||
$datosTipolog = $reqData['negro'] ?? null;
|
||||
if(!is_null($datosTipolog)){
|
||||
@ -484,6 +485,10 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
array_push($datosTipolog, $data);
|
||||
}
|
||||
|
||||
if ($type=='guardas') {
|
||||
$datosPedido->paginas_impresion = intval($reqData['paginas_impresion']) ?? 0;
|
||||
}
|
||||
|
||||
$a_favor_fibra = $reqData['a_favor_fibra'] ?? false;
|
||||
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq, $cliente_id, $datosTipolog, $a_favor_fibra);
|
||||
@ -712,7 +717,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
|
||||
is_rotativa: 0,
|
||||
tarifa_tipo: $tipo,
|
||||
uso_tarifa: $uso,
|
||||
uso_tarifa: ($uso=='guardas')?'interior':$uso,
|
||||
tirada: $datosPedido->tirada + $datosPedido->merma,
|
||||
papel_impresion_id: $papel->id,
|
||||
);
|
||||
@ -754,7 +759,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
}
|
||||
|
||||
$tarifamodel = new MaquinasTarifasImpresionModel();
|
||||
[$tarifaId, $tarifa] = $tarifamodel->getTarifa($maquina->maquina_id, $uso, $tipo);
|
||||
[$tarifaId, $tarifa] = $tarifamodel->getTarifa($maquina->maquina_id, ($uso=='guardas')?'interior':$uso, $tipo);
|
||||
if(!is_float($tarifa)){
|
||||
continue;
|
||||
}
|
||||
@ -792,7 +797,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$clientePreciosModel = new ClientePreciosModel();
|
||||
$config = (object)[
|
||||
"tipo" => $uso,
|
||||
"tipo" => ($uso=='guardas')?'interior':$uso,
|
||||
"tipo_maquina" => $maquina->is_inkjet?'inkjet':'toner',
|
||||
"tipo_impresion" => $tipo
|
||||
];
|
||||
@ -1255,6 +1260,17 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPapelGenericoGuardas()
|
||||
{
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
$data = $model->getPapelForComparador('colorhq', false, false, false, true);
|
||||
array_unshift($data, (object)array(
|
||||
"id" => 0,
|
||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
||||
));
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPapelGenericoSobreCubierta()
|
||||
{
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
|
||||
@ -18,15 +18,7 @@ class Test extends BaseController
|
||||
public function index()
|
||||
{
|
||||
echo '<pre>';
|
||||
$papelImpresionTipologiaModel = new \App\Models\Configuracion\PapelImpresionTipologiaModel();
|
||||
$datosTipologias = $papelImpresionTipologiaModel
|
||||
->findTipologiasForPapelImpresion(17, 'color')
|
||||
->get()->getResultObject();
|
||||
|
||||
|
||||
var_dump($datosTipologias);
|
||||
var_dump($datosTipologias[0]->cg);
|
||||
|
||||
$this->getPapelesGuardas();
|
||||
echo '</pre>';
|
||||
/*
|
||||
|
||||
@ -187,6 +179,13 @@ class Test extends BaseController
|
||||
var_dump($data);
|
||||
}
|
||||
|
||||
public function getPapelesGuardas(){
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
$data = $model->getPapelForComparador('color', false, false, false, true);
|
||||
|
||||
var_dump($data);
|
||||
}
|
||||
|
||||
public function getGramaje(){
|
||||
$model = new PapelGenericoModel();
|
||||
$data = $model->getGramajeComparador("AHUESADO OFFSET", "bnhq" );
|
||||
|
||||
@ -64,6 +64,7 @@ return [
|
||||
'retractilado' => 'Retractilado individual',
|
||||
'retractilado5' => 'Retractilado de 5',
|
||||
'Guardas' => 'Guardas',
|
||||
'imprimir_guardas' => 'Imprimir guardas',
|
||||
'fajaColor' => 'Imprimir faja a color',
|
||||
'compInteriorPlana' => 'Interior en plana',
|
||||
'compInteriorRotativa' => 'Interior en rotativa',
|
||||
@ -95,6 +96,7 @@ return [
|
||||
'encuadernacion' => 'Encuadernación',
|
||||
'solapasCubierta' => 'Solapas cubierta',
|
||||
'solapasAnchoCubierta' => 'Ancho solapas cubierta',
|
||||
'sinImpresion' => 'Sin impresion',
|
||||
'1cara' => '1 cara',
|
||||
'2caras' => '2 caras',
|
||||
'bn' => 'BN',
|
||||
|
||||
@ -93,7 +93,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
}
|
||||
|
||||
|
||||
public function getPapelForComparador($tipo, $is_cubierta = false, $is_sobrecubierta = false, $rotativa = false)
|
||||
public function getPapelForComparador($tipo, $is_cubierta = false, $is_sobrecubierta = false, $rotativa = false, $is_guardas = false)
|
||||
{
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
@ -128,8 +128,9 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
}
|
||||
else{
|
||||
$builder->where("t2.cubierta", 0);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
if(!$is_guardas){
|
||||
$builder->where("t2.cubierta", 0);
|
||||
}
|
||||
}
|
||||
|
||||
if($is_sobrecubierta==true){
|
||||
@ -137,13 +138,19 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
}
|
||||
else{
|
||||
$builder->where("t2.sobrecubierta", 0);
|
||||
if(!$is_guardas){
|
||||
$builder->where("t2.sobrecubierta", 0);
|
||||
}
|
||||
}
|
||||
|
||||
if($is_cubierta==false && $is_sobrecubierta==false){
|
||||
$builder->where("t5.uso", 'interior');
|
||||
}
|
||||
|
||||
if($is_guardas==true){
|
||||
$builder->where("t2.guardas", 1);
|
||||
}
|
||||
|
||||
if($rotativa==true){
|
||||
$builder->where("t2.rotativa", 1);
|
||||
}
|
||||
|
||||
@ -71,7 +71,9 @@ class PresupuestoService extends BaseService
|
||||
//interior (bn o color)
|
||||
if ($cubierta == 0 && $sobrecubierta == 0 && $rotativa == 0) {
|
||||
// precio papel
|
||||
$pliegos_libro = ($datosPedido->paginas / 2.0) / $response['fields']['num_formas']['value'];
|
||||
$pliegos_libro = ceil(($datosPedido->paginas / 2.0) / $response['fields']['num_formas']['value']);
|
||||
if($pliegos_libro<1)
|
||||
$pliegos_libro = 1;
|
||||
$pliegos_pedido = $pliegos_libro * ($datosPedido->tirada + $datosPedido->merma);
|
||||
$precio_libro = $pliegos_libro * ($precio_pliego_impresion+$margen_pliego_impresion);
|
||||
$margen_papel_pedido = $pliegos_libro * $margen_pliego_impresion * ($datosPedido->tirada + $datosPedido->merma);
|
||||
|
||||
@ -215,6 +215,44 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<p><?= lang('PapelImpresion.guardas') ?></p>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<select id="compCarasGuardas" name="comp_paginas_guardas" class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||
<option value="0">
|
||||
<p><?= lang('Presupuestos.sinImpresion') ?></p>
|
||||
</option>
|
||||
<option value="4">
|
||||
<p><?= lang('Presupuestos.1cara') ?></p>
|
||||
</option>
|
||||
<option value="8">
|
||||
<p><?= lang('Presupuestos.2caras') ?></p>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
<select id="compPapelGuardas" name="comp_papel_guardas" class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||
<?php if (isset($papelGenericoGuardasList) && is_array($papelGenericoGuardasList) && !empty($papelGenericoGuardasList)) :
|
||||
foreach ($papelGenericoGuardasList as $k => $v) : ?>
|
||||
<option value="<?= $v->id ?>">
|
||||
<?= $v->nombre ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<input readonly type="text" id="compGramajeGuardas" name="comp_gramaje_guardas" placeholder="0" maxLength="5" class="form-control comp_guardas_items" value='170'>
|
||||
</div>
|
||||
<div>
|
||||
<hr class="my-1">
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!----------------------------------------------------------------------------->
|
||||
|
||||
<div class="divider divider-dark text-start mb-1 comp-color-selected">
|
||||
@ -422,6 +460,66 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!----------------------------------------------------------------------------->
|
||||
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||
<div class="accordion mt-3" id="accordionCompGuardas">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingOne">
|
||||
<button id="accordion-button-int-guardas" type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompGuardasTip" aria-expanded="false" aria-controls="accordionCompGuardasTip">
|
||||
<h6 id="title_guardas"><?= lang("Presupuestos.Guardas") ?></h6>
|
||||
</button>
|
||||
</h2>
|
||||
|
||||
<div id="accordionCompGuardasTip" class="accordion-collapse collapse" data-bs-parent="#accordionCompGuardasTip">
|
||||
<div class="accordion-body">
|
||||
|
||||
<table id="tableCompGuardas" class="comparator-table table dt-responsive dataTable" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.tipo') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.paginas') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.papel') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.gramaje') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.marca') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.maquina') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.numeroPliegos') ?></th>
|
||||
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.pliegosPedido') ?></th>
|
||||
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.precioPliego') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.libro') ?></th>
|
||||
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.totalPapelPedido') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.lomo') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.peso') ?></th>
|
||||
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.horas') ?></th>
|
||||
<th style="padding-right: 0.75em; max-width:80px"><?= lang('Presupuestos.precioImpresion') ?></th>
|
||||
<th style="padding-right: 0.75em;"><?= lang('Presupuestos.total') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="dt-result dt-result-text" colspan="14"><?= lang('Presupuestos.total') ?> <?= lang("Presupuestos.Guardas") ?>:</td>
|
||||
<td id="total_comp_guardas" class="dt-result dt-result-value" colspan="2"> 0.00 </td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<div >
|
||||
<button type="button" name="insertarGuardasBtn"
|
||||
id="insertarGuardasBtn"
|
||||
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
|
||||
<?= lang('Presupuestos.insertarLinea').' '.strtoupper(lang('Presupuestos.Guardas')) ?>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
|
||||
|
||||
|
||||
</div> <!-- //.accordion-body -->
|
||||
@ -580,11 +678,22 @@
|
||||
allowClear: false,
|
||||
});
|
||||
|
||||
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||
$('#compCarasCubierta').select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: Infinity,
|
||||
});
|
||||
|
||||
$('#compPapelGuardas').select2({
|
||||
allowClear: false,
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
$('#compCarasGuardas').select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: Infinity,
|
||||
});
|
||||
|
||||
updatePapelesComparador();
|
||||
const paginasColor = document.getElementById('compCalPaginasColor');
|
||||
if (paginasColor.value.length > 0) {
|
||||
@ -827,6 +936,129 @@
|
||||
]
|
||||
});
|
||||
|
||||
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||
var tableCompGuardas = new DataTable('#tableCompGuardas',{
|
||||
scrollX: true,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
ordering: false,
|
||||
responsive: true,
|
||||
select: false,
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
|
||||
},
|
||||
columns: [
|
||||
{ 'data': 'tipo',
|
||||
'render': function ( data, type, row, meta ) {
|
||||
|
||||
return '<?= lang('Presupuestos.Guardas') ?>';
|
||||
}
|
||||
|
||||
},
|
||||
{ 'data': 'paginas' },
|
||||
{ 'data': 'papel' },
|
||||
{ 'data': 'gramaje' },
|
||||
{ 'data': 'marca' },
|
||||
{ 'data': 'maquina' },
|
||||
{ 'data': 'numeroPliegos' },
|
||||
{ 'data': 'pliegosPedido' },
|
||||
{ 'data': 'precioPliego' },
|
||||
{ 'data': 'libro' },
|
||||
{ 'data': 'totalPapelPedido' },
|
||||
{ 'data': 'lomo' },
|
||||
{ 'data': 'peso' },
|
||||
{ 'data': 'horasMaquina' },
|
||||
{ 'data': 'precioImpresion' },
|
||||
{ 'data': 'total' },
|
||||
{ 'data': 'maquinaId'},
|
||||
{ 'data': 'maquinaVelocidad'},
|
||||
{ 'data': 'tiempoMaquina'},
|
||||
{ 'data': 'papelGenericoId'},
|
||||
{ 'data': 'papelImpresionId'},
|
||||
{ 'data': 'tarifa_impresion_id'}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
target: [16,17,18,19,20,21],
|
||||
visible: false,
|
||||
searchable: false
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
function checkComparadorGuardas(actualizarLinea = false){
|
||||
|
||||
if ($('#compPapelGuardas').select2('data').length > 0 ){
|
||||
|
||||
const dimension = getDimensionLibro();
|
||||
|
||||
let datos = {
|
||||
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
|
||||
type: 'guardas',
|
||||
paginas: 8,
|
||||
paginas_impresion: parseInt($('#compCarasGuardas').select2('data')[0].id),
|
||||
tirada: parseInt($('#tirada').val()),
|
||||
merma: parseInt($('#mermacubierta').val()),
|
||||
color: 1,
|
||||
hq: 1,
|
||||
ancho: dimension.ancho,
|
||||
alto: dimension.alto,
|
||||
papel_generico_id: $('#compPapelGuardas').select2('data')[0].id,
|
||||
papel_generico: $('#compPapelGuardas').select2('data')[0].text.trim(),
|
||||
gramaje: parseInt($('#compGramajeGuardas').val()),
|
||||
cliente_id: $('#clienteId').find(":selected").val(),
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/cosidotapablanda/datatable",
|
||||
data: datos,
|
||||
success: function (data) {
|
||||
|
||||
clearGuardas();
|
||||
|
||||
if(data.lineas.length >0){
|
||||
/*
|
||||
fillCubierta(data);
|
||||
selectCubiertaLineas();
|
||||
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
|
||||
$('#insertarCubiertaBtn').removeClass('d-none')
|
||||
if(actualizarLinea){
|
||||
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
|
||||
for(row of rows){
|
||||
fill_lp_cubierta(row, true);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
else{
|
||||
$('#title_guardas').html('<?= lang("Presupuestos.Guardas") ?>');
|
||||
$('#insertarGuardasBtn').addClass('d-none')
|
||||
$('#total_comp_guardas').html('0.00')
|
||||
|
||||
}
|
||||
yeniden(data.<?= csrf_token() ?>);
|
||||
return true;
|
||||
},
|
||||
error: function(e){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
else{
|
||||
clearGuardas();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('.comp_guardas_items').on('change', function (e) {
|
||||
|
||||
checkComparadorGuardas(false,false);
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
async function getLineasIntPlana(is_color, is_hq, actualizarLinea){
|
||||
@ -1049,6 +1281,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('.comp_negro_items').on('change', function (e) {
|
||||
|
||||
checkComparadorInt(false,false);
|
||||
|
||||
@ -328,6 +328,12 @@ function clearCubierta() {
|
||||
}
|
||||
|
||||
|
||||
function clearGuardas() {
|
||||
|
||||
$('#tableCompGuardas').DataTable().clear().draw();
|
||||
$('#insertarGuardasBtn').css('display', 'none');
|
||||
}
|
||||
|
||||
function clearIntRot() {
|
||||
|
||||
$('#errorComRot').html('');
|
||||
|
||||
Reference in New Issue
Block a user