depurando fallos. Falta backend comprobacion

This commit is contained in:
jaimejimenezortega
2024-04-07 22:01:30 +02:00
parent 987da56f2a
commit eb3b3e5e3b
5 changed files with 5039 additions and 99 deletions

View File

@ -20,7 +20,7 @@ class PresupuestoServiciosExtraModel extends \App\Models\GoBaseModel
];
protected $allowedFields = ["presupuesto_id", "tarifa_extra_id", "nombre", "precio_total", "precio_unidad", "margen"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoPreimpresionesEntity";
protected $returnType = "App\Entities\Presupuestos\PresupuestoServiciosExtraEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
@ -48,7 +48,7 @@ class PresupuestoServiciosExtraModel extends \App\Models\GoBaseModel
public function getPrecioTarifa($tarifa_extra_id){
$modelTarifa = model('App\Models\Tarifas\TarifaextraModel');
$tarifa_value = $modelTarifa->getTarifaPresupuestoPreimpresion($tarifa_extra_id);
$tarifa_value = $modelTarifa->getTarifaPresupuestoExtra($tarifa_extra_id);
if (count($tarifa_value)>0) {
$result_data = $this->calcularTarifa($tarifa_value[0]);

View File

@ -37,6 +37,9 @@ $(document).on('click', '.btn-delete-serv', function(e) {
else if($(this).closest('table').attr('id').includes('tableOfServiciosPreimpresion')){
table = "tableOfServiciosPreimpresion";
}
else if($(this).closest('table').attr('id').includes('tableOfServiciosExtra')){
table = "tableOfServiciosExtra";
}
else{
table = "";
}
@ -60,6 +63,7 @@ $(document).on('click', '.btn-delete-serv', function(e) {
check_serv_acabado_error()
check_serv_preimpresion_error()
check_serv_manipulado_error()
check_serv_extra_error()
updatePresupuesto({
update_lineas: false,
update_servicios: false,
@ -156,6 +160,16 @@ var tableServiciosAcabado = new DataTable('#tableOfServiciosAcabado',{
},
});
tableServiciosAcabado.on('draw', function(){
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true})
})
function init_servicio_acabado(){
$('#add_servicio_acabado_list').select2({
@ -190,15 +204,7 @@ function init_servicio_acabado(){
update_resumen: true,
update_tiradas_alternativas: true})
})
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
})
check_serv_acabado_error()
}
@ -273,16 +279,6 @@ function get_tarifas_acabado(tarifa_id = -1, uso=null){
})
});
if(data.values.lenght > 0){
//updateTotales(false, true, false)
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
}
check_serv_acabado_error()
yeniden(data[window.csrf_token]);
@ -479,6 +475,14 @@ var tableServiciosEnc = new DataTable('#tableOfServiciosEncuadernacion',{
},
});
tableServiciosEnc.on('draw', function(){
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true})
})
function init_servicio_encuadernado(){
@ -560,14 +564,6 @@ function init_servicio_encuadernado(){
});
$('#proveedor_enc_' + element.tarifa_encuadernado_id).on('change', proveedor_enc_event)
});
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
check_serv_enc_error()
}
@ -602,13 +598,6 @@ function proveedor_enc_event(){
$('#precio_total_encuadernado_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].total).toFixed(2))
$('#enc_margen_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].margen).toFixed(2))
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
yeniden(data[window.csrf_token]);
return true;
},
@ -746,17 +735,6 @@ async function get_tarifas_enc(tipo=null, tarifa_id = -1){
});
if(data.values.lenght > 0){
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
}
check_serv_enc_error()
yeniden(data[window.csrf_token]);
return true;
@ -781,6 +759,8 @@ $('#insertar_serv_enc').on('click', function(){
}
check_serv_enc_error()
})
function get_datos_encuadernacion(){
var datosEnc = []
@ -882,6 +862,15 @@ var tableServiciosManipulado = new DataTable('#tableOfServiciosManipulado',{
},
});
tableServiciosManipulado.on('draw', function(){
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true})
})
function init_servicio_manipulado(){
$('#add_servicio_manipulado_list').select2({
@ -989,17 +978,6 @@ async function get_tarifas_manipulado(tipo=null, tarifa_id = -1){
update_tiradas_alternativas: true})
})
});
if(data.values.lenght > 0){
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
}
check_serv_manipulado_error()
yeniden(data[window.csrf_token]);
return true;
@ -1133,6 +1111,15 @@ var tableServiciosPreimpresion = new DataTable('#tableOfServiciosPreimpresion',{
}
});
tableServiciosPreimpresion.on('draw', function(){
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true})
})
function init_servicio_preimpresion(){
@ -1163,14 +1150,6 @@ function init_servicio_preimpresion(){
})
})
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
check_serv_preimpresion_error()
}
@ -1207,7 +1186,7 @@ function get_tarifas_preimpresion(tarifa_id = -1){
$.ajax({
type: "POST",
url: window.routes_servicios.dataTableOfPresupuestoPreimpresiones,
url: window.routes_servicios.dataTableOfPresupuestoPreimpresion,
data: datos,
success: function (data) {
@ -1231,17 +1210,6 @@ function get_tarifas_preimpresion(tarifa_id = -1){
})
});
if(data.values.lenght > 0){
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
}
check_serv_preimpresion_error()
yeniden(data[window.csrf_token]);
return true;
@ -1394,6 +1362,14 @@ var tableServiciosExtra = new DataTable('#tableOfServiciosExtra',{
}
});
tableServiciosExtra.on('draw', function(){
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true})
})
function init_servicio_extra(){
@ -1406,7 +1382,7 @@ function init_servicio_extra(){
window.serviciosextraList.forEach((element) =>{
tableServiciosPreimpresion.row.add([
tableServiciosExtra.row.add([
element.tarifa_extra_id,
element.nombre,
'<input class="update-totales-servicios" id="precio_servicioextra_' + element.tarifa_extra_id +'" value="' + parseFloat(element.precio).toFixed(2) + '"></input>',
@ -1424,14 +1400,6 @@ function init_servicio_extra(){
})
})
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
check_serv_extra_error()
}
@ -1483,7 +1451,7 @@ function get_tarifas_extra(tarifa_id = -1){
]).draw(false)
$('#precio_servicioextra_' + row.tarifa_id).on('change', function(){
updatePresupuesto({
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
@ -1492,17 +1460,6 @@ function get_tarifas_extra(tarifa_id = -1){
})
});
if(data.values.lenght > 0){
updatePresupuesto({
update_lineas: false,
update_servicios: false,
update_envios: false,
update_resumen: true,
update_tiradas_alternativas: true
})
}
check_serv_extra_error()
yeniden(data[window.csrf_token]);
return true;

View File

@ -114,6 +114,17 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
})
}
if ( typeof $("#tableOfServiciosExtra").DataTable() !== 'undefined' && $("#tableOfServiciosExtra").DataTable().rows().count() > 0){
$('#tableOfServiciosExtra tbody tr').each(function(){
var currentRow = $(this).closest("tr");
var subId = $('#tableOfServiciosExtra').DataTable().cell(currentRow,0).node().innerHTML;
var total = parseFloat($('#precio_servicioextra_' + subId)[0].value)
totalServicios += total
margenServicios += (total*parseFloat($('#servicioextra_margen_' + subId)[0].innerHTML)/100.0)
})
}
if ( typeof $("#tableOfServiciosManipulado").DataTable() !== 'undefined' && $("#tableOfServiciosManipulado").DataTable().rows().count() > 0){
$('#tableOfServiciosManipulado tbody tr').each(function(){

View File

@ -143,6 +143,10 @@ async function add_tirada_alternativa(tirada_alt) {
costes_servicios += parseFloat(valuePreimpresion.coste);
margen_servicios += parseFloat(valuePreimpresion.margen);
const valueServiciosExtra = await get_servExtra_tiradasAlternativas(parseInt(datos.tirada));
costes_servicios += parseFloat(valueServiciosExtra.coste);
margen_servicios += parseFloat(valueServiciosExtra.margen);
//console.log('coste preimpresion ('+ datos.tirada +'): ' + valuePreimpresion.coste);
const valueTransporte = await get_coste_envio_tiradasAlternativas(parseInt(datos.tirada));

4968
xdebug.log

File diff suppressed because it is too large Load Diff