terminado y arreglado otros bugs

This commit is contained in:
jaimejimenezortega
2024-06-18 17:47:21 +02:00
parent e235165499
commit 5e876f07fb
5 changed files with 73 additions and 28 deletions

View File

@ -693,6 +693,14 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$unidades_calculo,
$direccion['tipo'] == 'cajas' ? 0 : 1
);
if (count($coste_envio) > 0) {
$coste = floatval($coste_envio[0]->coste);
$margen = ($coste * floatval($coste_envio[0]->margen)) / 100.0;
$coste -= $margen;
$resultado_presupuesto['info']['totales'][$i]['coste_envio'] += $coste;
$resultado_presupuesto['info']['totales'][$i]['margen_envio'] += $margen;
}
}
catch(Exception $e){
return $this->respond([
@ -701,14 +709,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$csrfTokenName => $newTokenHash
]);
}
if (count($coste_envio) > 0) {
$coste = floatval($coste_envio[0]->coste);
$margen = ($coste * floatval($coste_envio[0]->margen)) / 100.0;
$coste -= $margen;
$resultado_presupuesto['info']['totales'][$i]['coste_envio'] += $coste;
$resultado_presupuesto['info']['totales'][$i]['margen_envio'] += $margen;
}
}
}
@ -782,10 +782,14 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
if ($servicio->tarifa_id == 3 || $servicio->tarifa_id == 5 || $servicio->tarifa_id == 16) {
// Servicios acabado
$this->guardarServicio($id, $servicio, 'acabado');
} else if ($servicio->tarifa_id == 24 || $servicio->tarifa_id == 9) {
} else if ($servicio->tarifa_id == 24 ) {
// Servicios preimpresion
$this->guardarServicio($id, $servicio, 'preimpresion');
} else if ($servicio->tarifa_id == 9) {
// Servicios extra
$this->guardarServicio($id, $servicio, 'extra');
} else if ($servicio->tarifa_id == 62) {
}
else if ($servicio->tarifa_id == 62) {
// Servicios manipulado
$this->guardarServicio($id, $servicio, 'manipulado');
}
@ -1475,7 +1479,22 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$totalServicios += floatval($resultado[0]->total);
$margenServicios += floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0;
}
} else if (intval($servicio) == 24 || intval($servicio) == 9) {
} else if (intval($servicio) == 24) {
// Servicios preimpresion (Ferro)
$resultado = PresupuestoCLienteService::getServiciosPreimpresion([
'tarifa_id' => $servicio,
]);
array_push($serviciosAutomaticos, $resultado[0]);
if ($resultado[0]->precio <= 0)
$error->servicios = lang('Presupuestos.errores.errorPresupuesto');
$coste_servicios += floatval($resultado[0]->precio);
if ($extra_info) {
$totalServicios += floatval($resultado[0]->precio);
$margenServicios += floatval($resultado[0]->precio) * floatval($resultado[0]->margen) / 100.0;
}
}
if(intval($servicio) == 9) {
// Servicios preimpresion
$resultado = PresupuestoCLienteService::getServiciosExtra([
'tarifa_id' => $servicio,

View File

@ -63,7 +63,7 @@ class PresupuestoServiciosExtraModel extends \App\Models\BaseModel
else{
$ret_array[] = (object)[
'tarifa_id'=> $tarifa_extra_id,
'tarifa_nombre'=> $modelTarifa->getNombreTarifaPreimpresion($tarifa_extra_id)[0]->nombre,
'tarifa_nombre'=> $modelTarifa->getNombreTarifaExtra($tarifa_extra_id)[0]->nombre,
'precio' => 0,
'margen' => 0,
];

View File

@ -178,6 +178,13 @@ $('#btnBack').on('click', function() {
});
function finalizarPresupuesto(confirmar){
let isColor = false;
if($('#colorColorDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked'))
isColor = true;
let isHq = false;
if($('#colorNegroDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked'))
isHq = true;
const paths = window.location.pathname.split("/").filter(path => path !== "");
let id=0;
@ -197,8 +204,8 @@ function finalizarPresupuesto(confirmar){
paginasColor: $('#paginasColor').val(),
tipo: $('.custom-option-tipo.checked').attr('id').replace('Div', ''),
tapa: $('#tapaDura').is(':checked') ? 'dura' : 'blanda',
isColor: $('#colorNegroDiv').hasClass('checked') ? 0 : 1,
isHq: $('#calidadEstandarDiv').hasClass('checked') ? 0 : 1,
isColor: isColor,
isHq: isHq,
papelInterior: $('#papelInterior option:selected').val(),
papelInteriorNombre: $('#papelInterior option:selected').text().trim(),
gramajeInterior: $('#gramajeInterior option:selected').text(),
@ -283,6 +290,7 @@ function finalizarPresupuesto(confirmar){
if(Object.keys(response).length > 0) {
if(response.status > 0){
if(confirmar || window.location.href.includes("add"))
window.location.href = response.url + '/' + response.status;
}

View File

@ -50,13 +50,21 @@
const lastColNr = $('#tableOfPresupuestos').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
</div>
</td>`;
if(data.estado == 'borrador')
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
</div>
</td>`;
else
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
</div>
</td>`;
};
// Setup - add a text input to each footer cell

View File

@ -51,13 +51,23 @@
const lastColNr = $('#tableOfPresupuestos').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
</div>
</td>`;
if (data.estado == 'aceptado') {
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
</div>
</td>`;
}
else{
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
</div>
</td>`;
}
};
// Setup - add a text input to each footer cell