From 5ff950d0786b18d54ae2331e038d6bd433a5e9bb Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 21 Jan 2022 10:33:40 +0100 Subject: [PATCH] refactor(invoice): hide report logo for non group companies #3519 --- db/dump/fixtures.sql | 15 +++++++------- .../report-header/report-header.html | 6 +++++- .../components/report-header/report-header.js | 20 ++++++++++++++++--- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 9d7f61116..dd7f5aabe 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -455,7 +455,8 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea INSERT INTO `vn`.`companyGroup`(`id`, `code`) VALUES - (1, 'Wayne Industries'); + (1, 'wayneIndustries'), + (2, 'Verdnatura'); INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`) VALUES @@ -466,13 +467,13 @@ INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`) VALUES (241, 442, 'ES111122333344111122221111', 128); -INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`, `phytosanitary`) +INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`, `companyGroupFk`, `phytosanitary`) VALUES - (69 , 'CCs', NULL, 30, NULL, 0, NULL, NULL), - (442 , 'VNL', 241, 30, 2 , 1, NULL, 'VNL Company - Plant passport'), - (567 , 'VNH', NULL, 30, NULL, 4, NULL, 'VNH Company - Plant passport'), - (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', NULL), - (1381, 'ORN', NULL, 30, NULL, 7, NULL, 'ORN Company - Plant passport'); + (69 , 'CCs', NULL, 30, NULL, 0, NULL, 1, NULL), + (442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport'), + (567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport'), + (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL), + (1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport'); INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`) VALUES diff --git a/print/core/components/report-header/report-header.html b/print/core/components/report-header/report-header.html index 2667f14ed..0479e5caf 100644 --- a/print/core/components/report-header/report-header.html +++ b/print/core/components/report-header/report-header.html @@ -1,5 +1,9 @@
- Verdnatura + Verdnatura
{{companyName}}. {{company.street}}. {{company.postCode}} {{company.city}}. diff --git a/print/core/components/report-header/report-header.js b/print/core/components/report-header/report-header.js index 58c06bc1a..50c3a1337 100755 --- a/print/core/components/report-header/report-header.js +++ b/print/core/components/report-header/report-header.js @@ -10,9 +10,16 @@ module.exports = { }, computed: { companyName() { - if (!this.company.name) return; + if (this.company.name) + return this.company.name.toUpperCase(); - return this.company.name.toUpperCase(); + return; + }, + companyGroup() { + if (this.company.groupName) + return this.company.groupName.toLowerCase(); + + return; }, companyPhone() { if (!this.company.phone) return; @@ -30,8 +37,15 @@ module.exports = { methods: { getCompany(code) { return db.findOne(` - SELECT s.name, s.street, s.postCode, s.city, s.phone + SELECT + s.name, + s.street, + s.postCode, + s.city, + s.phone, + cg.code AS groupName FROM company c + JOIN companyGroup cg ON cg.id = c.companyGroupFk JOIN supplier s ON s.id = c.id WHERE c.code = ?`, [code]); },