Merge pull request 'refactor: refs #7424 Component type refactor' (!2656) from 7424-componentType into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2656
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
Guillermo Bonet 2024-07-03 05:22:48 +00:00
commit d1a38ec589
12 changed files with 63 additions and 54 deletions

View File

@ -59,7 +59,7 @@ BEGIN
JOIN vn.saleComponent sc ON sc.saleFk = s.id
JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE ct.code = 'FREIGHT'
WHERE ct.code = 'freight'
AND r.created BETWEEN vDatedFrom AND vDatedTo
GROUP BY r.id
) sub ON sub.routeFk = r.Id_Ruta

View File

@ -2,7 +2,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bi`.`tarifa_componentes_series`
AS SELECT `ct`.`id` AS `tarifa_componentes_series_id`,
`ct`.`type` AS `Serie`,
`ct`.`name` AS `Serie`,
`ct`.`isBase` AS `base`,
`ct`.`isMargin` AS `margen`
FROM `vn`.`componentType` `ct`

View File

@ -8,7 +8,7 @@ BEGIN
JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE s.ticketFk = vTicketFk
AND ct.`type` = 'otros';
AND ct.code = 'other';
UPDATE vn.sale s
JOIN (

View File

@ -20,7 +20,8 @@ BEGIN
JOIN itemCategory ic ON ic.id = tp.categoryFk
JOIN saleComponent sc ON sc.saleFk = s.id
JOIN component c ON c.id = sc.componentFk
JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1
JOIN componentType ct ON ct.id = c.typeFk
AND ct.code = 'cost'
WHERE t.shipped BETWEEN vShippedFrom AND vShippedTo
AND ic.merchandise;

View File

@ -66,7 +66,7 @@ BEGIN
JOIN vn.componentType ct ON ct.id = c.typeFk
JOIN vn.sale s ON s.id = sc.saleFk
JOIN tmp.ticket t ON t.ticketFk = s.ticketFk
WHERE ct.code = 'FREIGHT'
WHERE ct.code = 'freight'
GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk
SET tf.freight = sb.freight;
@ -88,7 +88,7 @@ BEGIN
-- Margin
UPDATE tmp.ticketFloramondo tf
JOIN (SELECT SUM(IF(ct.code = 'COST',sc.value, 0)) cost,
JOIN (SELECT SUM(IF(ct.code = 'cost',sc.value, 0)) cost,
SUM(IF(ct.isMargin, sc.value, 0)) margin,
t.ticketFk
FROM vn.saleComponent sc

View File

@ -19,4 +19,4 @@ FROM (
)
JOIN `vn`.`componentType` `ct` ON(`ct`.`id` = `c`.`typeFk`)
)
WHERE `ct`.`type` = 'coste'
WHERE `ct`.`code` = 'cost'

View File

@ -16,6 +16,6 @@ FROM (
)
JOIN `vn`.`componentType` `ct` ON(
`ct`.`id` = `c`.`typeFk`
AND `ct`.`type` = 'agencia'
AND `ct`.`code` = 'freight'
)
)

View File

@ -0,0 +1,9 @@
ALTER TABLE vn.componentType
CHANGE code code varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL AFTER id;
ALTER TABLE vn.componentType
CHANGE `type` name varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
UPDATE IGNORE vn.componentType
SET code = LOWER(code);
UPDATE IGNORE vn.componentType
SET code = 'other'
WHERE id = 12;

View File

@ -12,7 +12,7 @@
"type": "number",
"description": "Identifier"
},
"type": {
"name": {
"type": "string"
},
"isBase":{

View File

@ -51,7 +51,7 @@
ng-repeat="saleComponent in sale.components track by saleComponent.componentFk"
class="components">
<td>
{{::saleComponent.component.componentType.type}}
{{::saleComponent.component.componentType.name}}
</td>
<td>
{{::saleComponent.component.name}}

View File

@ -20,7 +20,7 @@ class Controller extends Section {
include: {
relation: 'componentType',
scope: {
fields: ['type', 'isBase']
fields: ['name', 'isBase']
}
}
}

View File

@ -1,16 +1,15 @@
SELECT
s.id,
SELECT s.id,
s.itemFk,
s.concept,
s.quantity,
s.price,
s.price - SUM(IF(ctr.id = 6, sc.value, 0)) netPrice,
s.price - SUM(IF(ctr.code = 'freight', sc.value, 0)) netPrice,
s.discount,
i.size,
i.stems,
i.category,
it.id itemTypeId,
o.code AS origin,
o.code origin,
i.inkFk,
s.ticketFk,
tcl.code vatType,
@ -21,7 +20,7 @@ SELECT
i.value6,
i.tag7,
i.value7
FROM vn.sale s
FROM vn.sale s
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
LEFT JOIN component cr ON cr.id = sc.componentFk
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
@ -38,6 +37,6 @@ FROM vn.sale s
LEFT JOIN itemBotanicalWithGenus ib ON ib.itemFk = i.id
AND ic.code = 'plant'
AND ib.ediBotanic IS NOT NULL
WHERE s.ticketFk = ?
GROUP BY s.id
ORDER BY (it.isPackaging), s.concept, s.itemFk
WHERE s.ticketFk = ?
GROUP BY s.id
ORDER BY (it.isPackaging), s.concept, s.itemFk