From 759a140e6141778c37184946909b2f37dd661122 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 17 Jan 2023 11:45:50 +0100 Subject: [PATCH 1/5] feat(print): create entry-update-comission template refs #4586 --- .../assets/css/import.js | 13 +++++ .../assets/css/style.css | 5 ++ .../entry-update-comission.html | 48 +++++++++++++++++++ .../entry-update-comission.js | 21 ++++++++ .../entry-update-comission/locale/es.yml | 4 ++ 5 files changed, 91 insertions(+) create mode 100644 print/templates/email/entry-update-comission/assets/css/import.js create mode 100644 print/templates/email/entry-update-comission/assets/css/style.css create mode 100644 print/templates/email/entry-update-comission/entry-update-comission.html create mode 100755 print/templates/email/entry-update-comission/entry-update-comission.js create mode 100644 print/templates/email/entry-update-comission/locale/es.yml diff --git a/print/templates/email/entry-update-comission/assets/css/import.js b/print/templates/email/entry-update-comission/assets/css/import.js new file mode 100644 index 000000000..7360587f7 --- /dev/null +++ b/print/templates/email/entry-update-comission/assets/css/import.js @@ -0,0 +1,13 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`, + `${__dirname}/style.css`]) + .mergeStyles(); + diff --git a/print/templates/email/entry-update-comission/assets/css/style.css b/print/templates/email/entry-update-comission/assets/css/style.css new file mode 100644 index 000000000..5db85befa --- /dev/null +++ b/print/templates/email/entry-update-comission/assets/css/style.css @@ -0,0 +1,5 @@ +.external-link { + border: 2px dashed #8dba25; + border-radius: 3px; + text-align: center +} \ No newline at end of file diff --git a/print/templates/email/entry-update-comission/entry-update-comission.html b/print/templates/email/entry-update-comission/entry-update-comission.html new file mode 100644 index 000000000..003a1f09a --- /dev/null +++ b/print/templates/email/entry-update-comission/entry-update-comission.html @@ -0,0 +1,48 @@ + + + + + + {{ $t('subject') }} + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+

+ {{$t('dear')}} +

+

+
+
+ + +
+
+ +
+
+ +
+
+
+
+ + diff --git a/print/templates/email/entry-update-comission/entry-update-comission.js b/print/templates/email/entry-update-comission/entry-update-comission.js new file mode 100755 index 000000000..7e23c2b7c --- /dev/null +++ b/print/templates/email/entry-update-comission/entry-update-comission.js @@ -0,0 +1,21 @@ +const Component = require(`vn-print/core/component`); +const emailHeader = new Component('email-header'); +const emailFooter = new Component('email-footer'); + +module.exports = { + name: 'entry-update-comission', + components: { + 'email-header': emailHeader.build(), + 'email-footer': emailFooter.build() + }, + props: { + currencyName: { + type: [String], + required: true + }, + referenceCurrent: { + type: [String], + required: true + } + } +}; diff --git a/print/templates/email/entry-update-comission/locale/es.yml b/print/templates/email/entry-update-comission/locale/es.yml new file mode 100644 index 000000000..de58be3e7 --- /dev/null +++ b/print/templates/email/entry-update-comission/locale/es.yml @@ -0,0 +1,4 @@ +subject: Actualización tipo de cambio en entradas +title: Actualización tipo de cambio en entradas +dear: Hola, +body: 'El tipo de cambio para las ENTRADAS/COMPRAS en {0} se ha actualizado a partir de hoy en: {1}' \ No newline at end of file From 31d23f7dd1ee92f2fe1106d32794eaaf49ba5037 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 17 Jan 2023 11:50:27 +0100 Subject: [PATCH 2/5] feat(print): create entry-update-comission template refs #5112 --- .../email/entry-update-comission/entry-update-comission.html | 1 - 1 file changed, 1 deletion(-) diff --git a/print/templates/email/entry-update-comission/entry-update-comission.html b/print/templates/email/entry-update-comission/entry-update-comission.html index 003a1f09a..4c29d5b4b 100644 --- a/print/templates/email/entry-update-comission/entry-update-comission.html +++ b/print/templates/email/entry-update-comission/entry-update-comission.html @@ -29,7 +29,6 @@

-
From d5daa172d548ac834b5d0aaa5c1ca566120e6e8b Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 17 Jan 2023 11:53:29 +0100 Subject: [PATCH 3/5] refs #5112 feat(print): create entry-update-comission template --- .../email/entry-update-comission/entry-update-comission.html | 1 + 1 file changed, 1 insertion(+) diff --git a/print/templates/email/entry-update-comission/entry-update-comission.html b/print/templates/email/entry-update-comission/entry-update-comission.html index 4c29d5b4b..85439475b 100644 --- a/print/templates/email/entry-update-comission/entry-update-comission.html +++ b/print/templates/email/entry-update-comission/entry-update-comission.html @@ -29,6 +29,7 @@

+
From 503054fe05d4d04acfc43d952ba0c258cf1f7798 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 20 Jun 2023 08:58:22 +0200 Subject: [PATCH 4/5] refs #5112 modificaciones entry_updateComission --- .../232601/00-entry_updateComission.sql | 40 +++++++++++++ .../entry-update-comission.html | 58 ++++--------------- .../entry-update-comission.js | 10 ++-- 3 files changed, 54 insertions(+), 54 deletions(-) create mode 100644 db/changes/232601/00-entry_updateComission.sql diff --git a/db/changes/232601/00-entry_updateComission.sql b/db/changes/232601/00-entry_updateComission.sql new file mode 100644 index 000000000..5a25d72e8 --- /dev/null +++ b/db/changes/232601/00-entry_updateComission.sql @@ -0,0 +1,40 @@ +DELIMITER $$ +$$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_updateComission`(vCurrency INT) +BEGIN +/** + * Actualiza la comision de las entradas de hoy a futuro y las recalcula + * + * @param vCurrency id del tipo de moneda(SAR,EUR,USD,GBP,JPY) + */ + DECLARE vCurrencyName VARCHAR(25); + DECLARE vComission INT; + + CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision + SELECT e.id + FROM vn.entry e + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse w ON w.id = t.warehouseInFk + WHERE t.shipped >= util.VN_CURDATE() + AND e.currencyFk = vCurrency; + + SET vComission = currency_getCommission(vCurrency); + + UPDATE vn.entry e + JOIN tmp.recalcEntryCommision tmp ON tmp.id = e.id + SET e.commission = vComission; + + SELECT `name` INTO vCurrencyName + FROM currency + WHERE id = vCurrency; + + CALL entry_recalc(); + SELECT util.notification_send( + 'entry-update-comission', + JSON_OBJECT('currencyName', vCurrencyName, 'referenceCurrent', vComission), + account.myUser_getId() + ); + + DROP TEMPORARY TABLE tmp.recalcEntryCommision; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/print/templates/email/entry-update-comission/entry-update-comission.html b/print/templates/email/entry-update-comission/entry-update-comission.html index 85439475b..d3ca1202a 100644 --- a/print/templates/email/entry-update-comission/entry-update-comission.html +++ b/print/templates/email/entry-update-comission/entry-update-comission.html @@ -1,48 +1,10 @@ - - - - - - {{ $t('subject') }} - - - - - - - - -
- -
-
-
- -
-
- -
-
- -
-
-

- {{$t('dear')}} -

-

-
-
- - -
-
- -
-
- -
-
-
-
- - + +
+
+

+ {{$t('dear')}} +

+

+
+
+
diff --git a/print/templates/email/entry-update-comission/entry-update-comission.js b/print/templates/email/entry-update-comission/entry-update-comission.js index 7e23c2b7c..8afe10ea0 100755 --- a/print/templates/email/entry-update-comission/entry-update-comission.js +++ b/print/templates/email/entry-update-comission/entry-update-comission.js @@ -1,20 +1,18 @@ const Component = require(`vn-print/core/component`); -const emailHeader = new Component('email-header'); -const emailFooter = new Component('email-footer'); +const emailBody = new Component('email-body'); module.exports = { name: 'entry-update-comission', components: { - 'email-header': emailHeader.build(), - 'email-footer': emailFooter.build() + 'email-body': emailBody.build(), }, props: { currencyName: { - type: [String], + type: String, required: true }, referenceCurrent: { - type: [String], + type: Number, required: true } } From ffbaa4532006e7b448cd0cefe8d3be24b7903331 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 20 Jun 2023 09:05:39 +0200 Subject: [PATCH 5/5] refs #5112 changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8967a1633..fa2ebcd62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2326.01] - 2023-06-29 ### Added +- (Entradas -> Correo) Al cambiar el tipo de cambio enviará un correo a las personas designadas ### Changed