changed currency filter, fixed tag value errors

This commit is contained in:
Joan Sanchez 2019-01-31 11:44:03 +01:00
parent aac96f4b87
commit 1bcaf27563
59 changed files with 882 additions and 219 deletions

View File

@ -44,7 +44,7 @@ describe('Claim detail', () => {
.waitToGetProperty(selectors.claimDetail.totalClaimed, 'innerText'); .waitToGetProperty(selectors.claimDetail.totalClaimed, 'innerText');
expect(claimedQuantity).toEqual('10'); expect(claimedQuantity).toEqual('10');
expect(totalClaimed).toEqual('29.50 €'); expect(totalClaimed).toContain('29.50');
}); });
it('should delete the second item from the claim', async() => { it('should delete the second item from the claim', async() => {

View File

@ -65,7 +65,7 @@ describe('Client risk path', () => {
expect(company).toEqual('VNL'); expect(company).toEqual('VNL');
expect(firstRiskLineBalance).toEqual('0.00 €'); expect(firstRiskLineBalance).toContain('0.00');
}); });
it('should now click the new payment button', async() => { it('should now click the new payment button', async() => {
@ -91,7 +91,7 @@ describe('Client risk path', () => {
let result = await nightmare let result = await nightmare
.waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText');
expect(result).toEqual('100.00 €'); expect(result).toContain('100.00');
}); });
it('should again click the new payment button', async() => { it('should again click the new payment button', async() => {
@ -117,7 +117,7 @@ describe('Client risk path', () => {
let result = await nightmare let result = await nightmare
.waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText'); .waitToGetProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText');
expect(result).toEqual('-50.00 €'); expect(result).toContain('-€50.00');
}); });
it('should now click on the Clients button of the top bar menu', async() => { it('should now click on the Clients button of the top bar menu', async() => {

View File

@ -73,7 +73,7 @@ describe('Ticket Edit basic data path', () => {
.wait(1900) .wait(1900)
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
expect(result).toContain('-187.75'); expect(result).toContain('-187.75');
}); });
it(`should then click next to move on to step three`, async() => { it(`should then click next to move on to step three`, async() => {

View File

@ -5,15 +5,29 @@ import ngModule from '../module';
* *
* @return {String} The formated number * @return {String} The formated number
*/ */
export default function currency() {
return function(input, symbol, fractionSize) { export default function currency($translate) {
if (!fractionSize) function currency(input, symbol = 'EUR', fractionSize = 2) {
fractionSize = 2; let options = {
if (typeof input == 'number' && fractionSize) { style: 'currency',
input = input.toFixed(fractionSize); currency: symbol,
return `${input} ${symbol}`; minimumFractionDigits: fractionSize,
} maximumFractionDigits: fractionSize
return undefined;
}; };
if (typeof input == 'number') {
return new Intl.NumberFormat($translate.use(), options)
.format(input);
}
return undefined;
}
currency.$stateful = true;
return currency;
} }
currency.$inject = ['$translate'];
ngModule.filter('currency', currency); ngModule.filter('currency', currency);

View File

@ -12,28 +12,28 @@ describe('Currency filter', () => {
}; };
it('should return a ONE decimal number as per the argument', () => { it('should return a ONE decimal number as per the argument', () => {
let html = `<div id="test" >{{200 | currency: '': 1}}</div>`; let html = `<div id="test" >{{200 | currency: 'EUR': 1}}</div>`;
compile(html); compile(html);
expect($element[0].innerHTML).toEqual('200.0 €'); expect($element[0].innerHTML).toContain('200.0');
}); });
it('should return a TWO decimals number as per the argument', () => { it('should return a TWO decimals number as per the argument', () => {
let html = `<div id="test" >{{200 | currency: '': 2}}</div>`; let html = `<div id="test" >{{200 | currency: 'EUR': 2}}</div>`;
compile(html); compile(html);
expect($element[0].innerHTML).toEqual('200.00 €'); expect($element[0].innerHTML).toContain('200.00');
}); });
it('should return a TEN decimals number as per the argument', () => { it('should return a TEN decimals number as per the argument', () => {
let html = `<div id="test" >{{200 | currency: '': 10}}</div>`; let html = `<div id="test" >{{200 | currency: 'EUR': 10}}</div>`;
compile(html); compile(html);
expect($element[0].innerHTML).toEqual('200.0000000000 €'); expect($element[0].innerHTML).toContain('200.0000000000');
}); });
it('sould return nothing when the value is not set', () => { it('sould return nothing when the value is not set', () => {
let html = `<div id="test" >{{null | currency: '': 2}}</div>`; let html = `<div id="test" >{{null | currency: 'EUR': 2}}</div>`;
compile(html); compile(html);
expect($element[0].innerHTML).toEqual(''); expect($element[0].innerHTML).toEqual('');

View File

@ -50,6 +50,7 @@ function backWatch(done) {
nodemon({ nodemon({
exec: commands.join(' && '), exec: commands.join(' && '),
ext: 'js html css',
args: ['backOnly'], args: ['backOnly'],
watch: backSources, watch: backSources,
done: done done: done

View File

@ -30,5 +30,6 @@
"You can't create a ticket for a inactive client": "You can't create a ticket for a inactive client", "You can't create a ticket for a inactive client": "You can't create a ticket for a inactive client",
"Worker cannot be blank": "Worker cannot be blank", "Worker cannot be blank": "Worker cannot be blank",
"You must delete the claim id %d first": "You must delete the claim id %d first", "You must delete the claim id %d first": "You must delete the claim id %d first",
"You don't have enough privileges": "You don't have enough privileges" "You don't have enough privileges": "You don't have enough privileges",
"Tag value cannot be blank": "Tag value cannot be blank"
} }

View File

@ -35,10 +35,10 @@
value="{{$ctrl.zone.travelingDays}}"> value="{{$ctrl.zone.travelingDays}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Price" <vn-label-value label="Price"
value="{{$ctrl.zone.price | currency: '': 2}}"> value="{{$ctrl.zone.price | currency: 'EUR': 2}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Bonus" <vn-label-value label="Bonus"
value="{{$ctrl.zone.price | currency: '': 2}}"> value="{{$ctrl.zone.price | currency: 'EUR': 2}}">
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
</div> </div>

View File

@ -37,7 +37,7 @@
<vn-td>{{::zone.agencyMode.name}}</vn-td> <vn-td>{{::zone.agencyMode.name}}</vn-td>
<vn-td>{{::zone.warehouse.name}}</vn-td> <vn-td>{{::zone.warehouse.name}}</vn-td>
<vn-td>{{::zone.hour | date: 'HH:mm'}}</vn-td> <vn-td>{{::zone.hour | date: 'HH:mm'}}</vn-td>
<vn-td number>{{::zone.price | currency:'€':2}}</vn-td> <vn-td number>{{::zone.price | currency: 'EUR':2}}</vn-td>
<vn-td> <vn-td>
<vn-icon-button <vn-icon-button
ng-click="$ctrl.preview($event, zone)" ng-click="$ctrl.preview($event, zone)"

View File

@ -24,10 +24,10 @@
value="{{::$ctrl.summary.travelingDays}}"> value="{{::$ctrl.summary.travelingDays}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Price" <vn-label-value label="Price"
value="{{::$ctrl.summary.price | currency: '': 2}}"> value="{{::$ctrl.summary.price | currency: 'EUR': 2}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Bonus" <vn-label-value label="Bonus"
value="{{::$ctrl.summary.price | currency: '': 2}}"> value="{{::$ctrl.summary.price | currency: 'EUR': 2}}">
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>

View File

@ -10,7 +10,7 @@
<vn-horizontal> <vn-horizontal>
<div class="totalBox" ng-show="$ctrl.salesClaimed.length > 0"> <div class="totalBox" ng-show="$ctrl.salesClaimed.length > 0">
<vn-label-value label="Total claimed" <vn-label-value label="Total claimed"
value="{{$ctrl.claimedTotal | currency:'€':2}}"> value="{{$ctrl.claimedTotal | currency: 'EUR':2}}">
</vn-label-value> </vn-label-value>
</div> </div>
</vn-horizontal> </vn-horizontal>
@ -75,12 +75,12 @@
<vn-td number>{{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td> <vn-td number>{{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{saleClaimed.sale.quantity}}</vn-td> <vn-td number>{{saleClaimed.sale.quantity}}</vn-td>
<vn-td number>{{saleClaimed.sale.concept}}</vn-td> <vn-td number>{{saleClaimed.sale.concept}}</vn-td>
<vn-td number>{{saleClaimed.sale.price | currency:'€':2}}</vn-td> <vn-td number>{{saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{saleClaimed.sale.discount}} %</vn-td> <vn-td number>{{saleClaimed.sale.discount}} %</vn-td>
<vn-td number> <vn-td number>
{{(saleClaimed.sale.quantity * saleClaimed.sale.price) - {{(saleClaimed.sale.quantity * saleClaimed.sale.price) -
((saleClaimed.sale.discount * ((saleClaimed.sale.discount *
(saleClaimed.sale.quantity * saleClaimed.sale.price))/100) | currency:'€':2 (saleClaimed.sale.quantity * saleClaimed.sale.price))/100) | currency: 'EUR':2
}} }}
</vn-td> </vn-td>
<vn-td number> <vn-td number>
@ -138,10 +138,10 @@
<vn-td number>{{sale.landed | dateTime: 'dd/MM/yyyy'}}</vn-td> <vn-td number>{{sale.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{sale.quantity}}</vn-td> <vn-td number>{{sale.quantity}}</vn-td>
<vn-td number>{{sale.concept}}</vn-td> <vn-td number>{{sale.concept}}</vn-td>
<vn-td number>{{sale.price | currency:'€':2}}</vn-td> <vn-td number>{{sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{sale.discount}} %</vn-td> <vn-td number>{{sale.discount}} %</vn-td>
<vn-td number> <vn-td number>
{{(sale.quantity * sale.price) - ((sale.discount * (sale.quantity * sale.price))/100) | currency:'€':2}} {{(sale.quantity * sale.price) - ((sale.discount * (sale.quantity * sale.price))/100) | currency: 'EUR':2}}
</vn-td> </vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>

View File

@ -12,10 +12,10 @@
<vn-horizontal> <vn-horizontal>
<div class="totalBox"> <div class="totalBox">
<vn-label-value label="Total" <vn-label-value label="Total"
value="{{$ctrl.paidTotal | currency:'€':2}}"> value="{{$ctrl.paidTotal | currency: 'EUR':2}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Total claimed" <vn-label-value label="Total claimed"
value="{{$ctrl.claimedTotal | currency:'€':2}}"> value="{{$ctrl.claimedTotal | currency: 'EUR':2}}">
</vn-label-value> </vn-label-value>
</div> </div>
</vn-horizontal> </vn-horizontal>
@ -52,10 +52,10 @@
</vn-textfield> </vn-textfield>
</vn-td> </vn-td>
<vn-td>{{::saleClaimed.sale.concept}}</vn-td> <vn-td>{{::saleClaimed.sale.concept}}</vn-td>
<vn-td number>{{::saleClaimed.sale.price | currency:'€':2}}</vn-td> <vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{::saleClaimed.sale.discount}} %</vn-td> <vn-td number>{{::saleClaimed.sale.discount}} %</vn-td>
<vn-td number> <vn-td number>
{{::$ctrl.getSaleTotal(saleClaimed.sale) | currency:'€':2}} {{::$ctrl.getSaleTotal(saleClaimed.sale) | currency: 'EUR':2}}
</vn-td> </vn-td>
<vn-td number> <vn-td number>
<vn-icon-button <vn-icon-button
@ -104,10 +104,10 @@
<vn-td number>{{sale.landed | dateTime: 'dd/MM/yyyy'}}</vn-td> <vn-td number>{{sale.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{sale.quantity}}</vn-td> <vn-td number>{{sale.quantity}}</vn-td>
<vn-td number>{{sale.concept}}</vn-td> <vn-td number>{{sale.concept}}</vn-td>
<vn-td number>{{sale.price | currency:'€':2}}</vn-td> <vn-td number>{{sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{sale.discount}} %</vn-td> <vn-td number>{{sale.discount}} %</vn-td>
<vn-td number> <vn-td number>
{{(sale.quantity * sale.price) - ((sale.discount * (sale.quantity * sale.price))/100) | currency:'€':2}} {{(sale.quantity * sale.price) - ((sale.discount * (sale.quantity * sale.price))/100) | currency: 'EUR':2}}
</vn-td> </vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>

View File

@ -63,12 +63,12 @@
<vn-td number>{{saleClaimed.sale.quantity}}</vn-td> <vn-td number>{{saleClaimed.sale.quantity}}</vn-td>
<vn-td number>{{saleClaimed.quantity}}</vn-td> <vn-td number>{{saleClaimed.quantity}}</vn-td>
<vn-td>{{saleClaimed.sale.concept}}</vn-td> <vn-td>{{saleClaimed.sale.concept}}</vn-td>
<vn-td number>{{saleClaimed.sale.price | currency:'€':2}}</vn-td> <vn-td number>{{saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{saleClaimed.sale.discount}} %</vn-td> <vn-td number>{{saleClaimed.sale.discount}} %</vn-td>
<vn-td number> <vn-td number>
{{(saleClaimed.sale.quantity * saleClaimed.sale.price) - {{(saleClaimed.sale.quantity * saleClaimed.sale.price) -
((saleClaimed.sale.discount * ((saleClaimed.sale.discount *
(saleClaimed.sale.quantity * saleClaimed.sale.price))/100) | currency:'€':2 (saleClaimed.sale.quantity * saleClaimed.sale.price))/100) | currency: 'EUR':2
}} }}
</vn-td> </vn-td>
</vn-tr> </vn-tr>
@ -138,7 +138,7 @@
<vn-td number> <vn-td number>
{{(action.sale.quantity * action.sale.price) - {{(action.sale.quantity * action.sale.price) -
((action.sale.discount * ((action.sale.discount *
(action.sale.quantity * action.sale.price))/100) | currency:'€':2 (action.sale.quantity * action.sale.price))/100) | currency: 'EUR':2
}} }}
</vn-td> </vn-td>
</vn-tr> </vn-tr>

View File

@ -18,7 +18,7 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="insurance in insurances"> <vn-tr ng-repeat="insurance in insurances">
<vn-td number>{{::insurance.credit | currency: '': 2}}</vn-td> <vn-td number>{{::insurance.credit | currency: 'EUR': 2}}</vn-td>
<vn-td number>{{::insurance.grade}}</vn-td> <vn-td number>{{::insurance.grade}}</vn-td>
<vn-td>{{::insurance.created | date: 'dd/MM/yyyy'}}</vn-td> <vn-td>{{::insurance.created | date: 'dd/MM/yyyy'}}</vn-td>
</vn-tr> </vn-tr>

View File

@ -27,10 +27,10 @@
value="{{$ctrl.client.phone | phone}}"> value="{{$ctrl.client.phone | phone}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Credit" <vn-label-value label="Credit"
value="{{$ctrl.client.credit | currency: '': 2}}"> value="{{$ctrl.client.credit | currency: 'EUR': 2}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Secured credit" <vn-label-value label="Secured credit"
value="{{$ctrl.client.creditInsurance | currency: '': 2}}"> value="{{$ctrl.client.creditInsurance | currency: 'EUR': 2}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Sales person" <vn-label-value label="Sales person"
value="{{$ctrl.client.salesPerson.firstName}} {{$ctrl.client.salesPerson.name}}"> value="{{$ctrl.client.salesPerson.firstName}} {{$ctrl.client.salesPerson.name}}">

View File

@ -15,7 +15,7 @@
<vn-horizontal> <vn-horizontal>
<div class="totalBox" ng-if="model.data.length > 0"> <div class="totalBox" ng-if="model.data.length > 0">
<vn-label-value label="Total" <vn-label-value label="Total"
value="{{edit.model.sumAmount | currency: '': 2}}"> value="{{edit.model.sumAmount | currency: 'EUR': 2}}">
</vn-label-value> </vn-label-value>
</div> </div>
</vn-horizontal> </vn-horizontal>
@ -33,7 +33,7 @@
<vn-tr ng-repeat="greuge in greuges"> <vn-tr ng-repeat="greuge in greuges">
<vn-td>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-td> <vn-td>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-td>
<vn-td>{{::greuge.description}}</vn-td> <vn-td>{{::greuge.description}}</vn-td>
<vn-td>{{::greuge.amount | currency: '': 2}}</vn-td> <vn-td>{{::greuge.amount | currency: 'EUR': 2}}</vn-td>
<vn-td>{{::greuge.greugeType.name}}</vn-td> <vn-td>{{::greuge.greugeType.name}}</vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>

View File

@ -32,7 +32,7 @@
</vn-td> </vn-td>
<vn-td>{{::recovery.started | date:'dd/MM/yyyy' }}</vn-td> <vn-td>{{::recovery.started | date:'dd/MM/yyyy' }}</vn-td>
<vn-td>{{recovery.finished | date:'dd/MM/yyyy' }}</vn-td> <vn-td>{{recovery.finished | date:'dd/MM/yyyy' }}</vn-td>
<vn-td>{{::recovery.amount | currency:' €': 0}}</vn-td> <vn-td>{{::recovery.amount | currency: 'EUR': 0}}</vn-td>
<vn-td>{{::recovery.period}}</vn-td> <vn-td>{{::recovery.period}}</vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>

View File

@ -34,7 +34,7 @@
<vn-auto ng-repeat="riskByCompany in riskTotal"> <vn-auto ng-repeat="riskByCompany in riskTotal">
<vn-label-value <vn-label-value
label="{{riskByCompany.company.code}}" label="{{riskByCompany.company.code}}"
value="{{riskByCompany.amount | currency:'€':2}}"> value="{{riskByCompany.amount | currency: 'EUR':2}}">
</vn-label-value> </vn-label-value>
</vn-auto> </vn-auto>
</div> </div>
@ -65,9 +65,9 @@
<span ng-show="risk.ref" translate>BILL</span> {{::risk.ref}} <span ng-show="risk.ref" translate>BILL</span> {{::risk.ref}}
</vn-td> </vn-td>
<vn-td number>{{::risk.bankFk}}</vn-td> <vn-td number>{{::risk.bankFk}}</vn-td>
<vn-td number>{{::risk.debit | currency:'€':2}}</vn-td> <vn-td number>{{::risk.debit | currency: 'EUR':2}}</vn-td>
<vn-td number>{{::risk.credit | currency:'€':2}}</vn-td> <vn-td number>{{::risk.credit | currency: 'EUR':2}}</vn-td>
<vn-td number>{{risk.balance | currency:'€':2}}</vn-td> <vn-td number>{{risk.balance | currency: 'EUR':2}}</vn-td>
<vn-td center> <vn-td center>
<vn-check <vn-check
field="risk.isConciliate" field="risk.isConciliate"

View File

@ -149,16 +149,16 @@
<vn-one> <vn-one>
<h4 translate>Business data</h4> <h4 translate>Business data</h4>
<vn-label-value label="Total greuge" <vn-label-value label="Total greuge"
value="{{$ctrl.summary.totalGreuge | currency:'€':2}}"> value="{{$ctrl.summary.totalGreuge | currency: 'EUR':2}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Mana" <vn-label-value label="Mana"
value="{{$ctrl.summary.mana.mana | currency:'€':2}}"> value="{{$ctrl.summary.mana.mana | currency: 'EUR':2}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Rate" <vn-label-value label="Rate"
value="{{$ctrl.summary.claimsRatio[0].priceIncreasing | percentage}}"> value="{{$ctrl.summary.claimsRatio[0].priceIncreasing | percentage}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Average invoiced" <vn-label-value label="Average invoiced"
value="{{$ctrl.summary.averageInvoiced.invoiced | currency:'€':2}}"> value="{{$ctrl.summary.averageInvoiced.invoiced | currency: 'EUR':2}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Claims" <vn-label-value label="Claims"
value="{{$ctrl.summary.claimsRatio[0].claimingRate | percentage}}"> value="{{$ctrl.summary.claimsRatio[0].claimingRate | percentage}}">
@ -167,26 +167,26 @@
<vn-one> <vn-one>
<h4 translate>Financial information</h4> <h4 translate>Financial information</h4>
<vn-label-value label="Risk" <vn-label-value label="Risk"
value="{{$ctrl.summary.debt.debt | currency:'€':2}}" value="{{$ctrl.summary.debt.debt | currency: 'EUR':2}}"
ng-class="{alert: $ctrl.summary.debt.debt > $ctrl.summary.credit}" ng-class="{alert: $ctrl.summary.debt.debt > $ctrl.summary.credit}"
info="Invoices minus payments plus orders not yet invoiced"> info="Invoices minus payments plus orders not yet invoiced">
</vn-label-value> </vn-label-value>
<vn-label-value label="Credit" <vn-label-value label="Credit"
value="{{$ctrl.summary.credit | currency:'€':2 }} " value="{{$ctrl.summary.credit | currency: 'EUR':2 }} "
ng-class="{alert: $ctrl.summary.credit > $ctrl.summary.creditInsurance || ng-class="{alert: $ctrl.summary.credit > $ctrl.summary.creditInsurance ||
($ctrl.summary.credit && $ctrl.summary.creditInsurance == null)}" ($ctrl.summary.credit && $ctrl.summary.creditInsurance == null)}"
info="Verdnatura's maximum risk"> info="Verdnatura's maximum risk">
</vn-label-value> </vn-label-value>
<vn-label-value label="Secured credit" <vn-label-value label="Secured credit"
value="{{$ctrl.summary.creditInsurance | currency:'€':2}} ({{$ctrl.summary.classifications[0].insurances[0].grade}})" value="{{$ctrl.summary.creditInsurance | currency: 'EUR':2}} ({{$ctrl.summary.classifications[0].insurances[0].grade}})"
info="Solunion's maximum risk"> info="Solunion's maximum risk">
</vn-label-value> </vn-label-value>
<vn-label-value label="Balance" <vn-label-value label="Balance"
value="{{$ctrl.summary.sumRisk | currency:'€':2}}" value="{{$ctrl.summary.sumRisk | currency: 'EUR':2}}"
info="Invoices minus payments"> info="Invoices minus payments">
</vn-label-value> </vn-label-value>
<vn-label-value label="Balance due" <vn-label-value label="Balance due"
value="{{$ctrl.summary.defaulters[0].amount | currency:'€':2}}" value="{{$ctrl.summary.defaulters[0].amount | currency: 'EUR':2}}"
ng-class="{alert: $ctrl.summary.defaulters[0].amount}" ng-class="{alert: $ctrl.summary.defaulters[0].amount}"
info="Deviated invoices minus payments"> info="Deviated invoices minus payments">
</vn-label-value> </vn-label-value>

View File

@ -33,7 +33,7 @@
</vn-icon> </vn-icon>
</vn-td> </vn-td>
<vn-td>{{::transaction.id}}</vn-td> <vn-td>{{::transaction.id}}</vn-td>
<vn-td number>{{::transaction.amount | currency: '':2}}</vn-td> <vn-td number>{{::transaction.amount | currency: 'EUR':2}}</vn-td>
<vn-td>{{::transaction.created | dateTime:'dd/MM/yyyy'}}</vn-td> <vn-td>{{::transaction.created | dateTime:'dd/MM/yyyy'}}</vn-td>
<vn-td style="width: 3em; text-align: center"> <vn-td style="width: 3em; text-align: center">
<vn-icon-button <vn-icon-button

View File

@ -3,7 +3,11 @@ let UserError = require('vn-loopback/util/user-error');
module.exports = Self => { module.exports = Self => {
require('../methods/item-tag/filterItemTags')(Self); require('../methods/item-tag/filterItemTags')(Self);
Self.validatesPresenceOf('value', {message: 'Tag value cannot be blank'}); Self.rewriteDbError(function(err) {
if (err.code === 'ER_BAD_NULL_ERROR')
return new UserError(`Tag value cannot be blank`);
return err;
});
Self.rewriteDbError(function(err) { Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY') if (err.code === 'ER_DUP_ENTRY')

View File

@ -74,7 +74,7 @@
<vn-one> <vn-one>
<span>{{::item.available}}</span> <span>{{::item.available}}</span>
<span translate>from</span> <span translate>from</span>
<span>{{::item.price | currency: '': 2}}</span> <span>{{::item.price | currency: 'EUR': 2}}</span>
</vn-one> </vn-one>
<vn-auto> <vn-auto>
<a href="" vn-tooltip="Add"> <a href="" vn-tooltip="Add">

View File

@ -35,7 +35,7 @@
value="{{$ctrl.order.rows.length || 0}}"> value="{{$ctrl.order.rows.length || 0}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Total" <vn-label-value label="Total"
value="{{$ctrl.order.total | currency: '': 2}}"> value="{{$ctrl.order.total | currency: 'EUR': 2}}">
</vn-label-value> </vn-label-value>
</div> </div>
<div class="quicklinks"> <div class="quicklinks">

View File

@ -8,13 +8,13 @@
<vn-horizontal> <vn-horizontal>
<div class="totalBox"> <div class="totalBox">
<vn-label translate>Subtotal</vn-label> <vn-label translate>Subtotal</vn-label>
<span>{{$ctrl.subtotal | currency:'€':2}}</span> <span>{{$ctrl.subtotal | currency: 'EUR':2}}</span>
<p> <p>
<vn-label translate>VAT</vn-label> <vn-label translate>VAT</vn-label>
<span>{{$ctrl.VAT | currency:'€':2}}</span> <span>{{$ctrl.VAT | currency: 'EUR':2}}</span>
</p> </p>
<vn-label><strong>Total</strong></vn-label> <vn-label><strong>Total</strong></vn-label>
<strong>{{$ctrl.order.total | currency:'€':2}}</strong> <strong>{{$ctrl.order.total | currency: 'EUR':2}}</strong>
</div> </div>
</vn-horizontal> </vn-horizontal>
<vn-table> <vn-table>
@ -49,7 +49,7 @@
<vn-td>{{row.shipped | date: 'dd/MM/yyyy'}}</vn-td> <vn-td>{{row.shipped | date: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{row.quantity}}</vn-td> <vn-td number>{{row.quantity}}</vn-td>
<vn-td number> <vn-td number>
{{row.price | currency:'€':2}} {{row.price | currency: 'EUR':2}}
</vn-td> </vn-td>
<vn-td ng-if="!$ctrl.order.isConfirmed"> <vn-td ng-if="!$ctrl.order.isConfirmed">
<vn-icon-button <vn-icon-button

View File

@ -39,7 +39,7 @@
ng-repeat="price in $ctrl.prices"> ng-repeat="price in $ctrl.prices">
<vn-one class="ellipsize text" title="{{::price.warehouse}}">{{::price.warehouse}}</vn-one> <vn-one class="ellipsize text" title="{{::price.warehouse}}">{{::price.warehouse}}</vn-one>
<vn-one class="number text"> <vn-one class="number text">
<span orange ng-click="$ctrl.addQuantity(price)" class="link unselectable">{{::price.grouping}}</span><span> x {{::price.price | currency: '': 2}}</span> <span orange ng-click="$ctrl.addQuantity(price)" class="link unselectable">{{::price.grouping}}</span><span> x {{::price.price | currency: 'EUR': 2}}</span>
</vn-one> </vn-one>
<vn-one> <vn-one>
<vn-input-number <vn-input-number

View File

@ -34,9 +34,9 @@
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-one class="taxes"> <vn-one class="taxes">
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.summary.subTotal | currency:' €':2}}</p> <p><vn-label translate>Subtotal</vn-label> {{$ctrl.summary.subTotal | currency: 'EUR':2}}</p>
<p><vn-label translate>VAT</vn-label> {{$ctrl.summary.VAT | currency:' €':2}}</p> <p><vn-label translate>VAT</vn-label> {{$ctrl.summary.VAT | currency: 'EUR':2}}</p>
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.summary.total | currency:' €':2}}</strong></p> <p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.summary.total | currency: 'EUR':2}}</strong></p>
</vn-one> </vn-one>
<vn-auto> <vn-auto>
<table class="vn-grid"> <table class="vn-grid">
@ -70,8 +70,8 @@
</td> </td>
<td><vn-fetched-tags max-length="6" item="row.item"/></td> <td><vn-fetched-tags max-length="6" item="row.item"/></td>
<td number>{{::row.quantity}}</td> <td number>{{::row.quantity}}</td>
<td number>{{::row.price | currency:'€':2}}</td> <td number>{{::row.price | currency: 'EUR':2}}</td>
<td number>{{::row.quantity * row.price | currency:'€':2}}</td> <td number>{{::row.quantity * row.price | currency: 'EUR':2}}</td>
</tr> </tr>
<tr ng-if="!$ctrl.summary.rows" class="list list-element"> <tr ng-if="!$ctrl.summary.rows" class="list list-element">
<td colspan="8" style="text-align: center" translate>No results</td> <td colspan="8" style="text-align: center" translate>No results</td>

View File

@ -24,17 +24,17 @@
<tfoot> <tfoot>
<tr> <tr>
<td number colspan="7"> <td number colspan="7">
<span translate>Base</span> {{$ctrl.base() | currency:'€':3}} <span translate>Base</span> {{$ctrl.base() | currency: 'EUR':3}}
</td> </td>
</tr> </tr>
<tr> <tr>
<td number colspan="7"> <td number colspan="7">
<span translate>Margin</span> {{$ctrl.profitMargin() | currency:'€':3}} <span translate>Margin</span> {{$ctrl.profitMargin() | currency: 'EUR':3}}
</td> </td>
</tr> </tr>
<tr> <tr>
<td number colspan="7"> <td number colspan="7">
<span translate>Total</span> {{$ctrl.total() | currency:'€':3}} <span translate>Total</span> {{$ctrl.total() | currency: 'EUR':3}}
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
@ -66,10 +66,10 @@
}">{{::component.componentRate.name}}</td> }">{{::component.componentRate.name}}</td>
<td ng-class="::{ <td ng-class="::{
first: $index == 0,last: $index == sale.components.length - 1 first: $index == 0,last: $index == sale.components.length - 1
}" number>{{::component.value | currency:'€':3}}</td> }" number>{{::component.value | currency: 'EUR':3}}</td>
<td ng-class="::{ <td ng-class="::{
first: $index == 0,last: $index == sale.components.length - 1 first: $index == 0,last: $index == sale.components.length - 1
}" number>{{::sale.quantity * component.value | currency:'€':3}}</td> }" number>{{::sale.quantity * component.value | currency: 'EUR':3}}</td>
</tr> </tr>
<tr ng-if="model.data.length === 0" class="list list-element"> <tr ng-if="model.data.length === 0" class="list list-element">
<td colspan="7" style="text-align: center" translate>No results</td> <td colspan="7" style="text-align: center" translate>No results</td>

View File

@ -17,17 +17,17 @@
<td number>{{("000000"+sale.itemFk).slice(-6)}}</td> <td number>{{("000000"+sale.itemFk).slice(-6)}}</td>
<td><vn-fetched-tags max-length="6" item="sale.item"/></td> <td><vn-fetched-tags max-length="6" item="sale.item"/></td>
<td number>{{::sale.quantity}}</td> <td number>{{::sale.quantity}}</td>
<td number>{{::sale.price | currency: '': 2}}</td> <td number>{{::sale.price | currency: 'EUR': 2}}</td>
<td number>{{::sale.component.newPrice | currency: '': 2}}</td> <td number>{{::sale.component.newPrice | currency: 'EUR': 2}}</td>
<td number>{{::sale.component.difference | currency: '': 2}}</td> <td number>{{::sale.component.difference | currency: 'EUR': 2}}</td>
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="3"></td> <td colspan="3"></td>
<td number><strong>{{$ctrl.totalPrice | currency: '': 2}}</strong></td> <td number><strong>{{$ctrl.totalPrice | currency: 'EUR': 2}}</strong></td>
<td number><strong>{{$ctrl.totalNewPrice | currency: '': 2}}</strong></td> <td number><strong>{{$ctrl.totalNewPrice | currency: 'EUR': 2}}</strong></td>
<td number><strong>{{$ctrl.totalPriceDifference | currency: '': 2}}</strong></td> <td number><strong>{{$ctrl.totalPriceDifference | currency: 'EUR': 2}}</strong></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View File

@ -73,7 +73,7 @@
<vn-td class="{{$ctrl.stateColor(ticket)}}">{{::ticket.state}}</vn-td> <vn-td class="{{$ctrl.stateColor(ticket)}}">{{::ticket.state}}</vn-td>
<vn-td>{{::ticket.agencyMode}}</vn-td> <vn-td>{{::ticket.agencyMode}}</vn-td>
<vn-td>{{::ticket.warehouse}}</vn-td> <vn-td>{{::ticket.warehouse}}</vn-td>
<vn-td number>{{::ticket.total | currency: '': 2}}</vn-td> <vn-td number>{{::ticket.total | currency: 'EUR': 2}}</vn-td>
<vn-td> <vn-td>
<vn-icon-button <vn-icon-button
ng-click="$ctrl.preview($event, ticket)" ng-click="$ctrl.preview($event, ticket)"

View File

@ -51,7 +51,7 @@
<vn-one> <vn-one>
<span>{{::sale.quantity}}</span> <span>{{::sale.quantity}}</span>
<span translate>by</span> <span translate>by</span>
<span>{{::sale.price | currency: '': 2}}</span> <span>{{::sale.price | currency: 'EUR': 2}}</span>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>

View File

@ -37,7 +37,7 @@
<vn-td>{{::request.requester.user.name}}</vn-td> <vn-td>{{::request.requester.user.name}}</vn-td>
<vn-td>{{::request.atender.user.name}}</vn-td> <vn-td>{{::request.atender.user.name}}</vn-td>
<vn-td number>{{::request.quantity}}</vn-td> <vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price | currency: '': 2}}</vn-td> <vn-td number>{{::request.price | currency: 'EUR': 2}}</vn-td>
<vn-td number> <vn-td number>
<span <span
ng-show="::request.saleFk" ng-show="::request.saleFk"

View File

@ -1,5 +1,5 @@
<vn-horizontal pad-medium class="header"> <vn-horizontal pad-medium class="header">
<h5>MANÁ: {{$ctrl.mana | currency:' €':0}}</h5> <h5>MANÁ: {{$ctrl.mana | currency: 'EUR':0}}</h5>
</vn-horizontal> </vn-horizontal>
<div pad-medium> <div pad-medium>
<vn-textfield <vn-textfield
@ -15,6 +15,6 @@
<p class="simulatorTitle" translate>New price</p> <p class="simulatorTitle" translate>New price</p>
<p>{{($ctrl.edit[0].quantity * $ctrl.edit[0].price) <p>{{($ctrl.edit[0].quantity * $ctrl.edit[0].price)
- (($ctrl.newDiscount * ($ctrl.edit[0].quantity * $ctrl.edit[0].price))/100) - (($ctrl.newDiscount * ($ctrl.edit[0].quantity * $ctrl.edit[0].price))/100)
| currency:' €':2}}</p> | currency: 'EUR':2}}</p>
</div> </div>
</div> </div>

View File

@ -116,10 +116,10 @@
ng-click="$ctrl.showEditPricePopover($event, sale)" ng-click="$ctrl.showEditPricePopover($event, sale)"
pointer pointer
vn-tooltip="Edit price"> vn-tooltip="Edit price">
{{sale.price | currency:'€':2}} {{sale.price | currency: 'EUR':2}}
</vn-td> </vn-td>
<vn-td number ng-if="!$ctrl.isEditable"> <vn-td number ng-if="!$ctrl.isEditable">
{{sale.price | currency:'€':2}} {{sale.price | currency: 'EUR':2}}
</vn-td> </vn-td>
<vn-td number <vn-td number
ng-if="$ctrl.isEditable" ng-if="$ctrl.isEditable"
@ -134,7 +134,7 @@
{{sale.discount}} % {{sale.discount}} %
</vn-td> </vn-td>
<vn-td number> <vn-td number>
{{$ctrl.getSaleTotal(sale) | currency:'€':2}} {{$ctrl.getSaleTotal(sale) | currency: 'EUR':2}}
</vn-td> </vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>
@ -146,15 +146,15 @@
ng-if="$ctrl.sales.length > 0"> ng-if="$ctrl.sales.length > 0">
<p> <p>
<vn-label translate>Subtotal</vn-label> <vn-label translate>Subtotal</vn-label>
<span>{{$ctrl.subTotal | currency:'€':2}}</span> <span>{{$ctrl.subTotal | currency: 'EUR':2}}</span>
</p> </p>
<p> <p>
<vn-label translate>VAT</vn-label> <vn-label translate>VAT</vn-label>
<span>{{$ctrl.VAT | currency:'€':2}}</span> <span>{{$ctrl.VAT | currency: 'EUR':2}}</span>
</p> </p>
<p> <p>
<vn-label><strong>Total</strong></vn-label> <vn-label><strong>Total</strong></vn-label>
<strong>{{$ctrl.total | currency:'€':2}}</strong> <strong>{{$ctrl.total | currency: 'EUR':2}}</strong>
</p> </p>
</div> </div>
</vn-vertical> </vn-vertical>
@ -169,7 +169,7 @@
vn-id="editPricePopover" vn-id="editPricePopover"
on-open="$ctrl.getManaSalespersonMana()"> on-open="$ctrl.getManaSalespersonMana()">
<vn-horizontal pad-medium class="header"> <vn-horizontal pad-medium class="header">
<h5>MANÁ: {{$ctrl.mana | currency:'€':0}}</h5> <h5>MANÁ: {{$ctrl.mana | currency: 'EUR':0}}</h5>
</vn-horizontal> </vn-horizontal>
<div pad-medium> <div pad-medium>
<vn-textfield <vn-textfield
@ -185,7 +185,7 @@
<p class="simulatorTitle" translate>New price</p> <p class="simulatorTitle" translate>New price</p>
<p>{{($ctrl.sale.quantity * $ctrl.editedPrice) <p>{{($ctrl.sale.quantity * $ctrl.editedPrice)
- (($ctrl.sale.discount * ($ctrl.sale.quantity * $ctrl.editedPrice))/100) - (($ctrl.sale.discount * ($ctrl.sale.quantity * $ctrl.editedPrice))/100)
| currency:'€':2}}</p> | currency: 'EUR':2}}</p>
</div> </div>
</div> </div>
</vn-popover> </vn-popover>

View File

@ -46,9 +46,9 @@
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-one class="taxes"> <vn-one class="taxes">
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.summary.subTotal | currency:' €':2}}</p> <p><vn-label translate>Subtotal</vn-label> {{$ctrl.summary.subTotal | currency: 'EUR':2}}</p>
<p><vn-label translate>VAT</vn-label> {{$ctrl.summary.VAT | currency:' €':2}}</p> <p><vn-label translate>VAT</vn-label> {{$ctrl.summary.VAT | currency: 'EUR':2}}</p>
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.summary.total | currency:' €':2}}</strong></p> <p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.summary.total | currency: 'EUR':2}}</strong></p>
</vn-one> </vn-one>
<vn-auto name="sales"> <vn-auto name="sales">
<h4 translate>Sale</h4> <h4 translate>Sale</h4>
@ -92,9 +92,9 @@
</vn-td> </vn-td>
<vn-td><vn-fetched-tags max-length="6" item="sale.item" title="sale.concept"/></vn-td> <vn-td><vn-fetched-tags max-length="6" item="sale.item" title="sale.concept"/></vn-td>
<vn-td number>{{::sale.quantity}}</vn-td> <vn-td number>{{::sale.quantity}}</vn-td>
<vn-td number>{{::sale.price | currency:'€':2}}</vn-td> <vn-td number>{{::sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{::sale.discount}} %</vn-td> <vn-td number>{{::sale.discount}} %</vn-td>
<vn-td number>{{::sale.quantity * sale.price | currency:'€':2}}</vn-td> <vn-td number>{{::sale.quantity * sale.price | currency: 'EUR':2}}</vn-td>
</vn-tr> </vn-tr>
<vn-tr ng-if="!$ctrl.summary.sales" class="list list-element"> <vn-tr ng-if="!$ctrl.summary.sales" class="list list-element">
<vn-td colspan="8" style="text-align: center" translate>No results</vn-td> <vn-td colspan="8" style="text-align: center" translate>No results</vn-td>

View File

@ -34,8 +34,8 @@
} }
.row { .row {
margin-bottom: 15px; white-space: nowrap;
overflow: hidden margin-bottom: 15px
} }
.row.small { .row.small {
@ -52,10 +52,6 @@
box-sizing: border-box box-sizing: border-box
} }
.row .text, .row .control {
overflow: hidden
}
.row .description { .row .description {
position: relative; position: relative;
padding-top: 2px; padding-top: 2px;
@ -87,17 +83,18 @@
} }
.row.inline .text { .row.inline .text {
display: inline-block;
margin-bottom: 0; margin-bottom: 0;
width: 40%; width: 40%;
float: left
} }
.row.inline .control { .row.inline .control {
display: inline-block;
font-weight: bold; font-weight: bold;
padding-left: 20px; padding-left: 20px;
color: #000; color: #000;
width: 60%; width: 60%
float: left
} }
.row.inline .description { .row.inline .description {
@ -105,36 +102,29 @@
overflow: visible overflow: visible
} }
.grid {
border-bottom: 3px solid #888888
}
.grid .row {
padding: 5px;
margin-bottom: 0
}
.grid .header {
border-bottom: 1px solid #808080;
border-top: 1px solid #808080;
font-weight: bold
}
.grid .row.inline > section {
float: left;
}
.panel { .panel {
border: 1px solid #DDD; position: relative
margin-bottom: 10px;
position: relative;
padding:20px
} }
.panel .header { .panel .header {
background-color: #FFF; background-color: #FFF;
position:absolute;
left: 17.5px;
top: -12px;
padding: 2.5px 5px;
font-weight: bold; font-weight: bold;
margin-top: -20px }
.panel .body {
border: 1px solid #CCC;
margin-top: 10px;
overflow: hidden;
padding: 20px
}
.panel .body h3 {
margin-top: 0
} }
.box { .box {
@ -162,3 +152,54 @@
.pull-right { .pull-right {
float: right float: right
} }
.verticalText {
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
position: absolute;
text-align: center;
font-size: .65em;
width: 200px;
border: 2px solid #000;
right: -110px;
top: 50%
}
vn-table {
border-collapse: collapse;
margin: 20px 0;
display: table;
width: 100%;
}
vn-thead {
border-bottom: 1px solid #808080;
border-top: 1px solid #808080;
display: table-header-group
}
vn-tbody {
border-top: 3px solid #888888;
display: table-row-group
}
vn-tfoot {
border-top: 1px solid #808080;
display: table-footer-group
}
vn-tr {
display: table-row
}
vn-th {
font-weight: bold
}
vn-td, vn-th {
vertical-align: middle;
display: table-cell;
text-align: left;
padding: 5px 0
}

View File

@ -8,6 +8,8 @@
{"type": "report", "name": "delivery-note"}, {"type": "report", "name": "delivery-note"},
{"type": "report", "name": "invoice"}, {"type": "report", "name": "invoice"},
{"type": "report", "name": "rpt-claim-pickup-order"}, {"type": "report", "name": "rpt-claim-pickup-order"},
{"type": "report", "name": "rpt-letter-debtor"},
{"type": "report", "name": "rpt-sepa-core"},
{"type": "static", "name": "email-header"}, {"type": "static", "name": "email-header"},
{"type": "static", "name": "email-footer"}, {"type": "static", "name": "email-footer"},
{"type": "static", "name": "report-header"}, {"type": "static", "name": "report-header"},

View File

@ -95,9 +95,10 @@ module.exports = {
const template = await fs.readFile(templatePath, 'utf8'); const template = await fs.readFile(templatePath, 'utf8');
const css = require(stylePath); const css = require(stylePath);
const cssOptions = {inlinePseudoElements: true};
component.i18n = require(localePath); component.i18n = require(localePath);
component.template = juice.inlineContent(template, css); component.template = juice.inlineContent(template, css, cssOptions);
}, },
async toPdf(name, ctx) { async toPdf(name, ctx) {

View File

@ -16,8 +16,8 @@ module.exports = app => {
app.get(`/api/report/${name}`, (request, response, next) => { app.get(`/api/report/${name}`, (request, response, next) => {
reportEngine.toPdf(name, request).then(stream => { reportEngine.toPdf(name, request).then(stream => {
response.setHeader('Content-Disposition', `attachment; filename="${name}.pdf"`); // response.setHeader('Content-Disposition', `attachment; filename="${name}.pdf"`);
response.setHeader('Content-type', 'application/pdf'); // response.setHeader('Content-type', 'application/pdf');
stream.pipe(response); stream.pipe(response);
}).catch(e => { }).catch(e => {
next(e); next(e);

View File

@ -1,6 +1,4 @@
const database = require(`${appPath}/lib/database`); const database = require(`${appPath}/lib/database`);
const emailHeader = require('../email-header');
const emailFooter = require('../email-footer');
const UserException = require(`${appPath}/lib/exceptions/userException`); const UserException = require(`${appPath}/lib/exceptions/userException`);
module.exports = { module.exports = {
@ -42,7 +40,7 @@ module.exports = {
}, },
}, },
components: { components: {
'email-header': emailHeader, 'email-header': require('../email-header'),
'email-footer': emailFooter, 'email-footer': require('../email-footer'),
}, },
}; };

View File

@ -0,0 +1,6 @@
const CssReader = require(`${appPath}/lib/cssReader`);
module.exports = new CssReader([
`${appPath}/common/css/layout.css`,
`${__dirname}/style.css`])
.mergeStyles();

View File

@ -1,11 +1,11 @@
const database = require(`${appPath}/lib/database`); const database = require(`${appPath}/lib/database`);
const emailHeader = require('../email-header'); const reportEngine = require(`${appPath}/lib/reportEngine.js`);
const emailFooter = require('../email-footer');
const UserException = require(`${appPath}/lib/exceptions/userException`); const UserException = require(`${appPath}/lib/exceptions/userException`);
module.exports = { module.exports = {
name: 'letter-debtor-nd', name: 'letter-debtor-nd',
async asyncData(ctx, params) { async asyncData(ctx, params) {
const promises = [];
const data = { const data = {
isPreview: ctx.method === 'GET', isPreview: ctx.method === 'GET',
}; };
@ -16,21 +16,24 @@ module.exports = {
if (!params.companyFk) if (!params.companyFk)
throw new UserException('No company id specified'); throw new UserException('No company id specified');
return this.methods.fetchClientData(params.clientFk, params.companyFk) promises.push(reportEngine.toPdf('rpt-letter-debtor', ctx));
.then(([result]) => { promises.push(this.methods.fetchClient(params.clientFk, params.companyFk));
return Object.assign(data, result[0]);
return Promise.all(promises).then(result => {
const stream = result[0];
const [[client]] = result[1];
Object.assign(data, client);
Object.assign(data, {attachments: [{filename: 'rpt-letter-debtor.pdf', content: stream}]});
return data;
}); });
}, },
created() { created() {
this.$i18n.locale = this.locale; this.$i18n.locale = this.locale;
}, },
data() {
return {
attachments: ['http://localhost:8080/report/delivery-note'],
};
},
methods: { methods: {
fetchClientData(clientFk, companyFk) { fetchClient(clientFk, companyFk) {
return database.pool.query(` return database.pool.query(`
SELECT SELECT
u.lang locale, u.lang locale,
@ -47,13 +50,8 @@ module.exports = {
WHERE c.id = ? AND cny.id = ?`, [clientFk, companyFk]); WHERE c.id = ? AND cny.id = ?`, [clientFk, companyFk]);
}, },
}, },
computed: {
accountAddress: function() {
return this.iban.slice(-4);
},
},
components: { components: {
'email-header': emailHeader, 'email-header': require('../email-header'),
'email-footer': emailFooter, 'email-footer': require('../email-footer'),
}, },
}; };

View File

@ -6,12 +6,12 @@ module.exports = {
sections: { sections: {
introduction: { introduction: {
title: 'Estimado cliente', title: 'Estimado cliente',
description: `Nos dirigimos a Vd. nuevamente para informarle que sigue description: `Nos dirigimos a ti nuevamente para informarte que sigue
pendiente su deuda con nuestra empresa, tal y como puede comprobar en el extracto adjunto.`, pendiente tu deuda con nuestra empresa, tal y como puedes comprobar en el extracto adjunto.`,
terms: `Dado que los plazos de pago acordados están ampliamente superados, no procede mayor dilación en la liquidación del importe adeudado.`, terms: `Dado que los plazos de pago acordados están ampliamente superados, no procede mayor dilación en la liquidación del importe adeudado.`,
}, },
payMethod: { payMethod: {
description: 'Para ello dispone de las siguientes formas de pago', description: 'Para ello dispones de las siguientes formas de pago',
options: [ options: [
'Pago online desde nuestra web.', 'Pago online desde nuestra web.',
'Ingreso o transferencia al número de cuenta que detallamos al pie de esta carta, indicando el número de cliente.', 'Ingreso o transferencia al número de cuenta que detallamos al pie de esta carta, indicando el número de cliente.',
@ -27,11 +27,9 @@ module.exports = {
], ],
}, },
}, },
contactPhone: 'Para consultas, puede ponerse en contacto con nosotros en el <strong>96 324 21 00</strong>.', contactPhone: 'Para consultas, puedes ponerte en contacto con nosotros en el <strong>96 324 21 00</strong>.',
conclusion: 'En espera de sus noticias. <br/> Gracias por su atención.', conclusion: 'En espera de tus noticias. <br/> Gracias por tu atención.',
transferAccount: 'Datos para transferencia bancaria', transferAccount: 'Datos para transferencia bancaria',
}, },
}, },
}; };

View File

@ -0,0 +1,6 @@
const CssReader = require(`${appPath}/lib/cssReader`);
module.exports = new CssReader([
`${appPath}/common/css/layout.css`,
`${__dirname}/style.css`])
.mergeStyles();

View File

@ -1,7 +1,5 @@
const database = require(`${appPath}/lib/database`); const database = require(`${appPath}/lib/database`);
const reportEngine = require(`${appPath}/lib/reportEngine.js`); const reportEngine = require(`${appPath}/lib/reportEngine.js`);
const emailHeader = require('../email-header');
const emailFooter = require('../email-footer');
const UserException = require(`${appPath}/lib/exceptions/userException`); const UserException = require(`${appPath}/lib/exceptions/userException`);
@ -19,7 +17,7 @@ module.exports = {
if (!params.companyFk) if (!params.companyFk)
throw new UserException('No company id specified'); throw new UserException('No company id specified');
promises.push(reportEngine.toPdf('delivery-note', ctx)); promises.push(reportEngine.toPdf('rpt-letter-debtor', ctx));
promises.push(this.methods.fetchClient(params.clientFk, params.companyFk)); promises.push(this.methods.fetchClient(params.clientFk, params.companyFk));
return Promise.all(promises).then(result => { return Promise.all(promises).then(result => {
@ -27,7 +25,7 @@ module.exports = {
const [[client]] = result[1]; const [[client]] = result[1];
Object.assign(data, client); Object.assign(data, client);
Object.assign(data, {attachments: [{filename: 'delivery-note.pdf', content: stream}]}); Object.assign(data, {attachments: [{filename: 'rpt-letter-debtor.pdf', content: stream}]});
return data; return data;
}); });
@ -53,13 +51,8 @@ module.exports = {
WHERE c.id = ? AND cny.id = ?`, [clientFk, companyFk]); WHERE c.id = ? AND cny.id = ?`, [clientFk, companyFk]);
} }
}, },
computed: {
accountAddress: function() {
return this.iban.slice(-4);
},
},
components: { components: {
'email-header': emailHeader, 'email-header': require('../email-header'),
'email-footer': emailFooter, 'email-footer': require('../email-footer'),
}, },
}; };

View File

@ -10,9 +10,9 @@ module.exports = {
datos contables, tu cuenta tiene un saldo pendiente de liquidar.`, datos contables, tu cuenta tiene un saldo pendiente de liquidar.`,
}, },
}, },
checkExtract: `Te solicitamos compruebes que el extracto adjunto corresponde con los datos de que Vd. dispone. checkExtract: `Te solicitamos compruebes que el extracto adjunto corresponde con los datos de que dispones.
Nuestro departamento de administración le aclarará gustosamente cualquier duda que pueda tener, Nuestro departamento de administración te aclarará gustosamente cualquier duda que puedas tener,
e igualmente le facilitará cualquier documento que solicite.`, e igualmente te facilitará cualquier documento que solicites.`,
checkValidData: `Si al comprobar los datos aportados resultaran correctos, checkValidData: `Si al comprobar los datos aportados resultaran correctos,
te rogamos procedas a regularizar tu situación.`, te rogamos procedas a regularizar tu situación.`,
payMethod: `Si no deseas desplazarte personalmente hasta nuestras oficinas, payMethod: `Si no deseas desplazarte personalmente hasta nuestras oficinas,

View File

@ -1,6 +1,5 @@
footer { footer {
font-family: verdana, sans-serif; font-family: verdana, sans-serif;
margin-top: 30px;
font-size: 12px; font-size: 12px;
color: #555; color: #555;
zoom: 0.55 zoom: 0.55

View File

@ -8,3 +8,16 @@
margin-bottom: 20px; margin-bottom: 20px;
font-size: 2em font-size: 2em
} }
vn-table {
margin-top: 50px !important
}
.sign {
margin: 150px auto;
width: 300px
}
.sign .body {
height: 150px
}

View File

@ -7,7 +7,7 @@
<section class="columns"> <section class="columns">
<section class="size50"> <section class="size50">
<section class="size75"> <section class="size75">
<h1 style="margin-top:0" class="title">{{$t('title')}}</h1> <h1 class="title uppercase">{{$t('title')}}</h1>
<section class="row inline small"> <section class="row inline small">
<section class="text uppercase gray">{{$t('claimId')}}:</section> <section class="text uppercase gray">{{$t('claimId')}}:</section>
<section class="control">{{claimId}}</section> <section class="control">{{claimId}}</section>
@ -25,9 +25,8 @@
<section class="size50"> <section class="size50">
<section class="panel"> <section class="panel">
<section class="header">{{$t('clientData')}}</section> <section class="header">{{$t('clientData')}}</section>
<p> <section class="body">
<strong class="uppercase">{{clientName}}</strong> <h3 class="uppercase">{{clientName}}</h3>
</p>
<section> <section>
{{street}} {{street}}
</section> </section>
@ -40,33 +39,33 @@
</section> </section>
</section> </section>
</section> </section>
<section class="grid" style="margin-top:20px">
<section class="row header inline">
<section style="width: 15%">{{$t('quantity')}}</section>
<section style="width: 15%">{{$t('claims')}}</section>
<section style="width: 20%">{{$t('reference')}}</section>
<section style="width: 50%">{{$t('concept')}}</section>
</section>
<section class="row inline" v-for="sale in sales">
<section class="number" style="width: 15%">{{sale.quantity}}&nbsp;</section>
<section class="number" style="width: 15%">{{sale.claimQuantity}}&nbsp;</section>
<section style="width: 20%">{{sale.id}}&nbsp;</section>
<section style="width: 50%">{{sale.concept}}&nbsp;</section>
</section>
</section> </section>
<section class="columns" style="margin-top: 50px"> <vn-table>
<section class="size25">&nbsp;</section> <vn-thead>
<section class="size50"> <vn-tr>
<section class="panel" style="height: 150px"> <vn-th>{{$t('reference')}}</vn-th>
<section class="centered"> <vn-th>{{$t('quantity')}}</vn-th>
<vn-th>{{$t('claims')}}</vn-th>
<vn-th>{{$t('concept')}}</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr v-for="sale in sales" :key="sale.id">
<vn-td class="gray">{{sale.id}}</vn-td>
<vn-td>{{sale.quantity}}</vn-td>
<vn-td>{{sale.claimQuantity}}</vn-td>
<vn-td>{{sale.concept}}</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
<section class="panel sign">
<section class="body centered">
<h3>{{clientName}}</h3> <h3>{{clientName}}</h3>
</section> </section>
</section> </section>
</section>
<section class="size25">&nbsp;</section>
</section>
<p v-html="$t('sections.agency.description')"></p> <p v-html="$t('sections.agency.description')"></p>
</section> </section>

View File

@ -1,7 +1,7 @@
module.exports = { module.exports = {
messages: { messages: {
es: { es: {
title: 'ORD. RECOGIDA', title: 'Ord. recogida',
claimId: 'Reclamación', claimId: 'Reclamación',
clientId: 'Cliente', clientId: 'Cliente',
date: 'Fecha', date: 'Fecha',

View File

@ -0,0 +1,7 @@
const CssReader = require(`${appPath}/lib/cssReader`);
module.exports = new CssReader([
`${appPath}/common/css/layout.css`,
`${appPath}/common/css/misc.css`,
`${__dirname}/style.css`])
.mergeStyles();

View File

@ -0,0 +1,14 @@
.container {
color: #000
}
.title {
font-weight: 100;
margin-top: 0;
margin-bottom: 20px;
font-size: 2em
}
vn-table {
margin-top: 50px !important
}

View File

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="es">
<body>
<section class="container">
<report-header></report-header>
<section class="main">
<section class="columns">
<section class="size50">
<section class="size75">
<h1 class="title uppercase">{{$t('title')}}</h1>
<section class="row inline small">
<section class="text uppercase gray">{{$t('clientId')}}:</section>
<section class="control">{{clientId}}</section>
</section>
<section class="row inline small">
<section class="text uppercase gray">{{$t('date')}}:</section>
<section class="control">{{dated()}}</section>
</section>
</section>
</section>
<section class="size50">
<section class="panel">
<section class="header">{{$t('clientData')}}</section>
<section class="body">
<h3 class="uppercase">{{clientName}}</h3>
<section>
{{street}}
</section>
<section>
{{postcode}}, {{city}} ({{province}})
</section>
<section>
{{country}}
</section>
</section>
</section>
</section>
</section>
<vn-table>
<vn-thead>
<vn-tr>
<vn-th>{{$t('date')}}</vn-th>
<vn-th>{{$t('concept')}}</vn-th>
<vn-th class="number">{{$t('invoiced')}}</vn-th>
<vn-th class="number">{{$t('payed')}}</vn-th>
<vn-th class="number">{{$t('balance')}}</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr v-for="sale in sales" :key="sale.id">
<vn-td>{{toISOString(sale.issued)}}</vn-td>
<vn-td>{{sale.ref}}</vn-td>
<vn-td class="number">{{sale.debtOut}}</vn-td>
<vn-td class="number">{{sale.debtIn}}</vn-td>
<vn-td class="number">{{getBalance(sale)}}</vn-td>
</vn-tr>
</vn-tbody>
<vn-tfoot>
<vn-tr>
<vn-td></vn-td>
<vn-td><strong class="pull-right">Total</strong></vn-td>
<vn-td class="number">{{getTotalDebtOut()}}</vn-td>
<vn-td class="number">{{getTotalDebtIn()}}</vn-td>
<vn-td class="number">{{totalBalance}}</vn-td>
</vn-tr>
</vn-tfoot>
</vn-table>
</section>
<report-footer id="pageFooter"
:left-text="$t('client', [clientId])"
:center-text="clientName">
</report-footer>
</section>
</body>
</html>

View File

@ -0,0 +1,98 @@
const strftime = require('strftime');
const database = require(`${appPath}/lib/database`);
const UserException = require(`${appPath}/lib/exceptions/userException`);
module.exports = {
name: 'rpt-letter-debtor',
async asyncData(ctx, params) {
const promises = [];
const data = {};
if (!params.clientFk)
throw new UserException('No client id specified');
if (!params.companyFk)
throw new UserException('No company id specified');
promises.push(this.methods.fetchClient(params.clientFk));
promises.push(this.methods.fetchSales(params.clientFk, params.companyFk));
return Promise.all(promises).then(result => {
const [[client]] = result[0];
const [[sales]] = result[1];
if (!client)
throw new UserException('No client data found');
Object.assign(data, client, {sales});
return data;
});
},
created() {
this.$i18n.locale = this.locale;
},
data() {
return {totalBalance: 0.00};
},
methods: {
fetchClient(clientFk) {
return database.pool.query(
`SELECT
c.id clientId,
u.lang locale,
c.email AS recipient,
c.socialName AS clientName,
c.street,
c.postcode,
c.city,
c.fi,
p.name AS province,
ct.country
FROM client c
JOIN account.user u ON u.id = c.id
JOIN country ct ON ct.id = c.countryFk
LEFT JOIN province p ON p.id = c.provinceFk
WHERE c.id = ?`, [clientFk]);
},
fetchSales(clientFk, companyFk) {
return database.pool.query(
`CALL vn.clientGetDebtDiary(?, ?)`, [clientFk, companyFk]);
},
dated: () => {
return strftime('%d-%m-%Y', new Date());
},
toISOString: date => {
return strftime('%d-%m-%Y', date);
},
getBalance(sale) {
if (sale.debtOut)
this.totalBalance += parseFloat(sale.debtOut);
if (sale.debtIn)
this.totalBalance -= parseFloat(sale.debtIn);
return parseFloat(this.totalBalance.toFixed(2));
},
getTotalDebtOut() {
let debtOut = 0.00;
this.sales.forEach(sale => {
debtOut += sale.debtOut ? parseFloat(sale.debtOut) : 0;
});
return debtOut.toFixed(2);
},
getTotalDebtIn() {
let debtIn = 0.00;
this.sales.forEach(sale => {
debtIn += sale.debtIn ? parseFloat(sale.debtIn) : 0;
});
return debtIn.toFixed(2);
},
},
components: {
'report-header': require('../report-header'),
'report-footer': require('../report-footer'),
},
};

View File

@ -0,0 +1,16 @@
module.exports = {
messages: {
es: {
title: 'Extracto',
claimId: 'Reclamación',
clientId: 'Cliente',
clientData: 'Datos del cliente',
date: 'Fecha',
concept: 'Concepto',
invoiced: 'Facturado',
payed: 'Pagado',
balance: 'Saldo',
client: 'Cliente {0}'
},
},
};

View File

@ -0,0 +1,7 @@
const CssReader = require(`${appPath}/lib/cssReader`);
module.exports = new CssReader([
`${appPath}/common/css/layout.css`,
`${appPath}/common/css/misc.css`,
`${__dirname}/style.css`])
.mergeStyles();

View File

@ -0,0 +1,14 @@
.container {
color: #000
}
.title {
font-weight: 100;
margin-top: 0;
margin-bottom: 20px;
font-size: 2em
}
vn-table {
margin-top: 50px !important
}

View File

@ -0,0 +1,270 @@
<!DOCTYPE html>
<html lang="es">
<body>
<section class="container">
<report-header></report-header>
<section class="main">
<section class="panel supplierPanel">
<section class="body">
<section class="verticalText">{{$t('supplier.toCompleteBySupplier')}}</section>
<section class="row inline">
<section class="text">{{$t('supplier.orderReference')}}</section>
<section class="control">{{mandateCode}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.identifier')}}</section>
<section class="control">ES89000B97367486</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.name')}}</section>
<section class="control">{{supplierName}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.street')}}</section>
<section class="control">{{supplierStreet}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.location')}}</section>
<section class="control">{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.country')}}</section>
<section class="control">{{supplierCountry}}</section>
</section>
</section>
</section>
<section class="panel supplierPanel">
<section class="body">
<section class="verticalText">{{$t('supplier.toCompleteBySupplier')}}</section>
<section class="row inline">
<section class="text">{{$t('supplier.orderReference')}}</section>
<section class="control">{{mandateCode}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.identifier')}}</section>
<section class="control">ES89000B97367486</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.name')}}</section>
<section class="control">{{supplierName}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.street')}}</section>
<section class="control">{{supplierStreet}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.location')}}</section>
<section class="control">{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.country')}}</section>
<section class="control">{{supplierCountry}}</section>
</section>
</section>
</section>
<section class="panel supplierPanel">
<section class="body">
<section class="verticalText">{{$t('supplier.toCompleteBySupplier')}}</section>
<section class="row inline">
<section class="text">{{$t('supplier.orderReference')}}</section>
<section class="control">{{mandateCode}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.identifier')}}</section>
<section class="control">ES89000B97367486</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.name')}}</section>
<section class="control">{{supplierName}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.street')}}</section>
<section class="control">{{supplierStreet}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.location')}}</section>
<section class="control">{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.country')}}</section>
<section class="control">{{supplierCountry}}</section>
</section>
</section>
</section>
<section class="panel supplierPanel">
<section class="body">
<section class="verticalText">{{$t('supplier.toCompleteBySupplier')}}</section>
<section class="row inline">
<section class="text">{{$t('supplier.orderReference')}}</section>
<section class="control">{{mandateCode}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.identifier')}}</section>
<section class="control">ES89000B97367486</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.name')}}</section>
<section class="control">{{supplierName}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.street')}}</section>
<section class="control">{{supplierStreet}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.location')}}</section>
<section class="control">{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.country')}}</section>
<section class="control">{{supplierCountry}}</section>
</section>
</section>
</section>
<section class="panel supplierPanel">
<section class="body">
<section class="verticalText">{{$t('supplier.toCompleteBySupplier')}}</section>
<section class="row inline">
<section class="text">{{$t('supplier.orderReference')}}</section>
<section class="control">{{mandateCode}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.identifier')}}</section>
<section class="control">ES89000B97367486</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.name')}}</section>
<section class="control">{{supplierName}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.street')}}</section>
<section class="control">{{supplierStreet}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.location')}}</section>
<section class="control">{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.country')}}</section>
<section class="control">{{supplierCountry}}</section>
</section>
</section>
</section>
<section class="panel supplierPanel">
<section class="body">
<section class="verticalText">{{$t('supplier.toCompleteBySupplier')}}</section>
<section class="row inline">
<section class="text">{{$t('supplier.orderReference')}}</section>
<section class="control">{{mandateCode}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.identifier')}}</section>
<section class="control">ES89000B97367486</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.name')}}</section>
<section class="control">{{supplierName}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.street')}}</section>
<section class="control">{{supplierStreet}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.location')}}</section>
<section class="control">{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})</section>
</section>
<section class="row inline">
<section class="text">{{$t('supplier.country')}}</section>
<section class="control">{{supplierCountry}}</section>
</section>
</section>
</section>
<!-- <p class="font small">{{$t('bodyDescription}}</p>
<p class="font small"><strong>{{$t('clientAdvice}}</strong></p>
<section class="panel">
<section class="verticalText">{{$t('toCompleteByClient}}</section>
<section class="row inline">
<section class="text">{{$t('clientName}}</section>
<section class="control">{{clientName}}</section>
<section class="description">{{$t('accountHolder}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('clientStreet}}</section>
<section class="control">{{clientStreet}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('clientLocation}}</section>
<section class="control">{{clientPostCode}}, {{clientCity}} ({{clientProvince}})</section>
</section>
<section class="row inline">
<section class="text">{{$t('clientCountry}}</section>
<section class="control">{{clientCountry}}</section>
</section>
<section class="row inline">
<section class="text font verticalAlign">{{$t('swift}}</section>
<section class="control">
{{#swiftFields}}
<section class="box"></section>
{{/swiftFields}}
</section>
</section>
<section class="row">
<section class="text">{{$t('accountNumber}}</section>
<section class="control">
<section class="box">ES</section>
{{#accountNumberFields}}
<section class="box"></section>
{{/accountNumberFields}}
</section>
<section class="description">
<section class="line"><span>{{$t('accountNumberFormat}}</span></section>
</section>
</section>
<section class="row inline">
<section class="text font verticalAlign">{{$t('paymentType}}</section>
<section class="control">
<section class="columns">
<section class="size33">
<section class="size25">
<section class="box crossed">X</section>
</section>
<section class="size25 font verticalAlign">{{$t('recurrent}}</section>
</section>
<section class="size33 font centered">O</section>
<section class="size33">
<section class="size25">
<section class="box"></section>
</section>
<section class="size25 font verticalAlign">{{$t('unique}}</section>
</section>
</section>
</section>
</section>
<section class="row inline">
<section class="text">{{$t('signLocation}}</section>
<section class="control">{{currentDate}}, {{supplierProvince}}</section>
</section>
<section class="row inline">
<section class="text">{{$t('sign}}</section>
<section class="control"></section>
</section>
</section>
<p class="font small">{{$t('mandatoryFields}}</p>
<p class="font small">{{$t('sendOrder}}</p> -->
</section>
<report-footer id="pageFooter"
:left-text="$t('client', [clientId])"
:center-text="clientName">
</report-footer>
</section>
</body>
</html>

View File

@ -0,0 +1,67 @@
const strftime = require('strftime');
const database = require(`${appPath}/lib/database`);
const UserException = require(`${appPath}/lib/exceptions/userException`);
module.exports = {
name: 'rpt-sepa-core',
async asyncData(ctx, params) {
if (!params.clientFk)
throw new UserException('No client id specified');
if (!params.companyFk)
throw new UserException('No company id specified');
return this.methods.fetchClient(params.clientFk)
.then(([[client]]) => {
if (!client)
throw new UserException('No client data found');
return client;
});
},
created() {
if (this.locale)
this.$i18n.locale = this.locale;
},
methods: {
fetchClient(clientFk) {
return database.pool.query(
`SELECT
c.id clientId,
u.lang locale,
m.code mandateCode,
c.email AS recipient,
c.socialName AS clientName,
c.street AS clientStreet,
c.postcode AS clientPostCode,
c.city AS clientCity,
p.name AS clientProvince,
ct.country AS clientCountry,
s.name AS supplierName,
s.street AS supplierStreet,
sc.country AS supplierCountry,
s.postCode AS supplierPostCode,
s.city AS supplierCity,
sp.name AS supplierProvince
FROM client c
JOIN account.user u ON u.id = c.id
JOIN country ct ON ct.id = c.countryFk
LEFT JOIN province p ON p.id = c.provinceFk
LEFT JOIN mandate m ON m.clientFk = c.id AND m.finished IS NULL
LEFT JOIN supplier s ON s.id = m.companyFk
LEFT JOIN country sc ON sc.id = s.countryFk
LEFT JOIN province sp ON sp.id = s.provinceFk
WHERE c.id = ?`, [clientFk]);
},
dated: () => {
return strftime('%d-%m-%Y', new Date());
},
toISOString: date => {
return strftime('%d-%m-%Y', date);
},
},
components: {
'report-header': require('../report-header'),
'report-footer': require('../report-footer'),
},
};

View File

@ -0,0 +1,19 @@
module.exports = {
messages: {
es: {
title: 'Orden de domiciliación de adeudo SEPA CORE',
supplier: {
toCompleteBySupplier: 'A cumplimentar por el acreedor',
orderReference: 'Referencia de la orden de domiciliación',
identifier: 'Identificador del acreedor',
name: 'Nombre del acreedor',
street: 'Dirección',
location: 'CP - Población - Provincia',
country: 'País',
},
client: {
toCompleteByClient: 'A cumplimentar por el deudor',
},
},
},
};