mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado comparador plana
This commit is contained in:
@ -610,26 +610,25 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
|
|
||||||
public function obtenerComparadorPlana(){
|
public function obtenerComparadorPlana(){
|
||||||
echo "hola";
|
|
||||||
//if($this->request->isAJAX()){
|
if($this->request->isAJAX()){
|
||||||
|
|
||||||
$cliente_id = $this->request->getPost('cliente_id');
|
$cliente_id = $this->request->getPost('cliente_id');
|
||||||
$datosPedido = $this->request->getPost('datosPedido');
|
$datosPedido = $this->request->getPost('datosPedido');
|
||||||
$papel_generico = $this->request->getPost('papel_generico');
|
$papel_generico = $this->request->getPost('papel_generico');
|
||||||
$gramaje = $this->request->getPost('gramaje');
|
$gramaje = $this->request->getPost('gramaje');
|
||||||
$papelInteriorDirefente = $this->request->getPost('papelInteriorDiferente');
|
|
||||||
$paginas_color = $this->request->getPost('paginas_color');
|
$paginas_color = $this->request->getPost('paginas_color');
|
||||||
$isColor = $this->request->getPost('isColor');
|
$isColor = $this->request->getPost('isColor');
|
||||||
$isHq = $this->request->getPost('isHq');
|
$isHq = $this->request->getPost('isHq');
|
||||||
$tipo_impresion_id = $this->request->getPost('tipo_impresion_id');
|
$tipo_impresion_id = $this->request->getPost('tipo_impresion_id');
|
||||||
$uso = $this->request->getPost('uso');
|
$uso = $this->request->getPost('uso');
|
||||||
|
|
||||||
$data = (object)array(
|
$data = array(
|
||||||
'cliente_id' => $cliente_id,
|
'cliente_id' => $cliente_id,
|
||||||
'datosPedido' => $datosPedido,
|
'datosPedido' => (object)$datosPedido,
|
||||||
'papel_generico' => $papel_generico,
|
'papel_generico' => $papel_generico,
|
||||||
'gramaje' => $gramaje,
|
'gramaje' => $gramaje,
|
||||||
'papelInteriorDirefente' => $papelInteriorDirefente,
|
'papelInteriorDiferente' => true,
|
||||||
'paginas_color' => $paginas_color,
|
'paginas_color' => $paginas_color,
|
||||||
'isColor' => $isColor,
|
'isColor' => $isColor,
|
||||||
'isHq' => $isHq,
|
'isHq' => $isHq,
|
||||||
@ -637,12 +636,17 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
'uso' => $uso
|
'uso' => $uso
|
||||||
);
|
);
|
||||||
|
|
||||||
$data = PresupuestoClienteService::obtenerComparadorInteriorPlana($data);
|
$data = PresupuestoClienteService::obtenerPresupuestoClienteInterior($data, true);
|
||||||
return $this->respond($data);
|
return $this->respond(
|
||||||
/*}
|
[
|
||||||
|
'status' => 1,
|
||||||
|
'data' => $data
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -241,7 +241,7 @@ class PresupuestoClienteService extends BaseService
|
|||||||
* - isHq: si es alta calidad
|
* - isHq: si es alta calidad
|
||||||
* - paginas_color: número de páginas a color
|
* - paginas_color: número de páginas a color
|
||||||
*/
|
*/
|
||||||
private static function obtenerPresupuestoClienteInterior($data)
|
public static function obtenerPresupuestoClienteInterior($data, $return_raw = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
$uso = $data['uso'];
|
$uso = $data['uso'];
|
||||||
@ -351,6 +351,15 @@ class PresupuestoClienteService extends BaseService
|
|||||||
|
|
||||||
// Si hay negro y color, y se hace con el mismo papel, hay que buscar la combinación
|
// Si hay negro y color, y se hace con el mismo papel, hay que buscar la combinación
|
||||||
// más económica con la misma máquna
|
// más económica con la misma máquna
|
||||||
|
if($return_raw){
|
||||||
|
$linea_negro_plana = array_values(array_unique($linea_negro_plana, SORT_REGULAR));
|
||||||
|
$linea_color_plana = array_values(array_unique($linea_color_plana, SORT_REGULAR));
|
||||||
|
|
||||||
|
return[
|
||||||
|
'negro' => $linea_negro_plana,
|
||||||
|
'color' => $linea_color_plana
|
||||||
|
];
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
$paginas_negro > 0 && $paginas_color > 0 && $data['papelInteriorDiferente'] == 0 &&
|
$paginas_negro > 0 && $paginas_color > 0 && $data['papelInteriorDiferente'] == 0 &&
|
||||||
count($linea_negro_plana) > 0 && count($linea_color_plana) > 0
|
count($linea_negro_plana) > 0 && count($linea_color_plana) > 0
|
||||||
|
|||||||
@ -21,40 +21,7 @@ $('#compPosPaginasColor').on("keyup", function () {
|
|||||||
/*******************************
|
/*******************************
|
||||||
* Metodos
|
* Metodos
|
||||||
*******************************/
|
*******************************/
|
||||||
function getRowFromLineaInt(tipo, linea) {
|
|
||||||
|
|
||||||
$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);
|
|
||||||
|
|
||||||
|
|
||||||
data = {
|
|
||||||
'tipo': tipo,
|
|
||||||
'paginas': linea.fields.paginas,
|
|
||||||
'papel': linea.fields.papel_generico,
|
|
||||||
'gramaje': linea.fields.gramaje,
|
|
||||||
'marca': linea.fields.papel_impresion,
|
|
||||||
'maquina': linea.fields.maquina,
|
|
||||||
'numeroPliegos': isNaN(parseFloat(linea.fields.pliegos_libro)) ? "" : parseFloat(linea.fields.pliegos_libro).toFixed(2),
|
|
||||||
'pliegosPedido': isNaN(parseFloat(linea.fields.pliegos_pedido)) ? "" : parseFloat(linea.fields.pliegos_pedido).toFixed(2),
|
|
||||||
'precioPliego': isNaN(parseFloat(linea.fields.precios_pliegos)) ? "" : parseFloat(linea.fields.precios_pliegos).toFixed(6),
|
|
||||||
'libro': isNaN(parseFloat(linea.fields.precio_libro)) ? "" : parseFloat(linea.fields.precio_libro).toFixed(2),
|
|
||||||
'totalPapelPedido': isNaN(parseFloat(linea.fields.precio_pedido)) ? "" : parseFloat(linea.fields.precio_pedido).toFixed(2),
|
|
||||||
'lomo': isNaN(parseFloat(linea.fields.mano)) ? "" : parseFloat(linea.fields.mano).toFixed(2),
|
|
||||||
'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.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,
|
|
||||||
'papelGenericoId': linea.fields.papel_generico_id,
|
|
||||||
'papelImpresionId': linea.fields.papel_impresion_id,
|
|
||||||
'tarifa_impresion_id': linea.fields.tarifa_impresion_id,
|
|
||||||
}
|
|
||||||
if(data['tipo']=='guardas')
|
|
||||||
data['paginas_impresion'] = linea.fields.paginas_impresion;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRowFromLineaRot(linea) {
|
function getRowFromLineaRot(linea) {
|
||||||
|
|
||||||
@ -160,34 +127,7 @@ function clearIntRot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function selectIntLineas() {
|
|
||||||
var negro_selected = false;
|
|
||||||
var color_selected = false;
|
|
||||||
$("#tableCompIntPlana").DataTable().rows('.selected').deselect();
|
|
||||||
$("#tableCompIntPlana").DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
|
||||||
if (!negro_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('bn')) {
|
|
||||||
$("#tableCompIntPlana").DataTable().row(rowIdx).nodes().to$().toggleClass('selected');
|
|
||||||
negro_selected = true;
|
|
||||||
}
|
|
||||||
if (!color_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('color')) {
|
|
||||||
$("#tableCompIntPlana").DataTable().row(rowIdx).nodes().to$().toggleClass('selected');
|
|
||||||
color_selected = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var table = $("#tableCompIntPlana").DataTable();
|
|
||||||
var rows = table.rows('.selected').indexes();
|
|
||||||
var data = table.rows(rows).data();
|
|
||||||
|
|
||||||
var value_total = 0.00;
|
|
||||||
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
|
||||||
|
|
||||||
value_total += parseFloat(data[i]['total'])
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#total_comp_plana').html(value_total.toFixed(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectIntRotLineas() {
|
function selectIntRotLineas() {
|
||||||
|
|
||||||
|
|||||||
@ -162,6 +162,8 @@ class Comparador {
|
|||||||
this.btnInsertarPlana = $('#insertarPlanaBtn');
|
this.btnInsertarPlana = $('#insertarPlanaBtn');
|
||||||
this.btnInsertarRotativa = $('#insertarRotativaBtn');
|
this.btnInsertarRotativa = $('#insertarRotativaBtn');
|
||||||
this.btnInsertarCubierta = $('#insertarCubiertaBtn');
|
this.btnInsertarCubierta = $('#insertarCubiertaBtn');
|
||||||
|
|
||||||
|
this.cargando = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@ -261,10 +263,6 @@ class Comparador {
|
|||||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.paginasNegro.on("change", this.#changePaginasComparador.bind(this));
|
|
||||||
this.paginasNegrohq.on("change", this.#changePaginasComparador.bind(this));
|
|
||||||
this.paginasColor.on("change", this.#changePaginasComparador.bind(this));
|
|
||||||
this.paginasColorhq.on("change", this.#changePaginasComparador.bind(this));
|
|
||||||
|
|
||||||
$('.comp_negro_items').on('change', this.obtenerComparadorInterior.bind(this));
|
$('.comp_negro_items').on('change', this.obtenerComparadorInterior.bind(this));
|
||||||
$('.comp_negrohq_items').on('change', this.obtenerComparadorInterior.bind(this));
|
$('.comp_negrohq_items').on('change', this.obtenerComparadorInterior.bind(this));
|
||||||
@ -275,25 +273,25 @@ class Comparador {
|
|||||||
#changePaginasComparador(element) {
|
#changePaginasComparador(element) {
|
||||||
|
|
||||||
const paginas = parseInt($('#paginas').val());
|
const paginas = parseInt($('#paginas').val());
|
||||||
const newPaginas = parseInt($(element.currentTarget).val());
|
const newPaginas = parseInt($('#' + element).val());
|
||||||
|
|
||||||
if (paginas < newPaginas) {
|
if (paginas < newPaginas) {
|
||||||
$(element.currentTarget).val(paginas)
|
$('#' + element).val(paginas)
|
||||||
}
|
}
|
||||||
if ($(element.currentTarget).attr('id') == this.paginasNegro.attr('id')) {
|
if (element == this.paginasNegro.attr('id')) {
|
||||||
if (!$('.comp-color-selected').hasClass('d-none')) {
|
if (!$('.comp-color-selected').hasClass('d-none')) {
|
||||||
this.paginasColor.val((paginas - newPaginas) > 0 ? paginas - newPaginas : 0);
|
this.paginasColor.val((paginas - newPaginas) > 0 ? paginas - newPaginas : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($(element.currentTarget).attr('id') == this.paginasNegro.attr('id')) {
|
else if (element == this.paginasNegrohq.attr('id')) {
|
||||||
if (!$('.comp-colorhq-selected').hasClass('d-none')) {
|
if (!$('.comp-colorhq-selected').hasClass('d-none')) {
|
||||||
this.paginasColorhq.val((paginas - newPaginas) > 0 ? paginas - newPaginas : 0);
|
this.paginasColorhq.val((paginas - newPaginas) > 0 ? paginas - newPaginas : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($(element.currentTarget).attr('id') == this.paginasColor.attr('id')) {
|
else if (element == this.paginasColor.attr('id')) {
|
||||||
this.paginasNegro.val((paginas - newPaginas) > 0 ? paginas - newPaginas : 0);
|
this.paginasNegro.val((paginas - newPaginas) > 0 ? paginas - newPaginas : 0);
|
||||||
}
|
}
|
||||||
else if ($(element.currentTarget).attr('id') == this.paginasColorhq.attr('id')) {
|
else if (element == this.paginasColorhq.attr('id')) {
|
||||||
this.paginasNegrohq.val((paginas - newPaginas) > 0 ? paginas - newPaginas : 0);
|
this.paginasNegrohq.val((paginas - newPaginas) > 0 ? paginas - newPaginas : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,6 +299,8 @@ class Comparador {
|
|||||||
|
|
||||||
cargarDatos(datos) {
|
cargarDatos(datos) {
|
||||||
|
|
||||||
|
this.cargando = true;
|
||||||
|
|
||||||
this.tipo_impresion.val(datos.tipo_impresion).trigger('change');
|
this.tipo_impresion.val(datos.tipo_impresion).trigger('change');
|
||||||
this.updateOpcionesComparador();
|
this.updateOpcionesComparador();
|
||||||
this.comparador_json.val(JSON.stringify(datos.json_data));
|
this.comparador_json.val(JSON.stringify(datos.json_data));
|
||||||
@ -340,6 +340,9 @@ class Comparador {
|
|||||||
this.posPagColor.val(datos.posPagColor);
|
this.posPagColor.val(datos.posPagColor);
|
||||||
this.#computarPaginasColor(datos.posPagColor);
|
this.#computarPaginasColor(datos.posPagColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.cargando = false;
|
||||||
|
this.paginasNegro.trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -763,7 +766,7 @@ class Comparador {
|
|||||||
gramajes.push(this.gramajeNegro);
|
gramajes.push(this.gramajeNegro);
|
||||||
}
|
}
|
||||||
for (let element of papeles) {
|
for (let element of papeles) {
|
||||||
if (element.getVal() == 0 || element.getVal() == null) {
|
if (element.getVal() == 0 || element.getVal() == null) {
|
||||||
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
||||||
return { error: true, data: {} };
|
return { error: true, data: {} };
|
||||||
}
|
}
|
||||||
@ -778,21 +781,21 @@ class Comparador {
|
|||||||
|
|
||||||
if (this.tipo_impresion.val().includes('color')) {
|
if (this.tipo_impresion.val().includes('color')) {
|
||||||
if (this.tipo_impresion.val().includes('hq')) {
|
if (this.tipo_impresion.val().includes('hq')) {
|
||||||
papel_generico.color= { id: this.papelColorhq.getVal(), nombre: this.papelColorhq.getText() };
|
papel_generico.color = { id: this.papelColorhq.getVal(), nombre: this.papelColorhq.getText() };
|
||||||
gramaje.color= this.gramajeColorhq.getVal();
|
gramaje.color = this.gramajeColorhq.getVal();
|
||||||
paginasColor = this.paginasColorhq.val();
|
paginasColor = this.paginasColorhq.val();
|
||||||
}
|
}
|
||||||
papel_generico.negro= { id: this.papelNegrohq.getVal(), nombre: this.papelNegrohq.getText() } ;
|
papel_generico.negro = { id: this.papelNegrohq.getVal(), nombre: this.papelNegrohq.getText() };
|
||||||
gramaje.negro= this.gramajeNegrohq.getVal() ;
|
gramaje.negro = this.gramajeNegrohq.getVal();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.tipo_impresion.val().includes('hq')) {
|
if (this.tipo_impresion.val().includes('hq')) {
|
||||||
papel_generico.color = { id: this.papelColor.getVal(), nombre: this.papelColor.getText() } ;
|
papel_generico.color = { id: this.papelColor.getVal(), nombre: this.papelColor.getText() };
|
||||||
gramaje.color = this.gramajeColor.getVal() ;
|
gramaje.color = this.gramajeColor.getVal();
|
||||||
paginasColor = this.paginasColor.val();
|
paginasColor = this.paginasColor.val();
|
||||||
}
|
}
|
||||||
papel_generico.negro= { id: this.papelNegro.getVal(), nombre: this.papelNegro.getText() } ;
|
papel_generico.negro = { id: this.papelNegro.getVal(), nombre: this.papelNegro.getText() };
|
||||||
gramaje.negro= this.gramajeNegro.getVal() ;
|
gramaje.negro = this.gramajeNegro.getVal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,7 +820,6 @@ class Comparador {
|
|||||||
uso: uso,
|
uso: uso,
|
||||||
tipo_impresion_id: this.tipo_impresion_id,
|
tipo_impresion_id: this.tipo_impresion_id,
|
||||||
cliente_id: $('#clienteId').select2('data')[0].id,
|
cliente_id: $('#clienteId').select2('data')[0].id,
|
||||||
papelInteriorDiferente: 1,
|
|
||||||
papel_generico: papel_generico,
|
papel_generico: papel_generico,
|
||||||
gramaje: gramaje,
|
gramaje: gramaje,
|
||||||
isColor: this.tipo_impresion.val().includes('color'),
|
isColor: this.tipo_impresion.val().includes('color'),
|
||||||
@ -829,11 +831,20 @@ class Comparador {
|
|||||||
return { error: false, data: datos };
|
return { error: false, data: datos };
|
||||||
}
|
}
|
||||||
|
|
||||||
obtenerComparadorInterior(actualizarLineaPlana = false, actualizarLineaRot = false) {
|
obtenerComparadorInterior(event, actualizarLineaPlana = false, actualizarLineaRot = false) {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
|
||||||
|
if (this.cargando) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.currentTarget.id.includes('Paginas')) {
|
||||||
|
this.#changePaginasComparador(event.currentTarget.id);
|
||||||
|
}
|
||||||
|
|
||||||
this.tableCompIntPlana.clear().draw();
|
this.tableCompIntPlana.clear().draw();
|
||||||
this.tableCompIntRotativa.clear().draw();
|
this.tableCompIntRotativa.clear().draw();
|
||||||
this.btnInsertarPlana.addClass('d-none');
|
this.btnInsertarPlana.addClass('d-none');
|
||||||
@ -841,19 +852,51 @@ class Comparador {
|
|||||||
$('#title_int_plana').html(window.language.Presupuestos.compInteriorPlana);
|
$('#title_int_plana').html(window.language.Presupuestos.compInteriorPlana);
|
||||||
|
|
||||||
const datosComp = this.getDataForComp('interior');
|
const datosComp = this.getDataForComp('interior');
|
||||||
if(datosComp.error){
|
if (datosComp.error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
|
|
||||||
datosComp.data[this.csrf_token] = this.csrf_hash;
|
datosComp.data[this.csrf_token] = this.csrf_hash;
|
||||||
new Ajax('/presupuestoadmin/comparadorplana',
|
new Ajax('/presupuestoadmin/comparadorplana',
|
||||||
datosComp.data,
|
datosComp.data,
|
||||||
{},
|
{},
|
||||||
(response) =>{
|
(response) => {
|
||||||
console.log(response);
|
if (response.data.negro.length > 0) {
|
||||||
|
const isHq = response.data.negro[0].fields.tipo_linea.includes('hq');
|
||||||
|
let sorted = response.data.negro.sort(
|
||||||
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
|
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||||
|
sorted.forEach(function (linea) {
|
||||||
|
if (typeof linea.error == "undefined")
|
||||||
|
$('#tableCompIntPlana').DataTable().row
|
||||||
|
.add(self.getRowFromLineaInt(isHq ? 'bnhq' : 'bn', linea))
|
||||||
|
.draw()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (response.data.color.length > 0) {
|
||||||
|
const isHq = response.data.color[0].fields.tipo_linea.includes('hq');
|
||||||
|
let sorted = response.data.color.sort(
|
||||||
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
|
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||||
|
sorted.forEach(function (linea) {
|
||||||
|
if (typeof linea.error == "undefined")
|
||||||
|
$('#tableCompIntPlana').DataTable().row
|
||||||
|
.add(self.getRowFromLineaInt(isHq ? 'colorhq' : 'color', linea))
|
||||||
|
.draw()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.selectIntLineas();
|
||||||
|
if ($('#tableCompIntPlana').DataTable().rows().count() > 0) {
|
||||||
|
$('#title_int_plana').html(window.language.Presupuestos.compInteriorPlana + ' (' + self.tableCompIntPlana.rows().count() + ')');
|
||||||
|
$('#insertarPlanaBtn').removeClass('d-none');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#title_int_plana').html(window.language.Presupuestos.compInteriorPlana);
|
||||||
|
$('#insertarPlanaBtn').addClass('d-none');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(error) =>{
|
(error) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
).post();
|
).post();
|
||||||
@ -895,6 +938,70 @@ class Comparador {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectIntLineas() {
|
||||||
|
var negro_selected = false;
|
||||||
|
var color_selected = false;
|
||||||
|
$("#tableCompIntPlana").DataTable().rows('.selected').deselect();
|
||||||
|
$("#tableCompIntPlana").DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
|
if (!negro_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('bn')) {
|
||||||
|
$("#tableCompIntPlana").DataTable().row(rowIdx).nodes().to$().toggleClass('selected');
|
||||||
|
negro_selected = true;
|
||||||
|
}
|
||||||
|
if (!color_selected && $('#tableCompIntPlana').DataTable().cell(rowIdx, 0).data().includes('color')) {
|
||||||
|
$("#tableCompIntPlana").DataTable().row(rowIdx).nodes().to$().toggleClass('selected');
|
||||||
|
color_selected = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var table = $("#tableCompIntPlana").DataTable();
|
||||||
|
var rows = table.rows('.selected').indexes();
|
||||||
|
var data = table.rows(rows).data();
|
||||||
|
|
||||||
|
var value_total = 0.00;
|
||||||
|
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
|
||||||
|
value_total += parseFloat(data[i]['total'])
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#total_comp_plana').html(value_total.toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
getRowFromLineaInt(tipo, linea) {
|
||||||
|
|
||||||
|
const 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);
|
||||||
|
|
||||||
|
|
||||||
|
let data = {
|
||||||
|
'tipo': tipo,
|
||||||
|
'paginas': linea.fields.paginas,
|
||||||
|
'papel': linea.fields.papel_generico,
|
||||||
|
'gramaje': linea.fields.gramaje,
|
||||||
|
'marca': linea.fields.papel_impresion,
|
||||||
|
'maquina': linea.fields.maquina,
|
||||||
|
'numeroPliegos': isNaN(parseFloat(linea.fields.pliegos_libro)) ? "" : parseFloat(linea.fields.pliegos_libro).toFixed(2),
|
||||||
|
'pliegosPedido': isNaN(parseFloat(linea.fields.pliegos_pedido)) ? "" : parseFloat(linea.fields.pliegos_pedido).toFixed(2),
|
||||||
|
'precioPliego': isNaN(parseFloat(linea.fields.precios_pliegos)) ? "" : parseFloat(linea.fields.precios_pliegos).toFixed(6),
|
||||||
|
'libro': isNaN(parseFloat(linea.fields.precio_libro)) ? "" : parseFloat(linea.fields.precio_libro).toFixed(2),
|
||||||
|
'totalPapelPedido': isNaN(parseFloat(linea.fields.precio_pedido)) ? "" : parseFloat(linea.fields.precio_pedido).toFixed(2),
|
||||||
|
'lomo': isNaN(parseFloat(linea.fields.mano)) ? "" : parseFloat(linea.fields.mano).toFixed(2),
|
||||||
|
'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.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,
|
||||||
|
'papelGenericoId': linea.fields.papel_generico_id,
|
||||||
|
'papelImpresionId': linea.fields.papel_impresion_id,
|
||||||
|
'tarifa_impresion_id': linea.fields.tarifa_impresion_id,
|
||||||
|
}
|
||||||
|
if (data['tipo'] == 'guardas')
|
||||||
|
data['paginas_impresion'] = linea.fields.paginas_impresion;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user