7806_devToTest_2332 #2801
|
@ -60,6 +60,7 @@ module.exports = Self => {
|
||||||
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
||||||
|
|
||||||
for (let ticket of tickets) {
|
for (let ticket of tickets) {
|
||||||
|
if (ticket.observaciones) {
|
||||||
let observations = ticket.observaciones.split(' ');
|
let observations = ticket.observaciones.split(' ');
|
||||||
|
|
||||||
for (let observation of observations) {
|
for (let observation of observations) {
|
||||||
|
@ -72,6 +73,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return getCollection(id, tickets, sales, placements, myOptions);
|
return getCollection(id, tickets, sales, placements, myOptions);
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ BEGIN
|
||||||
AND e.id = vSelf;
|
AND e.id = vSelf;
|
||||||
|
|
||||||
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
||||||
CALL util.throw('Entry is not editable');
|
CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable'));
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -13,20 +13,32 @@ BEGIN
|
||||||
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
||||||
*/
|
*/
|
||||||
DECLARE vFiscalYear INT;
|
DECLARE vFiscalYear INT;
|
||||||
DECLARE vHasDistinctTransactions INT;
|
DECLARE vDistinctTransactions INT;
|
||||||
|
DECLARE vHasRepeatedTransactions BOOL;
|
||||||
|
|
||||||
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
|
SELECT COUNT(DISTINCT iit.transactionTypeSageFk) INTO vDistinctTransactions
|
||||||
FROM invoiceIn ii
|
FROM invoiceIn ii
|
||||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||||
WHERE ii.id = vSelf
|
WHERE iit.invoiceInFk = vSelf
|
||||||
AND iis.taxAreaFk = 'CEE'
|
AND iis.taxAreaFk = 'CEE'
|
||||||
AND transactionTypeSageFk;
|
AND iit.transactionTypeSageFk;
|
||||||
|
|
||||||
IF vHasDistinctTransactions > 1 THEN
|
IF vDistinctTransactions > 1 THEN
|
||||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
CALL util.throw ('This invoice does not allow different types of transactions');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
SELECT TRUE INTO vHasRepeatedTransactions
|
||||||
|
FROM invoiceInTax
|
||||||
|
WHERE invoiceInFk = vSelf
|
||||||
|
GROUP BY transactionTypeSageFk
|
||||||
|
HAVING COUNT(transactionTypeSageFk) > 1
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
IF vHasRepeatedTransactions THEN
|
||||||
|
CALL util.throw ('This invoice contains repeated types of transactions');
|
||||||
|
END IF;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT ii.bookEntried,
|
SELECT ii.bookEntried,
|
||||||
|
|
Loading…
Reference in New Issue