diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index c8e0ae168..41cd88b91 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -392,12 +392,13 @@ export default {
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"]',
- saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button',
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
advancedSearchItemType: 'vn-item-search-panel vn-autocomplete[ng-model="filter.typeFk"]',
advancedSearchButton: 'vn-item-search-panel button[type=submit]',
advancedSmartTableButton: 'vn-item-index vn-button[icon="search"]',
advancedSmartTableGrouping: 'vn-item-index vn-textfield[name=grouping]',
+ weightByPieceCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Weight/Piece"]',
+ saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button'
},
itemFixedPrice: {
add: 'vn-fixed-price vn-icon-button[icon="add_circle"]',
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/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}} |
{
i.subName,
i.isActive,
i.stems,
- i.density,
+ i.weightByPiece,
i.stemMultiplier,
i.typeFk,
i.isFloramondo,
diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json
index a6328a456..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",
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/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/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
|