refactor(invoice): hide report logo for non group companies #3519
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2022-01-21 10:33:40 +01:00
parent 4237cd56df
commit 5ff950d078
3 changed files with 30 additions and 11 deletions

View File

@ -455,7 +455,8 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea
INSERT INTO `vn`.`companyGroup`(`id`, `code`) INSERT INTO `vn`.`companyGroup`(`id`, `code`)
VALUES VALUES
(1, 'Wayne Industries'); (1, 'wayneIndustries'),
(2, 'Verdnatura');
INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`) INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`)
VALUES VALUES
@ -466,13 +467,13 @@ INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`)
VALUES VALUES
(241, 442, 'ES111122333344111122221111', 128); (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 VALUES
(69 , 'CCs', NULL, 30, NULL, 0, NULL, NULL), (69 , 'CCs', NULL, 30, NULL, 0, NULL, 1, NULL),
(442 , 'VNL', 241, 30, 2 , 1, NULL, 'VNL Company - Plant passport'), (442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport'),
(567 , 'VNH', NULL, 30, NULL, 4, NULL, 'VNH Company - Plant passport'), (567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport'),
(791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', NULL), (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL),
(1381, 'ORN', NULL, 30, NULL, 7, NULL, 'ORN Company - Plant passport'); (1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport');
INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`) INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`)
VALUES VALUES

View File

@ -1,5 +1,9 @@
<header> <header>
<img v-bind:src="getReportSrc('report-logo.svg')" alt="Verdnatura"/> <img
v-if="companyGroup == 'verdnatura'"
v-bind:src="getReportSrc('report-logo.svg')"
alt="Verdnatura"
/>
<section> <section>
{{companyName}}. {{company.street}}. {{companyName}}. {{company.street}}.
{{company.postCode}} {{company.city}}. {{company.postCode}} {{company.city}}.

View File

@ -10,9 +10,16 @@ module.exports = {
}, },
computed: { computed: {
companyName() { 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() { companyPhone() {
if (!this.company.phone) return; if (!this.company.phone) return;
@ -30,8 +37,15 @@ module.exports = {
methods: { methods: {
getCompany(code) { getCompany(code) {
return db.findOne(` 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 FROM company c
JOIN companyGroup cg ON cg.id = c.companyGroupFk
JOIN supplier s ON s.id = c.id JOIN supplier s ON s.id = c.id
WHERE c.code = ?`, [code]); WHERE c.code = ?`, [code]);
}, },