refs #6784 Delete clientTypeFk
This commit is contained in:
parent
a79ddc1c6c
commit
3813dbb9fd
|
@ -371,7 +371,7 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
||||||
(4, 'GCN Channel'),
|
(4, 'GCN Channel'),
|
||||||
(5, 'The Newspaper');
|
(5, 'The Newspaper');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
|
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk__`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
|
|
|
@ -19,7 +19,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
itemTypeFk,
|
itemTypeFk,
|
||||||
floor(sum(value)) as total,
|
floor(sum(value)) as total,
|
||||||
floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas
|
floor(sum(IF(typeFk = 'loses', value, 0))) as mermas
|
||||||
FROM vn.saleValue
|
FROM vn.saleValue
|
||||||
where year = vYear and week = vWeek
|
where year = vYear and week = vWeek
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ BEGIN
|
||||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
JOIN clientType ct ON ct.code = c.typeFk
|
||||||
JOIN warehouse w ON w.id = t.warehouseFk
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
JOIN address ad ON ad.id = t.addressFk
|
JOIN address ad ON ad.id = t.addressFk
|
||||||
LEFT JOIN province p ON p.id = ad.provinceFk
|
LEFT JOIN province p ON p.id = ad.provinceFk
|
||||||
|
|
|
@ -44,7 +44,7 @@ proc:BEGIN
|
||||||
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c on c.id = t.clientFk
|
JOIN client c on c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
JOIN clientType ct ON ct.code = c.typeFk
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
AND st.saleFk IS NULL
|
AND st.saleFk IS NULL
|
||||||
AND ct.code IN ('normal', 'trust')
|
AND ct.code IN ('normal', 'trust')
|
||||||
|
@ -70,7 +70,7 @@ proc:BEGIN
|
||||||
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c on c.id = t.clientFk
|
JOIN client c on c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
JOIN clientType ct ON ct.code = c.typeFk
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
AND st.saleFk IS NULL
|
AND st.saleFk IS NULL
|
||||||
AND ct.code IN ('normal', 'trust')
|
AND ct.code IN ('normal', 'trust')
|
||||||
|
|
|
@ -128,7 +128,7 @@ BEGIN
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
LEFT JOIN state st ON st.`code` = ts.`code`
|
LEFT JOIN state st ON st.`code` = ts.`code`
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
JOIN clientType ct ON ct.code = c.typeFk
|
||||||
JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
||||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
VIEW `vn`.`saleValue`
|
VIEW `vn`.`saleValue`
|
||||||
AS SELECT `wh`.`name` AS `warehouse`,
|
AS SELECT `wh`.`name` AS `warehouse`,
|
||||||
`c`.`name` AS `client`,
|
`c`.`name` AS `client`,
|
||||||
`c`.`typeFk` AS `clientTypeFk`,
|
`c`.`typeFk` AS `typeFk`,
|
||||||
`u`.`name` AS `buyer`,
|
`u`.`name` AS `buyer`,
|
||||||
`it`.`id` AS `itemTypeFk`,
|
`it`.`id` AS `itemTypeFk`,
|
||||||
`it`.`name` AS `family`,
|
`it`.`name` AS `family`,
|
||||||
|
|
|
@ -34,7 +34,6 @@ AS SELECT `c`.`id` AS `id_cliente`,
|
||||||
`c`.`hasLcr` AS `hasLcr`,
|
`c`.`hasLcr` AS `hasLcr`,
|
||||||
`c`.`defaultAddressFk` AS `default_address`,
|
`c`.`defaultAddressFk` AS `default_address`,
|
||||||
`c`.`riskCalculated` AS `risk_calculated`,
|
`c`.`riskCalculated` AS `risk_calculated`,
|
||||||
`c`.`clientTypeFk` AS `clientes_tipo_id`,
|
|
||||||
`c`.`hasToInvoiceByAddress` AS `invoiceByAddress`,
|
`c`.`hasToInvoiceByAddress` AS `invoiceByAddress`,
|
||||||
`c`.`isTaxDataChecked` AS `contabilizado`,
|
`c`.`isTaxDataChecked` AS `contabilizado`,
|
||||||
`c`.`isFreezed` AS `congelado`,
|
`c`.`isFreezed` AS `congelado`,
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.client DROP FOREIGN KEY tipos_de_cliente;
|
||||||
|
ALTER TABLE vn.client CHANGE COLUMN clientTypeFk clientTypeFk__ INT NOT NULL DEFAULT 1 COMMENT '@deprecated 2024-02-20 refs #6784';
|
|
@ -197,7 +197,7 @@
|
||||||
"type": {
|
"type": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "ClientType",
|
"model": "ClientType",
|
||||||
"foreignKey": "clientTypeFk"
|
"foreignKey": "clientTypeFk__"
|
||||||
},
|
},
|
||||||
"businessType": {
|
"businessType": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -41,7 +41,7 @@ module.exports = Self => {
|
||||||
include: {
|
include: {
|
||||||
relation: 'client',
|
relation: 'client',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'clientTypeFk'],
|
fields: ['id', 'clientTypeFk__'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'type',
|
relation: 'type',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
Loading…
Reference in New Issue