mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en lineas presupuesto
This commit is contained in:
@ -0,0 +1,689 @@
|
||||
import Ajax from "../../../components/ajax";
|
||||
import ClassSelect from "../../../components/select2";
|
||||
|
||||
|
||||
class LineasPresupuesto {
|
||||
|
||||
constructor(domItem, functions = {}) {
|
||||
this.domItem = domItem;
|
||||
this.functions = functions;
|
||||
|
||||
this.table = null;
|
||||
|
||||
this.addLineaManual = this.domItem.find("#btn_addLinea");
|
||||
}
|
||||
|
||||
init() {
|
||||
this.#initTable();
|
||||
|
||||
this.addLineaManual.on('click',
|
||||
}
|
||||
|
||||
#initTable() {
|
||||
|
||||
const lastColNr_lp = $('#tableLineasPresupuesto').find("tr:first th").length - 1;
|
||||
|
||||
const actionBtns_lp = function (data) {
|
||||
return `
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-lp mx-2" data-id="${data.row_id}"></i></a>
|
||||
`;
|
||||
};
|
||||
|
||||
this.table = new DataTable('#tableLineasPresupuesto', {
|
||||
scrollX: true,
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
ordering: true,
|
||||
responsive: true,
|
||||
select: false,
|
||||
rowId: 'row_id',
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
className: 'dt-control',
|
||||
orderable: false,
|
||||
data: null,
|
||||
defaultContent: ''
|
||||
},
|
||||
{
|
||||
targets: [1, 2, 3, 4, 5, 6, 7, 8, 9],
|
||||
orderable: false,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
targets: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
|
||||
orderable: false,
|
||||
},
|
||||
{
|
||||
targets: [10],
|
||||
orderable: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr_lp]
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{ data: null },
|
||||
{ data: 'tarifa_impresion_id' },
|
||||
{ data: 'maquina_ancho' },
|
||||
{ data: 'maquina_alto' },
|
||||
{ data: 'maquina_impresion_ancho' },
|
||||
{ data: 'maquina_impresion_alto' },
|
||||
{ data: 'formas' },
|
||||
{ data: 'formas_v' },
|
||||
{ data: 'formas_h' },
|
||||
{ data: 'formas_orientacion' },
|
||||
{
|
||||
data: 'position',
|
||||
type: "num",
|
||||
render: function (data, type, row, meta) {
|
||||
if (row.row_id.includes('_bn')) {
|
||||
return 0;
|
||||
}
|
||||
else if (row.row_id.includes('_color')) {
|
||||
return 1;
|
||||
}
|
||||
else if (row.row_id.includes('_cubierta')) {
|
||||
return 2;
|
||||
}
|
||||
else if (row.row_id.includes('_sobrecubierta')) {
|
||||
return 3;
|
||||
}
|
||||
else if (row.row_id.includes('_guardas')) {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'icon',
|
||||
render: function (data, type, row, meta) {
|
||||
return '<img style="padding: 0; margin:0;" src="' + data + '" />'
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'paginas',
|
||||
render: function (data, type, row, meta) {
|
||||
if (row.row_id != "lp_cubierta" && row.row_id != "lp_sobrecubierta" && row.row_id != "lp_guardas")
|
||||
return '<td class="lp-td"><input id="' + row.row_id + '_paginas" name="' + row.row_id + '_paginas" class="lp-cell lp-input paginas-lp" type="text" value="' + data + '"></td>';
|
||||
else if (row.row_id == "lp_cubierta") {
|
||||
select = '<select id="lp_cubierta_paginas" name="comp_paginas_cubierta" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;">'
|
||||
if (data == 2) {
|
||||
select += '<option value="2" selected >'
|
||||
}
|
||||
else {
|
||||
select += '<option value="2">'
|
||||
}
|
||||
select += '<p>' + window.language.Presupuestos.unaCara + '</p>'
|
||||
select += '</option>'
|
||||
if (data == 4) {
|
||||
select += '<option value="4" selected >'
|
||||
}
|
||||
else {
|
||||
select += '<option value="4">'
|
||||
}
|
||||
select += '<p>' + window.language.Presupuestos.dosCaras + '</p>'
|
||||
select += '</option>'
|
||||
select += '</select>'
|
||||
|
||||
return select;
|
||||
}
|
||||
else if (row.row_id == "lp_guardas") {
|
||||
select = '<select id="lp_guardas_paginas" name="comp_paginas_guardas" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;">'
|
||||
if (row.paginas_impresion == 0) {
|
||||
select += '<option value="0" selected >'
|
||||
}
|
||||
else {
|
||||
select += '<option value="0">'
|
||||
}
|
||||
select += '<p>' + window.language.Presupuestos.sinImpresion + '</p>'
|
||||
select += '</option>'
|
||||
if (row.paginas_impresion == 4) {
|
||||
select += '<option value="4" selected >'
|
||||
}
|
||||
else {
|
||||
select += '<option value="4">'
|
||||
}
|
||||
select += '<p>' + window.language.Presupuestos.unaCara + '</p>'
|
||||
select += '</option>'
|
||||
if (row.paginas_impresion == 8) {
|
||||
select += '<option value="8" selected >'
|
||||
}
|
||||
else {
|
||||
select += '<option value="8">'
|
||||
}
|
||||
select += '<p>' + window.language.Presupuestos.dosCaras + '</p>'
|
||||
select += '</option>'
|
||||
select += '</select>'
|
||||
|
||||
return select;
|
||||
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'papel',
|
||||
render: function (data, type, row, meta) {
|
||||
var select = $('<select>')
|
||||
.attr('id', row.row_id + '_papel')
|
||||
.attr('name', row.row_id + '_papel')
|
||||
.addClass('form-control form-select-sm lp-cell lp-select')
|
||||
.css('min-width', '150px')
|
||||
|
||||
let tipo = 'negro';
|
||||
switch(row.row_id){
|
||||
case 'lp_negrohq':
|
||||
tipo = 'negrohq';
|
||||
break;
|
||||
case 'lp_rot_color':
|
||||
case 'lp_color':
|
||||
tipo = 'color';
|
||||
break;
|
||||
case 'lp_colorhq':
|
||||
case 'lp_guardas':
|
||||
case 'lp_cubierta':
|
||||
case 'lp_sobrecubierta':
|
||||
tipo='colorhq';
|
||||
break
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
let papelGenerico = new ClassSelect('#' + row.row_id + '_papel',
|
||||
'/presupuestoadmin/papelgenerico', 'Seleccione papel', false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo_impresion: this.tipo_impresion_id,
|
||||
tirada: () => $('#tirada').val(),
|
||||
tipo: tipo,
|
||||
});
|
||||
if(data){
|
||||
papelGenerico.setOption(data, data);
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
}
|
||||
|
||||
return select[0].outerHTML
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'gramaje',
|
||||
render: function (data, type, row, meta) {
|
||||
var select = $('<select>')
|
||||
.attr('id', row.row_id + '_gramaje')
|
||||
.attr('name', row.row_id + '_gramaje')
|
||||
.addClass('form-control form-select-sm lp-cell lp-select ')//+ row.row_class + '-select')
|
||||
.css('min-width', '40px')
|
||||
|
||||
var option = '<option value="" selected>' + parseInt(data) + '</option>';
|
||||
select.append(option);
|
||||
|
||||
return select[0].outerHTML
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'papel_impresion',
|
||||
render: function (data, type, row, meta) {
|
||||
var select = $('<select>')
|
||||
.attr('id', row.row_id + '_papelImpresion')
|
||||
.attr('name', row.row_id + '_papelImpresion')
|
||||
.addClass('form-control form-select-sm lp-cell lp-select ' + row.row_class + '-select')
|
||||
.css('min-width', '150px')
|
||||
|
||||
var option = '<option value="' + row.papel_impresion_id + '" selected>' + data + '</option>';
|
||||
select.append(option);
|
||||
|
||||
return select[0].outerHTML
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'maquina',
|
||||
render: function (data, type, row, meta) {
|
||||
var select = $('<select>')
|
||||
.attr('id', row.row_id + '_maquina')
|
||||
.attr('name', row.row_id + '_maquina')
|
||||
.addClass('form-control form-select-sm lp-cell lp-select ' + row.row_class + '-select')
|
||||
.css('min-width', '110px')
|
||||
|
||||
var option = '<option value="' + row.maquina_id + '" selected>' + data + '</option>';
|
||||
select.append(option);
|
||||
|
||||
return select[0].outerHTML
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'tiempo',
|
||||
render: function (data, type, row, meta) {
|
||||
return '<td class="lp-td"><input id="' + row.row_id + '_tiempo" name="' + row.row_id + '_tiempo" readonly class="lp-cell lp-cell-disabled lp-input ' + row.row_class + '-input " type="text" value="' + data + '"></td>';
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'lomo',
|
||||
render: function (data, type, row, meta) {
|
||||
return '<td class="lp-td"><input id="' + row.row_id + '_lomo" name="' + row.row_id + '_lomo" readonly class="lp-cell lp-cell-disabled lp-input ' + row.row_class + '-input" type="text" value="' + data + '"></td>';
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'peso',
|
||||
render: function (data, type, row, meta) {
|
||||
return '<td class="lp-td"><input id="' + row.row_id + '_peso" name="' + row.row_id + '_peso" readonly class="lp-cell lp-cell-disabled lp-input ' + row.row_class + '-input" type="text" value="' + data + '"></td>';
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'total_linea',
|
||||
render: function (data, type, row, meta) {
|
||||
return '<td class="lp-td"><input id="' + row.row_id + '_total_linea" name="' + row.row_id + '_total_linea" readonly class="lp-cell lp-cell-disabled lp-input ' + row.row_class + '-input " type="text" value="' + data + '"></td>';
|
||||
}
|
||||
},
|
||||
{
|
||||
data: actionBtns_lp,
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
],
|
||||
"order": [10, 'asc']
|
||||
});
|
||||
|
||||
this.table.on('click', 'td.dt-control', function (e) {
|
||||
let tr = e.target.closest('tr');
|
||||
let row = tableLineasPresupuesto.row(tr);
|
||||
|
||||
if (row.child.isShown()) {
|
||||
// This row is already open - close it
|
||||
row.child.hide();
|
||||
}
|
||||
else {
|
||||
// Open this row
|
||||
row.child(format(row.data())).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#insertLineaManual() {
|
||||
|
||||
let dataRows = this.table.rows().data();
|
||||
|
||||
switch ($('#addLineasPresupuesto').val()) {
|
||||
// Se chequean todas las lineas de negro y todas las de color
|
||||
// (solo una de cada en interior)
|
||||
|
||||
case 'lp_bn':
|
||||
var hayLinea = false
|
||||
for (let number = 0; number < dataRows.length; number++) {
|
||||
if (dataRows[number].row_id == 'lp_bn' ||
|
||||
dataRows[number].row_id == 'lp_bnhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_bn') {
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (hayLinea) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({ tipo_maquina: 'toner' }, 'lp_bn', 'lp-bn');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_bn()
|
||||
break
|
||||
|
||||
case 'lp_bnhq':
|
||||
var hayLinea = false
|
||||
for (let number = 0; number < dataRows.length; number++) {
|
||||
if (dataRows[number].row_id == 'lp_bn' ||
|
||||
dataRows[number].row_id == 'lp_bnhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_bn') {
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (hayLinea) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({ tipo_maquina: 'toner' }, 'lp_bnhq', 'lp-bnhq');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_bnhq()
|
||||
break
|
||||
|
||||
case 'lp_color':
|
||||
var hayLinea = false
|
||||
for (let number = 0; number < dataRows.length; number++) {
|
||||
if (dataRows[number].row_id == 'lp_color' ||
|
||||
dataRows[number].row_id == 'lp_colorhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_color') {
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (hayLinea) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({ tipo_maquina: 'toner' }, 'lp_color', 'lp-color');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_color()
|
||||
break
|
||||
|
||||
case 'lp_colorhq':
|
||||
var hayLinea = false
|
||||
for (let number = 0; number < dataRows.length; number++) {
|
||||
if (dataRows[number].row_id == 'lp_color' ||
|
||||
dataRows[number].row_id == 'lp_colorhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_color') {
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (hayLinea) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({ tipo_maquina: 'toner' }, 'lp_colorhq', 'lp-colorhq');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_colorhq()
|
||||
break
|
||||
|
||||
case 'lp_rot_bn':
|
||||
var hayLinea = false
|
||||
for (let number = 0; number < dataRows.length; number++) {
|
||||
if (dataRows[number].row_id == 'lp_bn' ||
|
||||
dataRows[number].row_id == 'lp_bnhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_bn') {
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (hayLinea) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({ tipo_maquina: 'toner' }, 'lp_rot_bn', 'lp-rot-bn');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_rot_bn()
|
||||
break
|
||||
|
||||
case 'lp_rot_color':
|
||||
var hayLinea = false
|
||||
for (let number = 0; number < dataRows.length; number++) {
|
||||
if (dataRows[number].row_id == 'lp_color' ||
|
||||
dataRows[number].row_id == 'lp_colorhq' ||
|
||||
dataRows[number].row_id == 'lp_rot_color') {
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (hayLinea) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({ tipo_maquina: 'toner' }, 'lp_rot_color', 'lp-rot-color');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_rot_color()
|
||||
break
|
||||
|
||||
case 'lp_cubierta':
|
||||
var hayLinea = false
|
||||
for (let number = 0; number < dataRows.length; number++) {
|
||||
if (dataRows[number].row_id == 'lp_cubierta') {
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (hayLinea) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({ tipo_maquina: 'toner' }, 'lp_cubierta', 'lp-cubierta');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_cubierta()
|
||||
break
|
||||
|
||||
case 'lp_sobrecubierta':
|
||||
var hayLinea = false
|
||||
for (let number = 0; number < dataRows.length; number++) {
|
||||
if (dataRows[number].row_id == 'lp_sobrecubierta') {
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (hayLinea) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({ tipo_maquina: 'toner' }, 'lp_sobrecubierta', 'lp-sobrecubierta');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
eventos_lp_sobrecubierta()
|
||||
break
|
||||
|
||||
case 'lp_guardas':
|
||||
var hayLinea = false
|
||||
for (let number = 0; number < dataRows.length; number++) {
|
||||
if (dataRows[number].row_id == 'lp_guardas') {
|
||||
hayLinea = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (hayLinea) {
|
||||
popErrorAlert(window.language.Presupuestos.errores.lineaDuplicada, 'divAlarmasLineasPresupuesto');
|
||||
break
|
||||
}
|
||||
|
||||
var data = processRowData({ tipo_maquina: 'toner' }, 'lp_guardas', 'lp-guardas');
|
||||
tableLineasPresupuesto.row.add(data).draw()
|
||||
$('#lp_guardas_gramaje').empty()
|
||||
var o = new Option("170", "170");
|
||||
$('#lp_guardas_gramaje').append(o)
|
||||
eventos_lp_guardas()
|
||||
servicioGuardas(true)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||
}
|
||||
|
||||
#processRowData(row, rowId, rowClass) {
|
||||
|
||||
var icon = ""
|
||||
if (rowId == 'lp_bn') {
|
||||
if (row.tipo_maquina == 'toner')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_bn.png") ?>'
|
||||
else
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_inkjet_bn.png") ?>'
|
||||
}
|
||||
|
||||
else if (rowId == 'lp_bnhq') {
|
||||
if (row.tipo_maquina == 'toner')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_bnhq.png") ?>'
|
||||
else
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_inkjet_bn.png") ?>'
|
||||
}
|
||||
else if (rowId == 'lp_color') {
|
||||
if (row.tipo_maquina == 'toner')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_color.png") ?>'
|
||||
else
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_inkjet_color.png") ?>'
|
||||
}
|
||||
else if (rowId == 'lp_colorhq') {
|
||||
if (row.tipo_maquina == 'toner')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_colorhq.png") ?>'
|
||||
else
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_inkjet_color.png") ?>'
|
||||
}
|
||||
|
||||
else if (rowId == 'lp_cubierta')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_cubierta.png") ?>'
|
||||
else if (rowId == 'lp_sobrecubierta')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_sobrecubierta.png") ?>'
|
||||
else if (rowId == 'lp_guardas')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_guardas.png") ?>'
|
||||
else if (rowId == 'lp_rot_bn')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_rotativa_bn.png") ?>'
|
||||
else if (rowId == 'lp_rot_color')
|
||||
icon = '<?= site_url("themes/vuexy/img/safekat/presupuestos/icon_rotativa_color.png") ?>'
|
||||
|
||||
const blank_line = (typeof row.tarifa_impresion_id === 'undefined') ? 1 : 0;
|
||||
var data = {
|
||||
'row_id': rowId,
|
||||
'row_class': rowClass,
|
||||
|
||||
'tarifa_impresion_id': blank_line ? 0 : isNaN(parseInt(row.tarifa_impresion_id)) ? "" : parseInt(row.tarifa_impresion_id),
|
||||
'maquina_ancho': blank_line ? 0 : isNaN(parseFloat(row.dimensiones_maquina[0])) ? "" : parseFloat(row.dimensiones_maquina[0]),
|
||||
'maquina_alto': blank_line ? 0 : isNaN(parseFloat(row.dimensiones_maquina[1])) ? "" : parseFloat(row.dimensiones_maquina[1]),
|
||||
'maquina_impresion_ancho': blank_line ? 0 : isNaN(parseFloat(row.dimensiones_maquina_impresion[0])) ? "" : parseFloat(row.dimensiones_maquina_impresion[0]),
|
||||
'maquina_impresion_alto': blank_line ? 0 : isNaN(parseFloat(row.dimensiones_maquina_impresion[1])) ? "" : parseFloat(row.dimensiones_maquina_impresion[1]),
|
||||
'formas': blank_line ? 0 : isNaN(parseInt(row.num_formas.value)) ? 0 : parseInt(row.num_formas.value),
|
||||
'formas_v': blank_line ? 0 : isNaN(parseInt(row.num_formas.num_formas_verticales)) ? 0 : parseInt(row.num_formas.num_formas_verticales),
|
||||
'formas_h': blank_line ? 0 : isNaN(parseInt(row.num_formas.num_formas_horizontales)) ? 0 : parseInt(row.num_formas.num_formas_horizontales),
|
||||
'formas_orientacion': blank_line ? 0 : row.num_formas.posicion_formas,
|
||||
|
||||
'icon': icon,
|
||||
'paginas': blank_line ? 0 : row.paginas,
|
||||
'paginas_impresion': rowId == 'lp_guardas' ? row.paginas_impresion : 0,
|
||||
'papel': blank_line ? "" : row.papel_generico_id,
|
||||
'gramaje': blank_line ? "" : row.gramaje,
|
||||
'papel_impresion': blank_line ? "" : row.papel_impresion,
|
||||
'papel_impresion_id': blank_line ? "" : row.papel_impresion_id,
|
||||
'maquina': blank_line ? "" : row.maquina,
|
||||
'maquina_id': blank_line ? "" : row.maquina_id,
|
||||
|
||||
'tiempo': blank_line ? "" : row.tiempo_maquina,
|
||||
'lomo': isNaN(parseFloat(row.mano)) ? "" : parseFloat(row.mano).toFixed(2),
|
||||
'peso': isNaN(parseFloat(row.peso)) ? "" : parseFloat(row.peso).toFixed(2),
|
||||
|
||||
'total_linea': isNaN(parseFloat(row.total_impresion)) ? "" : parseFloat(row.total_impresion).toFixed(2),
|
||||
|
||||
'numeroPliegos': isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(0),
|
||||
'pliegosPedido': isNaN(parseFloat(row.pliegos_pedido)) ? "" : parseFloat(row.pliegos_pedido).toFixed(0),
|
||||
'precioPliego': isNaN(parseFloat(row.precios_pliegos)) ? "" : parseFloat(row.precios_pliegos).toFixed(6),
|
||||
'libro': isNaN(parseFloat(row.precio_libro)) ? "" : parseFloat(row.precio_libro).toFixed(2),
|
||||
'totalPapelPedido': isNaN(parseFloat(row.precio_pedido)) ? "" : parseFloat(row.precio_pedido).toFixed(2),
|
||||
'margenPapelPedido': isNaN(parseFloat(row.margen_papel_pedido)) ? "" : parseFloat(row.margen_papel_pedido).toFixed(2),
|
||||
'click': isNaN(parseFloat(row.precio_click)) ? "" : parseFloat(row.precio_click).toFixed(6),
|
||||
'totalClicks': isNaN(parseFloat(row.precio_click_pedido)) ? "" : parseFloat(row.precio_click_pedido).toFixed(2),
|
||||
'margenClicks': isNaN(parseFloat(row.margen_click_pedido)) ? "" : parseFloat(row.margen_click_pedido).toFixed(2),
|
||||
'horasMaquina': isNaN(parseFloat(row.horas_maquina)) ? "" : parseFloat(row.horas_maquina).toFixed(4),
|
||||
'precioHora': isNaN(parseFloat(row.precio_hora)) ? "" : parseFloat(row.precio_hora).toFixed(2),
|
||||
'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') {
|
||||
|
||||
data.numPagColor = row.paginas_color
|
||||
data.aFavorFibra = row.a_favor_fibra
|
||||
data.cobNegro = isNaN(parseFloat(row.datosTipologias.negro)) ? "" : parseFloat(row.datosTipologias.negro).toFixed(2)
|
||||
data.cobCyan = isNaN(parseFloat(row.datosTipologias.cyan)) ? "" : parseFloat(row.datosTipologias.cyan).toFixed(2)
|
||||
data.cobMagenta = isNaN(parseFloat(row.datosTipologias.magenta)) ? "" : parseFloat(row.datosTipologias.magenta).toFixed(2)
|
||||
data.cobAmarillo = isNaN(parseFloat(row.datosTipologias.amarillo)) ? "" : parseFloat(row.datosTipologias.amarillo).toFixed(2)
|
||||
data.gotaNegro = isNaN(parseFloat(row.datosTipologias.gota_negro)) ? "" : parseFloat(row.datosTipologias.gota_negro).toFixed(2)
|
||||
data.gotaColor = isNaN(parseFloat(row.datosTipologias.gota_color)) ? "" : parseFloat(row.datosTipologias.gota_color).toFixed(2)
|
||||
|
||||
data.resolucion = isNaN(parseFloat(row.resolucion)) ? "" : parseFloat(row.resolucion).toFixed(0)
|
||||
data.areaPaginas = isNaN(parseFloat(row.superficie)) ? "" : parseFloat(row.superficie).toFixed(2)
|
||||
|
||||
data.gotasNegro = isNaN(parseFloat(row.num_gotas_negro)) ? "" : parseFloat(row.num_gotas_negro).toFixed(0)
|
||||
data.gotasCyan = isNaN(parseFloat(row.num_gotas_cyan)) ? "" : parseFloat(row.num_gotas_cyan).toFixed(0)
|
||||
data.gotasMagenta = isNaN(parseFloat(row.num_gotas_magenta)) ? "" : parseFloat(row.num_gotas_magenta).toFixed(0)
|
||||
data.gotasAmarillo = isNaN(parseFloat(row.num_gotas_amarillo)) ? "" : parseFloat(row.num_gotas_amarillo).toFixed(0)
|
||||
data.precioPagNegro = isNaN(parseFloat(row.precio_pagina_negro)) ? "" : parseFloat(row.precio_pagina_negro).toFixed(6)
|
||||
data.precioPagColor = isNaN(parseFloat(row.precio_pagina_color)) ? "" : parseFloat(row.precio_pagina_color).toFixed(6)
|
||||
data.factorAltura = isNaN(parseFloat(row.factor_altura)) ? "" : parseFloat(row.factor_altura).toFixed(2)
|
||||
data.factorAnchura = isNaN(parseFloat(row.factor_anchura)) ? "" : parseFloat(row.factor_anchura).toFixed(2)
|
||||
data.paginasPliego = isNaN(parseFloat(row.paginas_por_pliego)) ? "" : parseFloat(row.paginas_por_pliego).toFixed(2)
|
||||
|
||||
if (rowId.includes('rot')) {
|
||||
data.metrosMinuto = isNaN(parseFloat(row.maquina_velocidad)) ? "" : parseFloat(row.maquina_velocidad).toFixed(2)
|
||||
data.metrosPapelLibro = isNaN(parseFloat(row.metros_papel_libro)) ? "" : parseFloat(row.metros_papel_libro).toFixed(2)
|
||||
data.metrosPapelTotal = isNaN(parseFloat(row.metros_papel_total)) ? "" : parseFloat(row.metros_papel_total).toFixed(2)
|
||||
data.velocidadCorte = isNaN(parseFloat(row.velocidad_corte)) ? "" : parseFloat(row.velocidad_corte).toFixed(2)
|
||||
data.precioHoraCorte = isNaN(parseFloat(row.precio_hora_corte)) ? "" : parseFloat(row.precio_hora_corte).toFixed(2)
|
||||
data.tiempoCorte = isNaN(parseFloat(row.tiempo_corte)) ? "" : parseFloat(row.tiempo_corte).toFixed(2)
|
||||
data.totalCorte = isNaN(parseFloat(row.total_corte)) ? "" : parseFloat(row.total_corte).toFixed(2)
|
||||
}
|
||||
else {
|
||||
data.totalCorte = 0
|
||||
}
|
||||
|
||||
data.clicksLibro = isNaN(parseFloat(row.clicks_libro)) ? "" : parseFloat(row.clicks_libro).toFixed(0)
|
||||
data.gTintaNegro = isNaN(parseFloat(row.peso_gotas_negro)) ? "" : parseFloat(row.peso_gotas_negro).toFixed(2)
|
||||
data.gTintaCyan = isNaN(parseFloat(row.peso_gotas_cyan)) ? "" : parseFloat(row.peso_gotas_cyan).toFixed(2)
|
||||
data.gTintaMagenta = isNaN(parseFloat(row.peso_gotas_magenta)) ? "" : parseFloat(row.peso_gotas_magenta).toFixed(2)
|
||||
data.gTintaAmarillo = isNaN(parseFloat(row.peso_gotas_amarillo)) ? "" : parseFloat(row.peso_gotas_amarillo).toFixed(2)
|
||||
data.clicksPedido = isNaN(parseFloat(row.clicks_pedido)) ? "" : parseFloat(row.clicks_pedido).toFixed(0)
|
||||
data.totalClicksPedido = isNaN(parseFloat(row.precio_click_pedido)) ? "" : parseFloat(row.precio_click_pedido).toFixed(2)
|
||||
data.totalTinta = isNaN(parseFloat(row.precio_tinta)) ? "" : parseFloat(row.precio_tinta).toFixed(2)
|
||||
|
||||
data.totalImpresion = isNaN(parseFloat(row.precio_click_pedido + row.precio_tinta + data.totalCorte)) ? "" : parseFloat(row.precio_click_pedido + row.precio_tinta + data.totalCorte).toFixed(2)
|
||||
|
||||
data.gTintaNegroPed = isNaN(parseFloat(row.peso_gotas_negro_pedido)) ? "" : parseFloat(row.peso_gotas_negro_pedido).toFixed(2)
|
||||
data.gTintaCyanPed = isNaN(parseFloat(row.peso_gotas_cyan_pedido)) ? "" : parseFloat(row.peso_gotas_cyan_pedido).toFixed(2)
|
||||
data.gTintaMagentaPed = isNaN(parseFloat(row.peso_gotas_magenta_pedido)) ? "" : parseFloat(row.peso_gotas_magenta_pedido).toFixed(2)
|
||||
data.gTintaAmarilloPed = isNaN(parseFloat(row.peso_gotas_amarillo_pedido)) ? "" : parseFloat(row.peso_gotas_amarillo_pedido).toFixed(2)
|
||||
|
||||
if (!rowId.includes('rot')) {
|
||||
data.cobCG = isNaN(parseFloat(row.datosTipologias.cg)) ? "" : parseFloat(row.datosTipologias.cg).toFixed(2)
|
||||
data.gotasCG = isNaN(parseFloat(row.num_gotas_cg)) ? "" : parseFloat(row.num_gotas_cg).toFixed(2)
|
||||
data.gTintaCG = isNaN(parseFloat(row.peso_gotas_cg)) ? "" : parseFloat(row.peso_gotas_cg).toFixed(2)
|
||||
data.gTintaCGPed = isNaN(parseFloat(row.peso_gotas_cg_pedido)) ? "" : parseFloat(row.peso_gotas_cg_pedido).toFixed(2)
|
||||
}
|
||||
|
||||
|
||||
data.alto_click = row.alto_click
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
#addEventosLineas(tipoLinea, isInkjet = false) {
|
||||
|
||||
$('#' + tipoLinea + '_papel').on("change", change_papelGenerico_lp_bn);
|
||||
$('#' + tipoLinea + '_gramaje').on("focus", { mantenerSeleccion: true }, set_lp_bn_gramaje);
|
||||
$('#' + tipoLinea + '_gramaje').on('change', function () {
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_bn_gramaje option:selected");
|
||||
if (selected.text() != previous) {
|
||||
clear_lp_bn(true)
|
||||
}
|
||||
});
|
||||
$('#' + tipoLinea + '_papelImpresion').on("focus", set_lp_bn_papelImpresion);
|
||||
$('#' + tipoLinea + '_maquina').on("focus", set_lp_bn_maquina);
|
||||
$('#' + tipoLinea + '_maquina').on("change", change_lp_bn_maquina);
|
||||
$('#' + tipoLinea + '_vercalculos').on("click", { rowId: 'lp_bn' }, verCalculosInkjet);
|
||||
|
||||
if (isInkjet) {
|
||||
$('.' + tipoLinea + '-tipologia').on("change", change_lp_bn_tipologia);
|
||||
$('#' + tipoLinea + '_defecto').on("click", por_defecto_lp_bn);
|
||||
$('#' + tipoLinea + '_aFavorFibra').on("change", change_lp_bn_aFavorFibra);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default LineasPresupuesto;
|
||||
Reference in New Issue
Block a user