diff --git a/db/changes/10490-august/00-ACL.sql b/db/changes/10490-august/00-ACL.sql
new file mode 100644
index 000000000..e07610c60
--- /dev/null
+++ b/db/changes/10490-august/00-ACL.sql
@@ -0,0 +1,4 @@
+INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
+ VALUES ('Sector','*','READ','ALLOW','ROLE','employee');
+INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
+ VALUES ('Sector','*','WRITE','ALLOW','ROLE','employee');
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index f7f241bc3..1f66a53cf 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -862,25 +862,25 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
('VT', 'Sales');
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`,
- `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`)
+ `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
VALUES
- (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15),
- (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10),
- (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5),
- (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL),
- (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL),
- (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL),
- (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL),
- (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL),
- (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL),
- (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL),
- (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL),
- (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL),
- (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL),
- (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL),
- (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL),
- (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL),
- (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL);
+ (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15,3),
+ (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2),
+ (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5),
+ (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
+ (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL),
+ (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
+ (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
+ (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
+ (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
-- Update the taxClass after insert of the items
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index 0ad9ad7f4..237fdad0c 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -391,7 +391,7 @@ export default {
intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Intrastat"]',
originCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Origin"]',
buyerCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Buyer"]',
- densityCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Density"]',
+ weightByPieceCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Weight/Piece"]',
saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button'
},
itemFixedPrice: {
diff --git a/e2e/paths/04-item/09_index.spec.js b/e2e/paths/04-item/09_index.spec.js
index f9262863d..6e0a4bd5c 100644
--- a/e2e/paths/04-item/09_index.spec.js
+++ b/e2e/paths/04-item/09_index.spec.js
@@ -31,7 +31,7 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
await page.waitToClick(selectors.itemsIndex.originCheckbox);
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
- await page.waitToClick(selectors.itemsIndex.densityCheckbox);
+ await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const message = await page.waitForSnackbar();
@@ -64,7 +64,7 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
await page.waitToClick(selectors.itemsIndex.originCheckbox);
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
- await page.waitToClick(selectors.itemsIndex.densityCheckbox);
+ await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const message = await page.waitForSnackbar();
diff --git a/front/core/components/input-time/index.js b/front/core/components/input-time/index.js
index d77ccbec2..0d01fbd32 100644
--- a/front/core/components/input-time/index.js
+++ b/front/core/components/input-time/index.js
@@ -23,12 +23,15 @@ export default class InputTime extends Field {
let date = null;
let value = this.input.value;
+ if (this.field && !this.modelDate)
+ this.modelDate = this.field;
+
if (value) {
let split = value.split(':').map(i => parseInt(i) || null);
- date = this.field instanceof Date
- ? this.field
- : new Date(this.field || null);
+ date = this.modelDate
+ ? new Date(this.modelDate)
+ : new Date();
date.setHours(split[0], split[1], 0, 0);
}
diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js
index 72bee98ae..2642d4f4d 100644
--- a/modules/entry/back/methods/entry/editLatestBuys.js
+++ b/modules/entry/back/methods/entry/editLatestBuys.js
@@ -52,7 +52,7 @@ module.exports = Self => {
switch (field) {
case 'size':
- case 'density':
+ case 'weightByPiece':
case 'description':
case 'packingOut':
modelName = 'Item';
diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js
index 00f72ea14..b920f4b58 100644
--- a/modules/entry/back/methods/entry/latestBuysFilter.js
+++ b/modules/entry/back/methods/entry/latestBuysFilter.js
@@ -157,7 +157,7 @@ module.exports = Self => {
i.image,
i.id AS itemFk,
i.size,
- i.density,
+ i.weightByPiece,
it.code,
i.typeFk,
i.family,
diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html
index 768c8c7ee..fc44ddfc2 100644
--- a/modules/entry/front/latest-buys/index.html
+++ b/modules/entry/front/latest-buys/index.html
@@ -68,8 +68,8 @@
Origin
|
-
- Density
+ |
+ Weight/Piece
|
Active
@@ -183,7 +183,7 @@
{{::buy.intrastat}}
| {{::buy.origin}} |
- {{::buy.density}} |
+ {{::buy.weightByPiece}} |
{
origin.itemTag = undefined;
origin.description = undefined;
- origin.image = undefined;
origin.comment = undefined;
origin.size = undefined;
diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js
index 8b2a014e6..c0b1cc0d9 100644
--- a/modules/item/back/methods/item/filter.js
+++ b/modules/item/back/methods/item/filter.js
@@ -160,7 +160,7 @@ module.exports = Self => {
i.subName,
i.isActive,
i.stems,
- i.density,
+ i.weightByPiece,
i.stemMultiplier,
i.typeFk,
i.isFloramondo,
diff --git a/modules/item/back/methods/item/specs/clone.spec.js b/modules/item/back/methods/item/specs/clone.spec.js
index d376b9e5b..1f4a87ac1 100644
--- a/modules/item/back/methods/item/specs/clone.spec.js
+++ b/modules/item/back/methods/item/specs/clone.spec.js
@@ -21,7 +21,7 @@ describe('item clone()', () => {
const result = await models.Item.clone(itemFk, options);
expect(result.id).toEqual(nextItemId);
- expect(result.image).toBeUndefined();
+ expect(result.image).toBeDefined();
expect(result.itemTag).toBeUndefined();
expect(result.comment).toBeUndefined();
expect(result.description).toBeUndefined();
diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json
index 01b6ba093..f9be2b6b1 100644
--- a/modules/item/back/models/item.json
+++ b/modules/item/back/models/item.json
@@ -53,9 +53,9 @@
"type": "number",
"description": "Relevancy"
},
- "density": {
+ "weightByPiece": {
"type": "number",
- "description": "Density"
+ "description": "WeightByPiece"
},
"stemMultiplier": {
"type": "number",
@@ -143,6 +143,9 @@
},
"packingShelve": {
"type": "number"
+ },
+ "weightByPiece": {
+ "type": "number"
}
},
"relations": {
diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html
index 22fd33a07..8d1afe4e1 100644
--- a/modules/item/front/basic-data/index.html
+++ b/modules/item/front/basic-data/index.html
@@ -124,9 +124,8 @@
Buyer
-
- Density
+ |
+ Weight/Piece
|
Multiplier
@@ -117,7 +117,7 @@
{{::item.userName}}
| |
- {{::item.density}} |
+ {{::item.weightByPiece}} |
{{::item.stemMultiplier}} |
-
+
diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html
index a504301a5..138788ed6 100644
--- a/modules/monitor/front/index/tickets/index.html
+++ b/modules/monitor/front/index/tickets/index.html
@@ -210,6 +210,9 @@
+
+
diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html
index d3ba25b11..737bbab13 100644
--- a/modules/route/front/basic-data/index.html
+++ b/modules/route/front/basic-data/index.html
@@ -21,7 +21,7 @@
{{name}} - {{nickname}}
-
diff --git a/modules/shelving/back/model-config.json b/modules/shelving/back/model-config.json
index b5619d8c5..c26c39d38 100644
--- a/modules/shelving/back/model-config.json
+++ b/modules/shelving/back/model-config.json
@@ -7,5 +7,8 @@
},
"ShelvingLog": {
"dataSource": "vn"
+ },
+ "Sector": {
+ "dataSource": "vn"
}
-}
+}
\ No newline at end of file
diff --git a/modules/shelving/back/models/sector.json b/modules/shelving/back/models/sector.json
new file mode 100644
index 000000000..0dc502cd0
--- /dev/null
+++ b/modules/shelving/back/models/sector.json
@@ -0,0 +1,72 @@
+{
+ "name": "Sector",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "sector"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "description": {
+ "type": "string",
+ "required": true
+ },
+ "warehouseFk": {
+ "type": "number",
+ "required": true
+ },
+ "isPreviousPreparedByPacking": {
+ "type": "boolean",
+ "required": true
+ },
+ "code": {
+ "type": "string",
+ "required": false
+ },
+ "isPreviousPrepared": {
+ "type": "boolean",
+ "required": true
+ },
+ "isPackagingArea": {
+ "type": "boolean",
+ "required": true
+ },
+ "reportFk": {
+ "type": "number",
+ "required": false
+ },
+ "sonFk": {
+ "type": "number",
+ "required": false
+ },
+ "isMain": {
+ "type": "boolean",
+ "required": true
+ },
+ "itemPackingTypeFk": {
+ "type": "string",
+ "required": false
+ },
+ "workerFk": {
+ "type": "number",
+ "required": false
+ },
+ "printerFk": {
+ "type": "number",
+ "required": false
+ },
+ "isHideForPickers": {
+ "type": "boolean",
+ "required": true
+ },
+ "isReserve": {
+ "type": "boolean",
+ "required": true
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/travel/back/methods/travel/extraCommunityFilter.js b/modules/travel/back/methods/travel/extraCommunityFilter.js
index feb16d052..34e0ff7fa 100644
--- a/modules/travel/back/methods/travel/extraCommunityFilter.js
+++ b/modules/travel/back/methods/travel/extraCommunityFilter.js
@@ -130,8 +130,8 @@ module.exports = Self => {
SUM(b.stickers) AS stickers,
s.id AS cargoSupplierFk,
s.nickname AS cargoSupplierNickname,
- CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg,
- CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
+ CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
+ CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
FROM travel t
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
LEFT JOIN entry e ON e.travelFk = t.id
@@ -143,7 +143,8 @@ module.exports = Self => {
JOIN warehouse wo ON wo.id = t.warehouseOutFk
JOIN country c ON c.id = wo.countryFk
LEFT JOIN continent cnt ON cnt.id = c.continentFk
- JOIN agencyMode am ON am.id = t.agencyModeFk`
+ JOIN agencyMode am ON am.id = t.agencyModeFk
+ JOIN vn.volumeConfig vc`
);
stmt.merge(conn.makeWhere(filter.where));
@@ -165,15 +166,16 @@ module.exports = Self => {
SUM(b.stickers) AS stickers,
e.evaNotes,
e.notes,
- CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg,
- CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
- FROM tmp.travel tr
+ CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg,
+ CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg
+ FROM tmp.travel tr
JOIN entry e ON e.travelFk = tr.id
JOIN buy b ON b.entryFk = e.id
JOIN packaging pkg ON pkg.id = b.packageFk
JOIN item i ON i.id = b.itemFk
JOIN itemType it ON it.id = i.typeFk
- JOIN supplier s ON s.id = e.supplierFk`
+ JOIN supplier s ON s.id = e.supplierFk
+ JOIN vn.volumeConfig vc`
);
stmt.merge(conn.makeGroupBy('e.id'));
diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json
index c6b984bd2..c155e331d 100644
--- a/modules/worker/back/model-config.json
+++ b/modules/worker/back/model-config.json
@@ -20,9 +20,6 @@
"EducationLevel": {
"dataSource": "vn"
},
- "Sector": {
- "dataSource": "vn"
- },
"WorkCenter": {
"dataSource": "vn"
},
diff --git a/modules/worker/back/models/sector.json b/modules/worker/back/models/sector.json
deleted file mode 100644
index 8bd5e773f..000000000
--- a/modules/worker/back/models/sector.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "Sector",
- "base": "VnModel",
- "options": {
- "mysql": {
- "table": "sector"
- }
- },
- "properties": {
- "id": {
- "type": "number",
- "id": true,
- "description": "Identifier"
- },
- "description": {
- "type": "string",
- "required": true
- }
- }
-}
\ No newline at end of file
diff --git a/package.json b/package.json
index d33b65f93..92ca13e45 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-back",
- "version": "8.6.0",
+ "version": "8.8.0",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",
@@ -37,7 +37,7 @@
"node-ssh": "^11.0.0",
"object-diff": "0.0.4",
"object.pick": "^1.3.0",
- "puppeteer": "^7.1.0",
+ "puppeteer": "^18.0.5",
"read-chunk": "^3.2.0",
"require-yaml": "0.0.1",
"sharp": "^0.27.1",
diff --git a/print/core/smtp.js b/print/core/smtp.js
index 50a413673..a55ba448d 100644
--- a/print/core/smtp.js
+++ b/print/core/smtp.js
@@ -29,7 +29,7 @@ module.exports = {
for (let attachment of options.attachments) {
const fileName = attachment.filename;
const filePath = attachment.path;
- if (fileName.includes('.png')) return;
+ if (fileName.includes('.png')) continue;
if (fileName || filePath)
attachments.push(filePath ? filePath : fileName);
diff --git a/print/methods/closure/closeAll.js b/print/methods/closure/closeAll.js
index dad8b4569..36b853052 100644
--- a/print/methods/closure/closeAll.js
+++ b/print/methods/closure/closeAll.js
@@ -11,15 +11,17 @@ module.exports = async function(request, response, next) {
if (reqArgs.to) toDate = reqArgs.to;
const todayMinDate = new Date();
- minDate.setHours(0, 0, 0, 0);
+ todayMinDate.setHours(0, 0, 0, 0);
const todayMaxDate = new Date();
- maxDate.setHours(23, 59, 59, 59);
+ todayMinDate.setHours(23, 59, 59, 59);
// Prevent closure for current day
if (toDate >= todayMinDate && toDate <= todayMaxDate)
throw new Error('You cannot close tickets for today');
+ console.log(`Making closure up to ${toDate}...`);
+
const tickets = await db.rawSql(`
SELECT
t.id,
diff --git a/print/methods/closure/closure.js b/print/methods/closure/closure.js
index 67a2538e8..fe5aba5e7 100644
--- a/print/methods/closure/closure.js
+++ b/print/methods/closure/closure.js
@@ -7,11 +7,13 @@ const storage = require('vn-print/core/storage');
module.exports = {
async start(tickets, reqArgs) {
+ console.log(tickets);
if (tickets.length == 0) return;
const failedtickets = [];
for (const ticket of tickets) {
try {
+ console.log(`Closing ticket id ${ticket.id}...`);
await db.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id]);
const invoiceOut = await db.findOne(`
diff --git a/print/templates/reports/extra-community/sql/entries.sql b/print/templates/reports/extra-community/sql/entries.sql
index ad2529a1c..a90bf8b0b 100644
--- a/print/templates/reports/extra-community/sql/entries.sql
+++ b/print/templates/reports/extra-community/sql/entries.sql
@@ -1,17 +1,18 @@
SELECT
- e.id,
- e.travelFk,
- e.ref,
- s.name AS supplierName,
- SUM(b.stickers) AS stickers,
- CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg,
- CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
-FROM travel t
- JOIN entry e ON e.travelFk = t.id
- JOIN buy b ON b.entryFk = e.id
- JOIN packaging pkg ON pkg.id = b.packageFk
- JOIN item i ON i.id = b.itemFk
- JOIN itemType it ON it.id = i.typeFk
- JOIN supplier s ON s.id = e.supplierFk
- WHERE t.id IN(?)
-GROUP BY e.id
\ No newline at end of file
+ e.id,
+ e.travelFk,
+ e.ref,
+ s.name AS supplierName,
+ SUM(b.stickers) AS stickers,
+ CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
+ CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
+ FROM travel t
+ JOIN entry e ON e.travelFk = t.id
+ JOIN buy b ON b.entryFk = e.id
+ JOIN packaging pkg ON pkg.id = b.packageFk
+ JOIN item i ON i.id = b.itemFk
+ JOIN itemType it ON it.id = i.typeFk
+ JOIN supplier s ON s.id = e.supplierFk
+ JOIN vn.volumeConfig vc
+ WHERE t.id IN(?)
+ GROUP BY e.id
\ No newline at end of file
diff --git a/print/templates/reports/extra-community/sql/travels.sql b/print/templates/reports/extra-community/sql/travels.sql
index f8a4e0142..b0987c330 100644
--- a/print/templates/reports/extra-community/sql/travels.sql
+++ b/print/templates/reports/extra-community/sql/travels.sql
@@ -6,9 +6,10 @@ SELECT
t.kg,
am.id AS agencyModeFk,
SUM(b.stickers) AS stickers,
- CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg,
- CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
+ CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
+ CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
FROM travel t
+ JOIN volumeConfig vc
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
LEFT JOIN entry e ON e.travelFk = t.id
LEFT JOIN buy b ON b.entryFk = e.id
|