diff --git a/modules/invoiceIn/back/methods/invoice-in/summary.js b/modules/invoiceIn/back/methods/invoice-in/summary.js
index 265aa06e7..acabe29d9 100644
--- a/modules/invoiceIn/back/methods/invoice-in/summary.js
+++ b/modules/invoiceIn/back/methods/invoice-in/summary.js
@@ -46,6 +46,24 @@ module.exports = Self => {
fields: ['withholding']
}
},
+ {
+ relation: 'invoiceInDueDay',
+ scope: {
+ fields: [
+ 'id',
+ 'invoiceInFk',
+ 'dueDated',
+ 'bankFk',
+ 'amount',
+ 'foreignValue'],
+ include: [{
+ relation: 'bank',
+ scope: {
+ fields: ['bank']
+ }
+ }]
+ }
+ },
{
relation: 'invoiceInTax',
scope: {
diff --git a/modules/invoiceIn/back/models/invoice-in-due-day.json b/modules/invoiceIn/back/models/invoice-in-due-day.json
index 5a66ecd8b..d2cffc81b 100644
--- a/modules/invoiceIn/back/models/invoice-in-due-day.json
+++ b/modules/invoiceIn/back/models/invoice-in-due-day.json
@@ -30,6 +30,13 @@
"created": {
"type": "date"
}
+ },
+ "relations": {
+ "bank": {
+ "type": "belongsTo",
+ "model": "Bank",
+ "foreignKey": "bankFk"
+ }
}
}
diff --git a/modules/invoiceIn/front/dueDay/index.html b/modules/invoiceIn/front/dueDay/index.html
new file mode 100644
index 000000000..579ef3609
--- /dev/null
+++ b/modules/invoiceIn/front/dueDay/index.html
@@ -0,0 +1,68 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/invoiceIn/front/dueDay/index.js b/modules/invoiceIn/front/dueDay/index.js
new file mode 100644
index 000000000..22b697f7e
--- /dev/null
+++ b/modules/invoiceIn/front/dueDay/index.js
@@ -0,0 +1,31 @@
+import ngModule from '../module';
+import Section from 'salix/components/section';
+
+class Controller extends Section {
+ add() {
+ this.$.model.insert({
+ dueDated: new Date(),
+ bankFk: this.vnConfig.local.bankFk
+ });
+ }
+
+ onSubmit() {
+ this.$.watcher.check();
+ this.$.model.save().then(() => {
+ this.$.watcher.notifySaved();
+ this.$.watcher.updateOriginalData();
+ this.card.reload();
+ });
+ }
+}
+
+ngModule.vnComponent('vnInvoiceInDueDay', {
+ template: require('./index.html'),
+ controller: Controller,
+ require: {
+ card: '^vnInvoiceInCard'
+ },
+ bindings: {
+ invoiceIn: '<'
+ }
+});
diff --git a/modules/invoiceIn/front/dueDay/index.spec.js b/modules/invoiceIn/front/dueDay/index.spec.js
new file mode 100644
index 000000000..7dddd3bb0
--- /dev/null
+++ b/modules/invoiceIn/front/dueDay/index.spec.js
@@ -0,0 +1,44 @@
+import './index.js';
+import watcher from 'core/mocks/watcher';
+import crudModel from 'core/mocks/crud-model';
+
+describe('InvoiceIn', () => {
+ describe('Component due day', () => {
+ let controller;
+ let $scope;
+ let vnApp;
+
+ beforeEach(ngModule('invoiceIn'));
+
+ beforeEach(inject(($componentController, $rootScope, _vnApp_) => {
+ vnApp = _vnApp_;
+ jest.spyOn(vnApp, 'showError');
+ $scope = $rootScope.$new();
+ $scope.model = crudModel;
+ $scope.watcher = watcher;
+
+ const $element = angular.element('');
+ controller = $componentController('vnInvoiceInDueDay', {$element, $scope});
+ controller.invoiceIn = {id: 1};
+ }));
+
+ describe('onSubmit()', () => {
+ it('should make HTTP POST request to save due day values', () => {
+ controller.card = {reload: () => {}};
+ jest.spyOn($scope.watcher, 'check');
+ jest.spyOn($scope.watcher, 'notifySaved');
+ jest.spyOn($scope.watcher, 'updateOriginalData');
+ jest.spyOn(controller.card, 'reload');
+ jest.spyOn($scope.model, 'save');
+
+ controller.onSubmit();
+
+ expect($scope.model.save).toHaveBeenCalledWith();
+ expect($scope.watcher.updateOriginalData).toHaveBeenCalledWith();
+ expect($scope.watcher.check).toHaveBeenCalledWith();
+ expect($scope.watcher.notifySaved).toHaveBeenCalledWith();
+ expect(controller.card.reload).toHaveBeenCalledWith();
+ });
+ });
+ });
+});
diff --git a/modules/invoiceIn/front/index.js b/modules/invoiceIn/front/index.js
index 033c4ad69..18e9d73c2 100644
--- a/modules/invoiceIn/front/index.js
+++ b/modules/invoiceIn/front/index.js
@@ -9,5 +9,6 @@ import './descriptor-popover';
import './summary';
import './basic-data';
import './tax';
+import './dueDay';
import './create';
import './log';
diff --git a/modules/invoiceIn/front/locale/es.yml b/modules/invoiceIn/front/locale/es.yml
index 46415480d..1ebfa8fe2 100644
--- a/modules/invoiceIn/front/locale/es.yml
+++ b/modules/invoiceIn/front/locale/es.yml
@@ -1,4 +1,5 @@
Add tax: Añadir iva
+Add due day: Añadir vencimiento
Amounts do not match: La BI no coincide con el vencimiento ni con el total
Due day: Vencimiento
Entries list: Listado de entradas
@@ -9,6 +10,7 @@ InvoiceIn deleted: Factura eliminada
Invoice list: Listado de facturas recibidas
InvoiceIn booked: Factura contabilizada
Remove tax: Quitar iva
+Remove due day: Quitar vencimiento
Sage tax: Sage iva
Sage transaction: Sage transaccion
Search invoices in by reference: Buscar facturas recibidas por referencia
diff --git a/modules/invoiceIn/front/routes.json b/modules/invoiceIn/front/routes.json
index bae496629..0eb6258d3 100644
--- a/modules/invoiceIn/front/routes.json
+++ b/modules/invoiceIn/front/routes.json
@@ -21,7 +21,11 @@
},
{
"state": "invoiceIn.card.tax",
- "icon": "icon-lines"
+ "icon": "icon-tax"
+ },
+ {
+ "state": "invoiceIn.card.dueDay",
+ "icon": "icon-calendar"
},
{
"state": "invoiceIn.card.log",
@@ -95,6 +99,16 @@
},
"acl": ["administrative"]
},
+ {
+ "url": "/dueDay",
+ "state": "invoiceIn.card.dueDay",
+ "component": "vn-invoice-in-due-day",
+ "description": "Due day",
+ "params": {
+ "invoice-in": "$ctrl.invoiceIn"
+ },
+ "acl": ["administrative"]
+ },
{
"url": "/log",
"state": "invoiceIn.card.log",
diff --git a/modules/invoiceIn/front/summary/index.html b/modules/invoiceIn/front/summary/index.html
index a4b7b06ee..ae6d985f8 100644
--- a/modules/invoiceIn/front/summary/index.html
+++ b/modules/invoiceIn/front/summary/index.html
@@ -58,7 +58,7 @@
-
+
+
+
+
+
+
+
+ Date
+ Bank
+ Amount
+ Foreign value
+
+
+
+
+ {{::dueDay.dueDated | date:'dd/MM/yyyy'}}
+ {{::dueDay.bank.bank}}
+ {{::dueDay.amount | currency: 'EUR':2}}
+ {{::dueDay.foreignValue}}
+
+
+
+
+
diff --git a/modules/invoiceIn/front/summary/locale/es.yml b/modules/invoiceIn/front/summary/locale/es.yml
index fbfa5f140..9349a1069 100644
--- a/modules/invoiceIn/front/summary/locale/es.yml
+++ b/modules/invoiceIn/front/summary/locale/es.yml
@@ -8,4 +8,6 @@ Accounted date: Fecha contable
Doc number: Numero documento
Sage withholding: Retención sage
Undeductible VAT: Iva no deducible
-Do not match: No coinciden
\ No newline at end of file
+Do not match: No coinciden
+VAT: IVA
+Due day: Vencimiento
\ No newline at end of file