Sistema/Empresa : Fix Guardar Empresa
-CAMBIOS EN BD: PA_Sis_EmpresasGet en SIG_Resp_MLR y Ventas Faltaba un Case en WHERE Un INNER a LEFT JOIN
This commit is contained in:
@@ -77,6 +77,9 @@ Partial Class Sistemas_Empresa
|
||||
End Property
|
||||
Public Property DtClasificacionIVA As DataTable
|
||||
Get
|
||||
If ViewState("DtClasificacionIVA") Is Nothing Then
|
||||
ViewState("DtClasificacionIVA") = New DataTable
|
||||
End If
|
||||
Return CType((ViewState("DtClasificacionIVA")), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
@@ -150,7 +153,6 @@ Partial Class Sistemas_Empresa
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
|
||||
@@ -162,7 +164,6 @@ Partial Class Sistemas_Empresa
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
CargaDdlPac()
|
||||
@@ -204,8 +205,6 @@ Partial Class Sistemas_Empresa
|
||||
TxtPlantillaVenta.Text = UsuarioActual.Empresa.PlantillaMailVenta
|
||||
TxtAsunto.Text = UsuarioActual.Empresa.AsuntoPlantillaMailVenta
|
||||
|
||||
InicializaClasificacionIVA()
|
||||
|
||||
Else
|
||||
'Configuración de Modalidad Insert
|
||||
ViewState("CveEmpresa") = -1
|
||||
@@ -215,9 +214,6 @@ Partial Class Sistemas_Empresa
|
||||
End If
|
||||
ConfiguracionEmpresa()
|
||||
|
||||
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -235,8 +231,6 @@ Partial Class Sistemas_Empresa
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim ObjEmpresas As New ClsSisEmpresas()
|
||||
@@ -346,7 +340,6 @@ Partial Class Sistemas_Empresa
|
||||
CargaCuentasContables()
|
||||
CargaDDLs()
|
||||
|
||||
|
||||
Dim Row As DataRow
|
||||
Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIVAxAcreditar.ToString))
|
||||
If Not IsNothing(Row) Then
|
||||
@@ -455,7 +448,6 @@ Partial Class Sistemas_Empresa
|
||||
CargaFuncionalidad(215, DdlFyE)
|
||||
CargaFuncionalidad(221, DdlActivoFijo)
|
||||
|
||||
|
||||
'CargaFuncionalidad(232, DdlProveedoresSIG)
|
||||
'CargaFuncionalidad(233, DdlClientesSIG)
|
||||
'CargaFuncionalidad(234, DdlDeudoresSIG)
|
||||
@@ -482,7 +474,7 @@ Partial Class Sistemas_Empresa
|
||||
|
||||
Session("FileUpload") = .ArchivoPfx
|
||||
End With
|
||||
|
||||
InicializaClasificacionIVA(ObjEmpresas)
|
||||
Else
|
||||
Alert("La Empresa Solicitada no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
|
||||
BtnGuardar.Enabled = False
|
||||
@@ -560,7 +552,7 @@ Partial Class Sistemas_Empresa
|
||||
|
||||
End If
|
||||
ViewState("CveEmpresa") = ObjEmpresas.CveEmpresa
|
||||
InicializaClasificacionIVA()
|
||||
'InicializaClasificacionIVA(ObjEmpresas)
|
||||
TextoOK = "La nueva Empresa se guardó correctamente."
|
||||
Else
|
||||
TextoError = "Ocurrió un error al agregar la empresa"
|
||||
@@ -638,30 +630,32 @@ Partial Class Sistemas_Empresa
|
||||
End If
|
||||
|
||||
'CLASIFICACIONES DE IVAS
|
||||
For Each Dr As DataRow In DtClasificacionIVA.Rows
|
||||
If Not Dr("CveClasificacion").ToString.ToEntero > 0 Then
|
||||
If Not ObjGral.RemoveClasificacionPorcentaje(Dr("CveClasificacionPorcentaje").ToString.ToEntero) Then
|
||||
TextoError = "Ocurrió un error al guardar los cambios de la empresa"
|
||||
End If
|
||||
ElseIf Dr("CveClasificacionPorcentaje").ToString.ToEntero = 0 Then
|
||||
If Not ObjGral.AddClasificacionPorcentaje(Dr("CveClasificacion").ToString.ToEntero, Dr("PorcentajeIVA").ToString.ToDouble,
|
||||
If DtClasificacionIVA IsNot Nothing OrElse DtClasificacionIVA.Rows.Count > 0 Then
|
||||
For Each Dr As DataRow In DtClasificacionIVA.Rows
|
||||
If Not Dr("CveClasificacion").ToString.ToEntero > 0 Then
|
||||
If Not ObjGral.RemoveClasificacionPorcentaje(Dr("CveClasificacionPorcentaje").ToString.ToEntero) Then
|
||||
TextoError = "Ocurrió un error al guardar los cambios de la empresa"
|
||||
End If
|
||||
ElseIf Dr("CveClasificacionPorcentaje").ToString.ToEntero = 0 Then
|
||||
If Not ObjGral.AddClasificacionPorcentaje(Dr("CveClasificacion").ToString.ToEntero, Dr("PorcentajeIVA").ToString.ToDouble,
|
||||
Dr("IdCtaIVAXAcreditar").ToString.ToEntero, Dr("IdCtaIVAAcreditable").ToString.ToEntero,
|
||||
Dr("IdCtaIVAXTrasladar").ToString.ToEntero, Dr("IdCtaIVATrasladado").ToString.ToEntero, CveEmpresa) Then
|
||||
TextoError = "Ocurrió un error al guardar los cambios de la empresa"
|
||||
End If
|
||||
ElseIf Dr("CveClasificacionPorcentaje").ToString.ToEntero > 0 Then
|
||||
If Not ObjGral.UpdateClasificacionPorcentaje(Dr("CveClasificacionPorcentaje").ToString.ToEntero, Dr("CveClasificacion").ToString.ToEntero, Dr("PorcentajeIVA").ToString.ToDouble,
|
||||
TextoError = "Ocurrió un error al guardar los cambios de la empresa"
|
||||
End If
|
||||
ElseIf Dr("CveClasificacionPorcentaje").ToString.ToEntero > 0 Then
|
||||
If Not ObjGral.UpdateClasificacionPorcentaje(Dr("CveClasificacionPorcentaje").ToString.ToEntero, Dr("CveClasificacion").ToString.ToEntero, Dr("PorcentajeIVA").ToString.ToDouble,
|
||||
Dr("IdCtaIVAXAcreditar").ToString.ToEntero, Dr("IdCtaIVAAcreditable").ToString.ToEntero,
|
||||
Dr("IdCtaIVAXTrasladar").ToString.ToEntero, Dr("IdCtaIVATrasladado").ToString.ToEntero) Then
|
||||
TextoError = "Ocurrió un error al guardar los cambios de la empresa"
|
||||
TextoError = "Ocurrió un error al guardar los cambios de la empresa"
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
|
||||
'RECARGA GLOBAL
|
||||
'RECARGA EMPRESA
|
||||
If TextoError = "" Then
|
||||
If ObjEmpresas.GetEmpresas(-1, "-1", "-1", "-1", "-1") Then
|
||||
GlobalDTEmpresas = ObjEmpresas.DtResultados
|
||||
If ObjEmpresas.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
GlobalDTEmpresas(CveEmpresa) = ObjEmpresas.DtResultados
|
||||
|
||||
'verifico si existe la carpeta de la empresa, sino la crea
|
||||
For Each dr As Data.DataRow In ObjEmpresas.DtResultados.Rows
|
||||
@@ -671,12 +665,11 @@ Partial Class Sistemas_Empresa
|
||||
Next
|
||||
End If
|
||||
|
||||
If ObjGral.GetClasificacionPorcentaje(-1) Then
|
||||
GlobalDTClasificacionPorcentaje(-1) = ObjGral.DtResultados
|
||||
If ObjGral.GetClasificacionPorcentaje(CveEmpresa) Then
|
||||
GlobalDTClasificacionPorcentaje(CveEmpresa) = ObjGral.DtResultados
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'AGREGAR FUNCIONALIDADES
|
||||
If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 201, DdlProveedores)
|
||||
If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 211, DdlClientes)
|
||||
@@ -691,7 +684,6 @@ Partial Class Sistemas_Empresa
|
||||
If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 218, DdlCaja)
|
||||
If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 215, DdlFyE)
|
||||
If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 221, DdlActivoFijo)
|
||||
|
||||
If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 246, DdlClientes)
|
||||
If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 237, DdlAnticipoCliente)
|
||||
|
||||
@@ -710,7 +702,6 @@ Partial Class Sistemas_Empresa
|
||||
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 243, DdlFyESIG)
|
||||
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 244, DdlActivoFijoSIG)
|
||||
|
||||
|
||||
'TRIGGER
|
||||
If TextoError = "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" Then
|
||||
|
||||
@@ -743,10 +734,8 @@ Partial Class Sistemas_Empresa
|
||||
Else
|
||||
Alert("La empresa tiene la información para el uso de contabilidad pero no se tiene activada", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If TextoError = "" Then
|
||||
ObjEmpresas.Commit()
|
||||
If ObjContPAQ IsNot Nothing Then ObjContPAQ.Commit()
|
||||
@@ -777,8 +766,7 @@ Partial Class Sistemas_Empresa
|
||||
Dim ObjEmpresas As New ClsSisEmpresas
|
||||
If ObjEmpresas.RemoveEmpresa(CveEmpresa) Then
|
||||
GlobalDTEmpresas = ObjEmpresas.DtResultados
|
||||
|
||||
Alert("La Empresa se Eliminó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Sistemas/Empresas.aspx"";")
|
||||
Alert("La Empresa se Eliminó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Sistemas/Empresa.aspx"";")
|
||||
End If
|
||||
ObjEmpresas.Dispose()
|
||||
End Sub
|
||||
@@ -802,9 +790,6 @@ Partial Class Sistemas_Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCuentasContablesSIG(Optional IdCuentaPadre As Integer = -1)
|
||||
@@ -950,9 +935,6 @@ Partial Class Sistemas_Empresa
|
||||
DdlCuentaPerdidaCambiaria.DataSource = DtCuentasContables : DdlCuentaPerdidaCambiaria.DataBind() : DdlCuentaPerdidaCambiaria.SelectedValue = Seleccionado
|
||||
DdlCuentaPerdidaCambiaria.AutoPostBack = False : DdlCuentaPerdidaCambiaria.Attributes.Remove("onclick") : DdlCuentaPerdidaCambiaria.CssClass &= " select2me"
|
||||
|
||||
|
||||
|
||||
|
||||
'CUENTAS PADRES
|
||||
|
||||
Case "21"
|
||||
@@ -1172,8 +1154,6 @@ Partial Class Sistemas_Empresa
|
||||
|
||||
End Sub
|
||||
Public Sub CargaDDLs()
|
||||
|
||||
|
||||
DdlIVAxAcreditar.AutoPostBack = True
|
||||
DdlIVAAcreditable.AutoPostBack = True
|
||||
DdlIVAxTrasladar.AutoPostBack = True
|
||||
@@ -1390,9 +1370,9 @@ Partial Class Sistemas_Empresa
|
||||
Next
|
||||
DtClasificacionIVA.AcceptChanges()
|
||||
End Sub
|
||||
Private Sub InicializaClasificacionIVA()
|
||||
Private Sub InicializaClasificacionIVA(ObjEmpresas As ClsSisEmpresas)
|
||||
CreaDtClasificacionIVA()
|
||||
CargaCuentasIVA()
|
||||
CargaCuentasIVA(ObjEmpresas)
|
||||
CargaClasificaciones()
|
||||
CargaClasificacionesIVA()
|
||||
End Sub
|
||||
@@ -1427,21 +1407,20 @@ Partial Class Sistemas_Empresa
|
||||
DtClasificacionIVA.Columns.Add("CuentaTrasladado", GetType(String))
|
||||
DtClasificacionIVA.Columns.Add("IdCtaIVATrasladado", GetType(Integer))
|
||||
End Sub
|
||||
Private Sub CargaCuentasIVA()
|
||||
Private Sub CargaCuentasIVA(ByRef ObjEmpresas As ClsSisEmpresas)
|
||||
|
||||
Dim ObjEmpresas As New ClsSisEmpresas()
|
||||
If ObjEmpresas.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresas.Empresa.UsaContabilidad Then
|
||||
|
||||
'If ObjEmpresas.Empresa.TipoContabilidad = 2 Then
|
||||
Dim Cuenta As New ClsContPAQi(ObjEmpresas.Empresa)
|
||||
If Cuenta.GetCuentas(-1, "-1", -1) Then
|
||||
DtCuentas = Cuenta.DtResultados
|
||||
End If
|
||||
Cuenta.Dispose()
|
||||
'End If
|
||||
If Cuenta.GetCuentas(-1, "-1", -1) Then
|
||||
DtCuentas = Cuenta.DtResultados
|
||||
End If
|
||||
Cuenta.Dispose()
|
||||
'End If
|
||||
|
||||
Try
|
||||
Try
|
||||
DdlIVAXAcreditarModal.DataSource = DtCuentas : DdlIVAXAcreditarModal.DataBind()
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
@@ -1460,7 +1439,7 @@ Partial Class Sistemas_Empresa
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjEmpresas.Dispose()
|
||||
'ObjEmpresas.Dispose()
|
||||
DdlIVAXAcreditarModal.Items.Insert(0, New ListItem("-", "-1"))
|
||||
DdlIVAAcreditableModal.Items.Insert(0, New ListItem("-", "-1"))
|
||||
DdlIVAXTrasladarModal.Items.Insert(0, New ListItem("-", "-1"))
|
||||
|
||||
Reference in New Issue
Block a user