@@ -133,64 +133,64 @@
- {{::ticket.id}}
+ {{ticket.id}}
|
- {{::ticket.nickname}}
+ {{ticket.nickname}}
|
- {{::ticket.userName | dashIfEmpty}}
+ {{ticket.userName | dashIfEmpty}}
|
-
- {{::ticket.shippedDate | date: 'dd/MM/yyyy'}}
+
+ {{ticket.shippedDate | date: 'dd/MM/yyyy'}}
|
- {{::ticket.zoneLanding | date: 'HH:mm'}} |
- {{::ticket.practicalHour | date: 'HH:mm'}} |
- {{::ticket.shipped | date: 'HH:mm'}} |
- {{::ticket.province}} |
+ {{ticket.zoneLanding | date: 'HH:mm'}} |
+ {{ticket.practicalHour | date: 'HH:mm'}} |
+ {{ticket.shipped | date: 'HH:mm'}} |
+ {{ticket.province}} |
- {{::ticket.refFk}}
+ {{ticket.refFk}}
- {{::ticket.state}}
+ ng-show="!ticket.refFk"
+ class="chip {{ticket.classColor}}">
+ {{ticket.state}}
|
- {{::ticket.zoneName | dashIfEmpty}}
+ {{ticket.zoneName | dashIfEmpty}}
|
-
- {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
+
+ {{(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
|
{
- this.vnApp.showMessage(this.$t('SMS sent!'));
+ this.vnApp.showMessage(this.$t('SMS sent'));
if (res.data) this.emit('send', {response: res.data});
});
diff --git a/modules/route/front/sms/index.spec.js b/modules/route/front/sms/index.spec.js
index 42bf30931..8bf35e673 100644
--- a/modules/route/front/sms/index.spec.js
+++ b/modules/route/front/sms/index.spec.js
@@ -30,7 +30,7 @@ describe('Route', () => {
controller.onResponse();
$httpBackend.flush();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!');
+ expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent');
});
it('should call onResponse without the destination and show an error snackbar', () => {
diff --git a/modules/ticket/back/methods/sale/salePreparingList.js b/modules/ticket/back/methods/sale/salePreparingList.js
new file mode 100644
index 000000000..e6e7d5164
--- /dev/null
+++ b/modules/ticket/back/methods/sale/salePreparingList.js
@@ -0,0 +1,33 @@
+module.exports = Self => {
+ Self.remoteMethodCtx('salePreparingList', {
+ description: 'Returns a list with the lines of a ticket and its different states of preparation',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'id',
+ type: 'number',
+ required: true,
+ description: 'The ticket id',
+ http: {source: 'path'}
+ }],
+ returns: {
+ type: ['object'],
+ root: true
+ },
+ http: {
+ path: `/:id/salePreparingList`,
+ verb: 'GET'
+ }
+ });
+
+ Self.salePreparingList = async(ctx, id, options) => {
+ const myOptions = {};
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ query = `CALL vn.salePreparingList(?)`;
+ const [sales] = await Self.rawSql(query, [id], myOptions);
+
+ return sales;
+ };
+};
diff --git a/modules/ticket/back/methods/sale/usesMana.js b/modules/ticket/back/methods/sale/usesMana.js
index 093057dca..3f55293bf 100644
--- a/modules/ticket/back/methods/sale/usesMana.js
+++ b/modules/ticket/back/methods/sale/usesMana.js
@@ -24,6 +24,8 @@ module.exports = Self => {
const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions);
const departments = await models.Department.getLeaves(salesDepartment.id, null, myOptions);
const workerDepartment = await models.WorkerDepartment.findById(userId, null, myOptions);
+ if (!workerDepartment) return false;
+
const usesMana = departments.find(department => department.id == workerDepartment.departmentFk);
return usesMana ? true : false;
diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js
index ae247fc24..bab201fdd 100644
--- a/modules/ticket/back/models/sale.js
+++ b/modules/ticket/back/models/sale.js
@@ -1,5 +1,6 @@
module.exports = Self => {
require('../methods/sale/getClaimableFromTicket')(Self);
+ require('../methods/sale/salePreparingList')(Self);
require('../methods/sale/reserve')(Self);
require('../methods/sale/deleteSales')(Self);
require('../methods/sale/updatePrice')(Self);
diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js
index 168002d07..b9b4519b9 100644
--- a/modules/ticket/front/descriptor-menu/index.js
+++ b/modules/ticket/front/descriptor-menu/index.js
@@ -267,8 +267,15 @@ class Controller extends Section {
if (client.hasElectronicInvoice) {
this.$http.post(`NotificationQueues`, {
- notificationFk: 'invoiceElectronic',
+ notificationFk: 'invoice-electronic',
authorFk: client.id,
+ params: JSON.stringify(
+ {
+ 'name': client.name,
+ 'email': client.email,
+ 'ticketId': this.id,
+ 'url': window.location.href
+ })
}).then(() => {
this.vnApp.showSuccess(this.$t('Invoice sent'));
});
diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html
index fc585650a..851817551 100644
--- a/modules/ticket/front/sale-tracking/index.html
+++ b/modules/ticket/front/sale-tracking/index.html
@@ -1,10 +1,11 @@
@@ -12,31 +13,27 @@
-
+ Is checked
Item
- Description
+ Description
Quantity
- Original
- Worker
- State
- Created
+
-
-
-
-
+
+
+
+
+
+
+
- {{sale.itemFk | zeroFill:6}}
+ {{::sale.itemFk | zeroFill:6}}
@@ -53,16 +50,18 @@
{{::sale.quantity}}
- {{::sale.originalQuantity}}
-
-
- {{::sale.userNickname | dashIfEmpty}}
-
+
+
+
+
+
- {{::sale.state}}
- {{::sale.created | date: 'dd/MM/yyyy HH:mm'}}
@@ -70,8 +69,99 @@
+ warehouse-fk="$ctrl.ticket.warehouseFk"
+ ticket-fk="$ctrl.ticket.id">
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+ Quantity
+ Original
+ Worker
+ State
+ Created
+
+
+
+
+ {{::sale.quantity}}
+ {{::sale.originalQuantity}}
+
+
+ {{::sale.userNickname | dashIfEmpty}}
+
+
+ {{::sale.state}}
+ {{::sale.created | date: 'dd/MM/yyyy HH:mm'}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Quantity
+ Worker
+ Shelving
+ Parking
+ Created
+
+
+
+
+ {{::itemShelvingSale.quantity}}
+
+
+ {{::itemShelvingSale.name | dashIfEmpty}}
+
+
+ {{::itemShelvingSale.shelvingFk}}
+ {{::itemShelvingSale.code}}
+ {{::itemShelvingSale.created | date: 'dd/MM/yyyy HH:mm'}}
+
+
+
+
+
+
+
+
diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js
index 394ef4f1e..60e42a461 100644
--- a/modules/ticket/front/sale-tracking/index.js
+++ b/modules/ticket/front/sale-tracking/index.js
@@ -1,12 +1,100 @@
import ngModule from '../module';
import Section from 'salix/components/section';
+import './style.scss';
-class Controller extends Section {}
+class Controller extends Section {
+ constructor($element, $) {
+ super($element, $);
+ this.filter = {
+ include: [
+ {
+ relation: 'item'
+ }, {
+ relation: 'saleTracking',
+ scope: {
+ fields: ['isChecked']
+ }
+ }
+ ]
+ };
+ }
+
+ get sales() {
+ return this._sales;
+ }
+
+ set sales(value) {
+ this._sales = value;
+ if (value) {
+ const query = `Sales/${this.$params.id}/salePreparingList`;
+ this.$http.get(query)
+ .then(res => {
+ this.salePreparingList = res.data;
+ for (const salePreparing of this.salePreparingList) {
+ for (const sale of this.sales) {
+ if (salePreparing.saleFk == sale.id)
+ sale.preparingList = salePreparing;
+ }
+ }
+ });
+ }
+ }
+
+ showItemDescriptor(event, sale) {
+ this.quicklinks = {
+ btnThree: {
+ icon: 'icon-transaction',
+ state: `item.card.diary({
+ id: ${sale.itemFk},
+ warehouseFk: ${this.ticket.warehouseFk},
+ lineFk: ${sale.id}
+ })`,
+ tooltip: 'Item diary'
+ }
+ };
+ this.$.itemDescriptor.show(event.target, sale.itemFk);
+ }
+
+ chipHasSaleGroupDetail(hasSaleGroupDetail) {
+ if (hasSaleGroupDetail) return 'pink';
+ else return 'message';
+ }
+
+ chipIsPreviousSelected(isPreviousSelected) {
+ if (isPreviousSelected) return 'notice';
+ else return 'message';
+ }
+
+ chipIsPrevious(isPrevious) {
+ if (isPrevious) return 'dark-notice';
+ else return 'message';
+ }
+
+ chipIsPrepared(isPrepared) {
+ if (isPrepared) return 'warning';
+ else return 'message';
+ }
+
+ chipIsControled(isControled) {
+ if (isControled) return 'yellow';
+ else return 'message';
+ }
+
+ showSaleTracking(sale) {
+ this.saleId = sale.id;
+ this.$.saleTracking.show();
+ }
+
+ showItemShelvingSale(sale) {
+ this.saleId = sale.id;
+ this.$.itemShelvingSale.show();
+ }
+}
ngModule.vnComponent('vnTicketSaleTracking', {
template: require('./index.html'),
controller: Controller,
bindings: {
- ticket: '<',
- },
+ ticket: '<'
+ }
});
diff --git a/modules/ticket/front/sale-tracking/locale/es.yml b/modules/ticket/front/sale-tracking/locale/es.yml
new file mode 100644
index 000000000..eabc0a04d
--- /dev/null
+++ b/modules/ticket/front/sale-tracking/locale/es.yml
@@ -0,0 +1,6 @@
+ItemShelvings sale: Carros línea
+has saleGroupDetail: tiene detalle grupo lineas
+is previousSelected: es previa seleccionada
+is previous: es previa
+is prepared: esta preparado
+is controled: esta controlado
diff --git a/modules/ticket/front/sale-tracking/style.scss b/modules/ticket/front/sale-tracking/style.scss
new file mode 100644
index 000000000..6d8b3db69
--- /dev/null
+++ b/modules/ticket/front/sale-tracking/style.scss
@@ -0,0 +1,7 @@
+@import "variables";
+
+.chip {
+ display: inline-block;
+ min-width: 15px;
+ min-height: 25px;
+}
diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html
index c624b1a95..d65a83c58 100644
--- a/modules/ticket/front/sale/index.html
+++ b/modules/ticket/front/sale/index.html
@@ -441,10 +441,11 @@
-
-
+ sms="$ctrl.newSMS"
+ on-send="$ctrl.onSmsSend($sms)">
+
this.vnApp.showSuccess(this.$t('SMS sent')));
+ }
+
/**
* Inserts a new instance
*/
diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html
index 5174f8da2..ee8dcdf98 100644
--- a/modules/travel/front/extra-community/index.html
+++ b/modules/travel/front/extra-community/index.html
@@ -27,7 +27,7 @@
diff --git a/modules/travel/front/extra-community/index.js b/modules/travel/front/extra-community/index.js
index a4ac487e6..2389570b9 100644
--- a/modules/travel/front/extra-community/index.js
+++ b/modules/travel/front/extra-community/index.js
@@ -43,16 +43,6 @@ class Controller extends Section {
this.smartTableOptions = {};
}
- get hasDateRange() {
- const userParams = this.$.model.userParams;
- const hasLanded = userParams.landedTo;
- const hasShipped = userParams.shippedFrom;
- const hasContinent = userParams.continent;
- const hasWarehouseOut = userParams.warehouseOutFk;
-
- return hasLanded || hasShipped || hasContinent || hasWarehouseOut;
- }
-
onDragInterval() {
if (this.dragClientY > 0 && this.dragClientY < 75)
this.$window.scrollTo(0, this.$window.scrollY - 10);
diff --git a/modules/travel/front/extra-community/index.spec.js b/modules/travel/front/extra-community/index.spec.js
index ae48b9ca1..18ddee665 100644
--- a/modules/travel/front/extra-community/index.spec.js
+++ b/modules/travel/front/extra-community/index.spec.js
@@ -14,17 +14,6 @@ describe('Travel Component vnTravelExtraCommunity', () => {
controller.$.model.refresh = jest.fn();
}));
- describe('hasDateRange()', () => {
- it('should return truthy when shippedFrom or landedTo are set as userParams', () => {
- const now = new Date();
- controller.$.model.userParams = {shippedFrom: now, landedTo: now};
-
- const result = controller.hasDateRange;
-
- expect(result).toBeTruthy();
- });
- });
-
describe('findDraggable()', () => {
it('should find the draggable element', () => {
const draggable = document.createElement('tr');
diff --git a/print/templates/email/invoice-electronic/invoice-electronic.html b/print/templates/email/invoice-electronic/invoice-electronic.html
new file mode 100644
index 000000000..fc96e0970
--- /dev/null
+++ b/print/templates/email/invoice-electronic/invoice-electronic.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+ {{ $t('subject') }}
+
+
+ {{ $t('title') }} {{name}}
+ {{ $t('clientMail') }} {{email}}
+ {{ $t('ticketId') }} {{ticketId}}
+
+
diff --git a/print/templates/email/invoice-electronic/invoice-electronic.js b/print/templates/email/invoice-electronic/invoice-electronic.js
new file mode 100644
index 000000000..2e1e739ac
--- /dev/null
+++ b/print/templates/email/invoice-electronic/invoice-electronic.js
@@ -0,0 +1,21 @@
+module.exports = {
+ name: 'invoice-electronic',
+ props: {
+ name: {
+ type: [String],
+ required: true
+ },
+ email: {
+ type: [String],
+ required: true
+ },
+ ticketId: {
+ type: [Number],
+ required: true
+ },
+ url: {
+ type: [String],
+ required: true
+ }
+ },
+};
diff --git a/print/templates/email/invoice-electronic/locale/en.yml b/print/templates/email/invoice-electronic/locale/en.yml
new file mode 100644
index 000000000..5523a2fa3
--- /dev/null
+++ b/print/templates/email/invoice-electronic/locale/en.yml
@@ -0,0 +1,4 @@
+subject: A electronic invoice has been created
+title: A new electronic invoice has been created for the client
+clientMail: The client's email is
+ticketId: The invoice's ticket is
\ No newline at end of file
diff --git a/print/templates/email/invoice-electronic/locale/es.yml b/print/templates/email/invoice-electronic/locale/es.yml
new file mode 100644
index 000000000..2cbcfbb36
--- /dev/null
+++ b/print/templates/email/invoice-electronic/locale/es.yml
@@ -0,0 +1,4 @@
+subject: Se ha creado una factura electrónica
+title: Se ha creado una nueva factura electrónica para el cliente
+clientMail: El correo del cliente es
+ticketId: El ticket de la factura es
\ No newline at end of file
diff --git a/print/templates/reports/invoice/invoice.js b/print/templates/reports/invoice/invoice.js
index 48848c079..f7011ad81 100755
--- a/print/templates/reports/invoice/invoice.js
+++ b/print/templates/reports/invoice/invoice.js
@@ -82,7 +82,7 @@ module.exports = {
return this.rawSqlFromDef(`taxes`, [reference]);
},
fetchIntrastat(reference) {
- return this.rawSqlFromDef(`intrastat`, [reference, reference, reference, reference, reference]);
+ return this.rawSqlFromDef(`intrastat`, [reference, reference, reference]);
},
fetchRectified(reference) {
return this.rawSqlFromDef(`rectified`, [reference]);
diff --git a/print/templates/reports/invoice/sql/intrastat.sql b/print/templates/reports/invoice/sql/intrastat.sql
index 7f5fbdf39..f986a9564 100644
--- a/print/templates/reports/invoice/sql/intrastat.sql
+++ b/print/templates/reports/invoice/sql/intrastat.sql
@@ -1,39 +1,26 @@
SELECT *
FROM invoiceOut io
JOIN invoiceOutSerial ios ON io.serial = ios.code
- JOIN
- (SELECT
- t.refFk,
- ir.id code,
- ir.description description,
- CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL(10,2)) stems,
- CAST(SUM(CAST(IFNULL(i.stems, 1) * s.quantity * IF(ic.grams, ic.grams, i.density * ic.cm3delivery / 1000) / 1000 AS DECIMAL(10,2)) *
- IF(sub.weight, sub.weight / vn.invoiceOut_getWeight(?), 1)) AS DECIMAL(10,2)) netKg,
- CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100 )) AS DECIMAL(10,2)) subtotal
- FROM vn.ticket t
- JOIN vn.sale s ON s.ticketFk = t.id
- JOIN vn.item i ON i.id = s.itemFk
- JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk
- JOIN vn.intrastat ir ON ir.id = i.intrastatFk
- LEFT JOIN (
- SELECT t2.weight
- FROM vn.ticket t2
- WHERE refFk = ? AND weight
- LIMIT 1
- ) sub ON TRUE
- WHERE t.refFk = ?
- AND i.intrastatFk
- GROUP BY i.intrastatFk
- UNION ALL
- SELECT
- NULL AS refFk,
- NULL AS code,
- NULL AS description,
- 0 AS stems,
- 0 AS netKg,
- IF(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0) AS subtotal
- FROM vn.ticketService ts
- JOIN vn.ticket t ON ts.ticketFk = t.id
- WHERE t.refFk = ?) sub
- WHERE io.`ref` = ? AND ios.isCEE
- ORDER BY sub.code;
+ JOIN(
+ SELECT ir.id code,
+ ir.description,
+ iii.stems,
+ iii.net netKg,
+ iii.amount subtotal
+ FROM vn.invoiceInIntrastat iii
+ LEFT JOIN vn.invoiceIn ii ON ii.id = iii.invoiceInFk
+ LEFT JOIN vn.invoiceOut io ON io.ref = ii.supplierRef
+ LEFT JOIN vn.intrastat ir ON ir.id = iii.intrastatFk
+ WHERE io.`ref` = ?
+ UNION ALL
+ SELECT NULL code,
+ 'Servicios' description,
+ 0 stems,
+ 0 netKg,
+ IF(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0) subtotal
+ FROM vn.ticketService ts
+ JOIN vn.ticket t ON ts.ticketFk = t.id
+ WHERE t.refFk = ?
+ ) sub
+ WHERE io.ref = ? AND ios.isCEE
+ ORDER BY sub.code;
|