Merge branch 'dev' into 7296-expeditionTruck
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
b03fe4e6d3
|
@ -0,0 +1,24 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
const {spawn} = require('child_process');
|
||||||
|
|
||||||
|
function watchDatabaseChanges() {
|
||||||
|
console.log('Watching for changes in db/routines and db/versions');
|
||||||
|
fs.watch('db', {recursive: true}, (eventType, filename) => {
|
||||||
|
if (filename.endsWith('.sql')) {
|
||||||
|
let command;
|
||||||
|
if (filename.startsWith('routines')) command = 'push';
|
||||||
|
else if (filename.startsWith('versions')) command = 'run';
|
||||||
|
|
||||||
|
if (command) {
|
||||||
|
const process = spawn('myt', [command]);
|
||||||
|
process.stdout.on('data', data => console.log(data.toString()));
|
||||||
|
process.stderr.on('data', data => console.error(`stderr: ${data}`));
|
||||||
|
process.on('error', error => console.error(`error: ${error.message}`));
|
||||||
|
process.on('close', () => console.log('Watching for changes in db/routines and db/versions'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (require.main === module) watchDatabaseChanges();
|
||||||
|
module.exports = watchDatabaseChanges;
|
|
@ -53,7 +53,7 @@ BEGIN
|
||||||
IFNULL(c.street, ''),
|
IFNULL(c.street, ''),
|
||||||
c.accountingAccount,
|
c.accountingAccount,
|
||||||
@fi := IF(cu.code = LEFT(TRIM(c.fi), 2) AND c.isVies, MID(TRIM(c.fi), 3, LENGTH(TRIM(c.fi))-1), TRIM(c.fi)),
|
@fi := IF(cu.code = LEFT(TRIM(c.fi), 2) AND c.isVies, MID(TRIM(c.fi), 3, LENGTH(TRIM(c.fi))-1), TRIM(c.fi)),
|
||||||
IF(c.isVies, CONCAT(cu.code, @fi ), TRIM(c.fi)),
|
IF(c.isVies, CONCAT(IFNULL(cu.viesCode,cu.code), @fi ), TRIM(c.fi)),
|
||||||
IFNULL(c.postcode, ''),
|
IFNULL(c.postcode, ''),
|
||||||
IFNULL(c.city, ''),
|
IFNULL(c.city, ''),
|
||||||
IFNULL(pr.CodigoProvincia, ''),
|
IFNULL(pr.CodigoProvincia, ''),
|
||||||
|
@ -91,7 +91,7 @@ BEGIN
|
||||||
IFNULL(s.street, ''),
|
IFNULL(s.street, ''),
|
||||||
s.account,
|
s.account,
|
||||||
@nif := IF(co.code = LEFT(TRIM(s.nif), 2), MID(TRIM(s.nif), 3, LENGTH(TRIM(s.nif))-1), TRIM(s.nif)),
|
@nif := IF(co.code = LEFT(TRIM(s.nif), 2), MID(TRIM(s.nif), 3, LENGTH(TRIM(s.nif))-1), TRIM(s.nif)),
|
||||||
IF(s.isVies, CONCAT(co.code, @nif), TRIM(s.nif)),
|
IF(s.isVies, CONCAT(IFNULL(co.viesCode,co.code), @nif), TRIM(s.nif)),
|
||||||
IFNULL(s.postCode,''),
|
IFNULL(s.postCode,''),
|
||||||
IFNULL(s.city, ''),
|
IFNULL(s.city, ''),
|
||||||
IFNULL(pr.CodigoProvincia, ''),
|
IFNULL(pr.CodigoProvincia, ''),
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balance_create`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balance_create`(
|
||||||
IN vStartingMonth INT,
|
vStartingMonth INT,
|
||||||
IN vEndingMonth INT,
|
vEndingMonth INT,
|
||||||
IN vCompany INT,
|
vCompany INT,
|
||||||
IN vIsConsolidated BOOLEAN,
|
vIsConsolidated BOOLEAN,
|
||||||
IN vInterGroupSalesIncluded BOOLEAN)
|
vInterGroupSalesIncluded BOOLEAN
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Crea un balance financiero para una empresa durante
|
* Crea un balance financiero para una empresa durante
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByBuy`(IN vBuyFk INT(11))
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByBuy`(
|
||||||
|
vBuyFk INT(11)
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Recalcula los precios de una compra
|
* Recalcula los precios de una compra
|
||||||
*
|
*
|
||||||
* @param vBuyFk
|
* @param vBuyFk
|
||||||
*/
|
*/
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc;
|
DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc;
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp.buyRecalc
|
CREATE TEMPORARY TABLE tmp.buyRecalc
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByEntry`(IN vEntryFk INT(11))
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_recalcPricesByEntry`(
|
||||||
|
vEntryFk INT(11)
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Recalcula los precios de una entrada
|
* Recalcula los precios de una entrada
|
||||||
*
|
*
|
||||||
* @param vEntryFk
|
* @param vEntryFk
|
||||||
*/
|
*/
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc;
|
DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc;
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp.buyRecalc
|
CREATE TEMPORARY TABLE tmp.buyRecalc
|
||||||
|
|
|
@ -188,11 +188,12 @@ BEGIN
|
||||||
FROM tPendingDuedates vp
|
FROM tPendingDuedates vp
|
||||||
LEFT JOIN supplier s ON s.id = vp.supplierFk
|
LEFT JOIN supplier s ON s.id = vp.supplierFk
|
||||||
LEFT JOIN client c ON c.fi = s.nif
|
LEFT JOIN client c ON c.fi = s.nif
|
||||||
LEFT JOIN clientRisk cr ON cr.clientFk = c.id
|
LEFT JOIN clientRisk cr ON cr.clientFk = c.id
|
||||||
AND cr.companyFk = vp.companyFk
|
AND cr.companyFk = vp.companyFk
|
||||||
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
|
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
|
||||||
LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk
|
LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk
|
||||||
LEFT JOIN country co ON co.id = be.countryFk;
|
LEFT JOIN country co ON co.id = be.countryFk
|
||||||
|
GROUP BY vp.id;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tOpeningBalances;
|
DROP TEMPORARY TABLE tOpeningBalances;
|
||||||
DROP TEMPORARY TABLE tPendingDuedates;
|
DROP TEMPORARY TABLE tPendingDuedates;
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTrash`(
|
|
||||||
vItemFk INT,
|
|
||||||
vWarehouseFk INT,
|
|
||||||
vQuantity INT,
|
|
||||||
vIsTrash BOOLEAN)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vTicketFk INT;
|
|
||||||
DECLARE vClientFk INT;
|
|
||||||
DECLARE vCompanyVnlFk INT DEFAULT 442;
|
|
||||||
DECLARE vCalc INT;
|
|
||||||
|
|
||||||
SELECT barcodeToItem(vItemFk) INTO vItemFk;
|
|
||||||
|
|
||||||
SELECT IF(vIsTrash, 200, 400) INTO vClientFk;
|
|
||||||
|
|
||||||
SELECT t.id INTO vTicketFk
|
|
||||||
FROM ticket t
|
|
||||||
JOIN address a ON a.id=t.addressFk
|
|
||||||
WHERE t.warehouseFk = vWarehouseFk
|
|
||||||
AND t.clientFk = vClientFk
|
|
||||||
AND DATE(t.shipped) = util.VN_CURDATE()
|
|
||||||
AND a.isDefaultAddress
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk);
|
|
||||||
|
|
||||||
IF vTicketFk IS NULL THEN
|
|
||||||
CALL ticket_add(
|
|
||||||
vClientFk,
|
|
||||||
util.VN_CURDATE(),
|
|
||||||
vWarehouseFk,
|
|
||||||
vCompanyVnlFk,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
util.VN_CURDATE(),
|
|
||||||
account.myUser_getId(),
|
|
||||||
FALSE,
|
|
||||||
vTicketFk);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO sale(ticketFk, itemFk, concept, quantity)
|
|
||||||
SELECT vTicketFk,
|
|
||||||
vItemFk,
|
|
||||||
CONCAT(longName,' ',worker_getCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)),
|
|
||||||
vQuantity
|
|
||||||
FROM item
|
|
||||||
WHERE id = vItemFk;
|
|
||||||
|
|
||||||
UPDATE cache.visible
|
|
||||||
SET visible = visible - vQuantity
|
|
||||||
WHERE calc_id = vCalc
|
|
||||||
AND item_id = vItemFk;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -21,9 +21,6 @@ BEGIN
|
||||||
|
|
||||||
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
|
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
|
||||||
|
|
||||||
-- Añadido temporalmente para ver si ya no sucede el cuelgue de db
|
|
||||||
SET vShowType = TRUE;
|
|
||||||
|
|
||||||
WITH itemTags AS (
|
WITH itemTags AS (
|
||||||
SELECT i.id,
|
SELECT i.id,
|
||||||
typeFk,
|
typeFk,
|
||||||
|
@ -82,7 +79,7 @@ BEGIN
|
||||||
AND iss.warehouseFk = vWarehouseFk
|
AND iss.warehouseFk = vWarehouseFk
|
||||||
JOIN itemTags its
|
JOIN itemTags its
|
||||||
WHERE a.available > 0
|
WHERE a.available > 0
|
||||||
AND IF(vShowType, i.typeFk = its.typeFk, TRUE)
|
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
||||||
AND i.id <> vSelf
|
AND i.id <> vSelf
|
||||||
ORDER BY `counter` DESC,
|
ORDER BY `counter` DESC,
|
||||||
(t.name = its.name) DESC,
|
(t.name = its.name) DESC,
|
||||||
|
|
|
@ -34,7 +34,7 @@ BEGIN
|
||||||
ticketFk INT(11),
|
ticketFk INT(11),
|
||||||
saleFk INT(11),
|
saleFk INT(11),
|
||||||
isFreezed INTEGER(1) DEFAULT 0,
|
isFreezed INTEGER(1) DEFAULT 0,
|
||||||
risk DECIMAL(10,2) DEFAULT 0,
|
risk DECIMAL(10,1) DEFAULT 0,
|
||||||
hasHighRisk TINYINT(1) DEFAULT 0,
|
hasHighRisk TINYINT(1) DEFAULT 0,
|
||||||
hasTicketRequest INTEGER(1) DEFAULT 0,
|
hasTicketRequest INTEGER(1) DEFAULT 0,
|
||||||
itemShortage VARCHAR(255),
|
itemShortage VARCHAR(255),
|
||||||
|
|
|
@ -7,7 +7,7 @@ BEGIN
|
||||||
*
|
*
|
||||||
* @param vSelf El id del ticket
|
* @param vSelf El id del ticket
|
||||||
*/
|
*/
|
||||||
DECLARE vCmrFk, vPreviousCmrFk, vCurrentCmrFk INT;
|
DECLARE vCmrFk INT;
|
||||||
SELECT cmrFk INTO vCmrFk
|
SELECT cmrFk INTO vCmrFk
|
||||||
FROM ticket
|
FROM ticket
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
|
@ -44,8 +44,6 @@ BEGIN
|
||||||
AND t.id = vSelf
|
AND t.id = vSelf
|
||||||
GROUP BY t.id;
|
GROUP BY t.id;
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
IF vCmrFk THEN
|
IF vCmrFk THEN
|
||||||
UPDATE cmr c
|
UPDATE cmr c
|
||||||
JOIN tTicket t
|
JOIN tTicket t
|
||||||
|
@ -57,9 +55,7 @@ BEGIN
|
||||||
c.supplierFk = t.supplierFk,
|
c.supplierFk = t.supplierFk,
|
||||||
c.ead = t.landed
|
c.ead = t.landed
|
||||||
WHERE id = vCmrFk;
|
WHERE id = vCmrFk;
|
||||||
ELSE
|
ELSE
|
||||||
SELECT MAX(id) INTO vPreviousCmrFk FROM cmr;
|
|
||||||
|
|
||||||
INSERT INTO cmr (
|
INSERT INTO cmr (
|
||||||
senderInstruccions,
|
senderInstruccions,
|
||||||
truckPlate,
|
truckPlate,
|
||||||
|
@ -70,17 +66,14 @@ BEGIN
|
||||||
ead
|
ead
|
||||||
)
|
)
|
||||||
SELECT * FROM tTicket;
|
SELECT * FROM tTicket;
|
||||||
|
|
||||||
SELECT MAX(id) INTO vCurrentCmrFk FROM cmr;
|
|
||||||
|
|
||||||
IF vPreviousCmrFk <> vCurrentCmrFk THEN
|
IF (SELECT EXISTS(SELECT * FROM tTicket)) THEN
|
||||||
UPDATE ticket
|
UPDATE ticket
|
||||||
SET cmrFk = vCurrentCmrFk
|
SET cmrFk = LAST_INSERT_ID()
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
DROP TEMPORARY TABLE tTicket;
|
DROP TEMPORARY TABLE tTicket;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -7,6 +7,8 @@ BEGIN
|
||||||
UPDATE expedition
|
UPDATE expedition
|
||||||
SET hasNewRoute = TRUE
|
SET hasNewRoute = TRUE
|
||||||
WHERE ticketFk = NEW.id;
|
WHERE ticketFk = NEW.id;
|
||||||
|
|
||||||
|
CALL ticket_doCmr(NEW.id);
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
CREATE OR REPLACE PROCEDURE `vn`.`balance_create`() BEGIN END;
|
CREATE OR REPLACE PROCEDURE `vn`.`balance_create`() BEGIN END;
|
||||||
CREATE OR REPLACE PROCEDURE `vn`.`buy_recalcPricesByEntry`() BEGIN END;
|
|
||||||
CREATE OR REPLACE PROCEDURE `vn`.`buy_recalcPricesByBuy`() BEGIN END;
|
|
||||||
|
|
||||||
GRANT EXECUTE ON PROCEDURE vn.balance_create TO `financialBoss`, `hrBoss`;
|
GRANT EXECUTE ON PROCEDURE vn.balance_create TO `financialBoss`, `hrBoss`;
|
||||||
GRANT EXECUTE ON PROCEDURE vn.buy_recalcPricesByEntry TO `buyer`, `claimManager`, `employee`;
|
GRANT EXECUTE ON PROCEDURE vn.buy_recalcPricesByEntry TO `buyer`, `claimManager`, `employee`;
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE vn.country
|
||||||
|
ADD IF NOT EXISTS viesCode varchar(2) DEFAULT NULL NULL AFTER code;
|
||||||
|
|
||||||
|
UPDATE IGNORE vn.country
|
||||||
|
SET viesCode = 'FR'
|
||||||
|
WHERE code = 'MC'; -- Mónaco
|
|
@ -0,0 +1,5 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
ALTER TABLE vn.packaging
|
||||||
|
MODIFY COLUMN height decimal(10,2) DEFAULT NULL NULL,
|
||||||
|
MODIFY COLUMN `depth` decimal(10,2) DEFAULT NULL NULL,
|
||||||
|
MODIFY COLUMN width decimal(10,2) DEFAULT NULL NULL;
|
|
@ -0,0 +1 @@
|
||||||
|
REVOKE UPDATE (`size`, longName, name) ON vn.item FROM buyer;
|
|
@ -6,6 +6,7 @@ const log = require('fancy-log');
|
||||||
const Myt = require('@verdnatura/myt/myt');
|
const Myt = require('@verdnatura/myt/myt');
|
||||||
const Run = require('@verdnatura/myt/myt-run');
|
const Run = require('@verdnatura/myt/myt-run');
|
||||||
const Start = require('@verdnatura/myt/myt-start');
|
const Start = require('@verdnatura/myt/myt-start');
|
||||||
|
const watchDatabaseChanges = require('./db/dbWatcher');
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
|
|
||||||
|
@ -245,6 +246,7 @@ routes.description = 'Merges all module routes file into one file';
|
||||||
function watch(done) {
|
function watch(done) {
|
||||||
gulp.watch(routeFiles, gulp.series(routes));
|
gulp.watch(routeFiles, gulp.series(routes));
|
||||||
gulp.watch(localeFiles, gulp.series(locales));
|
gulp.watch(localeFiles, gulp.series(locales));
|
||||||
|
watchDatabaseChanges();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
watch.description = `Watches for changes in routes and locale files`;
|
watch.description = `Watches for changes in routes and locale files`;
|
||||||
|
|
|
@ -33,7 +33,6 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
await Self.makePdf(id, options);
|
await Self.makePdf(id, options);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
|
||||||
throw new UserError('Error while generating PDF', 'pdfError');
|
throw new UserError('Error while generating PDF', 'pdfError');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,11 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
arg: 'checked',
|
||||||
|
type: 'boolean',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
|
@ -51,6 +56,7 @@ module.exports = Self => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const myOptions = {userId: ctx.req.accessToken.userId};
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
const {id, refFk, newClientFk, cplusRectificationTypeFk, siiTypeInvoiceOutFk, invoiceCorrectionTypeFk} = ctx.args;
|
const {id, refFk, newClientFk, cplusRectificationTypeFk, siiTypeInvoiceOutFk, invoiceCorrectionTypeFk} = ctx.args;
|
||||||
|
const checked = ctx.args.checked;
|
||||||
let tx;
|
let tx;
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -96,9 +102,10 @@ module.exports = Self => {
|
||||||
|
|
||||||
await models.Ticket.invoiceTickets(ctx, refundTicketIds, invoiceCorrection, myOptions);
|
await models.Ticket.invoiceTickets(ctx, refundTicketIds, invoiceCorrection, myOptions);
|
||||||
|
|
||||||
const [invoiceId] = await models.Ticket.invoiceTicketsAndPdf(ctx, clonedTicketIds, null, myOptions);
|
if (!checked) {
|
||||||
|
const [invoiceId] = await models.Ticket.invoiceTicketsAndPdf(ctx, clonedTicketIds, null, myOptions);
|
||||||
return invoiceId;
|
return invoiceId;
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -1,15 +1,3 @@
|
||||||
<vn-crud-model
|
|
||||||
auto-load="true"
|
|
||||||
url="CplusRectificationTypes"
|
|
||||||
data="cplusRectificationTypes"
|
|
||||||
order="description">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
auto-load="true"
|
|
||||||
url="SiiTypeInvoiceOuts"
|
|
||||||
data="siiTypeInvoiceOuts"
|
|
||||||
where="{code: {like: 'R%'}}">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
auto-load="true"
|
auto-load="true"
|
||||||
url="InvoiceCorrectionTypes"
|
url="InvoiceCorrectionTypes"
|
||||||
|
@ -211,14 +199,14 @@
|
||||||
vn-one
|
vn-one
|
||||||
vn-id="cplusRectificationType"
|
vn-id="cplusRectificationType"
|
||||||
required="true"
|
required="true"
|
||||||
data="cplusRectificationTypes"
|
data="$ctrl.cplusRectificationTypes"
|
||||||
show-field="description"
|
show-field="description"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
ng-model="$ctrl.cplusRectificationType"
|
ng-model="$ctrl.cplusRectificationType"
|
||||||
search-function="{or: [{id: $search}, {description: {like: '%'+ $search +'%'}}]}"
|
search-function="{or: [{id: $search}, {description: {like: '%'+ $search +'%'}}]}"
|
||||||
label="Rectificative type">
|
label="Rectificative type">
|
||||||
<tpl-item>
|
<tpl-item>
|
||||||
{{::description}}
|
{{ ::description}}
|
||||||
</tpl-item>
|
</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
@ -226,7 +214,7 @@
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
vn-one
|
vn-one
|
||||||
vn-id="siiTypeInvoiceOut"
|
vn-id="siiTypeInvoiceOut"
|
||||||
data="siiTypeInvoiceOuts"
|
data="$ctrl.siiTypeInvoiceOuts"
|
||||||
show-field="description"
|
show-field="description"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
fields="['id','code','description']"
|
fields="['id','code','description']"
|
||||||
|
@ -248,6 +236,14 @@
|
||||||
label="Type">
|
label="Type">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-check
|
||||||
|
ng-model="$ctrl.isChecked"
|
||||||
|
label="destinationClient"
|
||||||
|
info="transferInvoiceInfo"
|
||||||
|
/>
|
||||||
|
</vn-check>
|
||||||
|
</vn-horizontal>
|
||||||
</section>
|
</section>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
|
|
|
@ -7,6 +7,7 @@ class Controller extends Section {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
this.vnReport = vnReport;
|
this.vnReport = vnReport;
|
||||||
this.vnEmail = vnEmail;
|
this.vnEmail = vnEmail;
|
||||||
|
this.checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
get invoiceOut() {
|
get invoiceOut() {
|
||||||
|
@ -23,6 +24,26 @@ class Controller extends Section {
|
||||||
return this.aclService.hasAny(['invoicing']);
|
return this.aclService.hasAny(['invoicing']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isChecked() {
|
||||||
|
return this.checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
set isChecked(value) {
|
||||||
|
this.checked = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$onInit() {
|
||||||
|
this.$http.get(`CplusRectificationTypes`, {filter: {order: 'description'}})
|
||||||
|
.then(res => {
|
||||||
|
this.cplusRectificationTypes = res.data;
|
||||||
|
this.cplusRectificationType = res.data.filter(type => type.description == 'I – Por diferencias')[0].id;
|
||||||
|
});
|
||||||
|
this.$http.get(`SiiTypeInvoiceOuts`, {filter: {where: {code: {like: 'R%'}}}})
|
||||||
|
.then(res => {
|
||||||
|
this.siiTypeInvoiceOuts = res.data;
|
||||||
|
this.siiTypeInvoiceOut = res.data.filter(type => type.code == 'R4')[0].id;
|
||||||
|
});
|
||||||
|
}
|
||||||
loadData() {
|
loadData() {
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -34,7 +55,7 @@ class Controller extends Section {
|
||||||
}, {
|
}, {
|
||||||
relation: 'client',
|
relation: 'client',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'name', 'email']
|
fields: ['id', 'name', 'email', 'hasToInvoiceByAddress']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -136,12 +157,24 @@ class Controller extends Section {
|
||||||
newClientFk: this.clientId,
|
newClientFk: this.clientId,
|
||||||
cplusRectificationTypeFk: this.cplusRectificationType,
|
cplusRectificationTypeFk: this.cplusRectificationType,
|
||||||
siiTypeInvoiceOutFk: this.siiTypeInvoiceOut,
|
siiTypeInvoiceOutFk: this.siiTypeInvoiceOut,
|
||||||
invoiceCorrectionTypeFk: this.invoiceCorrectionType
|
invoiceCorrectionTypeFk: this.invoiceCorrectionType,
|
||||||
|
checked: this.checked
|
||||||
};
|
};
|
||||||
this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
|
|
||||||
const invoiceId = res.data;
|
this.$http.get(`Clients/${this.clientId}`).then(response => {
|
||||||
this.vnApp.showSuccess(this.$t('Transferred invoice'));
|
const clientData = response.data;
|
||||||
this.$state.go('invoiceOut.card.summary', {id: invoiceId});
|
const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress;
|
||||||
|
|
||||||
|
if (this.checked && hasToInvoiceByAddress) {
|
||||||
|
if (!window.confirm(this.$t('confirmTransferInvoice')))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
|
||||||
|
const invoiceId = res.data;
|
||||||
|
this.vnApp.showSuccess(this.$t('Transferred invoice'));
|
||||||
|
this.$state.go('invoiceOut.card.summary', {id: invoiceId});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
The following refund tickets have been created: "The following refund tickets have been created: {{ticketIds}}"
|
The following refund tickets have been created: "The following refund tickets have been created: {{ticketIds}}"
|
||||||
Transfer invoice to...: Transfer invoice to...
|
Transfer invoice to...: Transfer invoice to...
|
||||||
Cplus Type: Cplus Type
|
Cplus Type: Cplus Type
|
||||||
|
transferInvoice: Transfer Invoice
|
||||||
|
destinationClient: Bill destination client
|
||||||
|
transferInvoiceInfo: New tickets from the destination customer will be generated in the default consignee.
|
||||||
|
confirmTransferInvoice: Destination customer has marked to bill by consignee, do you want to continue?
|
|
@ -24,3 +24,7 @@ Refund...: Abono...
|
||||||
Transfer invoice to...: Transferir factura a...
|
Transfer invoice to...: Transferir factura a...
|
||||||
Rectificative type: Tipo rectificativa
|
Rectificative type: Tipo rectificativa
|
||||||
Transferred invoice: Factura transferida
|
Transferred invoice: Factura transferida
|
||||||
|
transferInvoice: Transferir factura
|
||||||
|
destinationClient: Facturar cliente destino
|
||||||
|
transferInvoiceInfo: Los nuevos tickets del cliente destino serán generados en el consignatario por defecto.
|
||||||
|
confirmTransferInvoice: El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?
|
|
@ -19,6 +19,9 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The requested item quantity',
|
description: 'The requested item quantity',
|
||||||
|
}, {
|
||||||
|
arg: 'attenderFk',
|
||||||
|
type: 'number'
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@ -73,12 +76,14 @@ module.exports = Self => {
|
||||||
ticketFk: request.ticketFk,
|
ticketFk: request.ticketFk,
|
||||||
itemFk: ctx.args.itemFk,
|
itemFk: ctx.args.itemFk,
|
||||||
quantity: ctx.args.quantity,
|
quantity: ctx.args.quantity,
|
||||||
|
attenderFk: ctx.args.attenderFk,
|
||||||
concept: item.name
|
concept: item.name
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
await request.updateAttributes({
|
await request.updateAttributes({
|
||||||
saleFk: sale.id,
|
saleFk: sale.id,
|
||||||
itemFk: sale.itemFk,
|
itemFk: sale.itemFk,
|
||||||
isOk: true
|
isOk: true,
|
||||||
|
attenderFk: sale.attenderFk,
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const query = `CALL vn.sale_calculateComponent(?, NULL)`;
|
const query = `CALL vn.sale_calculateComponent(?, NULL)`;
|
||||||
|
|
|
@ -113,7 +113,8 @@
|
||||||
"test:e2e": "node e2e/tests.js",
|
"test:e2e": "node e2e/tests.js",
|
||||||
"test:front": "jest --watch",
|
"test:front": "jest --watch",
|
||||||
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
|
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
|
||||||
"lint": "eslint ./ --cache --ignore-pattern .gitignore"
|
"lint": "eslint ./ --cache --ignore-pattern .gitignore",
|
||||||
|
"watch:db": "node ./db/dbWatcher.js"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"projects": [
|
"projects": [
|
||||||
|
|
Loading…
Reference in New Issue