Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
e683ee66c1
|
@ -180,6 +180,15 @@
|
||||||
"icon": "pan_tool"
|
"icon": "pan_tool"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"url": "/invoices",
|
||||||
|
"state": "clientCard.invoices",
|
||||||
|
"component": "vn-client-invoices",
|
||||||
|
"menu": {
|
||||||
|
"description": "Invoices",
|
||||||
|
"icon": "insert_drive_file"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"url": "/recovery",
|
"url": "/recovery",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
|
|
|
@ -19,6 +19,7 @@ import './credit-create/credit-create';
|
||||||
import './greuge-list/greuge-list';
|
import './greuge-list/greuge-list';
|
||||||
import './greuge-create/greuge-create';
|
import './greuge-create/greuge-create';
|
||||||
import './mandate/mandate';
|
import './mandate/mandate';
|
||||||
|
import './invoices/invoices';
|
||||||
import './summary/client-summary';
|
import './summary/client-summary';
|
||||||
import './recovery-list/recovery-list';
|
import './recovery-list/recovery-list';
|
||||||
import './recovery-create/recovery-create';
|
import './recovery-create/recovery-create';
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<mg-ajax path="/client/api/InvoiceOuts/filter" options="vnIndexNonAuto"></mg-ajax>
|
||||||
|
<mg-ajax path="/client/api/InvoiceOuts/{{edit.params.id}}/sumAmount" options="mgEdit"></mg-ajax>
|
||||||
|
<vn-card margin-medium>
|
||||||
|
<vn-vertical pad-large>
|
||||||
|
<vn-title margin-large-bottom>Invoices</vn-title>
|
||||||
|
<vn-vertical style="text-align: center;">
|
||||||
|
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
||||||
|
<vn-column-header vn-one field="ref" text="Reference" default-order="ASC"></vn-column-header>
|
||||||
|
<vn-column-header vn-one field="issued" text="Issue date"></vn-column-header>
|
||||||
|
<vn-column-header vn-one field="dued" text="Due date"></vn-column-header>
|
||||||
|
<vn-column-header vn-one field="amount" text="Amount"></vn-column-header>
|
||||||
|
</vn-grid-header>
|
||||||
|
<vn-vertical>
|
||||||
|
<vn-one
|
||||||
|
ng-if="index.model.count > 0"
|
||||||
|
class="list list-content">
|
||||||
|
<vn-horizontal
|
||||||
|
class="list list-element"
|
||||||
|
pad-small-bottom
|
||||||
|
ng-repeat="invoice in index.model.instances track by greuge.id">
|
||||||
|
<vn-one>{{::invoice.ref}}</vn-one>
|
||||||
|
<vn-one>{{::invoice.issued | date:'dd/MM/yyyy' }}</vn-one>
|
||||||
|
<vn-one>{{::invoice.dued | date:'dd/MM/yyyy' }}</vn-one>
|
||||||
|
<vn-one>{{::invoice.amount | currency:'€':2}}</vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-one>
|
||||||
|
<vn-one
|
||||||
|
ng-if="index.model.count === 0"
|
||||||
|
pad-small-v translate>
|
||||||
|
No results
|
||||||
|
</vn-one>
|
||||||
|
</vn-vertical>
|
||||||
|
<vn-horizontal vn-one class="list list-footer">
|
||||||
|
<vn-three></vn-three>
|
||||||
|
<vn-one>{{edit.model.sumAmount | currency:'€':2}}</vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-vertical>
|
||||||
|
<vn-paging margin-large-top vn-one index="index" total="index.model.count"></vn-paging>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
|
@ -0,0 +1,15 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import FilterClientList from '../filter-client-list';
|
||||||
|
|
||||||
|
class Controller extends FilterClientList {
|
||||||
|
constructor($scope, $timeout, $state, $stateParams) {
|
||||||
|
super($scope, $timeout, $state);
|
||||||
|
$scope.$stateParams = $stateParams;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controller.$inject = ['$scope', '$timeout', '$state', '$stateParams'];
|
||||||
|
|
||||||
|
ngModule.component('vnClientInvoices', {
|
||||||
|
template: require('./invoices.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
Invoices: Facturas
|
||||||
|
Reference: Referencia
|
||||||
|
Issue date: Fecha de emisión
|
||||||
|
Due date: Vencimiento
|
||||||
|
Amount: Total
|
|
@ -0,0 +1,14 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.installMethod('filter', filterParams);
|
||||||
|
|
||||||
|
function filterParams(params) {
|
||||||
|
return {
|
||||||
|
where: {
|
||||||
|
clientFk: params.clientFk
|
||||||
|
},
|
||||||
|
skip: (params.page - 1) * params.size,
|
||||||
|
limit: params.size,
|
||||||
|
order: params.order,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,27 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethod('sumAmount', {
|
||||||
|
description: 'Returns the sum of invoices amount for a client',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [{
|
||||||
|
arg: 'id',
|
||||||
|
description: 'The client Id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
http: {source: 'path'}
|
||||||
|
}],
|
||||||
|
returns: {
|
||||||
|
arg: 'sumAmount',
|
||||||
|
type: 'number'
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/:id/sumAmount`,
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.sumAmount = async id => {
|
||||||
|
let query = `SELECT SUM(amount) AS sumAmount FROM vn.invoiceOut WHERE clientFk = ?`;
|
||||||
|
let result = await Self.rawSql(query, [id]);
|
||||||
|
return result[0].sumAmount;
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = function(Self) {
|
||||||
|
require('../methods/invoiceOut/filter.js')(Self);
|
||||||
|
require('../methods/invoiceOut/sumAmount.js')(Self);
|
||||||
|
};
|
|
@ -446,4 +446,11 @@ INSERT INTO `vn`.`invoiceOut`(`id`, `ref`, `serial`, `amount`, `clientFk`, `crea
|
||||||
VALUES
|
VALUES
|
||||||
( 1, 'T1111111' , 'T', 500 , 1, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
|
( 1, 'T1111111' , 'T', 500 , 1, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
|
||||||
( 2, 'V2222222' , 'V', 350.50 , 2, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
|
( 2, 'V2222222' , 'V', 350.50 , 2, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
|
||||||
( 3, 'E3333333' , 'E', 90.30 , 3, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1);
|
( 3, 'E3333333' , 'E', 90.30 , 3, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, `period`)
|
||||||
|
VALUES
|
||||||
|
( 1, '1', CURDATE(), date_add(CURDATE(),INTERVAL 1 MONTH), 50, 7),
|
||||||
|
( 2, '2', CURDATE(), date_add(CURDATE(),INTERVAL 3 MONTH), 100, 1),
|
||||||
|
( 3, '2', CURDATE(), date_add(CURDATE(),INTERVAL 1 MONTH), 50, 7),
|
||||||
|
( 4, '3', CURDATE(), NULL, 50, 7);
|
Loading…
Reference in New Issue