refs #5112 modificaciones entry_updateComission
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Robert Ferrús 2023-06-20 08:58:22 +02:00
parent 068eca80ab
commit 503054fe05
3 changed files with 54 additions and 54 deletions

View File

@ -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 ;

View File

@ -1,48 +1,10 @@
<!DOCTYPE html> <email-body v-bind="$props">
<html v-bind:lang="$i18n.locale"> <div class="grid-row">
<head> <div class="grid-block vn-pa-ml">
<meta name="viewport" content="width=device-width"> <p>
<meta name="format-detection" content="telephone=no"> {{$t('dear')}}
<title>{{ $t('subject') }}</title> </p>
</head> <p v-html="$t('body',[currencyName,referenceCurrent])"></p>
<body> </div>
<table class="grid"> </div>
<tbody> </email-body>
<tr>
<td>
<!-- Empty block -->
<div class="grid-row">
<div class="grid-block empty"></div>
</div>
<!-- Header block -->
<div class="grid-row">
<div class="grid-block">
<email-header></email-header>
</div>
</div>
<!-- Block -->
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<p>
{{$t('dear')}}
</p>
<p v-html="$t('body',[currencyName,referenceCurrent])"></p>
</div>
</div>
<!-- Footer block -->
<div class="grid-row">
<div class="grid-block">
<email-footer></email-footer>
</div>
</div>
<!-- Empty block -->
<div class="grid-row">
<div class="grid-block empty"></div>
</div>
</td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@ -1,20 +1,18 @@
const Component = require(`vn-print/core/component`); const Component = require(`vn-print/core/component`);
const emailHeader = new Component('email-header'); const emailBody = new Component('email-body');
const emailFooter = new Component('email-footer');
module.exports = { module.exports = {
name: 'entry-update-comission', name: 'entry-update-comission',
components: { components: {
'email-header': emailHeader.build(), 'email-body': emailBody.build(),
'email-footer': emailFooter.build()
}, },
props: { props: {
currencyName: { currencyName: {
type: [String], type: String,
required: true required: true
}, },
referenceCurrent: { referenceCurrent: {
type: [String], type: Number,
required: true required: true
} }
} }