feat: refs #6777 ultima comprobacion
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Robert Ferrús 2024-04-10 09:42:55 +02:00
parent d151d57613
commit c2a2a86f35
12 changed files with 15 additions and 182 deletions

View File

@ -21,9 +21,9 @@ BEGIN
CREATE TEMPORARY TABLE tmp.ticket_list
(PRIMARY KEY (id))
ENGINE = MEMORY
SELECT Id_Ticket
FROM vn2008.Tickets t
JOIN vn.invoiceOut io ON io.`ref` = t.Factura
SELECT t.id
FROM vn.ticket t
JOIN vn.invoiceOut io ON io.`ref` = t.refFk
WHERE year(io.issued) = vYear
AND month(io.issued) = vMonth;
@ -46,7 +46,7 @@ BEGIN
) as grupo
, tp.reino_id
, a.tipo_id
, t.empresa_id
, t.companyFk
, a.expenseFk
+ IF(e.empresa_grupo = e2.empresa_grupo
,1
@ -54,8 +54,8 @@ BEGIN
) * 100000
+ tp.reino_id * 1000 as Gasto
FROM vn2008.Movimientos m
JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket
JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna
JOIN vn.ticket t ON t.id = m.Id_Ticket
JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk
JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente
JOIN tmp.ticket_list tt on tt.id = t.id
JOIN vn2008.Articles a on m.Id_Article = a.Id_Article
@ -66,7 +66,7 @@ BEGIN
AND Preu <> 0
AND m.Descuento <> 100
AND a.tipo_id != TIPO_PATRIMONIAL
GROUP BY grupo, reino_id, tipo_id, empresa_id, Gasto;
GROUP BY grupo, reino_id, tipo_id, companyFk, Gasto;
INSERT INTO bs.ventas_contables(year
, month
@ -92,7 +92,7 @@ BEGIN
JOIN vn.ticket t ON ts.ticketFk = t.id
JOIN vn.address a on a.id = t.addressFk
JOIN vn.client cl on cl.id = a.clientFk
JOIN tmp.ticket_list tt on tt.Id_Ticket = t.id
JOIN tmp.ticket_list tt on tt.id = t.id
JOIN vn.company c on c.id = t.companyFk
LEFT JOIN vn.company c2 on c2.clientFk = cl.id
GROUP BY grupo, t.companyFk ;

View File

@ -10,10 +10,10 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
CREATE TEMPORARY TABLE tmp.ticket_list
(PRIMARY KEY (Id_Ticket))
SELECT Id_Ticket
FROM vn2008.Tickets t
JOIN vn.invoiceOut io ON io.id = t.Factura
(PRIMARY KEY (id))
SELECT t.id
FROM vn.ticket t
JOIN vn.invoiceOut io ON io.id = t.refFk
WHERE year(io.issued) = vYear
AND month(io.issued) = vMonth;

View File

@ -1,19 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Rutas`
AS SELECT `r`.`id` AS `Id_Ruta`,
`r`.`workerFk` AS `Id_Trabajador`,
`r`.`created` AS `Fecha`,
`r`.`vehicleFk` AS `Id_Vehiculo`,
`r`.`agencyModeFk` AS `Id_Agencia`,
`r`.`time` AS `Hora`,
`r`.`isOk` AS `ok`,
`r`.`kmStart` AS `km_start`,
`r`.`kmEnd` AS `km_end`,
`r`.`started` AS `date_start`,
`r`.`finished` AS `date_end`,
`r`.`gestdocFk` AS `gestdoc_id`,
`r`.`cost` AS `cost`,
`r`.`m3` AS `m3`,
`r`.`description` AS `description`
FROM `vn`.`route` `r`

View File

@ -1,13 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`state`
AS SELECT `s`.`id` AS `id`,
`s`.`name` AS `name`,
`s`.`order` AS `order`,
`s`.`alertLevel` AS `alert_level`,
`s`.`code` AS `code`,
`s`.`sectorProdPriority` AS `sectorProdPriority`,
`s`.`nextStateFk` AS `nextStateFk`,
`s`.`isPreviousPreparable` AS `isPreviousPreparable`,
`s`.`isPicked` AS `isPicked`
FROM `vn`.`state` `s`

View File

@ -1,10 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`tag`
AS SELECT `t`.`id` AS `id`,
`t`.`name` AS `name`,
`t`.`isFree` AS `isFree`,
`t`.`isQuantitatif` AS `isQuantitatif`,
`t`.`sourceTable` AS `sourceTable`,
`t`.`unit` AS `unit`
FROM `vn`.`tag` `t`

View File

@ -1,10 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`tarifa_componentes`
AS SELECT `tarifa_componentes`.`Id_Componente` AS `Id_Componente`,
`tarifa_componentes`.`Componente` AS `Componente`,
`tarifa_componentes`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`,
`tarifa_componentes`.`tarifa_class` AS `tarifa_class`,
`tarifa_componentes`.`tax` AS `tax`,
`tarifa_componentes`.`is_renewable` AS `is_renewable`
FROM `bi`.`tarifa_componentes`

View File

@ -1,7 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`tarifa_componentes_series`
AS SELECT `tarifa_componentes_series`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`,
`tarifa_componentes_series`.`Serie` AS `Serie`,
`tarifa_componentes_series`.`base` AS `base`
FROM `bi`.`tarifa_componentes_series`

View File

@ -1,39 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`tblContadores`
AS SELECT `c`.`id` AS `id`,
`c`.`ochoa` AS `ochoa`,
`c`.`invoiceOutFk` AS `nfactura`,
`c`.`inventoried` AS `FechaInventario`,
`c`.`itemLog` AS `HistoricoArticulo`,
`c`.`weekGoal` AS `week_goal`,
`c`.`photosPath` AS `Rutafotos`,
`c`.`cashBoxNumber` AS `numCaja`,
`c`.`redCode` AS `CodigoRojo`,
`c`.`TabletTime` AS `Tablet_Hora`,
`c`.`t0` AS `t0`,
`c`.`t1` AS `t1`,
`c`.`t2` AS `t2`,
`c`.`t3` AS `t3`,
`c`.`cc` AS `cc`,
`c`.`palet` AS `palet`,
`c`.`campaign` AS `campaign`,
`c`.`campaignLife` AS `campaign_life`,
`c`.`truckDays` AS `truck_days`,
`c`.`transportCharges` AS `tasa_transporte`,
`c`.`escanerPath` AS `escaner_path`,
`c`.`printedTurn` AS `turnoimpreso`,
`c`.`truckLength` AS `truck_length`,
`c`.`fuelConsumption` AS `fuel_consumption`,
`c`.`petrol` AS `petrol`,
`c`.`maintenance` AS `maintenance`,
`c`.`hourPrice` AS `hour_price`,
`c`.`meterPrice` AS `meter_price`,
`c`.`kmPrice` AS `km_price`,
`c`.`routeOption` AS `route_option`,
`c`.`dbproduccion` AS `dbproduccion`,
`c`.`mdbServer` AS `mdbServer`,
`c`.`fakeEmail` AS `fakeEmail`,
`c`.`defaultersMaxAmount` AS `defaultersMaxAmount`,
`c`.`ASIEN` AS `ASIEN`
FROM `vn`.`config` `c`

View File

@ -1,6 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`thermograph`
AS SELECT `t`.`id` AS `thermograph_id`,
`t`.`model` AS `model`
FROM `vn`.`thermograph` `t`

View File

@ -1,8 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`ticket_observation`
AS SELECT `to`.`id` AS `ticket_observation_id`,
`to`.`ticketFk` AS `Id_Ticket`,
`to`.`observationTypeFk` AS `observation_type_id`,
`to`.`description` AS `text`
FROM `vn`.`ticketObservation` `to`

View File

@ -1,6 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`tickets_gestdoc`
AS SELECT `td`.`ticketFk` AS `Id_Ticket`,
`td`.`dmsFk` AS `gestdoc_id`
FROM `vn`.`ticketDms` `td`

View File

@ -1,49 +0,0 @@
-- Para evitar el error al hacer myt run
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Clientes`
AS SELECT `c`.`id` AS `id_cliente`,
`c`.`name` AS `cliente`,
`c`.`fi` AS `if`,
`c`.`socialName` AS `razonSocial`,
`c`.`contact` AS `contacto`,
`c`.`street` AS `domicilio`,
`c`.`city` AS `poblacion`,
`c`.`postcode` AS `codPostal`,
`c`.`phone` AS `telefono`,
`c`.`mobile` AS `movil`,
`c`.`isRelevant` AS `real`,
`c`.`email` AS `e-mail`,
`c`.`iban` AS `iban`,
`c`.`dueDay` AS `vencimiento`,
`c`.`accountingAccount` AS `Cuenta`,
`c`.`isEqualizated` AS `RE`,
`c`.`provinceFk` AS `province_id`,
`c`.`hasToInvoice` AS `invoice`,
`c`.`credit` AS `credito`,
`c`.`countryFk` AS `Id_Pais`,
`c`.`isActive` AS `activo`,
`c`.`gestdocFk` AS `gestdoc_id`,
`c`.`quality` AS `calidad`,
`c`.`payMethodFk` AS `pay_met_id`,
`c`.`created` AS `created`,
`c`.`isToBeMailed` AS `mail`,
`c`.`contactChannelFk` AS `chanel_id`,
`c`.`hasSepaVnl` AS `sepaVnl`,
`c`.`hasCoreVnl` AS `coreVnl`,
`c`.`hasCoreVnh` AS `coreVnh`,
`c`.`hasLcr` AS `hasLcr`,
`c`.`defaultAddressFk` AS `default_address`,
`c`.`riskCalculated` AS `risk_calculated`,
`c`.`hasToInvoiceByAddress` AS `invoiceByAddress`,
`c`.`isTaxDataChecked` AS `contabilizado`,
`c`.`isFreezed` AS `congelado`,
`c`.`creditInsurance` AS `creditInsurance`,
`c`.`isCreatedAsServed` AS `isCreatedAsServed`,
`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,
`c`.`salesPersonFk` AS `Id_Trabajador`,
`c`.`isVies` AS `vies`,
`c`.`eypbc` AS `EYPBC`,
`c`.`bankEntityFk` AS `bankEntityFk`,
`c`.`typeFk` AS `typeFk`
FROM `vn`.`client` `c`;