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`)
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

View File

@ -1,5 +1,9 @@
<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>
{{companyName}}. {{company.street}}.
{{company.postCode}} {{company.city}}.

View File

@ -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]);
},