@@ -70,6 +65,7 @@
href="= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
= $this->endSection() ?>
@@ -89,4 +85,6 @@
+
+
= $this->endSection() ?>
\ No newline at end of file
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoItems.php
index f99d60a1..615b2da0 100644
--- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoItems.php
+++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosPresupuestoItems.php
@@ -143,6 +143,7 @@
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_resumen.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_resumen.php
index 7eb9dee7..3f447a46 100644
--- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_resumen.php
+++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_resumen.php
@@ -5,9 +5,11 @@
Precio unidad: €
- Total base: €
- Iva (%): €
- Total: €
+ Total base: €
+ Envío: €
+ Total antes de I.V.A: €
+ Iva (%): €
+ Total: €
diff --git a/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php b/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php
index 4a12a566..23abe408 100644
--- a/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php
+++ b/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php
@@ -86,13 +86,13 @@
diff --git a/ci4/app/Views/themes/vuexy/main/menus/presupuesto_menu.php b/ci4/app/Views/themes/vuexy/main/menus/presupuesto_menu.php
index 0b253bdb..52af9ab7 100644
--- a/ci4/app/Views/themes/vuexy/main/menus/presupuesto_menu.php
+++ b/ci4/app/Views/themes/vuexy/main/menus/presupuesto_menu.php
@@ -23,27 +23,23 @@ if (auth()->user()->can('presupuesto.menu')) {
-
-
-
+
\ No newline at end of file
diff --git a/httpdocs/assets/js/safekat/pages/cliente/cliente.js b/httpdocs/assets/js/safekat/pages/cliente/cliente.js
index a49e68ca..329c7726 100644
--- a/httpdocs/assets/js/safekat/pages/cliente/cliente.js
+++ b/httpdocs/assets/js/safekat/pages/cliente/cliente.js
@@ -61,9 +61,12 @@ class Cliente {
document.addEventListener('DOMContentLoaded', function () {
- const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
-
-
+ const dropdown = document.querySelector(".dropdown-language");
+ const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
+ let locale = 'es';
+ if (activeItem) {
+ locale = activeItem.getAttribute("data-language");
+ }
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['ClienteContactos', 'ClientePrecios'] }, {},
function(translations) {
diff --git a/httpdocs/assets/js/safekat/pages/cliente/clienteList.js b/httpdocs/assets/js/safekat/pages/cliente/clienteList.js
index 69b67ea9..6170c326 100644
--- a/httpdocs/assets/js/safekat/pages/cliente/clienteList.js
+++ b/httpdocs/assets/js/safekat/pages/cliente/clienteList.js
@@ -147,7 +147,12 @@ class ClienteList {
document.addEventListener('DOMContentLoaded', function () {
- const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
+ const dropdown = document.querySelector(".dropdown-language");
+ const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
+ let locale = 'es';
+ if (activeItem) {
+ locale = activeItem.getAttribute("data-language");
+ }
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Clientes', 'FormasPago', 'Users'] }, {},
function (translations) {
diff --git a/httpdocs/assets/js/safekat/pages/facturas/facturasList.js b/httpdocs/assets/js/safekat/pages/facturas/facturasList.js
new file mode 100644
index 00000000..d0c66bf1
--- /dev/null
+++ b/httpdocs/assets/js/safekat/pages/facturas/facturasList.js
@@ -0,0 +1,199 @@
+$(() => {
+
+ $(document).on('click', '.btn-edit', function (e) {
+ window.location.href = '/facturas/edit/' + $(this).attr('data-id');
+ });
+
+ const lastColNr = $('#tableOfFacturas').find("tr:first th").length - 1;
+
+ let datatableColumns = [];
+ if ($('#cliente_id').val() == -1) {
+ datatableColumns = [
+ { 'data': 'id' },
+ { 'data': 'numero' },
+ { 'data': 'fecha_factura_at', searchable: false },
+ { 'data': 'cliente' },
+ { 'data': 'base', render: (d) => `
${d}` },
+ { 'data': 'total', render: (d) => `
${d}` },
+ { 'data': 'pendiente', render: (d) => `
${d}` },
+ { 'data': 'creditoAsegurado' },
+ { 'data': 'estado' },
+ { 'data': 'estado_pago' },
+ { 'data': 'forma_pago' },
+ { 'data': 'vencimiento' },
+ { 'data': 'dias_vencimiento' },
+ { 'data': 'action' }
+ ];
+ } else {
+ datatableColumns = [
+ { 'data': 'id' },
+ { 'data': 'numero' },
+ { 'data': 'fecha_factura_at', searchable: false },
+ { 'data': 'base', render: (d) => `
${d}` },
+ { 'data': 'total', render: (d) => `
${d}` },
+ { 'data': 'pendiente', render: (d) => `
${d}` },
+ { 'data': 'action' }
+ ];
+ }
+
+ $('#tableOfFacturas').DataTable({
+ processing: true,
+ serverSide: true,
+ autoWidth: true,
+ responsive: true,
+ scrollX: true,
+ orderCellsTop: true,
+ lengthMenu: [5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500],
+ pageLength: 250,
+ "dom": 'lBrtip',
+ buttons: [
+ {
+ text: 'Exportar Excel Contaplus',
+ action: function (e, dt, button, config) {
+ var searchValue = theTable.search(); // Captura el valor del campo de búsqueda
+ var ajaxParams = theTable.ajax.params(); // Captura otros parámetros de la tabla
+
+ console.log(searchValue);
+
+ /*
+ $.ajax({
+ url: '/ruta/exportarExcel', // URL del servidor para manejar la exportación
+ type: 'POST',
+ data: {
+ search: searchValue,
+ extraParams: ajaxParams
+ },
+ xhrFields: {
+ responseType: 'blob' // Para manejar la descarga del archivo
+ },
+ success: function(blob, status, xhr) {
+ // Crear un enlace temporal para descargar el archivo
+ var link = document.createElement('a');
+ var url = window.URL.createObjectURL(blob);
+ link.href = url;
+ link.download = 'datos_personalizados.xlsx';
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(url);
+ }
+ });
+ */
+ }
+ },
+ {
+ text: 'Exportar Lineas a Excel',
+ action: function (e, dt, button, config) {
+ var searchValue = theTable.search(); // Captura el valor del campo de búsqueda
+ var ajaxParams = theTable.ajax.params(); // Captura otros parámetros de la tabla
+
+ console.log(searchValue);
+
+ }
+ },
+ {
+ text: 'Exportar Girosgit ',
+ action: function (e, dt, button, config) {
+ var searchValue = theTable.search(); // Captura el valor del campo de búsqueda
+ var ajaxParams = theTable.ajax.params(); // Captura otros parámetros de la tabla
+
+ console.log(searchValue);
+
+ }
+ }
+ ],
+ order: [[0, 'asc']],
+ language: {
+ url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
+ },
+ ajax: {
+ url: '/facturas/datatable',
+ type: 'GET',
+ data: function (d) {
+ d.cliente_id = $('#cliente_id').val();
+ d.fecha_factura = getDate();
+ }
+ },
+ columnDefs: [
+ {
+ orderable: false,
+ searchable: false,
+ targets: [lastColNr]
+ },
+ ],
+ columns: datatableColumns,
+ });
+
+ $(document).on("keyup", ".factura-filter", (event) => {
+ //console.log(this.datatablePlanningRot.column($(event.currentTarget).attr("name")))
+ let columnName = $(event.currentTarget).attr("name");
+ let columnIndex = $('#tableOfFacturas').DataTable().columns().eq(0).filter(function (index) {
+ return $('#tableOfFacturas').DataTable().column(index).dataSrc() === columnName;
+ })[0];
+ $('#tableOfFacturas').DataTable().column(columnIndex).search($(event.currentTarget).val()).draw()
+ })
+
+ $(document).on("change", ".factura-filter-select", (event) => {
+ let columnName = $(event.currentTarget).attr("name");
+ let columnIndex = $('#tableOfFacturas').DataTable().columns().eq(0).filter(function (index) {
+ return $('#tableOfFacturas').DataTable().column(index).dataSrc() === columnName;
+ })[0];
+ $('#tableOfFacturas').DataTable().column(columnIndex).search($(event.currentTarget).val()).draw();
+ });
+
+
+
+ let bsRangePickerRange = $('#' + 'fechaFactura');
+ bsRangePickerRange.daterangepicker({
+ ranges: {
+ [window.datepickerLang.hoy]: [moment(), moment()],
+ [window.datepickerLang.ayer]: [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
+ [window.datepickerLang.ultimos7]: [moment().subtract(6, 'days'), moment()],
+ [window.datepickerLang.ultimos30]: [moment().subtract(29, 'days'), moment()],
+ [window.datepickerLang.esteMes]: [moment().startOf('month'), moment().endOf('month')],
+ [window.datepickerLang.ultimoMes]: [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
+ },
+ opens: 'right',
+ language: window.datepickerLocale,
+ "locale": {
+ "customRangeLabel": window.datepickerLang.rangoPersonalizado,
+ "format": "YYYY-MM-DD",
+ "separator": " ",
+ "applyLabel": window.datepickerLang.aplicar,
+ "cancelLabel": window.datepickerLang.limpiar,
+
+ },
+ "alwaysShowCalendars": true,
+ autoUpdateInput: false,
+
+ });
+
+
+ function getDate() {
+
+ let picker = bsRangePickerRange.data('daterangepicker');
+
+ if (!picker || !picker.startDate || !picker.endDate || $('#fechaFactura').val() == '') {
+ return '';
+ }
+
+ let startDate = picker.startDate.format('YYYY-MM-DD');
+ let endDate = picker.endDate.format('YYYY-MM-DD');
+
+ return startDate + "|" + endDate;
+
+ }
+
+ bsRangePickerRange.on('apply.daterangepicker', function (ev, picker) {
+
+ $(this).val(picker.startDate.format('DD/MM/YYYY') + ' ' + picker.endDate.format('DD/MM/YYYY'));
+ let table = $('#tableOfFacturas').DataTable();
+ table.column(2).draw();
+ });
+
+ bsRangePickerRange.on('cancel.daterangepicker', function (ev, picker) {
+ $(this).val('');
+ $('#tableOfFacturas').DataTable().column(2).search('').draw();
+ });
+
+})
\ No newline at end of file
diff --git a/httpdocs/assets/js/safekat/pages/maquinas/maquinasList.js b/httpdocs/assets/js/safekat/pages/maquinas/maquinasList.js
index da6760c3..8dac7849 100644
--- a/httpdocs/assets/js/safekat/pages/maquinas/maquinasList.js
+++ b/httpdocs/assets/js/safekat/pages/maquinas/maquinasList.js
@@ -182,7 +182,12 @@ class MaquinasList {
document.addEventListener('DOMContentLoaded', function () {
- const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
+ const dropdown = document.querySelector(".dropdown-language");
+ const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
+ let locale = 'es';
+ if (activeItem) {
+ locale = activeItem.getAttribute("data-language");
+ }
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Maquinas'] }, {},
function (translations) {
diff --git a/httpdocs/assets/js/safekat/pages/pedidos/pedidos.js b/httpdocs/assets/js/safekat/pages/pedidos/pedidos.js
new file mode 100644
index 00000000..555634b9
--- /dev/null
+++ b/httpdocs/assets/js/safekat/pages/pedidos/pedidos.js
@@ -0,0 +1,145 @@
+import Ajax from "../../components/ajax.js"
+
+class Pedidos {
+
+ constructor() {
+
+ this.total_ejemplares = 0;
+ this.total_facturado = 0;
+
+ this.tableFacturas = $('#tableOfFacturas').DataTable();
+ this.tablePedidos = $('#tableOfLineasPedido').DataTable();
+ this.btnAddFactura = $('#add-factura');
+ }
+
+ init() {
+
+ if (this.btnAddFactura) {
+ this.tableFacturas.on('draw', function () {
+ this.total_facturado = 0;
+ for (let i = 0; i < this.tableFacturas.rows().count(); i++) {
+ this.total_facturado += parseFloat(this.tableFacturas.row(i).data().ejemplares);
+ }
+ this.checkAddFactura();
+ }.bind(this));
+
+ this.tablePedidos.on('draw', function () {
+ this.total_ejemplares = 0;
+ for (let i = 0; i < this.tablePedidos.rows().count(); i++) {
+ this.total_ejemplares += parseInt(this.tablePedidos.row(i).data().unidades);
+ }
+ this.checkAddFactura();
+ }.bind(this));
+
+ this.btnAddFactura.on('click', this.addFacturaAction.bind(this));
+ }
+ }
+
+ addFacturaAction() {
+
+ Swal.fire({
+ title: 'Seleccione serie de facturación',
+ html: `
`,
+ showCancelButton: true,
+ cancelButtonText: 'Cancelar',
+ showDenyButton: false,
+ confirmButtonText: 'Ok',
+ showDenyButton: false,
+ buttonsStyling: false,
+ customClass: {
+ confirmButton: 'btn btn-primary',
+ cancelButton: 'btn btn-danger'
+ },
+ didOpen: function () {
+ $('.serie-facturacion-select').select2({
+ allowClear: false,
+ minimumResultsForSearch: -1,
+ //dropdownParent: $('#swal2-html-container'),
+ ajax: {
+ url: '/configuracion/series-facturas/menuitemsFacturas',
+ type: 'post',
+ dataType: 'json',
+
+ data: function (params) {
+ return {
+ id: 'id',
+ text: 'nombre',
+ searchTerm: params.term,
+
+ };
+ },
+ delay: 60,
+ processResults: function (response) {
+ return {
+ results: response.menu
+ };
+ },
+ cache: true
+ }
+ });
+ },
+ preConfirm: () => {
+ return $('#select-serie').val();
+ }
+ }).then(result => {
+ if (result.isConfirmed) {
+ if (result.value != null && result.value != '' && result.value != 0) {
+ let id = window.location.pathname.split('/').pop();
+ const ajax = new Ajax(`/pedidos/insertfactura`,
+ {
+ pedido_id: id,
+ serie_id: result.value,
+
+ },
+ null,
+ () => {
+ this.tableFacturas.clearPipeline().draw();
+ },
+ (error) => {
+ console.log("Error:", error);
+ }
+ )
+ ajax.post();
+ }
+ }
+ });
+ }
+
+ checkAddFactura() {
+
+ if (this.total_facturado == this.total_ejemplares) {
+ this.btnAddFactura.addClass('d-none');
+ }
+ else {
+ this.btnAddFactura.removeClass('d-none');
+ }
+ };
+}
+
+$(document).ready(function () {
+
+ /*
+ const dropdown = document.querySelector(".dropdown-language");
+ const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
+ let locale = 'es';
+ if (activeItem) {
+ locale = activeItem.getAttribute("data-language");
+ }
+ new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Presupuestos', 'PresupuestosDirecciones'] }, {},
+ function (translations) {
+ window.language = JSON.parse(translations);
+ new PresupuestoAdminEdit().init();
+ },
+ function (error) {
+ console.log("Error getting translations:", error);
+ }
+ ).post();*/
+
+ new Pedidos().init();
+});
+
+export default Pedidos;
\ No newline at end of file
diff --git a/httpdocs/assets/js/safekat/pages/plantillasTarifasCliente/edit.js b/httpdocs/assets/js/safekat/pages/plantillasTarifasCliente/edit.js
index fdabc5ab..81d5952f 100644
--- a/httpdocs/assets/js/safekat/pages/plantillasTarifasCliente/edit.js
+++ b/httpdocs/assets/js/safekat/pages/plantillasTarifasCliente/edit.js
@@ -775,10 +775,13 @@ class PlantillasTarifasClienteForm {
document.addEventListener('DOMContentLoaded', function () {
- const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
-
-
-
+ const dropdown = document.querySelector(".dropdown-language");
+ const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
+ let locale = 'es';
+ if (activeItem) {
+ locale = activeItem.getAttribute("data-language");
+ }
+
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['ClientePrecios'] }, {},
function (translations) {
window.language = JSON.parse(translations);
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminAdd.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminAdd.js
index 03f8cf38..d911e1dc 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminAdd.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminAdd.js
@@ -152,7 +152,7 @@ class PresupuestoAdminAdd {
datos.papel_formato_alto = this.altoPersonalizado.val()
}
datos.selectedTirada = this.tirada.val();
-
+
return datos;
}
@@ -161,9 +161,9 @@ class PresupuestoAdminAdd {
const tirada = parseInt($('#tirada').val());
const POD = parseInt($('#POD').val());
let merma = 0;
-
+
merma = tirada * 0.1 <= POD ? tirada * 0.1 : POD;
-
+
$('#mermacubierta').val(parseInt(merma))
$('#merma').val(parseInt(merma))
}
@@ -172,8 +172,13 @@ class PresupuestoAdminAdd {
document.addEventListener('DOMContentLoaded', function () {
- const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
-
+ const dropdown = document.querySelector(".dropdown-language");
+ const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
+ let locale = 'es';
+ if (activeItem) {
+ locale = activeItem.getAttribute("data-language");
+ }
+
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Presupuestos', 'PresupuestosDirecciones'] }, {},
function (translations) {
window.language = JSON.parse(translations);
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js
index 60ffaa21..1784b657 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js
@@ -640,7 +640,12 @@ class PresupuestoAdminEdit {
document.addEventListener('DOMContentLoaded', function () {
- const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
+ const dropdown = document.querySelector(".dropdown-language");
+ const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
+ let locale = 'es';
+ if (activeItem) {
+ locale = activeItem.getAttribute("data-language");
+ }
$(document).on("keydown", "textarea", function (event) {
if (event.key === "Enter" && !event.shiftKey) {
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosGenerales.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosGenerales.js
index f981d106..742aac2d 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosGenerales.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosGenerales.js
@@ -15,6 +15,8 @@ class DatosGenerales{
this.coleccion = this.domItem.find('#coleccion');
this.numeroEdicion = this.domItem.find('#numeroEdicion');
this.isbn = this.domItem.find('#isbn');
+
+ this.openCliente = this.domItem.find('#openCliente');
this.cliente = new ClassSelect($('#clienteId'), '/clientes/cliente/getSelect2', 'Seleccione cliente');
@@ -31,6 +33,11 @@ class DatosGenerales{
this.inc_rei.select2({
allowClear: false,
});
+
+ this.openCliente.click(()=>{
+ const urlObj = new URL(window.location.href);
+ window.open(`${urlObj.origin}` + '/clientes/cliente/edit/' + this.cliente.getVal());
+ });
}
cargarDatos(datos){
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js
index cbc1c042..1e152889 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js
@@ -18,7 +18,7 @@ class Resumen {
await self.updateTotales();
$(document).trigger('update-totales-completed');
});
- $("#totalDespuesDecuento").on('change',this.updateToastSummary.bind(this))
+ $("#totalDespuesDecuento").on('change', this.updateToastSummary.bind(this))
}
cargar(resumen) {
@@ -26,7 +26,7 @@ class Resumen {
// Mapear los valores a los elementos HTML por ID
$("#totalCostePapel").text(resumen.total_coste_papel.toString().replace('.', ',') + "€" || "0€");
$("#porcentajeMargenPapel").text(resumen.total_margenPercent_papel ? resumen.total_margenPercent_papel.toString().replace('.', ',') + "%" : "0%");
- $("#margenPapel").text(resumen.total_margen_papel.toString().replace('.', ',')+ "€" || "0€");
+ $("#margenPapel").text(resumen.total_margen_papel.toString().replace('.', ',') + "€" || "0€");
$("#totalCosteImpresion").text(resumen.total_coste_impresion.toString().replace('.', ',') + "€" || "0€");
$("#porcentajeMargenImpresion").text(resumen.total_margenPercent_impresion ? resumen.total_margenPercent_impresion.toString().replace('.', ',') + "%" : "0%");
@@ -56,7 +56,7 @@ class Resumen {
$("#totalAceptado").val(resumen.total_aceptado.toString().replace('.', ',') + "€" || "0€");
}
- $('#ivaReducido').val(resumen.iva_reducido ? 1: 0);
+ $('#ivaReducido').val(resumen.iva_reducido ? 1 : 0);
}
@@ -100,6 +100,7 @@ class Resumen {
let margenServicios = parseFloat(0);
let totalEnvios = 0;
+ let totalEnvios_base = 0;
let margenEnvios = 0;
let sumForFactor = 0.0;
@@ -134,7 +135,7 @@ class Resumen {
if (rowData.maquinaTipo == 'inkjet') {
totalImpresion += parseFloat(rowData.totalTinta)
- totalImpresion += parseFloat(rowData.totalCorte)?? 0;
+ totalImpresion += parseFloat(rowData.totalCorte) ?? 0;
//sumForFactor += (parseFloat(rowData.totalTinta) + parseFloat(rowData.totalCorte))
}
@@ -189,7 +190,7 @@ class Resumen {
let margen_servicio = parseFloat(rowData.margen);
totalServicios += total_servicio
let base = self.roundToTwoDecimals(total_servicio / (1 + margen_servicio / 100.0));
- base = self.roundToTwoDecimals(base / parseInt($('#tirada').val()))*parseInt($('#tirada').val());
+ base = self.roundToTwoDecimals(base / parseInt($('#tirada').val())) * parseInt($('#tirada').val());
margenServicios += self.roundToTwoDecimals(parseFloat(total_servicio - base));
});
}
@@ -201,7 +202,7 @@ class Resumen {
let margen_servicio = parseFloat(rowData.margen);
totalServicios += total_servicio
let base = self.roundToTwoDecimals(total_servicio / (1 + margen_servicio / 100.0));
- base = self.roundToTwoDecimals(base / parseInt($('#tirada').val()))*parseInt($('#tirada').val());
+ base = self.roundToTwoDecimals(base / parseInt($('#tirada').val())) * parseInt($('#tirada').val());
margenServicios += self.roundToTwoDecimals(parseFloat(total_servicio - base));
});
}
@@ -211,7 +212,7 @@ class Resumen {
let rowData = this.data();
let total_servicio = self.roundToTwoDecimals(parseFloat(rowData.precio));
let base = (parseFloat(rowData.precio / (1 + parseFloat(rowData.margen) / 100.0)).toFixed(2));
- base = self.roundToTwoDecimals(base / parseInt($('#tirada').val()))*parseInt($('#tirada').val());
+ base = self.roundToTwoDecimals(base / parseInt($('#tirada').val())) * parseInt($('#tirada').val());
margenServicios += self.roundToTwoDecimals(parseFloat(total_servicio - base));
totalServicios += total_servicio
});
@@ -222,7 +223,7 @@ class Resumen {
let rowData = this.data();
let total_servicio = self.roundToTwoDecimals(parseFloat(rowData.precio));
let base = (parseFloat(rowData.precio / (1 + parseFloat(rowData.margen) / 100.0)).toFixed(2));
- base = self.roundToTwoDecimals(base / parseInt($('#tirada').val()))*parseInt($('#tirada').val());
+ base = self.roundToTwoDecimals(base / parseInt($('#tirada').val())) * parseInt($('#tirada').val());
margenServicios += self.roundToTwoDecimals(parseFloat(total_servicio - base));
totalServicios += total_servicio;
});
@@ -235,7 +236,7 @@ class Resumen {
let margen_servicio = parseFloat(rowData.margen);
totalServicios += total_servicio
let base = self.roundToTwoDecimals(total_servicio / (1 + margen_servicio / 100.0));
- base = self.roundToTwoDecimals(base / parseInt($('#tirada').val()))*parseInt($('#tirada').val());
+ base = self.roundToTwoDecimals(base / parseInt($('#tirada').val())) * parseInt($('#tirada').val());
margenServicios += self.roundToTwoDecimals(parseFloat(total_servicio - base));
});
}
@@ -262,15 +263,16 @@ class Resumen {
if (updateEnvio) {
- totalEnvios = parseFloat($('#envio_base').val());
+ totalEnvios_base = parseFloat($('#envio_base').val());
if (typeof $('#tableOfDireccionesEnvio').DataTable() !== 'undefined' && $('#tableOfDireccionesEnvio').DataTable().rows().count() > 0) {
$('#tableOfDireccionesEnvio').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
- if (rowIdx == 0) {
- return;
+ // el primer envio es el base, y no se debe de cobrar
+ if (rowIdx != 0) {
+
+ let data = this.data()
+ totalEnvios += parseFloat(data.precio)
+ margenEnvios += parseFloat((data.precio) * data.margen / 100)
}
- let data = this.data()
- totalEnvios += parseFloat(data.precio)
- margenEnvios += parseFloat((data.precio) * data.margen / 100)
});
}
@@ -298,10 +300,11 @@ class Resumen {
if ($('#total_descuentoPercent').val() < 0) {
$('#total_descuentoPercent').val(0)
}
- let totalAntesDescuento = totalCostes + totalMargenes
+ let totalAntesDescuento = totalCostes + totalMargenes - parseFloat(totalEnvios.toFixed(2)) + totalEnvios_base;
let totalDescuento = totalAntesDescuento * parseInt($('#total_descuentoPercent').val() || 0) / 100
- let totalPresupuesto = totalAntesDescuento - totalDescuento
+ let totalPresupuesto = totalAntesDescuento - totalDescuento; // para el calculo del precio_u solo se tiene en cuenta el base
let precioUnidad = totalPresupuesto / parseInt($('#tirada').val())
+ totalPresupuesto += totalEnvios;
$('#totalAntesDescuento').text((this.addSeparatorsNF(totalAntesDescuento.toFixed(2), ".", ",", ".")) + "€")
$('#descuentoTotal').text((this.addSeparatorsNF(totalDescuento.toFixed(2), ".", ",", ".")) + "€")
@@ -313,15 +316,15 @@ class Resumen {
$('#precioUnidadPresupuesto').attr('val', (precioUnidad).toFixed(4))
$('#totalDespuesDecuento').trigger("change")
- $('#factor').text(this.addSeparatorsNF(((totalPresupuesto - totalEnvios - margenEnvios) / sumForFactor).toFixed(2), ".", ",", "."))
- $('#factor').attr('val', ((totalPresupuesto - totalEnvios - margenEnvios) / sumForFactor).toFixed(2))
- $('#factor_ponderado').text(this.addSeparatorsNF(((totalPresupuesto - totalEnvios - margenEnvios) / sumForFactorPonderado).toFixed(2), ".", ",", "."))
- $('#factor_ponderado').attr('val', ((totalPresupuesto - totalEnvios - margenEnvios) / sumForFactorPonderado).toFixed(2))
+ $('#factor').text(this.addSeparatorsNF(((totalPresupuesto - totalEnvios - totalEnvios_base - margenEnvios) / sumForFactor).toFixed(2), ".", ",", "."))
+ $('#factor').attr('val', ((totalPresupuesto - totalEnvios - totalEnvios_base - margenEnvios) / sumForFactor).toFixed(2))
+ $('#factor_ponderado').text(this.addSeparatorsNF(((totalPresupuesto - totalEnvios - totalEnvios_base - margenEnvios) / sumForFactorPonderado).toFixed(2), ".", ",", "."))
+ $('#factor_ponderado').attr('val', ((totalPresupuesto - totalEnvios - totalEnvios_base - margenEnvios) / sumForFactorPonderado).toFixed(2))
}
- getData(){
+ getData() {
let data = {
'total_coste_papel': $('#totalCostePapel').text().replace('€', '').replace(',', '.'),
@@ -354,7 +357,7 @@ class Resumen {
'iva_reducido': $('#ivaReducido').val()
};
- if($('#confirmar_presupuesto').prop('checked')){
+ if ($('#confirmar_presupuesto').prop('checked')) {
data.confirmar = '1';
data.total_aceptado = $('#totalDespuesDecuento').text().replace('€', '').replace(',', '.');
}
@@ -365,15 +368,14 @@ class Resumen {
roundToTwoDecimals(num) {
return parseFloat(num.toFixed(2));
}
- updateToastSummary()
- {
- if(this.toastPresupuestoTotal){
+ updateToastSummary() {
+ if (this.toastPresupuestoTotal) {
this.toastPresupuestoTotal.close()
}
this.toastPresupuestoTotal = toastPresupuestoSummary($("#totalDespuesDecuento").text() ?? 0)
this.toastPresupuestoTotal.fire().then((result) => {
- if(result.isDismissed && result.dismiss == 'close'){
+ if (result.isDismissed && result.dismiss == 'close') {
this.updateToastSummary()
$('html, body').animate(
{
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
index 8965dea4..f7d474c9 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
@@ -622,7 +622,8 @@ class PresupuestoCliente {
('precio-tiradas-' + response.tiradas[i]),
response.tiradas[i],
precio,
- response.precio_u[i]
+ response.precio_u[i],
+ response.coste_envio[i]
);
if (this.actualizarTiradasEnvio) {
@@ -895,7 +896,10 @@ class PresupuestoCliente {
$('#menu_resumen_button').trigger('click');
setTimeout(() => {
self.resumen.init_dropzone();
- self.resumen.generate_total(response.data.resumen.base, response.data.resumen.precio_unidad, response.data.datosGenerales.ivaReducido);
+ self.resumen.generate_total(response.data.resumen.base,
+ response.data.resumen.precio_unidad,
+ response.data.resumen.total_envio,
+ response.data.datosGenerales.ivaReducido);
}, 0);
}
}, 0);
@@ -988,7 +992,12 @@ document.addEventListener('DOMContentLoaded', function () {
}
}
- const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
+ const dropdown = document.querySelector(".dropdown-language");
+ const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
+ let locale = 'es';
+ if (activeItem) {
+ locale = activeItem.getAttribute("data-language");
+ }
new Ajax('/translate/getTranslation', { locale: locale, translationFile: 'Presupuestos' }, {},
initialize,
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js
index 4c297776..0ccd5839 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js
@@ -48,6 +48,8 @@ class Resumen {
this.precio_unidad = $(this.domItem.find("#resumenPrecioU"));
this.total_base = $(this.domItem.find("#resumenTotalBase"));
+ this.total_envios = $(this.domItem.find("#resumenTotalEnvio"));
+ this.total_antes_iva = $(this.domItem.find("#resumenTotalAntesIVA"));
this.iva_porcentaje = $(this.domItem.find("#resumenIvaPorcentaje"));
this.iva = $(this.domItem.find("#resumenIva"));
this.total = $(this.domItem.find("#resumenTotal"));
@@ -308,19 +310,26 @@ class Resumen {
return parseInt($(this).find('.tarjeta-tiradas-precios-tirada').attr('data')) == unidades;
});
+
+ let envios = tarjetaPrecio.find('.tarjeta-tiradas-precios-envio').val();
+ this.total_envios.text(this.#changeDecimalFormat(parseFloat(envios).toFixed(2)));
+
let precio_u_text = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio-unidad').text();
precio_u_text = precio_u_text.replace('€/ud', '');
const base = tarjetaPrecio.find('.tarjeta-tiradas-precios-precio').attr('data');
let base_text = this.#changeDecimalFormat(parseFloat(base).toFixed(2));
+ const total_antes_iva_text = this.#changeDecimalFormat((parseFloat(base) + parseFloat(envios)).toFixed(2));
+
const iva_porcentaje = parseInt(this.datosGenerales.ivaReducido.find('option:selected').val()) == 1 ? 0.04 : 0.21;
- const iva = (parseFloat(base) * iva_porcentaje).toFixed(2);
+ const iva = ((parseFloat(base) + parseFloat(envios))* iva_porcentaje).toFixed(2);
let iva_text = this.#changeDecimalFormat(iva);
- const total = (parseFloat(base) + parseFloat(iva)).toFixed(2);
+ const total = (parseFloat(base) + parseFloat(envios) +parseFloat(iva)).toFixed(2);
let total_text = this.#changeDecimalFormat(total);
+
this.precio_unidad.text(precio_u_text);
this.total_base.text(base_text);
this.iva_porcentaje.text(this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? '4' : '21');
@@ -329,23 +338,28 @@ class Resumen {
}
- generate_total(base, precio_u, iva_reducido) {
+ generate_total(base, precio_u, total_envio, iva_reducido) {
let precio_u_text = String(precio_u);
precio_u_text = precio_u_text.replace('€/u', '');
precio_u_text = this.#changeDecimalFormat(precio_u_text);
let base_text = this.#changeDecimalFormat(String(base));
+ let envios_text = this.#changeDecimalFormat(total_envio.toFixed(2));
+ let total_antes_iva = parseFloat(base) + parseFloat(total_envio);
+ let total_antes_iva_text = this.#changeDecimalFormat(total_antes_iva.toFixed(2));
const iva_porcentaje = !iva_reducido? 0.21 : 0.04;
- const iva = (parseFloat(base) * iva_porcentaje).toFixed(2);
+ const iva = ((parseFloat(base) + parseFloat(total_envio)) * iva_porcentaje).toFixed(2);
let iva_text = this.#changeDecimalFormat(iva);
- const total = (parseFloat(base) + parseFloat(iva)).toFixed(2);
+ const total = (parseFloat(base) + parseFloat(total_envio) + parseFloat(iva)).toFixed(2);
let total_text = this.#changeDecimalFormat(total);
this.precio_unidad.text(precio_u_text);
this.total_base.text(base_text);
+ this.total_envios.text(envios_text);
+ this.total_antes_iva.text(total_antes_iva_text);
this.iva_porcentaje.text(!iva_reducido? '21' : '4');
this.iva.text(iva_text);
this.total.text(total_text);
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/tarjetaTiradasPrecio.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/tarjetaTiradasPrecio.js
index 25e11ef5..1fbeead7 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/tarjetaTiradasPrecio.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/tarjetaTiradasPrecio.js
@@ -1,13 +1,14 @@
class tarjetaTiradasPrecio {
- constructor(domItem, id, tirada, precio, precio_unidad) {
+ constructor(domItem, id, tirada, precio, precio_unidad, envio) {
this.domItem = domItem;
this.id = id;
this.tirada = tirada;
this.precio = precio;
this.precio_unidad = precio_unidad;
+ this.envio = envio;
- this.card = this.#generateHTML(id, tirada, precio, precio_unidad);
+ this.card = this.#generateHTML(id, tirada, precio, precio_unidad, envio);
this.domItem.append(this.card);
}
@@ -15,7 +16,7 @@ class tarjetaTiradasPrecio {
return value.toLocaleString("de-DE", { minimumFractionDigits: digits, maximumFractionDigits: digits });
}
- #generateHTML(id, tirada, precio, precio_unidad) {
+ #generateHTML(id, tirada, precio, precio_unidad, envio) {
let $html = $('
', {
id: id,
@@ -37,6 +38,7 @@ class tarjetaTiradasPrecio {
const formattedPrecio = this.formatNumber(precio, 2);
const formattedPrecioUnidad = this.formatNumber(precio_unidad, 4);
+
$listContent.append($('', {
id: 'ud_' + id,
@@ -56,6 +58,12 @@ class tarjetaTiradasPrecio {
text: formattedPrecioUnidad + '€/ud'
}).attr('data', precio_unidad));
+ $listContent.append($('', {
+ id: 'envio_' + id,
+ type: 'hidden',
+ class: 'mb-1 tarjeta-tiradas-precios-envio',
+ }).val(envio));
+
$liWrapper.append($listContent);
$link.append($liWrapper);
$html.append($link);
diff --git a/httpdocs/assets/js/safekat/pages/soporte/tickets.js b/httpdocs/assets/js/safekat/pages/soporte/tickets.js
index c442772f..f140db83 100644
--- a/httpdocs/assets/js/safekat/pages/soporte/tickets.js
+++ b/httpdocs/assets/js/safekat/pages/soporte/tickets.js
@@ -293,7 +293,12 @@ class Ticket {
document.addEventListener('DOMContentLoaded', function () {
- const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
+ const dropdown = document.querySelector(".dropdown-language");
+ const activeItem = dropdown.querySelector(".dropdown-menu .dropdown-item");
+ let locale = 'es';
+ if (activeItem) {
+ locale = activeItem.getAttribute("data-language");
+ }
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Tickets', 'datePicker'] }, {},
function (translations) {
diff --git a/httpdocs/themes/vuexy/css/pedidos.css b/httpdocs/themes/vuexy/css/pedidos.css
new file mode 100644
index 00000000..8e5e190c
--- /dev/null
+++ b/httpdocs/themes/vuexy/css/pedidos.css
@@ -0,0 +1,9 @@
+.swal2-container {
+ overflow-y: visible !important;
+}
+.swal2-html-container {
+ overflow: visible !important;
+}
+.select2-dropdown {
+ z-index: 999999999 !important;
+}
\ No newline at end of file