Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-09-06 13:52:10 +02:00
commit a718b6e81f
9 changed files with 186 additions and 14 deletions

View File

@ -1,5 +1,10 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(
OUT `vCalc` INT,
`vRefresh` INT,
`vWarehouse` INT,
`vDated` DATE
)
proc: BEGIN proc: BEGIN
DECLARE vStartDate DATE; DECLARE vStartDate DATE;
DECLARE vReserveDate DATETIME; DECLARE vReserveDate DATETIME;

View File

@ -0,0 +1,31 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_updateItem`(
`vItem` INT,
`vWarehouse` INT,
`vDated` DATE,
`vQuantity` INT
)
BEGIN
/**
* Immediately deduct/add an amount from the available cache (if exists).
*
* @param vItem The item id
* @param vWarehouse The warehouse id
* @param vDated Available cache date
* @param vQuantity The amount to be deducted from the cache
*/
DECLARE vCalc INT;
SELECT id INTO vCalc
FROM cache_calc
WHERE cacheName = 'available'
AND params = CONCAT_WS('/', vWarehouse, vDated);
IF vCalc IS NOT NULL THEN
UPDATE available
SET available = available - vQuantity
WHERE calc_id = vCalc
AND item_id = vItem;
END IF;
END$$
DELIMITER ;

View File

@ -1,8 +1,8 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_addItem`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_addItem`(
vSelf INT, vSelf INT,
vWarehouse INT, vWarehouse INT,
vItem INT, vItem INT,
vAmount INT) vAmount INT)
BEGIN BEGIN
/** /**
@ -102,6 +102,8 @@ BEGIN
amount = vAdd, amount = vAdd,
price = vPrice; price = vPrice;
CALL cache.available_updateItem(vItem, vWarehouse, vShipment, vAdd);
SET vRow = LAST_INSERT_ID(); SET vRow = LAST_INSERT_ID();
INSERT INTO orderRowComponent (rowFk, componentFk, price) INSERT INTO orderRowComponent (rowFk, componentFk, price)
@ -121,6 +123,6 @@ BEGIN
END IF; END IF;
COMMIT; COMMIT;
CALL vn.ticketCalculatePurge; CALL vn.ticketCalculatePurge;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -17,6 +17,7 @@ BEGIN
DECLARE vHasDailyInvoice BOOL; DECLARE vHasDailyInvoice BOOL;
DECLARE vWithPackage BOOL; DECLARE vWithPackage BOOL;
DECLARE vHasToInvoice BOOL; DECLARE vHasToInvoice BOOL;
DECLARE vSerial VARCHAR(2);
DECLARE cur CURSOR FOR DECLARE cur CURSOR FOR
SELECT ticketFk FROM tmp.ticket_close; SELECT ticketFk FROM tmp.ticket_close;
@ -83,14 +84,17 @@ BEGIN
GROUP BY e.freightItemFk); GROUP BY e.freightItemFk);
IF(vHasDailyInvoice) AND vHasToInvoice THEN IF(vHasDailyInvoice) AND vHasToInvoice THEN
SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial;
IF NOT vSerial THEN
CALL util.throw('Cannot booking without a serial');
END IF;
-- Facturacion rapida
CALL ticket_setState(vCurTicketFk, 'DELIVERED'); CALL ticket_setState(vCurTicketFk, 'DELIVERED');
-- Facturar si está contabilizado
IF vIsTaxDataChecked THEN IF vIsTaxDataChecked THEN
CALL invoiceOut_newFromClient( CALL invoiceOut_newFromClient(
vClientFk, vClientFk,
(SELECT invoiceSerial(vClientFk, vCompanyFk, 'multiple')), vSerial,
vShipped, vShipped,
vCompanyFk, vCompanyFk,
NULL, NULL,

View File

@ -0,0 +1,129 @@
use vn;
CREATE TABLE IF NOT EXISTS `material` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `material` (`name`) VALUES ('Abedul');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acacia');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acero');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acero Galvanizado');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acetato');
INSERT IGNORE INTO `material` (`name`) VALUES ('Acrílico');
INSERT IGNORE INTO `material` (`name`) VALUES ('Alambre');
INSERT IGNORE INTO `material` (`name`) VALUES ('Algodón');
INSERT IGNORE INTO `material` (`name`) VALUES ('Aluminio');
INSERT IGNORE INTO `material` (`name`) VALUES ('Antracita');
INSERT IGNORE INTO `material` (`name`) VALUES ('Arcilla');
INSERT IGNORE INTO `material` (`name`) VALUES ('Bambú');
INSERT IGNORE INTO `material` (`name`) VALUES ('Banano');
INSERT IGNORE INTO `material` (`name`) VALUES ('Canneté');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cartón');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cartulina');
INSERT IGNORE INTO `material` (`name`) VALUES ('Celofán');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cemento');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cera');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cerámica');
INSERT IGNORE INTO `material` (`name`) VALUES ('Chapa');
INSERT IGNORE INTO `material` (`name`) VALUES ('Chenilla');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cloruro de polivinilo');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cobre');
INSERT IGNORE INTO `material` (`name`) VALUES ('Corcho');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cordel');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton Chess');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cristal');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cubo Asa');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cuerda');
INSERT IGNORE INTO `material` (`name`) VALUES ('Cuero');
INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Raso');
INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Velvet');
INSERT IGNORE INTO `material` (`name`) VALUES ('Eco Glass');
INSERT IGNORE INTO `material` (`name`) VALUES ('Encaje');
INSERT IGNORE INTO `material` (`name`) VALUES ('Esparto');
INSERT IGNORE INTO `material` (`name`) VALUES ('Espuma');
INSERT IGNORE INTO `material` (`name`) VALUES ('Felpa');
INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra');
INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Coco');
INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Vidrio y Resina');
INSERT IGNORE INTO `material` (`name`) VALUES ('Fieltro');
INSERT IGNORE INTO `material` (`name`) VALUES ('Foam');
INSERT IGNORE INTO `material` (`name`) VALUES ('Gamuza');
INSERT IGNORE INTO `material` (`name`) VALUES ('Gasa');
INSERT IGNORE INTO `material` (`name`) VALUES ('Glass');
INSERT IGNORE INTO `material` (`name`) VALUES ('Goma');
INSERT IGNORE INTO `material` (`name`) VALUES ('Grafito');
INSERT IGNORE INTO `material` (`name`) VALUES ('Hierro');
INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja Carbono');
INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja de Mirto');
INSERT IGNORE INTO `material` (`name`) VALUES ('Hormigón');
INSERT IGNORE INTO `material` (`name`) VALUES ('Jute');
INSERT IGNORE INTO `material` (`name`) VALUES ('Kraft');
INSERT IGNORE INTO `material` (`name`) VALUES ('Lana');
INSERT IGNORE INTO `material` (`name`) VALUES ('Látex');
INSERT IGNORE INTO `material` (`name`) VALUES ('Latrix');
INSERT IGNORE INTO `material` (`name`) VALUES ('Lienzo');
INSERT IGNORE INTO `material` (`name`) VALUES ('Lino');
INSERT IGNORE INTO `material` (`name`) VALUES ('Lurex');
INSERT IGNORE INTO `material` (`name`) VALUES ('Madera');
INSERT IGNORE INTO `material` (`name`) VALUES ('Metacrilato');
INSERT IGNORE INTO `material` (`name`) VALUES ('Metal');
INSERT IGNORE INTO `material` (`name`) VALUES ('Mimbre');
INSERT IGNORE INTO `material` (`name`) VALUES ('Musgo');
INSERT IGNORE INTO `material` (`name`) VALUES ('Nonwoven');
INSERT IGNORE INTO `material` (`name`) VALUES ('Nylon');
INSERT IGNORE INTO `material` (`name`) VALUES ('Organza');
INSERT IGNORE INTO `material` (`name`) VALUES ('Paja');
INSERT IGNORE INTO `material` (`name`) VALUES ('Pana');
INSERT IGNORE INTO `material` (`name`) VALUES ('Papel');
INSERT IGNORE INTO `material` (`name`) VALUES ('Paperweb');
INSERT IGNORE INTO `material` (`name`) VALUES ('Paulownia');
INSERT IGNORE INTO `material` (`name`) VALUES ('Peluche');
INSERT IGNORE INTO `material` (`name`) VALUES ('Piedra');
INSERT IGNORE INTO `material` (`name`) VALUES ('Pizarra');
INSERT IGNORE INTO `material` (`name`) VALUES ('Plástico');
INSERT IGNORE INTO `material` (`name`) VALUES ('Poliestireno');
INSERT IGNORE INTO `material` (`name`) VALUES ('Polipropileno');
INSERT IGNORE INTO `material` (`name`) VALUES ('Poliresina');
INSERT IGNORE INTO `material` (`name`) VALUES ('Polyester');
INSERT IGNORE INTO `material` (`name`) VALUES ('Porcelana');
INSERT IGNORE INTO `material` (`name`) VALUES ('Puntilla');
INSERT IGNORE INTO `material` (`name`) VALUES ('PVC');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rafia');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rama');
INSERT IGNORE INTO `material` (`name`) VALUES ('Raso');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rattan');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rayon');
INSERT IGNORE INTO `material` (`name`) VALUES ('Reciclable');
INSERT IGNORE INTO `material` (`name`) VALUES ('Red');
INSERT IGNORE INTO `material` (`name`) VALUES ('Resina');
INSERT IGNORE INTO `material` (`name`) VALUES ('Roca');
INSERT IGNORE INTO `material` (`name`) VALUES ('Rope');
INSERT IGNORE INTO `material` (`name`) VALUES ('Saco');
INSERT IGNORE INTO `material` (`name`) VALUES ('Salim');
INSERT IGNORE INTO `material` (`name`) VALUES ('Seagrass');
INSERT IGNORE INTO `material` (`name`) VALUES ('Silicona');
INSERT IGNORE INTO `material` (`name`) VALUES ('Sisal');
INSERT IGNORE INTO `material` (`name`) VALUES ('Tejido');
INSERT IGNORE INTO `material` (`name`) VALUES ('Tela');
INSERT IGNORE INTO `material` (`name`) VALUES ('Terciopelo');
INSERT IGNORE INTO `material` (`name`) VALUES ('Terracota');
INSERT IGNORE INTO `material` (`name`) VALUES ('Textil');
INSERT IGNORE INTO `material` (`name`) VALUES ('Titanio');
INSERT IGNORE INTO `material` (`name`) VALUES ('Tul');
INSERT IGNORE INTO `material` (`name`) VALUES ('Velvet');
INSERT IGNORE INTO `material` (`name`) VALUES ('Vidrio');
INSERT IGNORE INTO `material` (`name`) VALUES ('Yute');
INSERT IGNORE INTO `material` (`name`) VALUES ('Zinc');
INSERT IGNORE INTO `material` (`name`) VALUES ('Base de goma');
INSERT IGNORE INTO `material` (`name`) VALUES ('Base de madera');
INSERT IGNORE INTO `material` (`name`) VALUES ('Plumas');
INSERT IGNORE INTO `material` (`name`) VALUES ('Protección Uva');
INSERT IGNORE INTO `material` (`name`) VALUES ('Purpurina');
UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name= 'Material';
UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name='Material secundario';

View File

@ -1,4 +1,3 @@
/** /**
* Flattens an array of objects by converting each object into a flat structure. * Flattens an array of objects by converting each object into a flat structure.
* *

View File

@ -23,6 +23,7 @@ class Controller extends Dialog {
} }
set clientFk(value) { set clientFk(value) {
if (!value) return;
this.receipt.clientFk = value; this.receipt.clientFk = value;
const filter = { const filter = {
@ -32,6 +33,7 @@ class Controller extends Dialog {
} }
}; };
this.getAmountPaid();
this.$http.get(`Clients/findOne`, {filter}) this.$http.get(`Clients/findOne`, {filter})
.then(res => { .then(res => {
this.receipt.email = res.data.email; this.receipt.email = res.data.email;
@ -50,7 +52,6 @@ class Controller extends Dialog {
set companyFk(value) { set companyFk(value) {
this.receipt.companyFk = value; this.receipt.companyFk = value;
this.getAmountPaid();
} }
set description(value) { set description(value) {
@ -152,7 +153,7 @@ class Controller extends Dialog {
getAmountPaid() { getAmountPaid() {
const filter = { const filter = {
where: { where: {
clientFk: this.$params.id, clientFk: this.$params.id ?? this.clientFk,
companyFk: this.receipt.companyFk companyFk: this.receipt.companyFk
} }
}; };
@ -210,8 +211,8 @@ ngModule.vnComponent('vnClientBalanceCreate', {
payed: '<?', payed: '<?',
bankFk: '<?', bankFk: '<?',
amountPaid: '<?', amountPaid: '<?',
clientFk: '<?',
companyFk: '<?', companyFk: '<?',
description: '<?', description: '<?',
clientFk: '<?'
} }
}); });

View File

@ -1,7 +1,7 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
describe('item getVisibleAvailable()', () => { describe('item getVisibleAvailable()', () => {
it('should check available visible for today', async() => { it('should check available visible for tomorrow', async() => {
const tx = await models.Item.beginTransaction({}); const tx = await models.Item.beginTransaction({});
const options = {transaction: tx}; const options = {transaction: tx};
@ -9,6 +9,7 @@ describe('item getVisibleAvailable()', () => {
const itemFk = 1; const itemFk = 1;
const warehouseFk = 1; const warehouseFk = 1;
const dated = Date.vnNew(); const dated = Date.vnNew();
dated.setDate(dated.getDate() + 1);
const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options);