7983-testToMaster_2438 #2977
|
@ -3967,3 +3967,7 @@ VALUES
|
||||||
(4, 'Referencia Transferencias', 'trnRef'),
|
(4, 'Referencia Transferencias', 'trnRef'),
|
||||||
(5, 'Referencia Nominas', 'payRef'),
|
(5, 'Referencia Nominas', 'payRef'),
|
||||||
(6, 'ABA', 'aba');
|
(6, 'ABA', 'aba');
|
||||||
|
|
||||||
|
INSERT IGNORE INTO ormConfig
|
||||||
|
SET id =1,
|
||||||
|
selectLimit = 1000;
|
|
@ -4,7 +4,7 @@ proc: BEGIN
|
||||||
/**
|
/**
|
||||||
* Crea o actualiza la cache con la última compra y fecha de cada
|
* Crea o actualiza la cache con la última compra y fecha de cada
|
||||||
* artículo hasta ayer. Para obtener la última compra hasta una fecha
|
* artículo hasta ayer. Para obtener la última compra hasta una fecha
|
||||||
* determinada utilizar el procedimiento vn.buyUltimate().
|
* determinada utilizar el procedimiento vn.buy_getUltimate().
|
||||||
*
|
*
|
||||||
* @param vRefresh %TRUE para forzar el recálculo de la cache
|
* @param vRefresh %TRUE para forzar el recálculo de la cache
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buyUltimate`(
|
|
||||||
vWarehouseFk SMALLINT,
|
|
||||||
vDated DATE
|
|
||||||
)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* @deprecated Usar buy_getUltimate
|
|
||||||
* Calcula las últimas compras realizadas hasta una fecha.
|
|
||||||
*
|
|
||||||
* @param vItemFk Id del artículo
|
|
||||||
* @param vWarehouseFk Id del almacén
|
|
||||||
* @param vDated Compras hasta fecha
|
|
||||||
* @return tmp.buyUltimate
|
|
||||||
*/
|
|
||||||
CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,20 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buyUltimateFromInterval`(
|
|
||||||
vWarehouseFk SMALLINT,
|
|
||||||
vStarted DATE,
|
|
||||||
vEnded DATE
|
|
||||||
)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* @deprecated Usar buy_getUltimateFromInterval
|
|
||||||
* Calcula las últimas compras realizadas
|
|
||||||
* desde un rango de fechas.
|
|
||||||
*
|
|
||||||
* @param vWarehouseFk Id del almacén si es NULL se actualizan todos
|
|
||||||
* @param vStarted Fecha inicial
|
|
||||||
* @param vEnded Fecha fin
|
|
||||||
* @return tmp.buyUltimateFromInterval
|
|
||||||
*/
|
|
||||||
CALL vn.buy_getUltimateFromInterval(NULL, vWarehouseFk, vStarted, vEnded);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -371,5 +371,6 @@
|
||||||
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
|
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
|
||||||
"The entry not have stickers": "La entrada no tiene etiquetas",
|
"The entry not have stickers": "La entrada no tiene etiquetas",
|
||||||
"Too many records": "Demasiados registros",
|
"Too many records": "Demasiados registros",
|
||||||
"Original invoice not found": "Factura original no encontrada"
|
"Original invoice not found": "Factura original no encontrada",
|
||||||
|
"The entry has no lines or does not exist": "La entrada no tiene lineas o no existe"
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
const {toCSV} = require('vn-loopback/util/csv');
|
const {toCSV} = require('vn-loopback/util/csv');
|
||||||
const {flatten} = require('vn-loopback/util/flatten');
|
const {flatten} = require('vn-loopback/util/flatten');
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('getBuysCsv', {
|
Self.remoteMethodCtx('getBuysCsv', {
|
||||||
|
@ -36,6 +37,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.getBuysCsv = async(ctx, id, options) => {
|
Self.getBuysCsv = async(ctx, id, options) => {
|
||||||
const data = await Self.getBuys(ctx, id, null, options);
|
const data = await Self.getBuys(ctx, id, null, options);
|
||||||
|
if (!data.length) throw new UserError('The entry has no lines or does not exist');
|
||||||
const dataFlatted = flatten(data);
|
const dataFlatted = flatten(data);
|
||||||
return [toCSV(dataFlatted), 'text/csv', `inline; filename="buys-${id}.csv"`];
|
return [toCSV(dataFlatted), 'text/csv', `inline; filename="buys-${id}.csv"`];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue