mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en edit
This commit is contained in:
@ -164,6 +164,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$datosPresupuesto->clienteList = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
$datosPresupuesto->clienteList = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||||
|
|
||||||
|
$this->obtenerTiradas($presupuestoEntity);
|
||||||
|
$this->obtenerDatosPapel($presupuestoEntity);
|
||||||
|
|
||||||
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
|
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
|
||||||
|
|
||||||
$this->viewData['paisList'] = $this->getPaisListItems();
|
$this->viewData['paisList'] = $this->getPaisListItems();
|
||||||
@ -1369,8 +1372,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
if ($linea['tipo_maquina'] == 'inkjet') {
|
if ($linea['tipo_maquina'] == 'inkjet') {
|
||||||
$totalImpresion += $linea['precio_tinta'];
|
$totalImpresion += $linea['precio_tinta'];
|
||||||
$totalImpresion += $linea['total_corte'];
|
if(array_key_exists('total_corte', $linea)){
|
||||||
$sumForFactor += $linea['total_corte'];
|
$totalImpresion += $linea['total_corte'];
|
||||||
|
$sumForFactor += $linea['total_corte'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$margenImpresion += $linea['margen_impresion_horas'];
|
$margenImpresion += $linea['margen_impresion_horas'];
|
||||||
$margenImpresion += $linea['margen_click_pedido'];
|
$margenImpresion += $linea['margen_click_pedido'];
|
||||||
@ -1521,13 +1526,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$color = 'negro';
|
$color = 'negro';
|
||||||
|
|
||||||
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||||
$data = $model->where('presupuestoId', $presupuestoId)->findAll();;
|
$data = $model->where('presupuesto_id', $presupuestoId)->findAll();;
|
||||||
foreach($data as $linea){
|
foreach($data as $linea){
|
||||||
|
|
||||||
if (strpos($linea->tipo, "hq") !== false) { // $linea->tipo contains the substring "hq"
|
if (strpos($linea->tipo, "hq") !== false) { // $linea->tipo contains the substring "hq"
|
||||||
$calidad='premium';
|
$calidad='premium';
|
||||||
}
|
}
|
||||||
if (strpos($linea->tipo, "hq") !== false) { // $linea->tipo contains the substring "hq"
|
if (strpos($linea->tipo, "color") !== false) { // $linea->tipo contains the substring "color"
|
||||||
$color='color';
|
$color='color';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1544,5 +1549,58 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$tapa = 'dura';
|
$tapa = 'dura';
|
||||||
|
|
||||||
return $tapa;
|
return $tapa;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function obtenerTiradas($presupuestoEntity){
|
||||||
|
|
||||||
|
$tiradas_alternativas = json_decode($presupuestoEntity->tirada_alternativa_json_data, true);
|
||||||
|
$tiradas = array();
|
||||||
|
array_push($tiradas, $presupuestoEntity->tirada);
|
||||||
|
if(!is_null($tiradas_alternativas)){
|
||||||
|
if(count($tiradas_alternativas) > 0){
|
||||||
|
foreach($tiradas_alternativas as $tirada){
|
||||||
|
array_push($tiradas, intval($tirada['tirada']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort($tiradas);
|
||||||
|
$presupuestoEntity->selected_tirada = $presupuestoEntity->tirada;
|
||||||
|
for($i=0; $i<count($tiradas); $i++){
|
||||||
|
$key = 'tirada' . ($i==0?'':strval($i+1));
|
||||||
|
$presupuestoEntity->$key = $tiradas[$i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function obtenerDatosPapel($presupuestoEntity){
|
||||||
|
|
||||||
|
$id = $presupuestoEntity->id;
|
||||||
|
|
||||||
|
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||||
|
$data = $model->where('presupuesto_id', $id)->findAll();
|
||||||
|
if(count($data)>0){
|
||||||
|
foreach($data as $linea){
|
||||||
|
// Se coje el primer papel que se encuentre para el interior
|
||||||
|
// para presupuestos del cliente sólo se escoje un papel para el interior
|
||||||
|
if (strpos($linea->tipo, "bn") !== false || strpos($linea->tipo, "color") !== false) {
|
||||||
|
$presupuestoEntity->papel_interior = $linea->papel_id;
|
||||||
|
$presupuestoEntity->gramaje_interior = $linea->gramaje;
|
||||||
|
}
|
||||||
|
// Si es cubierta
|
||||||
|
else if (strpos($linea->tipo, "cubierta") !== false && strpos($linea->tipo, "sobrecubierta") === false) {
|
||||||
|
$presupuestoEntity->papel_cubierta = $linea->papel_id;
|
||||||
|
$presupuestoEntity->gramaje_cubierta = $linea->gramaje;
|
||||||
|
}
|
||||||
|
// Si es sobrecubierta
|
||||||
|
else if (strpos($linea->tipo, "sobrecubierta") !== false) {
|
||||||
|
$presupuestoEntity->papel_sobrecubierta = $linea->papel_id;
|
||||||
|
$presupuestoEntity->gramaje_sobrecubierta = $linea->gramaje;
|
||||||
|
}
|
||||||
|
// Si es guardas
|
||||||
|
else if (strpos($linea->tipo, "guardas") !== false) {
|
||||||
|
$presupuestoEntity->papel_guardas = $linea->papel_id;;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -576,6 +576,14 @@
|
|||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
|
|
||||||
|
|
||||||
|
window.datosDisenioLibro = {
|
||||||
|
papel_interior: <?php echo $presupuestoEntity->papel_interior ? $presupuestoEntity->papel_interior : 'null'; ?>,
|
||||||
|
gramaje_interior: <?php echo $presupuestoEntity->gramaje_interior ? $presupuestoEntity->gramaje_interior : 'null'; ?>,
|
||||||
|
papel_cubierta: <?php echo $presupuestoEntity->papel_cubierta ? $presupuestoEntity->papel_cubierta : 'null'; ?>,
|
||||||
|
gramaje_cubierta: <?php echo $presupuestoEntity->gramaje_cubierta ? $presupuestoEntity->gramaje_cubierta : 'null'; ?>,
|
||||||
|
papel_sobrecubierta: <?php echo $presupuestoEntity->papel_sobrecubierta ? $presupuestoEntity->papel_sobrecubierta : 'null'; ?>,
|
||||||
|
gramaje_sobrecubierta: <?php echo $presupuestoEntity->gramaje_sobrecubierta ? $presupuestoEntity->gramaje_sobrecubierta : 'null'; ?>,
|
||||||
|
}
|
||||||
window.routes_disenio_libro = {
|
window.routes_disenio_libro = {
|
||||||
obtenerGramaje: "<?= route_to('obtenerGramaje') ?>",
|
obtenerGramaje: "<?= route_to('obtenerGramaje') ?>",
|
||||||
presupuestoCliente: "<?= route_to('presupuestoCliente') ?>",
|
presupuestoCliente: "<?= route_to('presupuestoCliente') ?>",
|
||||||
|
|||||||
@ -153,7 +153,20 @@ function initDisenioLibro() {
|
|||||||
$('.change-tipo-impresion').trigger('change');
|
$('.change-tipo-impresion').trigger('change');
|
||||||
|
|
||||||
$('#papelInterior').trigger('change');
|
$('#papelInterior').trigger('change');
|
||||||
|
$('#papelInterior').val(window.datosDisenioLibro.papel_interior);
|
||||||
|
$('#gramajeInterior').append($('<option>', {
|
||||||
|
value: window.datosDisenioLibro.gramaje_interior,
|
||||||
|
text: window.datosDisenioLibro.gramaje_interior
|
||||||
|
}));
|
||||||
|
$('#gramajeInterior').val(window.datosDisenioLibro.gramaje_interior);
|
||||||
$('#papelCubierta').val('').trigger('change');
|
$('#papelCubierta').val('').trigger('change');
|
||||||
|
$('#papelCubierta').val(window.datosDisenioLibro.papel_cubierta);
|
||||||
|
$('#gramajeCubierta').append($('<option>', {
|
||||||
|
value: window.datosDisenioLibro.gramaje_cubierta,
|
||||||
|
text: window.datosDisenioLibro.gramaje_cubierta
|
||||||
|
}));
|
||||||
|
$('#gramajeCubierta').val(window.datosDisenioLibro.gramaje_cubierta);
|
||||||
|
|
||||||
$('#papelSobrecubierta').val('').trigger('change');
|
$('#papelSobrecubierta').val('').trigger('change');
|
||||||
|
|
||||||
$('#enableSobrecubierta').trigger('change');
|
$('#enableSobrecubierta').trigger('change');
|
||||||
@ -718,25 +731,27 @@ async function calcularPresupuesto() {
|
|||||||
|
|
||||||
$('#precios').show();
|
$('#precios').show();
|
||||||
|
|
||||||
for (i = 0; i < response.tiradas.length; i++) {
|
if(response.tiradas){
|
||||||
const total = (parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2) ;
|
for (i = 0; i < response.tiradas.length; i++) {
|
||||||
const label = "tiradaPrecio" + parseInt(i+1);
|
const total = (parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2) ;
|
||||||
|
const label = "tiradaPrecio" + parseInt(i+1);
|
||||||
|
|
||||||
let html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div id="' + label + '" peso="' +response.peso[i]+ '" class="list-group" >';
|
html += '<div id="' + label + '" peso="' +response.peso[i]+ '" class="list-group" >';
|
||||||
html += '<a href="javascript:void(0);" class="list-group-item list-group-item-action">';
|
html += '<a href="javascript:void(0);" class="list-group-item list-group-item-action">';
|
||||||
html += '<div class="li-wrapper d-flex justify-content-start align-items-center" >';
|
html += '<div class="li-wrapper d-flex justify-content-start align-items-center" >';
|
||||||
html += '<div class="list-content">';
|
html += '<div class="list-content">';
|
||||||
html += '<h7 id="ud_' + label + '" class="mb-1">' + (response.tiradas[i] + ' ud.') + '</h7>';
|
html += '<h7 id="ud_' + label + '" class="mb-1">' + (response.tiradas[i] + ' ud.') + '</h7>';
|
||||||
html += '<h6 id="tot_' + label + '" class="mb-1">' + ('Total: ' + total + '€') + '</h6>';
|
html += '<h6 id="tot_' + label + '" class="mb-1">' + ('Total: ' + total + '€') + '</h6>';
|
||||||
html += '<h7 id="pu_' + label + '" class="mb-1">' + (response.precio_u[i] + '€/ud') + '</h7>';
|
html += '<h7 id="pu_' + label + '" class="mb-1">' + (response.precio_u[i] + '€/ud') + '</h7>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</div>'
|
html += '</div>'
|
||||||
html += '</a>';
|
html += '</a>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
$('#divTiradasPrecio').append(html);
|
$('#divTiradasPrecio').append(html);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (error) {
|
error: function (error) {
|
||||||
|
|||||||
8522
xdebug.log
8522
xdebug.log
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user