#263 No mostrar sumatorio en client.factura CR Juan

This commit is contained in:
Javi Gallego 2018-04-19 16:31:47 +02:00
parent 6f162c774e
commit 59979b87bd
4 changed files with 2 additions and 34 deletions

View File

@ -1,5 +1,4 @@
<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-vertical>
<vn-card pad-large>
<vn-vertical>
@ -31,10 +30,7 @@
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-horizontal vn-one class="list list-footer"></vn-horizontal>
</vn-vertical>
<vn-paging margin-large-top vn-one index="index" total="index.model.count"></vn-paging>
</vn-vertical>

View File

@ -8,7 +8,7 @@ module.exports = Self => {
},
skip: (params.page - 1) * params.size,
limit: params.size,
order: params.order,
order: params.order
};
}
};

View File

@ -1,27 +0,0 @@
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;
};
};

View File

@ -1,4 +1,3 @@
module.exports = function(Self) {
require('../methods/invoiceOut/filter.js')(Self);
require('../methods/invoiceOut/sumAmount.js')(Self);
};