--cambios de creación de cuentas
This commit is contained in:
@@ -518,7 +518,7 @@ Partial Class Compras_Proveedores
|
||||
|
||||
|
||||
'Configuración de Modalidad Update
|
||||
ActivarRegistroAutomatico()
|
||||
'ActivarRegistroAutomatico()
|
||||
BtnGuardar.Text = "Guardar Cambios"
|
||||
LtlTitulo.Text = "Proveedor:"
|
||||
'ImgAddVenta
|
||||
@@ -589,7 +589,6 @@ Partial Class Compras_Proveedores
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(256) Then LnkParametros.Visible = True 'Actualizar Límite de Crédito
|
||||
|
||||
ActivarRegistroAutomatico()
|
||||
End If
|
||||
|
||||
'Crea y carga CuentasBancarias - tab:Bancos
|
||||
@@ -692,34 +691,25 @@ Partial Class Compras_Proveedores
|
||||
If CveProveedor > 0 Then
|
||||
|
||||
Dim ObjProveedores As New ClsCompProveedores
|
||||
|
||||
If ObjProveedores.GetRePresentanteLegal(-1, UsuarioActual.CveEmpresa, CveProveedor) Then
|
||||
|
||||
GvRepresentante.DataSource = ObjProveedores.DtResultados
|
||||
Else
|
||||
GvRepresentante.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjProveedores.Dispose()
|
||||
|
||||
GvRepresentante.DataBind()
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub CargaCuentasContables(Optional IdCuentaPadre As Integer = -1)
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaContabilidad Then
|
||||
Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
If ObjContabilidad.GetCuentasRecursiva(IdCuentaPadre, 1) Then
|
||||
DtCuentasContables = ObjContabilidad.DtResultados
|
||||
Else
|
||||
DtCuentasContables = Nothing
|
||||
End If
|
||||
ObjContabilidad.Dispose()
|
||||
ElseIf UsuarioActual.Empresa.TipoContabilidad = 1 Then
|
||||
'If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaContabilidad Then
|
||||
' Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
' If ObjContabilidad.GetCuentasRecursiva(IdCuentaPadre, 1) Then
|
||||
' DtCuentasContables = ObjContabilidad.DtResultados
|
||||
' Else
|
||||
' DtCuentasContables = Nothing
|
||||
' End If
|
||||
' ObjContabilidad.Dispose()
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 1 OrElse UsuarioActual.CveEmpresa.Contiene(13, 83) Then
|
||||
Dim ObjContabilidad As New ClsContabilidad
|
||||
If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then
|
||||
DtCuentasContables = ObjContabilidad.DtResultados
|
||||
@@ -916,7 +906,7 @@ Partial Class Compras_Proveedores
|
||||
|
||||
DdlRegimenFiscal.SelectedValueExist(ObjProveedor.CveRegimenFiscal
|
||||
)
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 1 OrElse UsuarioActual.CveEmpresa.Contiene(13, 83) Then
|
||||
CargaCuentasConceptos()
|
||||
divCuentas.Visible = True
|
||||
divCuentasContp.Visible = False
|
||||
@@ -1045,6 +1035,7 @@ Partial Class Compras_Proveedores
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
If ObjConta.GetCuentasConceptos(1, UsuarioActual.CveEmpresa, CveProveedor:=CveProveedor) Then
|
||||
GvCta.DataSource = ObjConta.DtResultados
|
||||
If ObjConta.DtResultados.Rows.Count = 0 Then BtnCuentaDesglose.Visible = True
|
||||
End If
|
||||
ObjConta.Dispose()
|
||||
GvCta.DataBind()
|
||||
@@ -1550,128 +1541,13 @@ Partial Class Compras_Proveedores
|
||||
|
||||
Dim codigo As String = "-1"
|
||||
Dim MsgCuentaContable As String = ""
|
||||
Dim IdCuentaContable As Integer = -1
|
||||
Dim IdCuentaAltaCompaq As Integer = -1
|
||||
Dim CodigoCuentaAltaCompaq As String = ""
|
||||
Dim NombreCuentaCuentaAltaCompaq As String = ""
|
||||
|
||||
Dim IdProveedor As Integer = -1
|
||||
|
||||
Dim errorContPaq As Boolean = False
|
||||
|
||||
Dim AplicarEvaluacion As Boolean = ChkAplicarEvaluacion.Checked
|
||||
Dim FechaEvaluacion As String = If(IsDate(TxtFechaEva.Text.Trim()), TxtFechaEva.Text, "-1")
|
||||
Dim CicloEvaluacion As Integer = If(AplicarEvaluacion, DdlCicloEvaluacion.SelectedValue.ToEntero(), -1)
|
||||
|
||||
'Dim IdContPaqi As Integer
|
||||
'Dim CodigoPersona As Integer
|
||||
|
||||
'If UsuarioActual.Empresa.Funcionalidad(522).ToString = "1" Then
|
||||
' Dim ObjContPaqi As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
|
||||
' If UsuarioActual.Empresa.UsaContabilidad Then
|
||||
|
||||
' If ObjContPaqi.GetPersona(TxtRFC.Text) Then
|
||||
|
||||
' If ObjContPaqi.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("Id").ToString.ToEntero
|
||||
' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString.ToEntero
|
||||
|
||||
' Dim Cont_EsProveedor As Integer = If(Boolean.Parse(ObjContPaqi.DtResultados.Rows(0)("EsProveedor").ToString), 1, 0)
|
||||
' Dim Cont_Nombre As String = ObjContPaqi.DtResultados(0)("Nombre").ToString
|
||||
' Dim Cont_RFC As String = ObjContPaqi.DtResultados(0)("RFC").ToString
|
||||
|
||||
' If ObjContPaqi.UpdatePersona(IdContPaqi, Cont_Nombre, Cont_RFC, 1, Cont_EsProveedor) Then
|
||||
' errorContPaq = False
|
||||
' Else
|
||||
' errorContPaq = True
|
||||
' End If
|
||||
|
||||
' Else
|
||||
' If ObjContPaqi.AddPersona(TxtNombreComercial.Text.Trim, TxtRFC.Text.Trim, 0, 1) Then
|
||||
' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiPersona").ToString.ToEntero
|
||||
' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString.ToEntero
|
||||
' errorContPaq = False
|
||||
' Else
|
||||
' errorContPaq = True
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
' If Not errorContPaq Then
|
||||
' ObjContPaqi.Commit()
|
||||
' ObjContPaqi.Dispose()
|
||||
' Else
|
||||
' ObjContPaqi.RollBack()
|
||||
' ObjContPaqi.Dispose()
|
||||
' Exit Sub
|
||||
' End If
|
||||
|
||||
'End If
|
||||
|
||||
Dim ClaveFuncionalidad As Integer = UsuarioActual.Empresa.Funcionalidad(201).ToEntero
|
||||
|
||||
If CveProveedor = -1 Then
|
||||
|
||||
Dim ObjContaAC As ClsContPAQi = Nothing
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ((UsuarioActual.Empresa.Funcionalidad(200).ToEntero > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(201).ToEntero > 0)) Then 'FUNCIONALIDAD 112=AGREGAR CTA CONTABLE PROVEEDOR
|
||||
|
||||
ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa)
|
||||
ObjContaAC.IniciaTransacSQL()
|
||||
|
||||
|
||||
If DdlCveTipoProveedor.SelectedValue = "2" Then 'cuando es acreedor
|
||||
ClaveFuncionalidad = UsuarioActual.Empresa.Funcionalidad(202).ToEntero
|
||||
End If
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(322).ToString.Trim.ToEntero > 0 Then
|
||||
IdCuentaContable = UsuarioActual.Empresa.Funcionalidad(322).ToString.Trim.ToEntero
|
||||
Else
|
||||
IdCuentaContable = ObjContaAC.AddSiguienteCuentaHijo(ClaveFuncionalidad, TxtRazonSocial.Text.Trim, "D", 2)
|
||||
IdCuentaAltaCompaq = IdCuentaContable
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If IdCuentaContable > 0 Then
|
||||
|
||||
ObjContaAC.GetCuentas(IdCuentaContable, "-1", -1)
|
||||
Dim dt As DataTable = ObjContaAC.DtResultados
|
||||
Dim CtaCodigo As String
|
||||
|
||||
If dt.Rows.Count = 1 Then
|
||||
Dim row As DataRow = dt.Rows(0)
|
||||
CtaCodigo = CStr(row("CtaCodigo"))
|
||||
CodigoCuentaAltaCompaq = CStr(row("Codigo"))
|
||||
NombreCuentaCuentaAltaCompaq = TxtRazonSocial.Text.Trim
|
||||
DdlCtaContProveedores.Items.Add(New ListItem(CtaCodigo, IdCuentaContable.ToString)) : DdlCtaContProveedores.SelectedValueExist(IdCuentaContable.ToString)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
IdProveedor = ObjContaAC.AddProveedor(IdCuentaContable, TxtRFC.Text.Trim, TxtRazonSocial.Text.Trim, "")
|
||||
|
||||
If IdProveedor > 0 Then
|
||||
|
||||
Else
|
||||
ObjContaAC.RollBack()
|
||||
Alert("Ocurrio un error al guardar en el padron de proveedores")
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else
|
||||
ObjContaAC.RollBack()
|
||||
ErrorConta = True
|
||||
Alert("Ocurrio un error al guardar la cuenta contable")
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Dim ObjProveedores As New ClsCompProveedores()
|
||||
Dim ObjCuentasDeposito As New ClsGenerales(ObjProveedores.IniciaTransacSQL())
|
||||
|
||||
@@ -1696,13 +1572,6 @@ Partial Class Compras_Proveedores
|
||||
Next
|
||||
End If
|
||||
|
||||
'If UsuarioActual.CveEmpresa = 119 Then
|
||||
' If Not AsignaCuentasAutomaticas(ObjProveedores, NuevoCveProveedor) Then
|
||||
' ErrorCuentasContables = True
|
||||
' End If
|
||||
'End If
|
||||
|
||||
|
||||
''Agrega Sucursales
|
||||
If TempDTSucursales.Rows.Count > 0 Then
|
||||
For Each row As DataRow In TempDTSucursales.Rows
|
||||
@@ -1742,25 +1611,8 @@ Partial Class Compras_Proveedores
|
||||
Next
|
||||
End If
|
||||
|
||||
If IdCuentaAltaCompaq > 0 Then
|
||||
|
||||
Dim CveConceptoContable As Integer
|
||||
If DdlCveTipoProveedor.SelectedValue.ToEntero.Contiene(1, 3) Then
|
||||
CveConceptoContable = 5
|
||||
Else
|
||||
CveConceptoContable = 305
|
||||
End If
|
||||
|
||||
If Not AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq, CveConceptoContable, ObjProveedores.IniciaTransacSQL, IdCompaqPadre:=ClaveFuncionalidad, CveProveedorCuenta:=NuevoCveProveedor) Then
|
||||
ErrorCuentasContablesSIG = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If ErrorBancos Or ErrorContactos Or ErrorSucursales Or ErrorCuentasContables Or ErrorCuentasContablesSIG Then ''se deben validar las 3 juntas????????
|
||||
ObjProveedores.RollBack()
|
||||
If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack()
|
||||
If ErrorBancos Then
|
||||
Alert("Ocurrió un error al registrar las Cuentas Bancarias", TipoMensaje.MsgError)
|
||||
Else
|
||||
@@ -1779,8 +1631,6 @@ Partial Class Compras_Proveedores
|
||||
End If
|
||||
Else
|
||||
ObjProveedores.Commit()
|
||||
If ObjContaAC IsNot Nothing Then ObjContaAC.Commit()
|
||||
|
||||
'ACTUALIZAR GLOBAL
|
||||
GlobalDTCompProveedores(UsuarioActual.CveEmpresa) = Nothing
|
||||
GlobalDTProveedoresCuentas(UsuarioActual.CveEmpresa, -1) = Nothing
|
||||
@@ -1792,43 +1642,9 @@ Partial Class Compras_Proveedores
|
||||
|
||||
ObjProveedores.Dispose()
|
||||
ObjCuentasDeposito.Dispose()
|
||||
If ObjContaAC IsNot Nothing Then ObjContaAC.Dispose()
|
||||
|
||||
Else
|
||||
'If UsuarioActual.Empresa.Funcionalidad(522).ToString = "1" Then
|
||||
|
||||
' If UsuarioActual.Empresa.UsaContabilidad Then
|
||||
' Dim ObjContPaqi As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
' If Not errorContPaq Then
|
||||
' If ObjContPaqi.GetProveedor(TxtRFC.Text.Trim) Then
|
||||
' If ObjContPaqi.DtResultados.Rows.Count > 0 Then
|
||||
' IdProveedor = ObjContPaqi.DtResultados.Rows(0)("Id").ToString.ToEntero
|
||||
' errorContPaq = False
|
||||
' Else
|
||||
' IdProveedor = ObjContPaqi.AddProveedor(DdlCtaContProveedores.SelectedValue.ToEntero, TxtRFC.Text.Trim, TxtNombreComercial.Text.Trim, "", CodigoPersona)
|
||||
' If IdProveedor > 0 Then
|
||||
' errorContPaq = False
|
||||
' Else
|
||||
' errorContPaq = True
|
||||
' End If
|
||||
' End If
|
||||
' Else
|
||||
' errorContPaq = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
|
||||
' If Not errorContPaq Then
|
||||
' ObjContPaqi.Commit()
|
||||
' ObjContPaqi.Dispose()
|
||||
' Else
|
||||
' ObjContPaqi.RollBack()
|
||||
' ObjContPaqi.Dispose()
|
||||
' Alert("Se Presento un Error al Guardar el Proveedor en ContPAQi.", TipoMensaje.MsgError)
|
||||
' Exit Sub
|
||||
' End If
|
||||
' End If
|
||||
|
||||
'End If
|
||||
Dim CreoCuenta As Boolean = False
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso (UsuarioActual.Empresa.UsaAC Or (UsuarioActual.Empresa.UsaContabilidad And UsuarioActual.Empresa.Funcionalidad(322).ToString.Trim.ToEntero = 0)) Then
|
||||
@@ -2022,73 +1838,6 @@ Partial Class Compras_Proveedores
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq As String, NombreCuentaCuentaAltaCompaq As String, IdCuentaAltaCompaq As Integer, CveConceptoContable As Integer, Optional Transaccion As SqlClient.SqlTransaction = Nothing, Optional IdCompaqPadre As Integer = -1, Optional CveProveedorCuenta As Integer = -1) As Boolean
|
||||
|
||||
If Not UsuarioActual.CveEmpresa.Contiene(7, 11, 145, 122) Then
|
||||
Return True
|
||||
End If
|
||||
|
||||
If Not IdCompaqPadre > 0 Then
|
||||
Alert("Erroa al agregar la cuenta SIG, IdCompaq sin definir.", TipoMensaje.MsgError)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim Respuesta As Boolean = False
|
||||
Dim DisposeClases As Boolean = False
|
||||
Dim Tipo As String = "B"
|
||||
|
||||
If CveConceptoContable.Contiene(5, 305) Then
|
||||
Tipo = "D"
|
||||
ElseIf CveConceptoContable.Contiene(10) Then
|
||||
Tipo = "A"
|
||||
End If
|
||||
|
||||
Dim ObjContabilidad As ClsContabilidad
|
||||
|
||||
If Transaccion Is Nothing Then
|
||||
ObjContabilidad = New ClsContabilidad
|
||||
DisposeClases = True
|
||||
Else
|
||||
ObjContabilidad = New ClsContabilidad(Transaccion)
|
||||
DisposeClases = False
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(7, 11, 145, 122) Then
|
||||
If ObjContabilidad.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Dim CvePadre As Integer = ObjContabilidad.DtResultados.FiltroPrimeroValor("CveCuenta", $"IdCompaq={IdCompaqPadre}").ToEntero
|
||||
|
||||
If CvePadre > 0 Then
|
||||
|
||||
Dim CvecuentaNueva As Integer = ObjContabilidad.AddCuenta(CvePadre, CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, Tipo, 2, 1, CveProveedor:=CveProveedor, IdCompaq:=IdCuentaAltaCompaq)
|
||||
|
||||
If CvecuentaNueva > 0 Then
|
||||
If ObjContabilidad.AddCuentasAsignaciones(CveConceptoContable, UsuarioActual.CveEmpresa, CvecuentaNueva, CveProveedor:=CveProveedorCuenta, PorcentajeIVA:=0) Then
|
||||
Respuesta = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Respuesta = True
|
||||
End If
|
||||
|
||||
If DisposeClases Then
|
||||
ObjContabilidad.Dispose()
|
||||
|
||||
If Not Respuesta Then
|
||||
Alert("Se presento un error al agregar y asignar la cuenta (Conta SIG).", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
Return Respuesta
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
@@ -4371,11 +4120,9 @@ Partial Class Compras_Proveedores
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
|
||||
If Not AltaCuentaContabilidadSIG(Codigo, NombreCuenta, IdCuentaContable, CveConceptoContable, ObjProveedores.IniciaTransacSQL, IdCompaqPadre:=CuentaPadre, CveProveedorCuenta:=CveProveedor) Then
|
||||
TieneError = True
|
||||
End If
|
||||
'If Not AltaCuentaContabilidadSIG(Codigo, NombreCuenta, IdCuentaContable, CveConceptoContable, ObjProveedores.IniciaTransacSQL, IdCompaqPadre:=CuentaPadre, CveProveedorCuenta:=CveProveedor) Then
|
||||
' TieneError = True
|
||||
'End If
|
||||
|
||||
|
||||
If Not TieneError Then
|
||||
@@ -6079,6 +5826,60 @@ Partial Class Compras_Proveedores
|
||||
End If
|
||||
ObjBancos.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnCuentaDesglose_Click(sender As Object, e As EventArgs)
|
||||
Dim tCveConcepto As Integer = 5
|
||||
Dim tError As Boolean = False
|
||||
Dim Msg As String = ""
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
Dim ObjContai As ClsContPAQi = Nothing
|
||||
ObjConta.IniciaTransacSQL()
|
||||
Dim CveCuentaGlobal As Integer = -2
|
||||
If UsuarioActual.CveEmpresa = 13 Then
|
||||
CveCuentaGlobal = 84157
|
||||
End If
|
||||
'If ObjConta.GetCuentasGlobales(UsuarioActual.CveEmpresa, tCveConcepto) Then
|
||||
Dim Cve As Integer = ObjConta.GeneraCuentaDesglose(tCveConcepto, 1, CveCuentaGlobal, CveProveedor, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
If Cve > 0 Then
|
||||
If ObjConta.GetCuentas(Cve, "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
Dim drt As DataRow
|
||||
drt = ObjConta.DtResultados.FiltroPrimero("")
|
||||
If drt IsNot Nothing Then
|
||||
Msg = drt("Codigo").ToString & "-" & drt("Nombre").ToString
|
||||
End If
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
||||
If ObjConta.GetCuentas(drt("CvePadre").ToString.ToEntero, "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
Dim idpadre As Integer = ObjConta.DtResultados.FiltroPrimeroValor("IdCompaq").ToEntero
|
||||
ObjContai = New ClsContPAQi(UsuarioActual.Empresa)
|
||||
Dim tidcon As Integer = ObjContai.AddCuenta(drt("Codigo").ToString, drt("Nombre").ToString, "D", 2, 0, 1, 0, "", 1, idpadre)
|
||||
If tidcon > 0 Then
|
||||
If Not ObjConta.UpdateCuentaCompaq(Cve, tidcon, UsuarioActual.CveEmpresa) Then
|
||||
tError = True
|
||||
End If
|
||||
Else
|
||||
tError = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
tError = True
|
||||
End If
|
||||
|
||||
'End If
|
||||
'crear la cuenta en el contpaqi
|
||||
If Not tError Then
|
||||
Alert("Cuenta Generada correctamente.<br>" & Msg)
|
||||
ObjConta.Commit()
|
||||
If ObjContai IsNot Nothing Then ObjContai.Commit()
|
||||
Else
|
||||
ObjConta.RollBack()
|
||||
If ObjContai IsNot Nothing Then ObjContai.RollBack()
|
||||
ObjConta.Dispose()
|
||||
End If
|
||||
ObjConta.Dispose()
|
||||
CargaCuentasContables()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user