-- CORRECCION DE LINKED SERVER

This commit is contained in:
2023-11-22 11:37:30 -07:00
parent 0b3db5ec97
commit 687fdabab5

View File

@@ -7333,7 +7333,7 @@ Public Class ClsContPAQi
Dim Retorno As Boolean = False
StrSQL.Clear()
StrSQL.Append(" INSERT INTO [192.168.0.2].Ventas.dbo.Conta_Cuentas (CveClasificacionCuenta, Codigo, Nombre, Afectable,TipoCuenta,Estatus,FechaIng,CveUsuario,CveEmpresa,CveMoneda,IdCompaq,CvePadre) ")
StrSQL.Append(" INSERT INTO [SERVIDOR].Ventas.dbo.Conta_Cuentas (CveClasificacionCuenta, Codigo, Nombre, Afectable,TipoCuenta,Estatus,FechaIng,CveUsuario,CveEmpresa,CveMoneda,IdCompaq,CvePadre) ")
StrSQL.Append("SELECT CASE ")
StrSQL.Append(" WHEN Tipo = 'A' THEN 1 ")
StrSQL.Append(" WHEN Tipo = 'B' THEN 2 ")
@@ -7351,10 +7351,10 @@ Public Class ClsContPAQi
StrSQL.Append(" Codigo, Nombre, Afectable, CtaMayor AS TipoCuenta, 1 AS Estatus, Getdate() AS FechaIng, 100 ASCveUsuario, ")
StrSQL.Append(" @CveEmpresa AS CveEmpresa, ")
StrSQL.Append(" IdMoneda AS CveMoneda, C.Id AS IdCompaq, ")
StrSQL.Append(" (select cc.CveCuenta from [192.168.0.2].Ventas.dbo.Conta_Cuentas cc where cc.IdCompaq = a.IdCtaSup AND cc.CveEmpresa = @CveEmpresa ) as CvePadre ")
StrSQL.Append(" (select cc.CveCuenta from [SERVIDOR].Ventas.dbo.Conta_Cuentas cc where cc.IdCompaq = a.IdCtaSup AND cc.CveEmpresa = @CveEmpresa ) as CvePadre ")
StrSQL.Append(" FROM Cuentas c ")
StrSQL.Append(" INNER JOIN Asociaciones a on c.Id = a.IdSubCtade ")
StrSQL.Append(" WHERE c.Id IN(SELECT CC.Id FROM Cuentas CC LEFT JOIN [192.168.0.2].Ventas.dbo.Conta_Cuentas CS on CC.Id = CS.IdCompaq AND CS.CveEmpresa = @CveEmpresa WHERE CC.Codigo NOT IN('_BPASIVO') AND CS.CveCuenta IS NULL) ")
StrSQL.Append(" WHERE c.Id IN(SELECT CC.Id FROM Cuentas CC LEFT JOIN [SERVIDOR].Ventas.dbo.Conta_Cuentas CS on CC.Id = CS.IdCompaq AND CS.CveEmpresa = @CveEmpresa WHERE CC.Codigo NOT IN('_BPASIVO') AND CS.CveCuenta IS NULL) ")
StrSQL.Append(" ORDER BY Codigo; ")