This commit is contained in:
parent
3493ca1709
commit
474399b383
|
@ -4,7 +4,3 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp
|
|||
('CplusInvoiceType477', '*', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
||||
('InvoiceCorrectionType', '*', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
||||
('InvoiceOut', 'transferInvoice', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
|
||||
|
||||
INSERT INTO `vn`.`invoiceCorrectionType` (description)
|
||||
VALUES
|
||||
('Error en el cálculo del IVA')
|
|
@ -2974,3 +2974,9 @@ INSERT INTO vn.XDiario (id, ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EU
|
|||
(4, 2.0, util.VN_CURDATE(), '4300001104', NULL, 'n/fra T4444444', 8.88, NULL, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
|
||||
(5, 2.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T4444444 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
|
||||
(6, 2.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T4444444 Tony Stark', NULL, 0.81, 8.07, 'T', '4444444', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0);
|
||||
|
||||
INSERT INTO `vn`.`invoiceCorrectionType` (`id`, `description`)
|
||||
VALUES
|
||||
(1, 'Error en el cálculo del IVA'),
|
||||
(2, 'Error en el detalle de las ventas'),
|
||||
(3, 'Error en los datos del cliente');
|
|
@ -44,7 +44,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
for (const sale of sales) {
|
||||
const refundTicketId = await getTicketRefundId(group, sale.ticketFk, refundTickets, mappedTickets);
|
||||
const refundTicketId = mappedTickets.get(sale.ticketFk);
|
||||
|
||||
const createdSale = await models.Sale.create({
|
||||
ticketFk: refundTicketId,
|
||||
|
@ -62,14 +62,14 @@ module.exports = Self => {
|
|||
await models.SaleComponent.create(components, myOptions);
|
||||
}
|
||||
|
||||
if (servicesIds && servicesIds.length > 0) {
|
||||
if (servicesIds && servicesIds.length) {
|
||||
const servicesFilter = {
|
||||
where: {id: {inq: servicesIds}}
|
||||
};
|
||||
const services = await models.TicketService.find(servicesFilter, myOptions);
|
||||
|
||||
for (const service of services) {
|
||||
const refundTicketId = await getTicketRefundId(group, service.ticketFk, refundTickets, mappedTickets);
|
||||
const refundTicketId = mappedTickets.get(service.ticketFk);
|
||||
|
||||
await models.TicketService.create({
|
||||
description: service.description,
|
||||
|
@ -113,11 +113,4 @@ module.exports = Self => {
|
|||
|
||||
refundTickets.push(refundTicket);
|
||||
}
|
||||
|
||||
async function getTicketRefundId(group, ticketId, refundTickets, mappedTickets) {
|
||||
if (group) {
|
||||
const [firstRefundTicket] = refundTickets;
|
||||
return firstRefundTicket.id;
|
||||
} else return mappedTickets.get(ticketId);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue