Merge pull request 'feat: sincro client supplier sage refs #7595' (!2623) from 7595-sincro-sage into master
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2623
Reviewed-by: Jorge Penades <jorgep@verdnatura.es>
This commit is contained in:
Carlos Andrés 2024-06-20 15:33:18 +00:00
commit 9565bc1d77
1 changed files with 14 additions and 3 deletions

View File

@ -410,15 +410,26 @@ BEGIN
FROM sage.movConta mc FROM sage.movConta mc
JOIN vn.supplier s ON s.account = mc.CodigoCuenta JOIN vn.supplier s ON s.account = mc.CodigoCuenta
WHERE NOT enlazadoSage WHERE NOT enlazadoSage
)SELECT idClientSupplier, `type` ),clientSupplierSync AS(
SELECT idClientSupplier, `type`
FROM sage.clientSupplier cs
WHERE isSync
)
SELECT idClientSupplier, `type`
FROM sage.clientSupplier cs FROM sage.clientSupplier cs
WHERE NOT isSync WHERE NOT isSync
UNION UNION
SELECT id, 'C' SELECT id, 'C'
FROM client FROM client c
LEFT JOIN clientSupplierSync cs ON cs.idClientSupplier = c.id
AND cs.Type ='C'
WHERE cs.idClientSupplier IS NULL
UNION UNION
SELECT id, 'P' SELECT id, 'P'
FROM supplier; FROM supplier s
LEFT JOIN clientSupplierSync cs ON cs.idClientSupplier = s.id
AND cs.Type ='P'
WHERE cs.idClientSupplier IS NULL;
CALL clientSupplier_add(vCompanyFk); CALL clientSupplier_add(vCompanyFk);