From 4cdbb85e30bad4b6eb11bb3f21c66547f3f47633 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 20 Jan 2021 13:53:49 +0100 Subject: [PATCH] primer comit --- .../ticket/back/methods/ticket/makeInvoice.js | 14 +++++++ .../back/models/print-server-queue.json | 39 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 modules/ticket/back/models/print-server-queue.json diff --git a/modules/ticket/back/methods/ticket/makeInvoice.js b/modules/ticket/back/methods/ticket/makeInvoice.js index 226eebf97c..fabb2a5823 100644 --- a/modules/ticket/back/methods/ticket/makeInvoice.js +++ b/modules/ticket/back/methods/ticket/makeInvoice.js @@ -51,6 +51,20 @@ module.exports = function(Self) { let serial = result.serial; let stmts = []; + await Self.rawSql('CALL invoiceFromTicket(?)', [id], options); + await Self.rawSql('CALL invoiceOut_new(?, CURDATE(), null, @invoiceId)', [serial], options); + + + let [resultInvoice] = await Self.rawSql('SELECT @invoiceId id', options); + let invoiceId = resultInvoice.id; + + if serial != 'R' && invoiceId && invoiceId > 0 + { + await Self.rawSql('CALL invoiceOutBooking(?)', [invoiceId], options); + + INSERT INTO printServerQueue(priorityFk, reportFk, param1, workerFk) VALUES(1, 3, vInvoiceId, account.myUser_getId()); + + stmt = new ParameterizedSQL('CALL vn.invoiceOut_newFromTicket(?, ?, ?, @invoiceId)', [ ticket.id, serial, diff --git a/modules/ticket/back/models/print-server-queue.json b/modules/ticket/back/models/print-server-queue.json new file mode 100644 index 0000000000..4dcb58b628 --- /dev/null +++ b/modules/ticket/back/models/print-server-queue.json @@ -0,0 +1,39 @@ +{ + "name": "PrintServerQueue", + "description": "Print server queue", + "base": "VnModel", + "options": { + "mysql": { + "table": "printServerQueue" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "priorityFk": { + "type": "number" + }, + "reportFk": { + "type": "number", + "required": true + }, + "param1": { + "type": "number" + }, + "workerFk": { + "type": "number", + + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file