7525-devToTest #2542

Merged
alexm merged 231 commits from 7525-devToTest into test 2024-06-04 07:59:34 +00:00
8 changed files with 61 additions and 73 deletions
Showing only changes of commit 4550d3719c - Show all commits

View File

@ -11,11 +11,16 @@ Required applications.
* Node.js * Node.js
* Docker * Docker
* Git * Git
* MYT
You will need to install globally the following items. You will need to install globally the following items.
``` ```
$ sudo npm install -g jest gulp-cli $ sudo npm install -g jest gulp-cli
``` ```
After installing MYT you will need the following item.
```
$ apt install libkrb5-dev libssl-dev
```
## Installing dependencies and launching ## Installing dependencies and launching

View File

@ -1,5 +1,7 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_ValuateInventory`(vDated DATE, vIsDetailed BOOLEAN) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_valuateInventory`(
vDated DATE
)
BEGIN BEGIN
DECLARE vInventoried DATE; DECLARE vInventoried DATE;
DECLARE vHasNotInventory BOOLEAN DEFAULT FALSE; DECLARE vHasNotInventory BOOLEAN DEFAULT FALSE;
@ -15,8 +17,7 @@ BEGIN
SELECT tr.landed INTO vInventoried SELECT tr.landed INTO vInventoried
FROM travel tr FROM travel tr
JOIN `entry` e ON e.travelFk = tr.id JOIN `entry` e ON e.travelFk = tr.id
JOIN entryConfig ec WHERE tr.landed <= vDateDayEnd
WHERE landed <= vDateDayEnd
AND e.supplierFk = vInventorySupplierFk AND e.supplierFk = vInventorySupplierFk
ORDER BY tr.landed DESC ORDER BY tr.landed DESC
LIMIT 1; LIMIT 1;
@ -27,8 +28,7 @@ BEGIN
SELECT landed INTO vInventoryClone SELECT landed INTO vInventoryClone
FROM travel tr FROM travel tr
JOIN `entry` e ON e.travelFk = tr.id JOIN `entry` e ON e.travelFk = tr.id
JOIN entryConfig ec WHERE tr.landed >= vDated
WHERE landed >= vDated
AND e.supplierFk = vInventorySupplierFk AND e.supplierFk = vInventorySupplierFk
ORDER BY landed ASC ORDER BY landed ASC
LIMIT 1; LIMIT 1;
@ -38,13 +38,14 @@ BEGIN
END IF; END IF;
CREATE OR REPLACE TEMPORARY TABLE tInventory( CREATE OR REPLACE TEMPORARY TABLE tInventory(
warehouseFk SMALLINT, warehouseFk SMALLINT,
itemFk BIGINT, itemFk BIGINT,
quantity INT, quantity INT,
cost DOUBLE DEFAULT 0, volume DECIMAL(10,2),
total DOUBLE DEFAULT 0, cost DOUBLE DEFAULT 0,
warehouseInventory VARCHAR(20), total DOUBLE DEFAULT 0,
PRIMARY KEY (warehouseInventory, itemFk) USING HASH warehouseInventory VARCHAR(20),
PRIMARY KEY (warehouseInventory, itemFk) USING HASH
) )
ENGINE = MEMORY; ENGINE = MEMORY;
@ -60,9 +61,8 @@ BEGIN
JOIN `entry` e ON e.id = b.entryFk JOIN `entry` e ON e.id = b.entryFk
JOIN travel tr ON tr.id = e.travelFk JOIN travel tr ON tr.id = e.travelFk
JOIN itemType t ON t.id = i.typeFk JOIN itemType t ON t.id = i.typeFk
JOIN warehouse w ON w.id = warehouseInFk JOIN warehouse w ON w.id = tr.warehouseInFk
JOIN entryConfig ec WHERE tr.landed = vDateDayEnd
WHERE landed = vDateDayEnd
AND e.supplierFk = vInventorySupplierFk AND e.supplierFk = vInventorySupplierFk
AND w.valuatedInventory AND w.valuatedInventory
AND t.isInventory AND t.isInventory
@ -78,9 +78,8 @@ BEGIN
JOIN `entry` e ON e.id = b.entryFk JOIN `entry` e ON e.id = b.entryFk
JOIN travel tr ON tr.id = e.travelFk JOIN travel tr ON tr.id = e.travelFk
JOIN itemType t ON t.id = i.typeFk JOIN itemType t ON t.id = i.typeFk
JOIN warehouse w ON w.id = warehouseInFk JOIN warehouse w ON w.id = tr.warehouseInFk
JOIN entryConfig ec WHERE tr.landed = vInventoried
WHERE landed = vInventoried
AND e.supplierFk = vInventorySupplierFk AND e.supplierFk = vInventorySupplierFk
AND w.valuatedInventory AND w.valuatedInventory
AND t.isInventory AND t.isInventory
@ -99,7 +98,6 @@ BEGIN
JOIN travel tr ON tr.id = e.travelFk JOIN travel tr ON tr.id = e.travelFk
JOIN itemType t ON t.id = i.typeFk JOIN itemType t ON t.id = i.typeFk
JOIN warehouse w ON w.id = tr.warehouseInFk JOIN warehouse w ON w.id = tr.warehouseInFk
JOIN entryConfig ec
WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE) AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE)
AND NOT e.isRaid AND NOT e.isRaid
@ -183,52 +181,37 @@ BEGIN
AND e.isConfirmed AND e.isConfirmed
ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity); ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity);
CALL vn.buyUltimate(NULL, vDateDayEnd); CALL buyUltimate(NULL, vDateDayEnd);
DELETE FROM tInventory WHERE quantity IS NULL OR NOT quantity;
UPDATE tInventory i UPDATE tInventory i
JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.itemFk = bu.itemFk JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.itemFk = bu.itemFk
JOIN buy b ON b.id = bu.buyFk JOIN buy b ON b.id = bu.buyFk
SET total = i.quantity * (IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0)), LEFT JOIN itemCost ic ON ic.itemFk = i.itemFk
cost = IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0) AND ic.warehouseFk = i.warehouseFk
WHERE i.quantity; SET i.total = i.quantity * (IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0)),
i.cost = IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0),
i.volume = i.quantity * ic.cm3delivery / 1000000;
DELETE FROM tInventory SELECT ti.warehouseFk,
WHERE quantity IS NULL OR NOT quantity; i.id,
i.longName,
IF vIsDetailed THEN i.size,
SELECT ti.warehouseFk, ti.quantity,
i.id itemFk, ti.volume,
i.longName, tp.name itemTypeName,
i.size, ic.name itemCategoryName,
ti.quantity, ti.cost,
tp.name Tipo, ti.total,
ic.name Reino, ti.warehouseInventory
ti.cost, FROM tInventory ti
CAST(ti.total AS DECIMAL(10, 2)) total, JOIN warehouse w ON w.id = warehouseFk
ti.warehouseInventory almacen JOIN item i ON i.id = ti.itemFk
FROM tInventory ti JOIN itemType tp ON tp.id = i.typeFk
JOIN warehouse w ON w.id = warehouseFk JOIN itemCategory ic ON ic.id = tp.categoryFk
JOIN item i ON i.id = ti.itemFk WHERE w.valuatedInventory
JOIN itemType tp ON tp.id = i.typeFk AND ti.total > 0;
JOIN itemCategory ic ON ic.id = tp.categoryFk
WHERE w.valuatedInventory
AND ti.total > 0
ORDER BY ti.total DESC;
ELSE
SELECT i.warehouseInventory Almacen,
ic.name Reino,
CAST(i.total AS DECIMAL(10, 2)) Euros,
w.code Comprador,
it.id
FROM tInventory i
JOIN warehouse wh ON wh.id = warehouseFk
JOIN item it ON it.id = i.itemFk
JOIN itemType itp ON itp.id = it.typeFk
LEFT JOIN worker w ON w.id = itp.workerFk
JOIN itemCategory ic ON ic.id = itp.categoryFk
WHERE wh.valuatedInventory
AND i.total > 0;
END IF;
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tmp.buyUltimate, tmp.buyUltimate,

View File

@ -51,7 +51,7 @@ describe('Client Add address path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton); await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Incoterms is required for a non UEE member'); expect(message.text).toContain('Incoterms and Customs agent are required for a non UEE member');
}); });
it(`should receive an error after clicking save button as customsAgent is empty`, async() => { it(`should receive an error after clicking save button as customsAgent is empty`, async() => {

View File

@ -227,5 +227,7 @@
"They're not your subordinate": "They're not your subordinate", "They're not your subordinate": "They're not your subordinate",
"InvoiceIn is already booked": "InvoiceIn is already booked", "InvoiceIn is already booked": "InvoiceIn is already booked",
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency", "This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency",
"You can only have one PDA": "You can only have one PDA" "You can only have one PDA": "You can only have one PDA",
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member"
}
} }

View File

@ -359,5 +359,6 @@
"It was not able to create the invoice": "No se pudo crear la factura", "It was not able to create the invoice": "No se pudo crear la factura",
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)", "ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)",
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario", "This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
"You can only have one PDA": "Solo puedes tener un PDA" "You can only have one PDA": "Solo puedes tener un PDA",
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE"
} }

View File

@ -92,11 +92,8 @@ module.exports = function(Self) {
}, myOptions); }, myOptions);
const isUeeMember = province.country().isUeeMember; const isUeeMember = province.country().isUeeMember;
if (!isUeeMember && !args.incotermsFk) if (!isUeeMember && (!args.incotermsFk || !args.customsAgentFk))
throw new UserError(`Incoterms is required for a non UEE member`); throw new UserError(`Incoterms and Customs agent are required for a non UEE member`);
if (!isUeeMember && !args.customsAgentFk)
throw new UserError(`Customs agent is required for a non UEE member`);
delete args.ctx; // Remove unwanted properties delete args.ctx; // Remove unwanted properties
const newAddress = await models.Address.create(args, myOptions); const newAddress = await models.Address.create(args, myOptions);

View File

@ -50,7 +50,7 @@ describe('Address createAddress', () => {
} }
expect(error).toBeDefined(); expect(error).toBeDefined();
expect(error.message).toEqual('Incoterms is required for a non UEE member'); expect(error.message).toEqual('Incoterms and Customs agent are required for a non UEE member');
}); });
it('should throw a non uee member error if no customsAgent is defined', async() => { it('should throw a non uee member error if no customsAgent is defined', async() => {
@ -81,7 +81,7 @@ describe('Address createAddress', () => {
} }
expect(error).toBeDefined(); expect(error).toBeDefined();
expect(error.message).toEqual('Customs agent is required for a non UEE member'); expect(error.message).toEqual('Incoterms and Customs agent are required for a non UEE member');
}); });
it('should create a new address and set as a client default address', async() => { it('should create a new address and set as a client default address', async() => {

View File

@ -27,7 +27,7 @@
<vn-autocomplete <vn-autocomplete
url="Tickets" url="Tickets"
label="Ticket" label="Ticket"
search-function="{or: [{id: $search}, {nickname: {like: '%'+$search+'%'}}]}" search-function="{refFk: null, or: [{id: $search}, {nickname: {like: '%'+$search+'%'}}]}"
show-field="id" show-field="id"
value-field="id" value-field="id"
fields="['nickname']" fields="['nickname']"