Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7197-fixInvoiceIn
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
b27023cb9e
|
@ -60,6 +60,7 @@ module.exports = Self => {
|
|||
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
||||
|
||||
for (let ticket of tickets) {
|
||||
if (ticket.observaciones) {
|
||||
let observations = ticket.observaciones.split(' ');
|
||||
|
||||
for (let observation of observations) {
|
||||
|
@ -72,6 +73,7 @@ module.exports = Self => {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getCollection(id, tickets, sales, placements, myOptions);
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ BEGIN
|
|||
AND e.id = vSelf;
|
||||
|
||||
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$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -13,20 +13,32 @@ BEGIN
|
|||
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
||||
*/
|
||||
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
|
||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||
WHERE ii.id = vSelf
|
||||
WHERE iit.invoiceInFk = vSelf
|
||||
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');
|
||||
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
|
||||
ENGINE = MEMORY
|
||||
SELECT ii.bookEntried,
|
||||
|
|
Loading…
Reference in New Issue