mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
arreglados bugs de lineas. Ahora se suman los clicks en el total
This commit is contained in:
@ -84,6 +84,7 @@ const papelGenericoRotativaColorList = <?php echo json_encode($papelGenericoRota
|
||||
|
||||
// Formatting function for row details - modify as you need
|
||||
function format(d) {
|
||||
|
||||
var value = '<tr>'+
|
||||
'<td></td>'+
|
||||
'<td></td>'+
|
||||
@ -111,7 +112,7 @@ function format(d) {
|
||||
'</div>'+
|
||||
'<input id="' + d.row_id +'_margenPapelPedido" name="' + d.row_id +'_margenPapelPedido" readonly class="lp-input lp-cell lp-cell-disabled ' + d.row_class + '-input" type="text" value="' + d.margenPapelPedido +'" style="display: none;">' +
|
||||
'<div class="d-flex col-md-auto justify-content-center align-items-center">' +
|
||||
'<input id="' + d.row_id + '_checkPapel" name="' + d.row_id +'_checkPapel" class="update-totales" style="bottom:0;width: 15px; padding: 0; margin:0;" type="checkbox" checked>' +
|
||||
'<input id="' + d.row_id + '_checkPapel" name="' + d.row_id +'_checkPapel" class="update-totales" style="bottom:0;width: 15px; padding: 0; margin:0;" type="checkbox" ' + (d.check_papel_total==true?'checked':'') + '>' +
|
||||
'</div>'+
|
||||
'<div class="col-md-1 col-lg-1">' +
|
||||
"<?= lang("Presupuestos.click") ?>" +
|
||||
@ -134,7 +135,7 @@ function format(d) {
|
||||
'<input id="' + d.row_id +'_precioImpresion" name="' + d.row_id +'_precioImpresion" class="lp-input lp-cell lp-cell-disabled ' + d.row_class +'-input" type="text" value="' + d.precioImpresion +'">'+
|
||||
'</div>'+
|
||||
'<div class="d-flex col-md-auto justify-content-center align-items-center">' +
|
||||
'<input id="' + d.row_id + '_checkClicks" name="' + d.row_id +'_checkClicks" class="update-totales" style="bottom:0;width: 15px; padding: 0; margin:0;" type="checkbox" checked>' +
|
||||
'<input id="' + d.row_id + '_checkClicks" name="' + d.row_id +'_checkClicks" class="update-totales" style="bottom:0;width: 15px; padding: 0; margin:0;" type="checkbox" ' + (d.check_impresion_total==true?'checked':'') + '>' +
|
||||
'</div>'+
|
||||
'<input id="' + d.row_id +'_margenImpresion" name="' + d.row_id +'_margenImpresion" readonly class="lp-input lp-cell lp-cell-disabled ' + d.row_class + '-input" type="text" value="' + d.margenImpresion +'" style="display: none;">' +
|
||||
'</div>' +
|
||||
@ -575,17 +576,6 @@ tableLineasPresupuesto.on('click', 'td.dt-control', function (e) {
|
||||
|
||||
function processRowData(row, rowId, rowClass){
|
||||
|
||||
$('#lp_bn_numeroPliegos').val()
|
||||
$('#lp_bn_pliegosPedido').val()
|
||||
$('#lp_bn_precioPliego').val()
|
||||
$('#lp_bn_libro').val()
|
||||
$('#lp_bn_totalPapelPedido').val()
|
||||
$('#lp_bn_margenPapelPedido').val()
|
||||
$('#lp_bn_lomo').val()
|
||||
$('#lp_bn_peso').val()
|
||||
$('#lp_bn_click').val()
|
||||
$('#lp_bn_totalClicks').val()
|
||||
|
||||
var icon = ""
|
||||
if(rowId=='lp_bn'){
|
||||
if(row.tipo_maquina=='toner')
|
||||
@ -665,6 +655,8 @@ function processRowData(row, rowId, rowClass){
|
||||
'precioImpresion': isNaN(parseFloat(row.precio_impresion_horas)) ? "" : parseFloat(row.precio_impresion_horas).toFixed(2),
|
||||
'margenImpresion': isNaN(parseFloat(row.margen_impresion_horas)) ? "" : parseFloat(row.margen_impresion_horas).toFixed(2),
|
||||
'maquinaTipo': row.tipo_maquina,
|
||||
'check_papel_total': row.check_papel_total,
|
||||
'check_impresion_total': row.check_impresion_total,
|
||||
}
|
||||
|
||||
if(row.tipo_maquina=='inkjet'){
|
||||
@ -982,26 +974,26 @@ $('#addLineasPresupuesto').on("change", function (e) {
|
||||
|
||||
function update_total_linea(e){
|
||||
total = 0
|
||||
var rowData = tableLineasPresupuesto.row('#' + e.data.id_linea).data()
|
||||
if($('#' + e.data.id_linea + '_checkPapel').prop('checked')){
|
||||
total += parseFloat($('#' + e.data.id_linea + '_totalPapelPedido').val())
|
||||
}
|
||||
if($('#' + e.data.id_linea + '_checkClicks').prop('checked')){
|
||||
total += parseFloat($('#' + e.data.id_linea + '_precioImpresion').val())
|
||||
total += parseFloat($('#' + e.data.id_linea + '_margenImpresion').val())
|
||||
total += parseFloat($('#' + e.data.id_linea + '_totalClicks').val())
|
||||
|
||||
if (rowData.maquinaTipo == 'inkjet'){
|
||||
total += parseFloat(rowData.totalTinta)
|
||||
}
|
||||
if (e.data.id_linea.includes('rot_')){
|
||||
total += parseFloat(rowData.totalCorte)
|
||||
}
|
||||
}
|
||||
|
||||
var rowData = tableLineasPresupuesto.row('#' + e.data.id_linea).data()
|
||||
if (rowData.maquinaTipo == 'inkjet'){
|
||||
total += parseFloat(rowData.totalTinta)
|
||||
}
|
||||
if (e.data.id_linea.includes('rot_')){
|
||||
total += parseFloat(rowData.totalCorte)
|
||||
}
|
||||
|
||||
rowData.total_linea = parseFloat(total).toFixed(2)
|
||||
|
||||
tableLineasPresupuesto.row('#' + e.data.id_linea).data(rowData).draw(true)
|
||||
|
||||
updateTotales(true, false, false)
|
||||
}
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -89,6 +89,7 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
||||
var margenPapel = 0
|
||||
|
||||
var totalImpresion = 0
|
||||
var totalImpresionforMargen = 0
|
||||
var margenImpresion = 0
|
||||
|
||||
var totalServicios = 0
|
||||
@ -107,19 +108,30 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){
|
||||
}
|
||||
if($('#' + rowData.row_id + '_checkClicks').prop('checked')){
|
||||
totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
|
||||
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
|
||||
totalImpresionforMargen += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
|
||||
|
||||
if(rowData.maquinaTipo=='inkjet'){
|
||||
totalImpresion += parseFloat(rowData.totalTinta)
|
||||
totalImpresion += parseFloat(rowData.totalCorte)
|
||||
}
|
||||
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
|
||||
if(!isNaN(parseFloat($('#' + rowData.row_id + 'lp_bn_totalTinta').val())))
|
||||
totalImpresion += parseFloat($('#' + rowData.row_id + 'lp_bn_totalTinta').val())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
totalImpresion -= margenImpresion
|
||||
totalImpresionforMargen -= margenImpresion
|
||||
totalPapel -= margenPapel
|
||||
|
||||
var porcentajeMargenPapel = isNaN(margenPapel/(totalPapel)*100)?0:margenPapel/(totalPapel)*100
|
||||
$('#porcentajeMargenPapel').text(porcentajeMargenPapel.toFixed(0) + '%')
|
||||
$('#totalCostePapel').text(totalPapel.toFixed(2)+ '€')
|
||||
$('#margenPapel').text(margenPapel.toFixed(2) + '€')
|
||||
|
||||
var porcentajeMargenImpresion = isNaN(margenImpresion/(totalImpresion)*100)?0:margenImpresion/(totalImpresion)*100
|
||||
var porcentajeMargenImpresion = isNaN(margenImpresion/(totalImpresionforMargen)*100)?0:margenImpresion/(totalImpresionforMargen)*100
|
||||
$('#porcentajeMargenImpresion').text(porcentajeMargenImpresion.toFixed(0) + '%')
|
||||
$('#totalCosteImpresion').text(totalImpresion.toFixed(2) + '€')
|
||||
$('#margenImpresion').text(margenImpresion.toFixed(2) + '€')
|
||||
|
||||
@ -112,8 +112,8 @@ $('.accordion-button').on('click', function (e) {
|
||||
*******************************/
|
||||
function getRowFromLineaInt(tipo, linea) {
|
||||
|
||||
$precio_impresion = isNaN(parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas)) ? "" :
|
||||
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas).toFixed(2);
|
||||
$precio_impresion = isNaN(parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas + linea.fields.precio_click_pedido)) ? "" :
|
||||
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas + linea.fields.precio_click_pedido).toFixed(2);
|
||||
|
||||
|
||||
return {
|
||||
@ -132,8 +132,7 @@ function getRowFromLineaInt(tipo, linea) {
|
||||
'peso': isNaN(parseFloat(linea.fields.peso)) ? "" : parseFloat(linea.fields.peso).toFixed(2),
|
||||
'horasMaquina': isNaN(parseFloat(linea.fields.horas_maquina)) ? "" : parseFloat(linea.fields.horas_maquina).toFixed(2),
|
||||
'precioImpresion': $precio_impresion,
|
||||
'total': isNaN(parseFloat(linea.fields.precio_pedido) + parseFloat($precio_impresion)) ?
|
||||
"" : (parseFloat(linea.fields.precio_pedido) + parseFloat($precio_impresion)).toFixed(2),
|
||||
'total': isNaN(parseFloat(linea.fields.total_impresion).toFixed(2)) ? "" : parseFloat(linea.fields.total_impresion).toFixed(2),
|
||||
'maquinaId': linea.fields.maquina_id,
|
||||
'maquinaVelocidad': linea.fields.maquina_velocidad,
|
||||
'tiempoMaquina': linea.fields.tiempo_maquina,
|
||||
@ -145,8 +144,8 @@ function getRowFromLineaInt(tipo, linea) {
|
||||
|
||||
function getRowFromLineaRot(linea) {
|
||||
|
||||
$precio_impresion = isNaN(parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas)) ? "" :
|
||||
parseFloat(linea.fields.precio_impresion_horas + linea.fields.margen_impresion_horas).toFixed(2);
|
||||
$precio_impresion = isNaN(parseFloat(linea.fields.precio_impresion_horas + linea.fields.precio_click_pedido)) ? "" :
|
||||
parseFloat(linea.fields.precio_impresion_horas + linea.fields.precio_click_pedido).toFixed(2);
|
||||
|
||||
return {
|
||||
'tipo': 'rotativa',
|
||||
|
||||
Reference in New Issue
Block a user