7152-devToTest_2414 #2228
|
@ -17,16 +17,16 @@ BEGIN
|
|||
DECLARE vRefLen INT;
|
||||
DECLARE vRefPrefix VARCHAR(255);
|
||||
DECLARE vLastRef VARCHAR(255);
|
||||
DECLARE vCompanyCode INT;
|
||||
DECLARE vSage200Company INT;
|
||||
DECLARE vYearLen INT DEFAULT 2;
|
||||
DECLARE vPrefixLen INT;
|
||||
|
||||
SELECT companyCode INTO vCompanyCode
|
||||
SELECT sage200Company INTO vSage200Company
|
||||
FROM company
|
||||
WHERE id = NEW.companyFk;
|
||||
|
||||
IF vCompanyCode IS NULL THEN
|
||||
CALL util.throw('companyCodeNotDefined');
|
||||
IF vSage200Company IS NULL THEN
|
||||
CALL util.throw('vSage200CompanyNotDefined');
|
||||
END IF;
|
||||
|
||||
SELECT MAX(i.ref) INTO vLastRef
|
||||
|
@ -36,7 +36,7 @@ BEGIN
|
|||
AND i.companyFk = NEW.companyFk;
|
||||
|
||||
IF vLastRef IS NOT NULL THEN
|
||||
SET vPrefixLen = LENGTH(NEW.serial) + LENGTH(vCompanyCode) + vYearLen;
|
||||
SET vPrefixLen = LENGTH(NEW.serial) + LENGTH(vSage200Company) + vYearLen;
|
||||
SET vRefLen = LENGTH(vLastRef) - vPrefixLen;
|
||||
SET vRefPrefix = LEFT(vLastRef, vPrefixLen);
|
||||
SET vRef = RIGHT(vLastRef, vRefLen);
|
||||
|
@ -44,7 +44,7 @@ BEGIN
|
|||
SELECT refLen INTO vRefLen FROM invoiceOutConfig;
|
||||
SET vRefPrefix = CONCAT(
|
||||
NEW.serial,
|
||||
vCompanyCode,
|
||||
vSage200Company,
|
||||
RIGHT(YEAR(NEW.issued), vYearLen)
|
||||
);
|
||||
END IF;
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
-- Auto-generated SQL script #202402151810
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=69;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=567;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=791;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=792;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=965;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=1381;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=1463;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=2142;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=2292;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=2393;
|
||||
UPDATE vn.company
|
||||
SET companyGroupFk=NULL
|
||||
WHERE id=3869;
|
||||
ALTER TABLE vn.company MODIFY COLUMN sage200Company int(2) DEFAULT NULL NULL COMMENT 'Campo para la serie InvoiceOut';
|
Loading…
Reference in New Issue