-
+
Id
@@ -81,7 +73,7 @@
{{::zone.id}}
diff --git a/modules/zone/front/delivery-days/index.js b/modules/zone/front/delivery-days/index.js
index 12b1c57b1..21c65678f 100644
--- a/modules/zone/front/delivery-days/index.js
+++ b/modules/zone/front/delivery-days/index.js
@@ -74,33 +74,14 @@ class Controller extends Section {
zonesIds.push(event.zoneFk);
this.$.zoneEvents.show($event.target);
- const zoneModel = this.$.zoneModel;
- zoneModel.applyFilter({
- include: [
- {
- relation: 'agencyMode',
- scope: {fields: ['name']}
- },
- {
- relation: 'events',
- scope: {
- where: {dated: day}
- }
- },
- ],
- where: {
- id: {inq: zonesIds}
- }
- }).then(() => {
- const data = zoneModel.data;
- for (let row of data) {
- const [event] = row.events;
- if (event && event.hour)
- row.hour = event.hour;
- if (event && event.price)
- row.price = event.price;
- }
- });
+
+ const params = {
+ zonesId: zonesIds,
+ date: day
+ };
+
+ this.$http.post(`Zones/getZoneClosing`, params)
+ .then(res => this.zoneClosing = res.data);
}
preview(zone) {
diff --git a/modules/zone/front/delivery-days/index.spec.js b/modules/zone/front/delivery-days/index.spec.js
index c896021ed..3d71bc93f 100644
--- a/modules/zone/front/delivery-days/index.spec.js
+++ b/modules/zone/front/delivery-days/index.spec.js
@@ -96,46 +96,31 @@ describe('Zone Component vnZoneDeliveryDays', () => {
expect(controller.$.zoneEvents.show).not.toHaveBeenCalled();
});
- it('should call the show() method and then call the applyFilter() method with the expected ids', () => {
- const zoneModel = controller.$.zoneModel;
+ it('should call the show() method and call getZoneClosing() with the expected ids', () => {
jest.spyOn(controller.$.zoneEvents, 'show');
- jest.spyOn(zoneModel, 'applyFilter').mockReturnValue(new Promise(resolve => {
- zoneModel.data = [
- {id: 1, events: [{price: 25}]}
- ];
- }));
const event = new Event('click');
const target = document.createElement('div');
target.dispatchEvent(event);
+
+ const day = new Date();
const events = [
{zoneFk: 1},
{zoneFk: 2},
{zoneFk: 8}
];
-
- const day = new Date();
- controller.onSelection(event, events, [day]);
- const expectedFilter = {
- include: [
- {
- relation: 'agencyMode',
- scope: {fields: ['name']}
- },
- {
- relation: 'events',
- scope: {
- where: {dated: day}
- }
- }
- ],
- where: {
- id: {inq: [1, 2, 8]}
- }
+ const params = {
+ zonesId: [1, 2, 8],
+ date: [day][0]
};
+ const response = [{id: 1, hour: ''}];
+
+ $httpBackend.when('POST', 'Zones/getZoneClosing', params).respond({response});
+ controller.onSelection(event, events, [day]);
+ $httpBackend.flush();
expect(controller.$.zoneEvents.show).toHaveBeenCalledWith(target);
- expect(zoneModel.applyFilter).toHaveBeenCalledWith(expectedFilter);
+ expect(controller.zoneClosing.id).toEqual(response.id);
});
});
});
diff --git a/modules/zone/front/upcoming-deliveries/style.scss b/modules/zone/front/upcoming-deliveries/style.scss
index d3f33260a..b52231a09 100644
--- a/modules/zone/front/upcoming-deliveries/style.scss
+++ b/modules/zone/front/upcoming-deliveries/style.scss
@@ -15,6 +15,7 @@ vn-upcoming-deliveries {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ background-color: $color-bg;
}
vn-table vn-th.waste-family,
diff --git a/print/templates/reports/invoice/sql/intrastat.sql b/print/templates/reports/invoice/sql/intrastat.sql
index e391056ec..6bf72c158 100644
--- a/print/templates/reports/invoice/sql/intrastat.sql
+++ b/print/templates/reports/invoice/sql/intrastat.sql
@@ -2,9 +2,13 @@ SELECT
ir.id AS code,
ir.description AS description,
CAST(SUM(IFNULL(i.stems,1) * s.quantity) AS DECIMAL(10,2)) as stems,
- CAST(SUM( weight) AS DECIMAL(10,2)) as netKg,
+ CAST(SUM(IF(sv.physicalWeight, sv.physicalWeight, i.density * sub.cm3delivery/1000000)) AS DECIMAL(10,2)) netKg,
CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100 )) AS DECIMAL(10,2)) AS subtotal
- FROM vn.sale s
+ FROM vn.sale s
+ LEFT JOIN (SELECT ic.itemFk, ic.cm3, ic.cm3delivery
+ FROM vn.itemCost ic
+ WHERE ic.cm3
+ GROUP BY ic.itemFk) sub ON s.itemFk = sub.itemFk
LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id
LEFT JOIN vn.ticket t ON t.id = s.ticketFk
LEFT JOIN vn.invoiceOut io ON io.ref = t.refFk