-- sincronizar cuentas contpaq ->SIG
This commit is contained in:
@@ -7329,6 +7329,52 @@ Public Class ClsContPAQi
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function SincronizaCuentas(CveEmpresa As Integer) As Boolean
|
||||
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("SELECT CASE ")
|
||||
StrSQL.Append(" WHEN Tipo = 'A' THEN 1 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'B' THEN 2 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'C' THEN 3 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'D' THEN 4 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'E' THEN 5 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'F' THEN 6 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'G' THEN 7 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'H' THEN 8 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'I' THEN 9 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'J' THEN 10 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'K' THEN 11 ")
|
||||
StrSQL.Append(" WHEN Tipo = 'L' THEN 12 ")
|
||||
StrSQL.Append(" END AS CveClasificacionCuenta, ")
|
||||
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(" 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(" ORDER BY Codigo; ")
|
||||
|
||||
|
||||
|
||||
SqlDataAdapter(StrSQL.ToString, CommandType.Text)
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
Me.OnError("Ocurrió un error al sincronizar cuentas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
Reference in New Issue
Block a user