7806_devToTest_2332 #2801

Merged
alexm merged 126 commits from 7806_devToTest_2330 into test 2024-07-30 06:14:09 +00:00
4 changed files with 37 additions and 13 deletions
Showing only changes of commit c30362a266 - Show all commits

View File

@ -10,19 +10,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_comparative`(
)
proc: BEGIN
/**
* Genera una tabla de comparativa de artículos por itemType/comprador/fecha.
* Los datos se calculan en función de los parámetros proporcionados.
* Generates a comparison table of items by itemType/buyer/date.
* The data is calculated based on the provided parameters.
*
* @param vDate La fecha para la cual se generará la comparativa.
* @param vDayRange El rango de días a considerar para la comparativa.
* @param vWarehouseFk El identificador del almacén para filtrar los artículos.
* @param vAvailableSince La fecha de disponibilidad desde la cual se consideran los artículos disponibles.
* @param vBuyerFk El identificador del comprador para filtrar los artículos.
* @param vIsFloramondo Indica si se deben incluir solo los artículos de Floramondo (opcional).
* @param vCountryFk El identificador del país.
* @param tmp.comparativeFilterType(filterFk INT ,itemTypeFk INT)
* @param vDate The date for which the comparison will be generated.
* @param vDayRange The range of days to consider for the comparison.
* @param vWarehouseFk The warehouse identifier to filter the items.
* @param vAvailableSince The availability date from which the items are considered available.
* @param vBuyerFk The buyer identifier to filter the items.
* @param vIsFloramondo Indicates whether only Floramondo items should be included (optional).
* @param vCountryFk The country identifier.
* @param tmp.comparativeFilterType(filterFk INT, itemTypeFk INT)
* @return tmp.comparative
*/
DECLARE vDayRangeStart DATE;
DECLARE vDayRangeEnd DATE;
DECLARE w1, w2, w3, w4, w5, w6, w7 INT;

View File

@ -46,12 +46,18 @@ BEGIN
i.tag8 = JSON_VALUE(vTags, '$.8'),
i.tag9 = JSON_VALUE(vTags, '$.9'),
i.tag10 = JSON_VALUE(vTags, '$.10'),
i.tag11 = JSON_VALUE(vTags, '$.11'),
i.tag12 = JSON_VALUE(vTags, '$.12'),
i.tag13 = JSON_VALUE(vTags, '$.13'),
i.value5 = JSON_VALUE(vValues, '$.5'),
i.value6 = JSON_VALUE(vValues, '$.6'),
i.value7 = JSON_VALUE(vValues, '$.7'),
i.value8 = JSON_VALUE(vValues, '$.8'),
i.value9 = JSON_VALUE(vValues, '$.9'),
i.value10 = JSON_VALUE(vValues, '$.10'),
i.value11 = JSON_VALUE(vValues, '$.11'),
i.value12 = JSON_VALUE(vValues, '$.12'),
i.value13 = JSON_VALUE(vValues, '$.13'),
i.producerFk = p.id,
i.inkFk = k.id,
i.originFk = IFNULL(o.id, i.originFk)

View File

@ -0,0 +1,8 @@
ALTER TABLE vn.item ADD IF NOT EXISTS tag11 varchar(20) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS value11 varchar(50) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS tag12 varchar(20) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS value12 varchar(50) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS tag13 varchar(20) DEFAULT NULL NULL;
ALTER TABLE vn.item ADD IF NOT EXISTS value13 varchar(50) DEFAULT NULL NULL;

View File

@ -53,13 +53,22 @@ module.exports = Self => {
const stmts = [];
const stmt = new ParameterizedSQL(
`SELECT t.id AS ticketFk, c.id AS clientFk, c.name AS clientName, tw.weekDay,
wh.name AS warehouseName, u.id AS workerFk, u.name AS userName, u.nickName, tw.agencyModeFk
`SELECT t.id AS ticketFk,
c.id AS clientFk,
c.name AS clientName,
tw.weekDay,
wh.name AS warehouseName,
u.id AS workerFk,
u.name AS userName,
u.nickName,
tw.agencyModeFk,
am.name agencyModeName
FROM ticketWeekly tw
JOIN ticket t ON t.id = tw.ticketFk
JOIN client c ON c.id = t.clientFk
JOIN account.user u ON u.id = c.salesPersonFk
JOIN warehouse wh ON wh.id = t.warehouseFk`
JOIN warehouse wh ON wh.id = t.warehouseFk
LEFT JOIN agencyMode am ON am.id = tw.agencyModeFk`
);
stmt.merge(conn.makeSuffix(filter));