37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
|
|
module.exports = function(Self) {
|
|
Self.remoteMethodCtx('invoiceTicketsAndPdf', {
|
|
description: 'Make out an invoice from one or more tickets',
|
|
accessType: 'WRITE',
|
|
accepts: [
|
|
{
|
|
arg: 'ticketsIds',
|
|
description: 'The tickets id',
|
|
type: ['number'],
|
|
required: true
|
|
},
|
|
{
|
|
arg: 'invoiceCorrection',
|
|
description: 'The invoice correction',
|
|
type: 'object',
|
|
}
|
|
|
|
],
|
|
returns: {
|
|
type: ['object'],
|
|
root: true
|
|
},
|
|
http: {
|
|
path: `/invoiceTicketsAndPdf`,
|
|
verb: 'POST'
|
|
}
|
|
});
|
|
|
|
Self.invoiceTicketsAndPdf = async(ctx, ticketsIds, invoiceCorrection, options) => {
|
|
const invoiceIds = await Self.invoiceTickets(ctx, ticketsIds, invoiceCorrection, options);
|
|
await Self.app.models.InvoiceOut.makePdfList(ctx, invoiceIds, null, options);
|
|
return invoiceIds;
|
|
};
|
|
};
|
|
|