refactor: refs #7424 Component type refactor #2656
|
@ -59,7 +59,7 @@ BEGIN
|
||||||
JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||||
JOIN vn.component c ON c.id = sc.componentFk
|
JOIN vn.component c ON c.id = sc.componentFk
|
||||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||||
WHERE ct.code = 'FREIGHT'
|
WHERE ct.code = 'freight'
|
||||||
AND r.created BETWEEN vDatedFrom AND vDatedTo
|
AND r.created BETWEEN vDatedFrom AND vDatedTo
|
||||||
GROUP BY r.id
|
GROUP BY r.id
|
||||||
) sub ON sub.routeFk = r.Id_Ruta
|
) sub ON sub.routeFk = r.Id_Ruta
|
||||||
|
|
|
@ -2,7 +2,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
SQL SECURITY DEFINER
|
SQL SECURITY DEFINER
|
||||||
VIEW `bi`.`tarifa_componentes_series`
|
VIEW `bi`.`tarifa_componentes_series`
|
||||||
AS SELECT `ct`.`id` AS `tarifa_componentes_series_id`,
|
AS SELECT `ct`.`id` AS `tarifa_componentes_series_id`,
|
||||||
`ct`.`type` AS `Serie`,
|
`ct`.`name` AS `Serie`,
|
||||||
`ct`.`isBase` AS `base`,
|
`ct`.`isBase` AS `base`,
|
||||||
`ct`.`isMargin` AS `margen`
|
`ct`.`isMargin` AS `margen`
|
||||||
FROM `vn`.`componentType` `ct`
|
FROM `vn`.`componentType` `ct`
|
||||||
|
|
|
@ -8,7 +8,7 @@ BEGIN
|
||||||
JOIN vn.component c ON c.id = sc.componentFk
|
JOIN vn.component c ON c.id = sc.componentFk
|
||||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||||
WHERE s.ticketFk = vTicketFk
|
WHERE s.ticketFk = vTicketFk
|
||||||
AND ct.`type` = 'otros';
|
AND ct.code = 'other';
|
||||||
|
|
||||||
UPDATE vn.sale s
|
UPDATE vn.sale s
|
||||||
JOIN (
|
JOIN (
|
||||||
|
|
|
@ -20,7 +20,8 @@ BEGIN
|
||||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||||
JOIN saleComponent sc ON sc.saleFk = s.id
|
JOIN saleComponent sc ON sc.saleFk = s.id
|
||||||
JOIN component c ON c.id = sc.componentFk
|
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
|
WHERE t.shipped BETWEEN vShippedFrom AND vShippedTo
|
||||||
AND ic.merchandise;
|
AND ic.merchandise;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ BEGIN
|
||||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||||
JOIN vn.sale s ON s.id = sc.saleFk
|
JOIN vn.sale s ON s.id = sc.saleFk
|
||||||
JOIN tmp.ticket t ON t.ticketFk = s.ticketFk
|
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
|
GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk
|
||||||
SET tf.freight = sb.freight;
|
SET tf.freight = sb.freight;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ BEGIN
|
||||||
|
|
||||||
-- Margin
|
-- Margin
|
||||||
UPDATE tmp.ticketFloramondo tf
|
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,
|
SUM(IF(ct.isMargin, sc.value, 0)) margin,
|
||||||
t.ticketFk
|
t.ticketFk
|
||||||
FROM vn.saleComponent sc
|
FROM vn.saleComponent sc
|
||||||
|
|
|
@ -19,4 +19,4 @@ FROM (
|
||||||
)
|
)
|
||||||
JOIN `vn`.`componentType` `ct` ON(`ct`.`id` = `c`.`typeFk`)
|
JOIN `vn`.`componentType` `ct` ON(`ct`.`id` = `c`.`typeFk`)
|
||||||
)
|
)
|
||||||
WHERE `ct`.`type` = 'coste'
|
WHERE `ct`.`code` = 'cost'
|
||||||
|
|
|
@ -16,6 +16,6 @@ FROM (
|
||||||
)
|
)
|
||||||
JOIN `vn`.`componentType` `ct` ON(
|
JOIN `vn`.`componentType` `ct` ON(
|
||||||
`ct`.`id` = `c`.`typeFk`
|
`ct`.`id` = `c`.`typeFk`
|
||||||
AND `ct`.`type` = 'agencia'
|
AND `ct`.`code` = 'freight'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -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;
|
|
@ -12,7 +12,7 @@
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "Identifier"
|
"description": "Identifier"
|
||||||
},
|
},
|
||||||
"type": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"isBase":{
|
"isBase":{
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
ng-repeat="saleComponent in sale.components track by saleComponent.componentFk"
|
ng-repeat="saleComponent in sale.components track by saleComponent.componentFk"
|
||||||
class="components">
|
class="components">
|
||||||
<td>
|
<td>
|
||||||
{{::saleComponent.component.componentType.type}}
|
{{::saleComponent.component.componentType.name}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{::saleComponent.component.name}}
|
{{::saleComponent.component.name}}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Controller extends Section {
|
||||||
include: {
|
include: {
|
||||||
relation: 'componentType',
|
relation: 'componentType',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['type', 'isBase']
|
fields: ['name', 'isBase']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
SELECT
|
SELECT s.id,
|
||||||
s.id,
|
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
s.concept,
|
s.concept,
|
||||||
s.quantity,
|
s.quantity,
|
||||||
s.price,
|
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,
|
s.discount,
|
||||||
i.size,
|
i.size,
|
||||||
i.stems,
|
i.stems,
|
||||||
i.category,
|
i.category,
|
||||||
it.id itemTypeId,
|
it.id itemTypeId,
|
||||||
o.code AS origin,
|
o.code origin,
|
||||||
i.inkFk,
|
i.inkFk,
|
||||||
s.ticketFk,
|
s.ticketFk,
|
||||||
tcl.code vatType,
|
tcl.code vatType,
|
||||||
|
|
Loading…
Reference in New Issue