Saldos iniciales carga clasificiaones y Cvemoneda y tipo cambio en otras cargas

This commit is contained in:
Oscar Irigoyen
2022-09-29 06:28:46 -07:00
parent 414342446c
commit 75522a4593
3 changed files with 165 additions and 16 deletions

View File

@@ -32,6 +32,8 @@ Public Class ClsClasificaciones
End Get
End Property
Public Property CveClasificacion As Integer = -1
#End Region
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
@@ -272,7 +274,8 @@ Public Class ClsClasificaciones
Public Function AddClasificaciones(Clasificacion As String, Codigo As String, IdCuentaGasto As Integer, CuentaGasto As String, IdCuentaCostos As Integer, CuentaCostos As String, IdCuentaIngreso As Integer, CuentaIngreso As String, CveCategoria As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional RequiereSerieLote As Integer = 0, Optional UsoClasificacion As Integer = -1, Optional CveSATPS As Integer = -1, Optional RequiereAFCompra As Boolean = False, Optional RequiereAFInsumo As Boolean = False, Optional RequierePersonal As Boolean = False,
Optional EsAcumulador As Boolean = False, Optional TopVentas As Boolean = False, Optional TopCompras As Boolean = False, Optional PrecioBaseCosto As Decimal = -1) As Boolean
Dim Retorno As Boolean = False
Dim Retorno As Boolean = False
Me.CveClasificacion = -1
DataAdapter("PA_ClasificacionesAdd")
@@ -306,13 +309,15 @@ Public Class ClsClasificaciones
.Add("@EsAcumulador", SqlDbType.Bit).Value = EsAcumulador
.Add("@TopCompras", SqlDbType.Bit).Value = TopCompras
.Add("@TopVentas", SqlDbType.Bit).Value = TopVentas
.Add("@PrecioBaseCosto", SqlDbType.Money).Value = PrecioBaseCosto
.Add("@PrecioBaseCosto", SqlDbType.Money).Value = PrecioBaseCosto
.Add("@CveClasificacion", SqlDbType.Int).Direction = ParameterDirection.Output
End With
Try
SqlAdapter.Fill(Data)
Me.CveClasificacion = SqlAdapter.SelectCommand.Parameters("@CveClasificacion").Value.ToString.ToEntero
Retorno = True
Catch Ex1 As SqlException
If Ex1.Message.Contains("Número: 2627;") Then

View File

@@ -29,7 +29,7 @@
<div class="actions">
<div class="btn-group">
</div>
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
@@ -44,6 +44,7 @@
<asp:ListItem Value="4" Text="Factura - Cliente"></asp:ListItem>
<asp:ListItem Value="14" Text="Anticipo Clientes"></asp:ListItem>
<asp:ListItem Value="5" Text="Productos y Sevicios" ></asp:ListItem>
<asp:ListItem Value="16" Text="Clasificaciones" Enabled="True"></asp:ListItem>
<asp:ListItem Value="6" Text="RH - Personal"></asp:ListItem>
<%--<asp:ListItem Value="7" Text="AF - Activos Fijos" Enabled="false"></asp:ListItem>--%>
<asp:ListItem Value="7" Text="AF - Activos Fijos" ></asp:ListItem>
@@ -53,7 +54,7 @@
<asp:ListItem Value="11" Text="ContaSIG - Saldos Iniciales Cuentas" Enabled="True"></asp:ListItem>
<asp:ListItem Value="12" Text="Almacen" Enabled="True"></asp:ListItem>
<asp:ListItem Value="15" Text="Bancos" Enabled="True"></asp:ListItem>
<asp:ListItem Value="16" Text="Clasificaciones" Enabled="True"></asp:ListItem>
</asp:RadioButtonList>
<div runat="server" id="divAlmacen">
<div class="row">

View File

@@ -628,6 +628,36 @@ Partial Class General_SaldosIniciales
Exit Sub
End If
ElseIf RblFormato.SelectedValue = "16" Then 'CLASIFICACIONES
If Not dt.Columns(0).ColumnName = "Clasificacion" Then
Alert("El nombre de la primera columna debe ser 'Clasificacion'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(1).ColumnName = "Categoria" Then
Alert("El nombre de la segunda columna debe ser 'Categoria'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(2).ColumnName = "UsoClasificacion" Then
Alert("El nombre de la segunda columna debe ser 'UsoClasificacion'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(3).ColumnName = "CuentaContableIngreso" Then
Alert("El nombre de la segunda columna debe ser 'CuentaContableIngreso'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(4).ColumnName = "CuentaContableGasto" Then
Alert("El nombre de la cuarta columna debe ser 'CuentaContableGasto'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
End If
@@ -2214,14 +2244,130 @@ Partial Class General_SaldosIniciales
ProcesaAnticipoCliente(dt, DTCuentasContables)
ElseIf RblFormato.SelectedValue = "15" Then
ProcesaBancos(dt, DTCuentasContables)
ElseIf RblFormato.SelectedValue = "16" Then
ProcesaClasificaciones(dt, DTCuentasContables)
End If
End If
End Sub
Private Sub ProcesaClasificaciones(dt As DataTable, dTCuentasContables As DataTable)
Dim ObjClasificaciones As New ClsClasificaciones
Dim ObjConta As New ClsContabilidad(ObjClasificaciones.IniciaTransacSQL)
Dim ErrorProceso As Boolean = False
Dim Contador As Integer = 0
For Each dRow As DataRow In dt.Rows
Dim Clasificacion As String = dRow("Clasificacion").ToString.Trim
Dim Categoria As String = dRow("Categoria").ToString.Trim
Dim UsoClasificacion As String = dRow("UsoClasificacion").ToString.Trim.ToUpper
Dim CuentaContableIngreso As String = dRow("CuentaContableIngreso").ToString.Trim
Dim CuentaContableGasto As String = dRow("CuentaContableGasto").ToString.Trim
Dim CveClasificacion As Integer = -1
Dim CveUsoClasificacion As Integer = -1
Dim CveCategoria As Integer = -1
CveCategoria = GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", $" Categoria = '{Categoria}' ").ToEntero
If Not CveCategoria > 0 Then
CveCategoria = GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCategoria", "").ToEntero
If Not CveCategoria > 0 Then
Alert($"Clasificación {Clasificacion} la categoria {Categoria} no es valida.", TipoMensaje.MsgAdvertencia)
ErrorProceso = True
Exit For
End If
End If
If UsoClasificacion = "INGRESOS" Then
CveUsoClasificacion = 1
ElseIf UsoClasificacion = "GASTO" Then
CveUsoClasificacion = 2
ElseIf UsoClasificacion = "INGRESOS/GASTO" Then
CveUsoClasificacion = 3
End If
If Not CveUsoClasificacion > 0 Then
Alert($"Clasificación {Clasificacion} el uso {UsoClasificacion} no es valido.", TipoMensaje.MsgAdvertencia)
ErrorProceso = True
Exit For
End If
Dim CveCuentaContableIngreso As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableIngreso}'").ToEntero
Dim CveCuentaContableGasto As Integer = dTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContableGasto}'").ToEntero
If CuentaContableIngreso.Trim.Length > 0 AndAlso CveCuentaContableIngreso <= 0 Then
Alert($"Clasificación {Clasificacion} no se encontro la cuenta de ingreso {CuentaContableIngreso}.", TipoMensaje.MsgAdvertencia)
ErrorProceso = True
End If
If CuentaContableGasto.Trim.Length > 0 AndAlso CveCuentaContableGasto <= 0 Then
Alert($"Clasificación {Clasificacion} no se encontro la cuenta de gasto {CuentaContableGasto}.", TipoMensaje.MsgAdvertencia)
ErrorProceso = True
End If
If ObjClasificaciones.AddClasificaciones(Clasificacion, "", -1, "-1", -1, "-1", -1, "-1", CveCategoria, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, RequiereSerieLote:=0, UsoClasificacion:=CveUsoClasificacion,
CveSATPS:=-1, RequiereAFCompra:=False, RequiereAFInsumo:=False, RequierePersonal:=False, EsAcumulador:=False, TopVentas:=False, TopCompras:=False, PrecioBaseCosto:=-1) Then
CveClasificacion = ObjClasificaciones.CveClasificacion
If Not CveClasificacion > 0 Then
ErrorProceso = True
End If
Else
ErrorProceso = True
End If
If Not ErrorProceso Then
If CveCuentaContableIngreso > 0 Then
If Not AsignacionCuenta(ObjConta, 4, CveCuentaContableIngreso, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CveClasificacion) Then
ErrorProceso = True
Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia)
Exit For
End If
End If
If CveCuentaContableGasto > 0 Then
If Not AsignacionCuenta(ObjConta, 6, CveCuentaContableGasto, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CveClasificacion) Then
ErrorProceso = True
Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia)
Exit For
End If
End If
End If
Contador = Contador + 1
Next
If Not ErrorProceso Then
ObjClasificaciones.Commit()
Alert($"Se agregaron {Contador} Clasificaciones.")
Else
ObjClasificaciones.RollBack()
End If
ObjClasificaciones.Dispose()
End Sub
Private Sub ProcesaBancos(DTBancos As DataTable, DTCuentasContables As DataTable)
Dim ErrorProceso As Boolean = False
@@ -2312,7 +2458,7 @@ Partial Class General_SaldosIniciales
End If
If Not AsignacionCuenta(ObjConta, 30, CveCuentaContable, CveCuentaBancaria, -1, -1, -1, UsuarioActual.CveEmpresa) Then
If Not AsignacionCuenta(ObjConta, 30, CveCuentaContable, CveCuentaBancaria, -1, -1, -1, UsuarioActual.CveEmpresa, -1) Then
ErrorProceso = True
Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia)
Exit For
@@ -2445,7 +2591,7 @@ Partial Class General_SaldosIniciales
End If
If Not AsignacionCuenta(ObjConta, 10, CveCuentaContable, -1, CveProveedor, -1, -1, UsuarioActual.CveEmpresa) Then
If Not AsignacionCuenta(ObjConta, 10, CveCuentaContable, -1, CveProveedor, -1, -1, UsuarioActual.CveEmpresa, -1) Then
ErrorProceso = True
Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia)
Exit For
@@ -2576,7 +2722,7 @@ Partial Class General_SaldosIniciales
End If
If Not AsignacionCuenta(ObjConta, 66, CveCuentaContable, -1, -1, CveCliente, -1, UsuarioActual.CveEmpresa) Then
If Not AsignacionCuenta(ObjConta, 66, CveCuentaContable, -1, -1, CveCliente, -1, UsuarioActual.CveEmpresa, -1) Then
ErrorProceso = True
Alert("Se presento un error al guardar en asignaciones", TipoMensaje.MsgAdvertencia)
Exit For
@@ -2619,19 +2765,14 @@ Partial Class General_SaldosIniciales
Private Function AsignacionCuenta(ObjContabilidad As ClsContabilidad, CveConceptoContable As Integer, CveCuentaContable As Integer, CveBancoCuenta As Integer, CveProveedor As Integer, CveCliente As Integer,
CvePersonal As Integer, CveEmpresa As Integer) As Boolean
CvePersonal As Integer, CveEmpresa As Integer, CveClasificacion As Integer) As Boolean
Dim Respuesta As Boolean = False
'If Not ObjConta.AddCuentasAsignaciones(28, UsuarioActual.CveEmpresa, CveCuentaContable, -1,
' -1, -1, ObjRH.CvePersonal, -1, -1, 0, CveBancoCuenta:=-1, CveConceptoNomina:=-1, CveSubProyecto:=-1, CveActivoFijo:=-1,
' CveTipoGasto:=-1, RegeneraCuenta:=False) Then
' ErrorRH = True
' Exit For
'End If
If ObjContabilidad.AddCuentasAsignaciones(CveConceptoContable, CveEmpresa, CveCuentaContable, -1,
CveProveedor, CveCliente, CvePersonal, -1, -1, 0, CveBancoCuenta:=CveBancoCuenta, CveConceptoNomina:=-1, CveSubProyecto:=-1, CveActivoFijo:=-1,
CveProveedor, CveCliente, CvePersonal, CveClasificacion, -1, 0, CveBancoCuenta:=CveBancoCuenta, CveConceptoNomina:=-1, CveSubProyecto:=-1, CveActivoFijo:=-1,
CveTipoGasto:=-1, RegeneraCuenta:=False) Then
Respuesta = True
End If
@@ -2673,6 +2814,8 @@ Partial Class General_SaldosIniciales
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoAnticipoCliente.xlsx"
ElseIf RblFormato.SelectedValue = "15" Then
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoBancos.xlsx"
ElseIf RblFormato.SelectedValue = "16" Then
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoClasificaciones.xlsx"
End If
If Not (Directorio = "") Then