Files
SIG/Sistemas/DefinicionEmpresa.aspx.vb

2049 lines
111 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports System.Runtime.InteropServices
Imports System.IO
Imports Microsoft.Reporting.WebForms
Imports Microsoft.Owin.Security.Provider
Imports log4net.Util
Partial Class Sistemas_DefinicionEmpresa
Inherits ClsPaginas
#Region " PROPIEDADES "
Private Property DtCuentasContables As Data.DataTable
Get
Return CType(ViewState("DtCuentasContables"), DataTable)
End Get
Set(value As Data.DataTable)
ViewState("DtCuentasContables") = value
End Set
End Property
Private Property EmpresaEditar As Empresa
Get
Return CType(ViewState("EmpresaEditar"), Empresa)
End Get
Set(value As Empresa)
ViewState("EmpresaEditar") = value
End Set
End Property
Private Property DtCuentasContablesSIG As Data.DataTable
Get
Return CType(ViewState("DtCuentasContablesSIG"), DataTable)
End Get
Set(value As Data.DataTable)
ViewState("DtCuentasContablesSIG") = value
End Set
End Property
Private Property DtFuncionalidades As Data.DataTable
Get
Return CType(ViewState("DtFuncionalidades"), DataTable)
End Get
Set(value As Data.DataTable)
ViewState("DtFuncionalidades") = value
End Set
End Property
Private Property BDContPAQ As String
Get
BDContPAQ = ViewState("BDContPAQ").ToString
End Get
Set(value As String)
ViewState("BDContPAQ") = value
End Set
End Property
Private Property ServerContPAQ As String
Get
ServerContPAQ = ViewState("ServerContPAQ").ToString
End Get
Set(value As String)
ViewState("ServerContPAQ") = value
End Set
End Property
Public Property DtCuentas As DataTable
Get
Return CType((ViewState("DtCuentas")), DataTable)
End Get
Set(value As DataTable)
ViewState("DtCuentas") = value
End Set
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)
ViewState("DtClasificacionIVA") = value
End Set
End Property
Public Property CveClasificacionPorcentaje As Integer
Get
Return CType((ViewState("CveClasificacionPorcentaje")), Integer)
End Get
Set(value As Integer)
ViewState("CveClasificacionPorcentaje") = value
End Set
End Property
Public Property Modalidad As String
Get
Return CType((ViewState("Modalidad")), String)
End Get
Set(value As String)
ViewState("Modalidad") = value
End Set
End Property
Public Property Index As Integer
Get
Return CType((ViewState("Index")), Integer)
End Get
Set(value As Integer)
ViewState("Index") = value
End Set
End Property
Public Property TipoContabilidad As Integer
Get
If ViewState("TipoContabilidad") Is Nothing Then
ViewState("TipoContabilidad") = -1
End If
Return CType((ViewState("TipoContabilidad")), Integer)
End Get
Set(value As Integer)
ViewState("TipoContabilidad") = value
End Set
End Property
Enum EnumOpActualizaArchivosCer
SinOpcion
KEY
CER
PFX
End Enum
Property OpActualizaArchivosCer As EnumOpActualizaArchivosCer
Get
If ViewState("OpActualizaArchivosCer") Is Nothing Then
ViewState("OpActualizaArchivosCer") = EnumOpActualizaArchivosCer.SinOpcion
End If
Return DirectCast(ViewState("OpActualizaArchivosCer"), EnumOpActualizaArchivosCer)
End Get
Set(value As EnumOpActualizaArchivosCer)
ViewState("OpActualizaArchivosCer") = value
End Set
End Property
Public Property SSLSoporte As Boolean
Get
If ViewState("SSLSoporte") Is Nothing Then
ViewState("SSLSoporte") = False
End If
Return Boolean.Parse(ViewState("SSLSoporte").ToString)
End Get
Set(value As Boolean)
ViewState("SSLSoporte") = value
End Set
End Property
Public Property UsaAC As Boolean
Get
If ViewState("UsaAC") Is Nothing Then
ViewState("UsaAC") = False
End If
Return Boolean.Parse(ViewState("UsaAC").ToString)
End Get
Set(value As Boolean)
ViewState("UsaAC") = value
End Set
End Property
Public Property Estatus As Boolean
Get
If ViewState("Estatus") Is Nothing Then
ViewState("Estatus") = False
End If
Return Boolean.Parse(ViewState("Estatus").ToString)
End Get
Set(value As Boolean)
ViewState("Estatus") = value
End Set
End Property
Public Property FacturaProduccion As Boolean
Get
If ViewState("FacturaProduccion") Is Nothing Then
ViewState("FacturaProduccion") = False
End If
Return Boolean.Parse(ViewState("FacturaProduccion").ToString)
End Get
Set(value As Boolean)
ViewState("FacturaProduccion") = value
End Set
End Property
Public Property EstatusFacturacion As Boolean
Get
If ViewState("EstatusFacturacion") Is Nothing Then
ViewState("EstatusFacturacion") = False
End If
Return Boolean.Parse(ViewState("EstatusFacturacion").ToString)
End Get
Set(value As Boolean)
ViewState("EstatusFacturacion") = value
End Set
End Property
Public Property UsaContabilidad As Boolean
Get
If ViewState("UsaContabilidad") Is Nothing Then
ViewState("UsaContabilidad") = False
End If
Return Boolean.Parse(ViewState("UsaContabilidad").ToString)
End Get
Set(value As Boolean)
ViewState("UsaContabilidad") = value
End Set
End Property
Public Property UsaBancos As Boolean
Get
If ViewState("UsaBancos") Is Nothing Then
ViewState("UsaBancos") = False
End If
Return Boolean.Parse(ViewState("UsaBancos").ToString)
End Get
Set(value As Boolean)
ViewState("UsaBancos") = value
End Set
End Property
Public Property UsaVentas As Boolean
Get
If ViewState("UsaVentas") Is Nothing Then
ViewState("UsaVentas") = False
End If
Return Boolean.Parse(ViewState("UsaVentas").ToString)
End Get
Set(value As Boolean)
ViewState("UsaVentas") = value
End Set
End Property
Public Property UsaCxC As Boolean
Get
If ViewState("UsaCxC") Is Nothing Then
ViewState("UsaCxC") = False
End If
Return Boolean.Parse(ViewState("UsaCxC").ToString)
End Get
Set(value As Boolean)
ViewState("UsaCxC") = value
End Set
End Property
Public Property UsaCompras As Boolean
Get
If ViewState("UsaCompras") Is Nothing Then
ViewState("UsaCompras") = False
End If
Return Boolean.Parse(ViewState("UsaCompras").ToString)
End Get
Set(value As Boolean)
ViewState("UsaCompras") = value
End Set
End Property
Public Property UsaInventarios As Boolean
Get
If ViewState("UsaInventarios") Is Nothing Then
ViewState("UsaInventarios") = False
End If
Return Boolean.Parse(ViewState("UsaInventarios").ToString)
End Get
Set(value As Boolean)
ViewState("UsaInventarios") = value
End Set
End Property
Public Property UsaRH As Boolean
Get
If ViewState("UsaRH") Is Nothing Then
ViewState("UsaRH") = False
End If
Return Boolean.Parse(ViewState("UsaRH").ToString)
End Get
Set(value As Boolean)
ViewState("UsaRH") = value
End Set
End Property
Public Property UsaNomina As Boolean
Get
If ViewState("UsaNomina") Is Nothing Then
ViewState("UsaNomina") = False
End If
Return Boolean.Parse(ViewState("UsaNomina").ToString)
End Get
Set(value As Boolean)
ViewState("UsaNomina") = value
End Set
End Property
Public Property UsaOS As Boolean
Get
If ViewState("UsaOS") Is Nothing Then
ViewState("UsaOS") = False
End If
Return Boolean.Parse(ViewState("UsaOS").ToString)
End Get
Set(value As Boolean)
ViewState("UsaOS") = value
End Set
End Property
'AsientoContable
Public Property AsientoContable As Boolean
Get
If ViewState("AsientoContable") Is Nothing Then
ViewState("AsientoContable") = False
End If
Return Boolean.Parse(ViewState("AsientoContable").ToString)
End Get
Set(value As Boolean)
ViewState("AsientoContable") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
If UsuarioActual.CveRol <> 1 AndAlso (Request("CveEmpresa") IsNot Nothing AndAlso Request("CveEmpresa").ToEntero > 0) Then
If Not ValidaCveEmpresaUsaurio(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
Alert("No tiene acceso a esta empresa.", TipoMensaje.MsgAdvertencia, "document.location.href = ""../Inicio.aspx""")
Exit Sub
End If
End If
CargaDdlPac()
CargaRegimenFiscal()
'CargaGridIndicadores()
DtCuentasContables = Nothing
DtFuncionalidades = Nothing
DtCuentas = Nothing
CveClasificacionPorcentaje = 0
'Session("FileUpload") = CveEmpresa
'CargaTareasProgramadas()
CargaDatos()
'Configuración de Modalidad Update
'TxtTimbres.Enabled = False
LbArchivoKeyDescarga.Visible = True
LbArchivoCerDescarga.Visible = True
LbArchivoPfxDescarga.Visible = True
BtnGuardar.Text = "Guardar Cambios"
'Plantilla Correo
End If
End Sub
Private Function ValidaCveEmpresaUsaurio(CveUsuario As Integer, CveEmpresaValidar As Integer) As Boolean
Dim Respuesta As Boolean = False
Using ObjEmpresas As New ClsSisEmpresas()
If ObjEmpresas.GetEmpresas(-1, "-1", "-1", "-1", "-1", UsuarioActual.CveUsuario) Then
If ObjEmpresas.DtResultados.FiltraParametros($"CveEmpresa = {CveEmpresaValidar}").Rows.Count = 1 Then
Respuesta = True
End If
End If
End Using
Return Respuesta
End Function
Private Sub CargaDatos()
Dim ObjEmpresas As New ClsSisEmpresas()
If ObjEmpresas.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
If ObjEmpresas.DtResultados.Rows.Count > 0 Then
Me.EmpresaEditar = ObjEmpresas.Empresa
With ObjEmpresas.Empresa
'Campos para Modificación
TxtEmpresa.Text = .Empresa : LtlTitulo.Text = "Consulta de Empresa: " & .Empresa
TxtNombreCorto.Text = .NombreCorto
TxtDireccion.Text = .Direccion
TxtNoExt.Text = .NoExt
TxtNoInt.Text = .NoInt
TxtColonia.Text = .Colonia
TxtCiudad.Text = .Ciudad
TxtEstado.Text = .Estado
TxtCP.Text = .CP.ToString
TxtRFC.Text = .RFC
TxtTelefono.Text = .Telefono
TxtContacto.Text = .Contacto 'Representante legal
TxtMail.Text = .Mail
'TxtBIUsuario.Text = .BIUsuario
'TxtBIContraseña.Text = .BIContraseña
TxtContraseñaKey.Text = .ContraseñaKey
TxtArchivoKey.Text = .ArchivoKey
TxtArchivoCer.Text = .ArchivoCer
TxtArchivoPfx.Text = .ArchivoPfx
Estatus = .Estatus
'TxtFecha.Text = .FechaIng.ToString
'TxtCveUsuario.Text = .Usuario
FacturaProduccion = .FacturaProduccion
TxtSendMail.Text = .SendMail
TxtSendMailPassword.Text = .SendMailPassword
TxtSendMailServer.Text = .SendMailServer
TxtSendMailPort.Text = .SendMailPuerto.ToString
ChkSendMailSSL.Checked = .SendMailSSL
ChkMostrarRetIVA.Checked = .MostrarRetIVA
ChkMostrarRetISR.Checked = .MostrarRetISR
'TxtRegimen.Text = .Regimen
EstatusFacturacion = .EstatusFacturacion
'TxtTimbres.Text = .Timbres.ToString
UsaContabilidad = .UsaContabilidad
UsaBancos = .UsaBancos
UsaVentas = .UsaVentas
UsaCxC = .UsaCxC
UsaCompras = .UsaCompras
UsaInventarios = .UsaInventarios
UsaRH = .UsaRH
UsaNomina = .UsaNomina
UsaOS = .UsaOS
'TxtBDContPAQi.Text = .BDContPAQi
'TxtServerContPAQi.Text = .ServerContPAQi
'TxtUsrContPAQi.Text = .UsrContPAQi
'TxtPwdContPAQi.Text = .PwdContPAQi
TxtBuzon_Mail.Text = .Buzon_Mail
TxtBuzon_Server.Text = .Buzon_Server
TxtBuzon_Puerto.Text = .Buzon_Puerto.ToString
ChkBuzon_SSL.Checked = .Buzon_SSL
TxtBuzon_USR.Text = .Buzon_USR
TxtBuzon_PWD.Text = .Buzon_PWD
'TxtMailSoporte.Text = .Soporte_Mail
'TxtServidorSoporte.Text = .Soporte_Server
'TxtPuertoSoporte.Text = .Soporte_Puerto.ToString
SSLSoporte = .Soporte_SSL
'TxtUsuarioSoporte.Text = .Soporte_USR
'DdlProtocoloSoporte.SelectedValue = .Soporte_Tipo
'TxtContraseñaSoporte.Text = .Soporte_PWD
'DdlCvePac.SelectedValueExist(.CvePAC.ToString)
DdlRegimen.SelectedValue = .CveRegimenFiscal.ToString
TxtCURP.Text = .CURP
'TxtImporte.Text.ToDecimal
TxtCIEC.Text = .CIEC
'DdlPlataforma.SelectedValue = .CvePlataforma.ToString
UsaAC = .UsaAC
TxtPorDepreciacion.Text = .PorDepreciacion.ToString
TxtExtension.Text = .Extension
TxtLocalidad.Text = .Localidad
DdlMetodoInventario.SelectedValue = .CveMetodoInventario.ToString
AsientoContable = .AsientoContableComprasContado
TxtPeriodoActual.Text = .PeriodoActual.ToString
TxtEjercicioActual.Text = .EjercicioActual.ToString
ChkDefaultAsistencias.Checked = .DefaultAsistencias
TxtDiasPermitidos.Text = .DiasPermitidos.ToString
DdlTipoCentroDeCostos.SelectedValue = .Tipo_CentroCosto.ToString
ChkReqCentroCostos.Checked = .RequiereCentroCostos
DdlTerminalTipo.SelectedValue = .PV_TerminalTipo.ToString
'TxtImporte.Text = .Importe.ToString
TipoContabilidad = .TipoContabilidad
TxtPlantillaVenta.Text = .PlantillaMailVenta
TxtAsunto.Text = .AsuntoPlantillaMailVenta
TxtPlantillaCotizacion.Text = .PlantillaMailVentaCotizacion
TxtAsuntoCotizacion.Text = .AsuntoPlantillaMailVentaCotizacion
'NUEVOS
TxtAreaGeografica.Text = .AreaGeografica
DdlProtocolo.Text = .Buzon_Tipo
'Fiel
'LblPfx.Text = .FielPFX
'lblPassFiel.Text = .FielPassword
'PARA PROPIEDAD - TRIGGER
BDContPAQ = .BDContPAQi
ServerContPAQ = .ServerContPAQi
'If TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" Then
' CargaCuentasContables()
' CargaDDLs()
' 'Dim Row As DataRow
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIVAxAcreditar.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlIVAxAcreditar.Items.Add(New ListItem(Row("CtaCodigo").ToString, .IdCuentaIVAxAcreditar.ToString))
' ' DdlIVAxAcreditar.SelectedValue = .IdCuentaIVAxAcreditar.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIVAAcreditable.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlIVAAcreditable.Items.Add(New ListItem(Row("CtaCodigo").ToString, .IdCuentaIVAAcreditable.ToString))
' ' ' DdlIVAAcreditable.SelectedValue = .IdCuentaIVAAcreditable.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIVAxTrasladar.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlIVAxTrasladar.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIVAxTrasladar.ToString))("CtaCodigo").ToString, .IdCuentaIVAxTrasladar.ToString))
' ' DdlIVAxTrasladar.SelectedValue = .IdCuentaIVAxTrasladar.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIVATrasladado.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlIVATrasladado.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIVATrasladado.ToString))("CtaCodigo").ToString, .IdCuentaIVATrasladado.ToString))
' ' DdlIVATrasladado.SelectedValue = .IdCuentaIVATrasladado.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaRetIVACirculacion.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlIVARetenciones.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaRetIVACirculacion.ToString))("CtaCodigo").ToString, .IdCuentaRetIVACirculacion.ToString))
' ' DdlIVARetenciones.SelectedValue = .IdCuentaRetIVACirculacion.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaRetISRCirculacion.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlISRCirculacion.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaRetISRCirculacion.ToString))("CtaCodigo").ToString, .IdCuentaRetISRCirculacion.ToString))
' ' DdlISRCirculacion.SelectedValue = .IdCuentaRetISRCirculacion.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaPerdidaCambiaria.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlCuentaPerdidaCambiaria.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaPerdidaCambiaria.ToString))("CtaCodigo").ToString, .IdCuentaPerdidaCambiaria.ToString))
' ' DdlCuentaPerdidaCambiaria.SelectedValue = .IdCuentaPerdidaCambiaria.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaGananciaCambiaria.ToString))
' 'If Not IsNothing(Row) Then
' ' DddlCuentaGananciaCambiaria.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaGananciaCambiaria.ToString))("CtaCodigo").ToString, .IdCuentaGananciaCambiaria.ToString))
' ' DddlCuentaGananciaCambiaria.SelectedValue = .IdCuentaGananciaCambiaria.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaDSV.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlDSV.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaDSV.ToString))("CtaCodigo").ToString, .IdCuentaDSV.ToString))
' ' DdlDSV.SelectedValue = .IdCuentaDSV.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaImpuestosLocales.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlImpuestosLocales.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaImpuestosLocales.ToString))("CtaCodigo").ToString, .IdCuentaImpuestosLocales.ToString))
' ' DdlImpuestosLocales.SelectedValue = .IdCuentaImpuestosLocales.ToString
' 'End If
' 'NUEVOS DATOS
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIEPSxAcreditar.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlIEPSxAcreditar.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIEPSxAcreditar.ToString))("CtaCodigo").ToString, .IdCuentaIEPSxAcreditar.ToString))
' ' DdlIEPSxAcreditar.SelectedValue = .IdCuentaIEPSxAcreditar.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIEPSAcreditable.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlIEPSAcreditable.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIEPSAcreditable.ToString))("CtaCodigo").ToString, .IdCuentaIEPSAcreditable.ToString))
' ' DdlIEPSAcreditable.SelectedValue = .IdCuentaIEPSAcreditable.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIEPSxTrasladar.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlIEPSxTrasladar.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIEPSxTrasladar.ToString))("CtaCodigo").ToString, .IdCuentaIEPSxTrasladar.ToString))
' ' DdlIEPSxTrasladar.SelectedValue = .IdCuentaIEPSxTrasladar.ToString
' 'End If
' 'Row = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIEPSTrasladado.ToString))
' 'If Not IsNothing(Row) Then
' ' DdlIEPSTrasladado.Items.Add(New ListItem(DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", .IdCuentaIEPSTrasladado.ToString))("CtaCodigo").ToString, .IdCuentaIEPSTrasladado.ToString))
' ' DdlIEPSTrasladado.SelectedValue = .IdCuentaIEPSTrasladado.ToString
' 'End If
'End If
'CUENTAS PADRES
ObjEmpresas.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa)
DtFuncionalidades = ObjEmpresas.DtResultados
'CargaFuncionalidad(201, DdlProveedores)
'CargaFuncionalidad(211, DdlClientes)
'CargaFuncionalidad(205, DdlDeudores)
'CargaFuncionalidad(202, DdlAcreedores)
'CargaFuncionalidad(203, DdlDocxPagar)
'CargaFuncionalidad(212, DdlAnticipoCliente)
'CargaFuncionalidad(204, DdlAnticipoProveedores)
'CargaFuncionalidad(208, DdlInventario)
'CargaFuncionalidad(216, DdlGasto)
'CargaFuncionalidad(209, DdlBancos)
'CargaFuncionalidad(218, DdlCaja)
'CargaFuncionalidad(215, DdlFyE)
'CargaFuncionalidad(221, DdlActivoFijo)
'CargaFuncionalidad(232, DdlProveedoresSIG)
'CargaFuncionalidad(233, DdlClientesSIG)
'CargaFuncionalidad(234, DdlDeudoresSIG)
'CargaFuncionalidad(235, DdlAcreedoresSIG)
'CargaFuncionalidad(236, DdlDocxPagarSIG)
'CargaFuncionalidad(237, DdlAnticipoClienteSIG)
'CargaFuncionalidad(238, DdlAnticipoProveedoresSIG)
'CargaFuncionalidad(239, DdlInventarioSIG)
'CargaFuncionalidad(240, DdlGastoSIG)
'CargaFuncionalidad(241, DdlBancosSIG)
'CargaFuncionalidad(242, DdlCajaSIG)
'CargaFuncionalidad(243, DdlFyESIG)
'CargaFuncionalidad(244, DdlActivoFijoSIG)
Session("FileUpload") = .Banner
Session("FileUpload") = .ArchivoKey
Session("FileUpload") = .ArchivoCer
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
End If
End If
ObjEmpresas.Dispose()
'CargarGrupoEmpresas()
UpDatos.Update()
End Sub
'Protected Sub CargarGrupoEmpresas()
' Dim ObjEmpresas As New ClsSisEmpresas()
' 'Gridview
' ObjEmpresas.GetEmpresasGrupos(UsuarioActual.CveEmpresa)
' GVGrupoEmpresas.DataSource = ObjEmpresas.DtResultados
' GVGrupoEmpresas.DataBind()
' 'DropdownList Empresas
' ObjEmpresas.GetEmpresasGruposNot(UsuarioActual.CveEmpresa)
' DdlEmpresas.Items.Clear()
' DdlEmpresas.DataSource = ObjEmpresas.DtResultados
' DdlEmpresas.DataBind()
' ObjEmpresas.Dispose()
' updategrupoempresa.Update()
'End Sub
'Protected Sub LinkButton1_Click(sender As Object, e As EventArgs) Handles AddGrupoEmpresa.Click
' Dim ObjEmpresas As New ClsSisEmpresas()
' ObjEmpresas.AddEmpresasGrupos(UsuarioActual.CveEmpresa, DdlEmpresas.SelectedValue.ToEntero)
' ObjEmpresas.Dispose()
' CargarGrupoEmpresas()
'End Sub
'Protected Sub GrupoEmpresas_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GVGrupoEmpresas.RowDeleting
' Dim ObjEmpresas As New ClsSisEmpresas()
' ObjEmpresas.RemoveEmpresasGrupos(UsuarioActual.CveEmpresa, CType(GVGrupoEmpresas.Rows(e.RowIndex).FindControl("GVColCVeEmpresa"), HiddenField).Value.ToEntero())
' ObjEmpresas.Dispose()
' CargarGrupoEmpresas()
'End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
Dim ObjEmpresas As New ClsSisEmpresas
Dim ObjGral As New ClsGenerales()
Dim ObjContPAQ As ClsContPAQi = Nothing
Dim Indicador As New ClsIndicadores(ObjEmpresas.IniciaTransacSQL())
Dim TextoError = ""
Dim TextoOK = ""
If False Then
'If ObjEmpresas.AddEmpresa(TxtCveEmpresa.Text.Trim.ToEntero, TxtEmpresa.Text.Trim, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim,
' TxtCiudad.Text.Trim, TxtEstado.Text.Trim, TxtRFC.Text.Trim, TxtCP.Text.Trim.ToEntero, TxtTelefono.Text.Trim, TxtContacto.Text.Trim, TxtMail.Text.Trim,
' DdlTipoFacturacion.SelectedValue, TxtBIUsuario.Text.Trim, TxtBIContraseña.Text.Trim, TxtContraseñaKey.Text.Trim, TxtArchivoKey.Text.Trim,
' TxtArchivoCer.Text.Trim, TxtArchivoPfx.Text.Trim, "", UsuarioActual.CveUsuario, ChkFacturaProduccion.Checked, ChkMostrarRetIVA.Checked,
' ChkMostrarRetISR.Checked, "-1", ChkEstatusFacturacion.Checked, TxtSendMail.Text.Trim, TxtSendMailPassword.Text.Trim, TxtSendMailServer.Text.Trim,
' TxtSendMailPort.Text.Trim.ToEntero, ChkSendMailSSL.Checked, ChkUsaContabilidad.Checked, ChkUsaBancos.Checked, ChkUsaVentas.Checked, ChkUsaCxC.Checked,
' ChkUsaCompras.Checked, ChkUsaInventarios.Checked, ChkUsaRH.Checked, ChkUsaNomina.Checked, ChkUsaOS.Checked, TxtBDContPAQi.Text.Trim, TxtServerContPAQi.Text.Trim,
' TxtUsrContPAQi.Text.Trim, TxtPwdContPAQi.Text.Trim, TxtBuzon_Mail.Text.Trim, TxtBuzon_Server.Text.Trim, TxtBuzon_Puerto.Text.Trim.ToEntero, ChkBuzon_SSL.Checked,
' TxtBuzon_USR.Text.Trim, TxtBuzon_PWD.Text.Trim, DdlProtocolo.SelectedValue, TxtMailSoporte.Text.Trim, TxtServidorSoporte.Text.Trim, TxtPuertoSoporte.Text.Trim.ToEntero, ChkSSLSoporte.Checked,
' TxtUsuarioSoporte.Text.Trim, TxtContraseñaSoporte.Text.Trim, DdlProtocoloSoporte.SelectedValue, DdlIVAxAcreditar.SelectedValue.ToEntero, DdlIVAAcreditable.SelectedValue.ToEntero,
' DdlIVAxTrasladar.SelectedValue.ToEntero, DdlIVATrasladado.SelectedValue.ToEntero, DdlIVARetenciones.SelectedValue.ToEntero, DdlCuentaOtrosIngresos.SelectedValue.ToEntero, DdlCuentaDescuentoVenta.SelectedValue.ToEntero, DdlISRCirculacion.SelectedValue.ToEntero,
' "".Trim, TxtAreaGeografica.Text.Trim, DdlCuentaPerdidaCambiaria.SelectedValue.ToEntero, DddlCuentaGananciaCambiaria.SelectedValue.ToEntero,
' TxtNombreCorto.Text, TxtCURP.Text.Trim, DdlRegimen.SelectedValue.ToEntero, TxtImporte.Text.ToDecimal, TxtCIEC.Text, DdlPlataforma.SelectedValue.ToEntero, ChkUsaAC.Checked,
' TxtPorDepreciacion.Text.ToDecimal, TxtExtension.Text, TxtLocalidad.Text, DdlMetodoInventario.SelectedValue.ToEntero, ChkAsientoContable.Checked, TxtPeriodoActual.Text.ToEntero,
' TxtEjercicioActual.Text.ToEntero, ChkDefaultAsistencias.Checked, TxtDiasPermitidos.Text.ToEntero, DdlTipoCentroDeCostos.SelectedValue.ToEntero, ChkReqCentroCostos.Checked, DdlTerminalTipo.SelectedValue.ToEntero, CvePAC:=DdlCvePac.SelectedValue.ToEntero, IdCuentaDSV:=DdlDSV.SelectedValue.ToEntero, IdCuentaImpuestosLocales:=DdlImpuestosLocales.SelectedValue.ToEntero,
' IdCuentaIEPSxAcreditar:=DdlIEPSxAcreditar.SelectedValue.ToEntero, IdCuentaIEPSAcreditable:=DdlIEPSAcreditable.SelectedValue.ToEntero, IdCuentaIEPSxTrasladar:=DdlIEPSxTrasladar.SelectedValue.ToEntero,
' IdCuentaIEPSTrasladado:=DdlIEPSTrasladado.SelectedValue.ToEntero) Then
' 'Movemos el Archivo Fisicamente
' If Session("FileUpload") IsNot Nothing AndAlso Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString) Then
' Dim Extension As String = Path.GetExtension(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString)
' File.Move(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString, Request.PhysicalApplicationPath + "Banners\" & ObjEmpresas.CveEmpresa.ToString & Extension)
' End If
' ViewState("CveEmpresa") = ObjEmpresas.CveEmpresa
' 'InicializaClasificacionIVA(ObjEmpresas)
' TextoOK = "La nueva Empresa se guardó correctamente."
'Else
' TextoError = "Ocurrió un error al agregar la empresa"
'End If
''Agregar Indicadores
'For Each Row As GridViewRow In GvIndicadores.Rows
' If Row.DataKey("CveIndicador") <> "" And Row.DataKey("CveEmpresa") = "" Then
' If Row.FCCheckBox("chkIndicador").Checked Then
' If Not Indicador.AddIndicadorEmpresa(Row.DataKey("CveIndicador").ToEntero, UsuarioActual.CveEmpresa) Then
' Exit For
' End If
' End If
' End If
'Next
Else
If ObjEmpresas.UpdateEmpresa(TxtEmpresa.Text.Trim, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtCiudad.Text.Trim, TxtEstado.Text.Trim, TxtRFC.Text.Trim,
TxtCP.Text.Trim.ToEntero, TxtTelefono.Text.Trim, TxtContacto.Text.Trim, TxtMail.Text.Trim, "CFDi", "-1",
"-1", TxtContraseñaKey.Text.Trim, TxtArchivoKey.Text.Trim, TxtArchivoCer.Text.Trim, TxtArchivoPfx.Text.Trim, "", Estatus,
FacturaProduccion, ChkMostrarRetIVA.Checked, ChkMostrarRetISR.Checked, "-1", EstatusFacturacion, TxtSendMail.Text.Trim,
TxtSendMailPassword.Text.Trim, TxtSendMailServer.Text.Trim, TxtSendMailPort.Text.Trim.ToEntero, ChkSendMailSSL.Checked, UsaContabilidad, UsaBancos,
UsaVentas, UsaCxC, UsaCompras, UsaInventarios, UsaRH, UsaNomina, UsaOS, "-1",
"-1", "-1", "-1", TxtBuzon_Mail.Text.Trim, TxtBuzon_Server.Text.Trim, TxtBuzon_Puerto.Text.Trim.ToEntero,
ChkBuzon_SSL.Checked, TxtBuzon_USR.Text.Trim, TxtBuzon_PWD.Text.Trim, UsuarioActual.CveEmpresa, DdlProtocolo.SelectedValue,
"-1", "-1", -1, SSLSoporte, "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, "", TxtAreaGeografica.Text.Trim,
-1, -1, TxtNombreCorto.Text, TxtCURP.Text.Trim, DdlRegimen.SelectedValue.ToEntero, 1,
-1, TxtCIEC.Text, 1, UsaAC,
TxtPorDepreciacion.Text.ToDecimal, TxtExtension.Text, TxtLocalidad.Text, DdlMetodoInventario.SelectedValue.ToEntero, AsientoContable, TxtPeriodoActual.Text.ToEntero,
TxtEjercicioActual.Text.ToEntero, ChkDefaultAsistencias.Checked, TxtDiasPermitidos.Text.ToEntero, DdlTipoCentroDeCostos.SelectedValue.ToEntero, ChkReqCentroCostos.Checked,
DdlTerminalTipo.SelectedValue.ToEntero, IdCuentaDSV:=-1, IdCuentaImpuestosLocales:=-1, IdCuentaIEPSxAcreditar:=-1, IdCuentaIEPSAcreditable:=-1,
IdCuentaIEPSxTrasladar:=-1, IdCuentaIEPSTrasladado:=-1) Then
'Movemos el Archivo Fisicamente
If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString) Then
Dim Extension As String = Path.GetExtension(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString)
If File.Exists(Request.PhysicalApplicationPath + "Banners\" & UsuarioActual.CveEmpresa & Extension) Then
File.Delete(Request.PhysicalApplicationPath + "Banners\" & UsuarioActual.CveEmpresa & Extension)
File.Move(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString, Request.PhysicalApplicationPath + "Banners\" & UsuarioActual.CveEmpresa & Extension)
Else
File.Move(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString, Request.PhysicalApplicationPath + "Banners\" & UsuarioActual.CveEmpresa & Extension)
End If
End If
TextoOK = "Los cambios de guardaron correctamente."
Else
TextoError = "Ocurrió un error al guardar los cambios de la empresa"
End If
'Agregar Indicadores
'For Each Row As GridViewRow In GvIndicadores.Rows
' If Row.DataKey("CveIndicador") <> "" AndAlso Row.DataKey("CveEmpresa") <> "" And Row.FCCheckBox("chkIndicador").Checked = False Then
' If Not Indicador.RemoveIndicadoresEmpresas(Row.DataKey("CveIndicador").ToEntero, UsuarioActual.CveEmpresa) Then
' Exit For
' End If
' End If
' If Row.DataKey("CveIndicador") <> "" And Row.DataKey("CveEmpresa") = "" Then
' If Row.FCCheckBox("chkIndicador").Checked Then
' If Not Indicador.AddIndicadorEmpresa(Row.DataKey("CveIndicador").ToEntero, UsuarioActual.CveEmpresa) Then
' Exit For
' End If
' End If
' End If
'Next
End If
'CLASIFICACIONES DE IVAS
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, UsuarioActual.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,
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"
End If
End If
Next
End If
'RECARGA EMPRESA
If TextoError = "" Then
If ObjEmpresas.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
GlobalDTEmpresas(UsuarioActual.CveEmpresa) = Nothing
'verifico si existe la carpeta de la empresa, sino la crea
For Each dr As Data.DataRow In ObjEmpresas.DtResultados.Rows
If Not IO.Directory.Exists(String.Format("{0}\{1}", ModExtensiones.DirectorioBaseEmpresas, dr("CveEmpresa"))) Then
IO.Directory.CreateDirectory(String.Format("{0}Empresas\{1}", ModExtensiones.DirectorioBaseEmpresas, dr("CveEmpresa")))
End If
Next
End If
' GlobalDTClasificacionPorcentaje(CveEmpresa) = Nothing
End If
'AGREGAR FUNCIONALIDADES
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 201, DdlProveedores)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 211, DdlClientes)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 208, DdlInventario)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 216, DdlGasto)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 209, DdlBancos)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 205, DdlDeudores)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 202, DdlAcreedores)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 203, DdlDocxPagar)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 212, DdlAnticipoCliente)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 204, DdlAnticipoProveedores)
'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)
''AGREGAR FUNCIONALIDADES
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 232, DdlProveedoresSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 233, DdlClientesSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 239, DdlInventarioSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 240, DdlGastoSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 241, DdlBancosSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 234, DdlDeudoresSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 235, DdlAcreedoresSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 236, DdlDocxPagarSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 237, DdlAnticipoClienteSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 238, DdlAnticipoProveedoresSIG)
'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 242, DdlCajaSIG)
'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
' If UsuarioActual.Empresa.UsaContabilidad Then
' If UsuarioActual.Empresa.TipoContabilidad = 2 Then
' 'CREA OBJETO EMPRESA
' If ObjEmpresas.GetEmpresas(TxtCveEmpresa.Text.ToEntero, "-1", "-1", "-1", "-1") Then
' Dim Empresa As New Empresa
' Empresa = ObjEmpresas.Empresa
' ObjContPAQ = New ClsContPAQi(Empresa)
' If ObjContPAQ.Conectado Then
' 'ADD
' If BDContPAQ = "" Then
' If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then
' TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos"
' End If
' End If
' 'UPDATE
' If BDContPAQ <> "" And (BDContPAQ <> TxtBDContPAQi.Text.Trim Or ServerContPAQ <> TxtServerContPAQi.Text.Trim) Then
' If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then
' TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos"
' End If
' End If
' Else
' TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos"
' End If
' End If
' End If
' 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()
Alert(TextoOK, TipoMensaje.MsgInformacion, "document.location.href=""/Sistemas/DefinicionEmpresa.aspx"";")
Session("FileUpload") = ""
CargaDatos()
UpDatos.Update()
Else
ObjEmpresas.RollBack()
If ObjContPAQ IsNot Nothing Then ObjContPAQ.RollBack()
Alert(TextoError, TipoMensaje.MsgError)
End If
ObjEmpresas.Dispose()
ObjGral.Dispose()
If ObjContPAQ IsNot Nothing Then ObjContPAQ.Dispose()
End Sub
Private Function AgregarFuncionalidad(ObjEmpresas As ClsSisEmpresas, CveFuncionalidad As Integer, ByRef Ddl As DropDownList) As String
Dim Retorno = ""
If Not ObjEmpresas.AddUpdateEmpresaFuncionalidades(UsuarioActual.CveEmpresa, CveFuncionalidad, Ddl.SelectedValue) Then
Retorno = "Ocurrió un error al vincular la cuenta contable"
End If
Return Retorno
End Function
'Nuevo Código
Private Sub CargaCuentasContables(Optional IdCuentaPadre As Integer = -1)
DtCuentasContables = Nothing
If UsuarioActual.Empresa.UsaContabilidad Then
Dim ObjEmpresa As New ClsSisEmpresas
Dim Empresa As Empresa = Nothing
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
Empresa = ObjEmpresa.Empresa
If Empresa.TipoContabilidad = 2 Then
Dim ObjContabilidad As New ClsContPAQi(Empresa)
If ObjContabilidad.GetCuentas(-1, "-1", -1, IdPadre:=IdCuentaPadre) Then
DtCuentasContables = ObjContabilidad.DtResultados
End If
ObjContabilidad.Dispose()
End If
End If
ObjEmpresa.Dispose()
End If
End Sub
Private Sub CargaCuentasContablesSIG(Optional IdCuentaPadre As Integer = -1)
DtCuentasContablesSIG = Nothing
Dim ObjEmpresa As New ClsSisEmpresas
Dim Empresa As Empresa = Nothing
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
Empresa = ObjEmpresa.Empresa
Dim ObjContabilidad As New ClsContabilidad
If ObjContabilidad.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa, CvePadre:=IdCuentaPadre) Then
DtCuentasContablesSIG = ObjContabilidad.DtResultados
End If
ObjContabilidad.Dispose()
End If
ObjEmpresa.Dispose()
End Sub
'Protected Sub BtnCargarCuentas_Click(sender As Object, e As EventArgs) Handles BtnCargarCuentas.Click
' If DtCuentasContables Is Nothing Then
' End If
' Dim Seleccionado As String
' Select Case HdnCuenta.Value
' Case "1"
' If DdlIVAxAcreditar.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlIVAxAcreditar.SelectedValue
' DdlIVAxAcreditar.Items.Clear() : DdlIVAxAcreditar.Items.Add(New ListItem("Seleccione", "0"))
' DdlIVAxAcreditar.DataSource = DtCuentasContables : DdlIVAxAcreditar.DataBind() : DdlIVAxAcreditar.SelectedValueExist(Seleccionado)
' DdlIVAxAcreditar.AutoPostBack = False : DdlIVAxAcreditar.Attributes.Remove("onclick") : DdlIVAxAcreditar.CssClass &= " select2me"
' Case "2"
' If DdlIVAAcreditable.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlIVAAcreditable.SelectedValue
' DdlIVAAcreditable.Items.Clear() : DdlIVAAcreditable.Items.Add(New ListItem("Seleccione", "0"))
' DdlIVAAcreditable.DataSource = DtCuentasContables : DdlIVAAcreditable.DataBind() : DdlIVAAcreditable.SelectedValue = Seleccionado
' DdlIVAAcreditable.AutoPostBack = False : DdlIVAAcreditable.Attributes.Remove("onclick") : DdlIVAAcreditable.CssClass &= " select2me"
' Case "3"
' If DdlIVAxTrasladar.Attributes("onclick") <> "" Then CargaCuentasContables(-1)
' Seleccionado = DdlIVAxTrasladar.SelectedValue
' DdlIVAxTrasladar.Items.Clear() : DdlIVAxTrasladar.Items.Add(New ListItem("Seleccione", "0"))
' DdlIVAxTrasladar.DataSource = DtCuentasContables : DdlIVAxTrasladar.DataBind() : DdlIVAxTrasladar.SelectedValue = Seleccionado
' DdlIVAxTrasladar.AutoPostBack = False : DdlIVAxTrasladar.Attributes.Remove("onclick") : DdlIVAxTrasladar.CssClass &= " select2me"
' Case "4"
' If DdlIVATrasladado.Attributes("onclick") <> "" Then CargaCuentasContables(-1)
' Seleccionado = DdlIVATrasladado.SelectedValue
' DdlIVATrasladado.Items.Clear() : DdlIVATrasladado.Items.Add(New ListItem("Seleccione", "0"))
' DdlIVATrasladado.DataSource = DtCuentasContables : DdlIVATrasladado.DataBind() : DdlIVATrasladado.SelectedValue = Seleccionado
' DdlIVATrasladado.AutoPostBack = False : DdlIVATrasladado.Attributes.Remove("onclick") : DdlIVATrasladado.CssClass &= " select2me"
' Case "5"
' If DdlIVARetenciones.Attributes("onclick") <> "" Then CargaCuentasContables(-1)
' Seleccionado = DdlIVARetenciones.SelectedValue
' DdlIVARetenciones.Items.Clear() : DdlIVARetenciones.Items.Add(New ListItem("Seleccione", "0"))
' DdlIVARetenciones.DataSource = DtCuentasContables : DdlIVARetenciones.DataBind() : DdlIVARetenciones.SelectedValue = Seleccionado
' DdlIVARetenciones.AutoPostBack = False : DdlIVARetenciones.Attributes.Remove("onclick") : DdlIVARetenciones.CssClass &= " select2me"
' Case "6"
' If DdlISRCirculacion.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlISRCirculacion.SelectedValue
' DdlISRCirculacion.Items.Clear() : DdlISRCirculacion.Items.Add(New ListItem("Seleccione", "0"))
' DdlISRCirculacion.DataSource = DtCuentasContables : DdlISRCirculacion.DataBind() : DdlISRCirculacion.SelectedValue = Seleccionado
' DdlISRCirculacion.AutoPostBack = False : DdlISRCirculacion.Attributes.Remove("onclick") : DdlISRCirculacion.CssClass &= " select2me"
' Case "7"
' If DdlProveedores.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlProveedores.SelectedValue
' DdlProveedores.Items.Clear() : DdlProveedores.Items.Add(New ListItem("Seleccione", "0"))
' DdlProveedores.DataSource = DtCuentasContables : DdlProveedores.DataBind() : DdlProveedores.SelectedValueExist(Seleccionado)
' DdlProveedores.AutoPostBack = False : DdlProveedores.Attributes.Remove("onclick") : DdlProveedores.CssClass &= " select2me"
' Case "8"
' If DdlClientes.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlClientes.SelectedValue
' DdlClientes.Items.Clear() : DdlClientes.Items.Add(New ListItem("Seleccione", "0"))
' DdlClientes.DataSource = DtCuentasContables : DdlClientes.DataBind() : DdlClientes.SelectedValueExist(Seleccionado)
' DdlClientes.AutoPostBack = False : DdlClientes.Attributes.Remove("onclick") : DdlClientes.CssClass &= " select2me"
' Case "9"
' If DdlInventario.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlInventario.SelectedValue
' DdlInventario.Items.Clear() : DdlInventario.Items.Add(New ListItem("Seleccione", "0"))
' DdlInventario.DataSource = DtCuentasContables : DdlInventario.DataBind() : DdlInventario.SelectedValue = Seleccionado
' DdlInventario.AutoPostBack = False : DdlInventario.Attributes.Remove("onclick") : DdlInventario.CssClass &= " select2me"
' Case "10"
' If DdlGasto.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlGasto.SelectedValue
' DdlGasto.Items.Clear() : DdlGasto.Items.Add(New ListItem("Seleccione", "0"))
' DdlGasto.DataSource = DtCuentasContables : DdlGasto.DataBind() : DdlGasto.SelectedValue = Seleccionado
' DdlGasto.AutoPostBack = False : DdlGasto.Attributes.Remove("onclick") : DdlGasto.CssClass &= " select2me"
' Case "11"
' If DdlBancos.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlBancos.SelectedValue
' DdlBancos.Items.Clear() : DdlBancos.Items.Add(New ListItem("Seleccione", "0"))
' DdlBancos.DataSource = DtCuentasContables : DdlBancos.DataBind() : DdlBancos.SelectedValue = Seleccionado
' DdlBancos.AutoPostBack = False : DdlBancos.Attributes.Remove("onclick") : DdlBancos.CssClass &= " select2me"
' Case "12"
' If DdlDeudores.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlDeudores.SelectedValue
' DdlDeudores.Items.Clear() : DdlDeudores.Items.Add(New ListItem("Seleccione", "0"))
' DdlDeudores.DataSource = DtCuentasContables : DdlDeudores.DataBind() : DdlDeudores.SelectedValue = Seleccionado
' DdlDeudores.AutoPostBack = False : DdlDeudores.Attributes.Remove("onclick") : DdlDeudores.CssClass &= " select2me"
' Case "13"
' If DdlAcreedores.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlAcreedores.SelectedValue
' DdlAcreedores.Items.Clear() : DdlAcreedores.Items.Add(New ListItem("Seleccione", "0"))
' DdlAcreedores.DataSource = DtCuentasContables : DdlAcreedores.DataBind() : DdlAcreedores.SelectedValue = Seleccionado
' DdlAcreedores.AutoPostBack = False : DdlAcreedores.Attributes.Remove("onclick") : DdlAcreedores.CssClass &= " select2me"
' Case "14"
' If DdlDocxPagar.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlDocxPagar.SelectedValue
' DdlDocxPagar.Items.Clear() : DdlDocxPagar.Items.Add(New ListItem("Seleccione", "0"))
' DdlDocxPagar.DataSource = DtCuentasContables : DdlDocxPagar.DataBind() : DdlDocxPagar.SelectedValue = Seleccionado
' DdlDocxPagar.AutoPostBack = False : DdlDocxPagar.Attributes.Remove("onclick") : DdlDocxPagar.CssClass &= " select2me"
' Case "15"
' If DdlAnticipoCliente.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlAnticipoCliente.SelectedValue
' DdlAnticipoCliente.Items.Clear() : DdlAnticipoCliente.Items.Add(New ListItem("Seleccione", "0"))
' DdlAnticipoCliente.DataSource = DtCuentasContables : DdlAnticipoCliente.DataBind() : DdlAnticipoCliente.SelectedValue = Seleccionado
' DdlAnticipoCliente.AutoPostBack = False : DdlAnticipoCliente.Attributes.Remove("onclick") : DdlAnticipoCliente.CssClass &= " select2me"
' Case "16"
' If DdlAnticipoProveedores.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlAnticipoProveedores.SelectedValue
' DdlAnticipoProveedores.Items.Clear() : DdlAnticipoProveedores.Items.Add(New ListItem("Seleccione", "0"))
' DdlAnticipoProveedores.DataSource = DtCuentasContables : DdlAnticipoProveedores.DataBind() : DdlAnticipoProveedores.SelectedValue = Seleccionado
' DdlAnticipoProveedores.AutoPostBack = False : DdlAnticipoProveedores.Attributes.Remove("onclick") : DdlAnticipoProveedores.CssClass &= " select2me"
' Case "17"
' If DdlCaja.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlCaja.SelectedValue
' DdlCaja.Items.Clear() : DdlCaja.Items.Add(New ListItem("Seleccione", "0"))
' DdlCaja.DataSource = DtCuentasContables : DdlCaja.DataBind() : DdlCaja.SelectedValue = Seleccionado
' DdlCaja.AutoPostBack = False : DdlCaja.Attributes.Remove("onclick") : DdlCaja.CssClass &= " select2me"
' Case "18"
' If DdlFyE.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlFyE.SelectedValue
' DdlFyE.Items.Clear() : DdlFyE.Items.Add(New ListItem("Seleccione", "0"))
' DdlFyE.DataSource = DtCuentasContables : DdlFyE.DataBind() : DdlFyE.SelectedValue = Seleccionado
' DdlFyE.AutoPostBack = False : DdlFyE.Attributes.Remove("onclick") : DdlFyE.CssClass &= " select2me"
' Case "19"
' If DddlCuentaGananciaCambiaria.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DddlCuentaGananciaCambiaria.SelectedValue
' DddlCuentaGananciaCambiaria.Items.Clear() : DddlCuentaGananciaCambiaria.Items.Add(New ListItem("Seleccione", "0"))
' DddlCuentaGananciaCambiaria.DataSource = DtCuentasContables : DddlCuentaGananciaCambiaria.DataBind() : DddlCuentaGananciaCambiaria.SelectedValueExist(Seleccionado)
' DddlCuentaGananciaCambiaria.AutoPostBack = False : DddlCuentaGananciaCambiaria.Attributes.Remove("onclick") : DddlCuentaGananciaCambiaria.CssClass &= " select2me"
' Case "20"
' If DdlCuentaPerdidaCambiaria.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlCuentaPerdidaCambiaria.SelectedValue
' DdlCuentaPerdidaCambiaria.Items.Clear() : DdlCuentaPerdidaCambiaria.Items.Add(New ListItem("Seleccione", "0"))
' DdlCuentaPerdidaCambiaria.DataSource = DtCuentasContables : DdlCuentaPerdidaCambiaria.DataBind() : DdlCuentaPerdidaCambiaria.SelectedValue = Seleccionado
' DdlCuentaPerdidaCambiaria.AutoPostBack = False : DdlCuentaPerdidaCambiaria.Attributes.Remove("onclick") : DdlCuentaPerdidaCambiaria.CssClass &= " select2me"
' 'CUENTAS PADRES
' Case "21"
' If DdlProveedores.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlProveedores.SelectedValue
' DdlProveedores.Items.Clear() : DdlProveedores.Items.Add(New ListItem("Seleccione", "0"))
' DdlProveedores.DataSource = DtCuentasContables : DdlProveedores.DataBind() : DdlProveedores.SelectedValue = Seleccionado
' DdlProveedores.AutoPostBack = False : DdlProveedores.Attributes.Remove("onclick") : DdlProveedores.CssClass &= " select2me"
' Case "22"
' If DdlClientes.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlClientes.SelectedValue
' DdlClientes.Items.Clear() : DdlClientes.Items.Add(New ListItem("Seleccione", "0"))
' DdlClientes.DataSource = DtCuentasContables : DdlClientes.DataBind() : DdlClientes.SelectedValue = Seleccionado
' DdlClientes.AutoPostBack = False : DdlClientes.Attributes.Remove("onclick") : DdlClientes.CssClass &= " select2me"
' Case "23"
' If DdlInventario.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlInventario.SelectedValue
' DdlInventario.Items.Clear() : DdlInventario.Items.Add(New ListItem("Seleccione", "0"))
' DdlInventario.DataSource = DtCuentasContables : DdlInventario.DataBind() : DdlInventario.SelectedValue = Seleccionado
' DdlInventario.AutoPostBack = False : DdlInventario.Attributes.Remove("onclick") : DdlInventario.CssClass &= " select2me"
' Case "24"
' If DdlGasto.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlGasto.SelectedValue
' DdlGasto.Items.Clear() : DdlGasto.Items.Add(New ListItem("Seleccione", "0"))
' DdlGasto.DataSource = DtCuentasContables : DdlGasto.DataBind() : DdlGasto.SelectedValue = Seleccionado
' DdlGasto.AutoPostBack = False : DdlGasto.Attributes.Remove("onclick") : DdlGasto.CssClass &= " select2me"
' Case "25"
' If DdlBancos.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlBancos.SelectedValue
' DdlBancos.Items.Clear() : DdlBancos.Items.Add(New ListItem("Seleccione", "0"))
' DdlBancos.DataSource = DtCuentasContables : DdlBancos.DataBind() : DdlBancos.SelectedValue = Seleccionado
' DdlBancos.AutoPostBack = False : DdlBancos.Attributes.Remove("onclick") : DdlBancos.CssClass &= " select2me"
' Case "26"
' If DdlDeudores.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlDeudores.SelectedValue
' DdlDeudores.Items.Clear() : DdlDeudores.Items.Add(New ListItem("Seleccione", "0"))
' DdlDeudores.DataSource = DtCuentasContables : DdlDeudores.DataBind() : DdlDeudores.SelectedValue = Seleccionado
' DdlDeudores.AutoPostBack = False : DdlDeudores.Attributes.Remove("onclick") : DdlDeudores.CssClass &= " select2me"
' Case "27"
' If DdlAcreedores.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlAcreedores.SelectedValue
' DdlAcreedores.Items.Clear() : DdlAcreedores.Items.Add(New ListItem("Seleccione", "0"))
' DdlAcreedores.DataSource = DtCuentasContables : DdlAcreedores.DataBind() : DdlAcreedores.SelectedValue = Seleccionado
' DdlAcreedores.AutoPostBack = False : DdlAcreedores.Attributes.Remove("onclick") : DdlAcreedores.CssClass &= " select2me"
' Case "28"
' If DdlDocxPagar.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlDocxPagar.SelectedValue
' DdlDocxPagar.Items.Clear() : DdlDocxPagar.Items.Add(New ListItem("Seleccione", "0"))
' DdlDocxPagar.DataSource = DtCuentasContables : DdlDocxPagar.DataBind() : DdlDocxPagar.SelectedValue = Seleccionado
' DdlDocxPagar.AutoPostBack = False : DdlDocxPagar.Attributes.Remove("onclick") : DdlDocxPagar.CssClass &= " select2me"
' Case "29"
' If DdlAnticipoCliente.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlAnticipoCliente.SelectedValue
' DdlAnticipoCliente.Items.Clear() : DdlAnticipoCliente.Items.Add(New ListItem("Seleccione", "0"))
' DdlAnticipoCliente.DataSource = DtCuentasContables : DdlAnticipoCliente.DataBind() : DdlAnticipoCliente.SelectedValue = Seleccionado
' DdlAnticipoCliente.AutoPostBack = False : DdlAnticipoCliente.Attributes.Remove("onclick") : DdlAnticipoCliente.CssClass &= " select2me"
' Case "30"
' If DdlAnticipoProveedores.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlAnticipoProveedores.SelectedValue
' DdlAnticipoProveedores.Items.Clear() : DdlAnticipoProveedores.Items.Add(New ListItem("Seleccione", "0"))
' DdlAnticipoProveedores.DataSource = DtCuentasContables : DdlAnticipoProveedores.DataBind() : DdlAnticipoProveedores.SelectedValue = Seleccionado
' DdlAnticipoProveedores.AutoPostBack = False : DdlAnticipoProveedores.Attributes.Remove("onclick") : DdlAnticipoProveedores.CssClass &= " select2me"
' Case "31"
' If DdlCaja.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlCaja.SelectedValue
' DdlCaja.Items.Clear() : DdlCaja.Items.Add(New ListItem("Seleccione", "0"))
' DdlCaja.DataSource = DtCuentasContables : DdlCaja.DataBind() : DdlCaja.SelectedValue = Seleccionado
' DdlCaja.AutoPostBack = False : DdlCaja.Attributes.Remove("onclick") : DdlCaja.CssClass &= " select2me"
' Case "32"
' If DdlFyE.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlFyE.SelectedValue
' DdlFyE.Items.Clear() : DdlFyE.Items.Add(New ListItem("Seleccione", "0"))
' DdlFyE.DataSource = DtCuentasContables : DdlFyE.DataBind() : DdlFyE.SelectedValue = Seleccionado
' DdlFyE.AutoPostBack = False : DdlFyE.Attributes.Remove("onclick") : DdlFyE.CssClass &= " select2me"
' Case "33"
' If DdlActivoFijo.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlActivoFijo.SelectedValue
' DdlActivoFijo.Items.Clear() : DdlActivoFijo.Items.Add(New ListItem("Seleccione", "0"))
' DdlActivoFijo.DataSource = DtCuentasContables : DdlActivoFijo.DataBind() : DdlActivoFijo.SelectedValue = Seleccionado
' DdlActivoFijo.AutoPostBack = False : DdlActivoFijo.Attributes.Remove("onclick") : DdlActivoFijo.CssClass &= " select2me"
' Case "34"
' If DdlDSV.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlDSV.SelectedValue
' DdlDSV.Items.Clear() : DdlDSV.Items.Add(New ListItem("Seleccione", "0"))
' DdlDSV.DataSource = DtCuentasContables : DdlDSV.DataBind() : DdlDSV.SelectedValue = Seleccionado
' DdlDSV.AutoPostBack = False : DdlDSV.Attributes.Remove("onclick") : DdlDSV.CssClass &= " select2me"
' Case "35"
' If DdlImpuestosLocales.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlImpuestosLocales.SelectedValue
' DdlImpuestosLocales.Items.Clear() : DdlImpuestosLocales.Items.Add(New ListItem("Seleccione", "0"))
' DdlImpuestosLocales.DataSource = DtCuentasContables : DdlImpuestosLocales.DataBind() : DdlImpuestosLocales.SelectedValue = Seleccionado
' DdlImpuestosLocales.AutoPostBack = False : DdlImpuestosLocales.Attributes.Remove("onclick") : DdlImpuestosLocales.CssClass &= " select2me"
' 'IEPS
' Case "36"
' If DdlIEPSxAcreditar.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlIEPSxAcreditar.SelectedValue
' DdlIEPSxAcreditar.Items.Clear() : DdlIEPSxAcreditar.Items.Add(New ListItem("Seleccione", "0"))
' DdlIEPSxAcreditar.DataSource = DtCuentasContables : DdlIEPSxAcreditar.DataBind() : DdlIEPSxAcreditar.SelectedValue = Seleccionado
' DdlIEPSxAcreditar.AutoPostBack = False : DdlIEPSxAcreditar.Attributes.Remove("onclick") : DdlIEPSxAcreditar.CssClass &= " select2me"
' Case "37"
' If DdlIEPSAcreditable.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlIEPSAcreditable.SelectedValue
' DdlIEPSAcreditable.Items.Clear() : DdlIEPSAcreditable.Items.Add(New ListItem("Seleccione", "0"))
' DdlIEPSAcreditable.DataSource = DtCuentasContables : DdlIEPSAcreditable.DataBind() : DdlIEPSAcreditable.SelectedValue = Seleccionado
' DdlIEPSAcreditable.AutoPostBack = False : DdlIEPSAcreditable.Attributes.Remove("onclick") : DdlIEPSAcreditable.CssClass &= " select2me"
' Case "38"
' If DdlIEPSxTrasladar.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlIEPSxTrasladar.SelectedValue
' DdlIEPSxTrasladar.Items.Clear() : DdlIEPSxTrasladar.Items.Add(New ListItem("Seleccione", "0"))
' DdlIEPSxTrasladar.DataSource = DtCuentasContables : DdlIEPSxTrasladar.DataBind() : DdlIEPSxTrasladar.SelectedValue = Seleccionado
' DdlIEPSxTrasladar.AutoPostBack = False : DdlIEPSxTrasladar.Attributes.Remove("onclick") : DdlIEPSxTrasladar.CssClass &= " select2me"
' Case "39"
' If DdlIEPSTrasladado.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlIEPSTrasladado.SelectedValue
' DdlIEPSTrasladado.Items.Clear() : DdlIEPSTrasladado.Items.Add(New ListItem("Seleccione", "0"))
' DdlIEPSTrasladado.DataSource = DtCuentasContables : DdlIEPSTrasladado.DataBind() : DdlIEPSTrasladado.SelectedValue = Seleccionado
' DdlIEPSTrasladado.AutoPostBack = False : DdlIEPSTrasladado.Attributes.Remove("onclick") : DdlIEPSTrasladado.CssClass &= " select2me"
' Case "40"
' If DdlCuentaDescuentoVenta.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlCuentaDescuentoVenta.SelectedValue
' DdlCuentaDescuentoVenta.Items.Clear() : DdlCuentaDescuentoVenta.Items.Add(New ListItem("Seleccione", "0"))
' DdlCuentaDescuentoVenta.DataSource = DtCuentasContables : DdlCuentaDescuentoVenta.DataBind() : DdlCuentaDescuentoVenta.SelectedValue = Seleccionado
' DdlCuentaDescuentoVenta.AutoPostBack = False : DdlCuentaDescuentoVenta.Attributes.Remove("onclick") : DdlCuentaDescuentoVenta.CssClass &= " select2me"
' Case "41"
' If DdlCuentaOtrosIngresos.Attributes("onclick") <> "" Then CargaCuentasContables()
' Seleccionado = DdlCuentaOtrosIngresos.SelectedValue
' DdlCuentaOtrosIngresos.Items.Clear() : DdlCuentaOtrosIngresos.Items.Add(New ListItem("Seleccione", "0"))
' DdlCuentaOtrosIngresos.DataSource = DtCuentasContables : DdlCuentaOtrosIngresos.DataBind() : DdlCuentaOtrosIngresos.SelectedValue = Seleccionado
' DdlCuentaOtrosIngresos.AutoPostBack = False : DdlCuentaOtrosIngresos.Attributes.Remove("onclick") : DdlCuentaOtrosIngresos.CssClass &= " select2me"
' ' 'PADRES SIG
' 'Case "42"
' ' If DdlProveedoresSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlProveedoresSIG.SelectedValue
' ' DdlProveedoresSIG.Items.Clear() : DdlProveedoresSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlProveedoresSIG.DataSource = DtCuentasContablesSIG : DdlProveedoresSIG.DataBind() : DdlProveedoresSIG.SelectedValue = Seleccionado
' ' DdlProveedoresSIG.AutoPostBack = False : DdlProveedoresSIG.Attributes.Remove("onclick") : DdlProveedoresSIG.CssClass &= " select2me"
' 'Case "43"
' ' If DdlClientesSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlClientesSIG.SelectedValue
' ' DdlClientesSIG.Items.Clear() : DdlClientesSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlClientesSIG.DataSource = DtCuentasContablesSIG : DdlClientesSIG.DataBind() : DdlClientesSIG.SelectedValue = Seleccionado
' ' DdlClientesSIG.AutoPostBack = False : DdlClientesSIG.Attributes.Remove("onclick") : DdlClientesSIG.CssClass &= " select2me"
' 'Case "44"
' ' If DdlInventarioSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlInventarioSIG.SelectedValue
' ' DdlInventarioSIG.Items.Clear() : DdlInventarioSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlInventarioSIG.DataSource = DtCuentasContablesSIG : DdlInventarioSIG.DataBind() : DdlInventarioSIG.SelectedValue = Seleccionado
' ' DdlInventarioSIG.AutoPostBack = False : DdlInventarioSIG.Attributes.Remove("onclick") : DdlInventarioSIG.CssClass &= " select2me"
' 'Case "45"
' ' If DdlGastoSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlGasto.SelectedValue
' ' DdlGastoSIG.Items.Clear() : DdlGastoSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlGastoSIG.DataSource = DtCuentasContablesSIG : DdlGastoSIG.DataBind() : DdlGastoSIG.SelectedValue = Seleccionado
' ' DdlGastoSIG.AutoPostBack = False : DdlGastoSIG.Attributes.Remove("onclick") : DdlGastoSIG.CssClass &= " select2me"
' 'Case "46"
' ' If DdlBancosSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlBancosSIG.SelectedValue
' ' DdlBancosSIG.Items.Clear() : DdlBancosSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlBancosSIG.DataSource = DtCuentasContablesSIG : DdlBancosSIG.DataBind() : DdlBancosSIG.SelectedValue = Seleccionado
' ' DdlBancosSIG.AutoPostBack = False : DdlBancosSIG.Attributes.Remove("onclick") : DdlBancosSIG.CssClass &= " select2me"
' 'Case "47"
' ' If DdlDeudoresSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlDeudoresSIG.SelectedValue
' ' DdlDeudoresSIG.Items.Clear() : DdlDeudoresSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlDeudoresSIG.DataSource = DtCuentasContablesSIG : DdlDeudoresSIG.DataBind() : DdlDeudoresSIG.SelectedValue = Seleccionado
' ' DdlDeudoresSIG.AutoPostBack = False : DdlDeudoresSIG.Attributes.Remove("onclick") : DdlDeudoresSIG.CssClass &= " select2me"
' 'Case "48"
' ' If DdlAcreedoresSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlAcreedoresSIG.SelectedValue
' ' DdlAcreedoresSIG.Items.Clear() : DdlAcreedoresSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlAcreedoresSIG.DataSource = DtCuentasContablesSIG : DdlAcreedoresSIG.DataBind() : DdlAcreedoresSIG.SelectedValue = Seleccionado
' ' DdlAcreedoresSIG.AutoPostBack = False : DdlAcreedoresSIG.Attributes.Remove("onclick") : DdlAcreedoresSIG.CssClass &= " select2me"
' 'Case "49"
' ' If DdlDocxPagarSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlDocxPagarSIG.SelectedValue
' ' DdlDocxPagarSIG.Items.Clear() : DdlDocxPagarSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlDocxPagarSIG.DataSource = DtCuentasContablesSIG : DdlDocxPagarSIG.DataBind() : DdlDocxPagarSIG.SelectedValue = Seleccionado
' ' DdlDocxPagarSIG.AutoPostBack = False : DdlDocxPagarSIG.Attributes.Remove("onclick") : DdlDocxPagarSIG.CssClass &= " select2me"
' 'Case "50"
' ' If DdlAnticipoClienteSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlAnticipoClienteSIG.SelectedValue
' ' DdlAnticipoClienteSIG.Items.Clear() : DdlAnticipoClienteSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlAnticipoClienteSIG.DataSource = DtCuentasContablesSIG : DdlAnticipoClienteSIG.DataBind() : DdlAnticipoClienteSIG.SelectedValue = Seleccionado
' ' DdlAnticipoClienteSIG.AutoPostBack = False : DdlAnticipoClienteSIG.Attributes.Remove("onclick") : DdlAnticipoClienteSIG.CssClass &= " select2me"
' 'Case "51"
' ' If DdlAnticipoProveedoresSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlAnticipoProveedoresSIG.SelectedValue
' ' DdlAnticipoProveedoresSIG.Items.Clear() : DdlAnticipoProveedoresSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlAnticipoProveedoresSIG.DataSource = DtCuentasContablesSIG : DdlAnticipoProveedoresSIG.DataBind() : DdlAnticipoProveedoresSIG.SelectedValue = Seleccionado
' ' DdlAnticipoProveedoresSIG.AutoPostBack = False : DdlAnticipoProveedoresSIG.Attributes.Remove("onclick") : DdlAnticipoProveedoresSIG.CssClass &= " select2me"
' 'Case "52"
' ' If DdlCajaSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlCajaSIG.SelectedValue
' ' DdlCajaSIG.Items.Clear() : DdlCajaSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlCajaSIG.DataSource = DtCuentasContablesSIG : DdlCajaSIG.DataBind() : DdlCajaSIG.SelectedValue = Seleccionado
' ' DdlCajaSIG.AutoPostBack = False : DdlCajaSIG.Attributes.Remove("onclick") : DdlCajaSIG.CssClass &= " select2me"
' 'Case "53"
' ' If DdlFyESIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlFyESIG.SelectedValue
' ' DdlFyESIG.Items.Clear() : DdlFyESIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlFyESIG.DataSource = DtCuentasContablesSIG : DdlFyESIG.DataBind() : DdlFyESIG.SelectedValue = Seleccionado
' ' DdlFyESIG.AutoPostBack = False : DdlFyESIG.Attributes.Remove("onclick") : DdlFyESIG.CssClass &= " select2me"
' 'Case "54"
' ' If DdlActivoFijoSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG()
' ' Seleccionado = DdlActivoFijoSIG.SelectedValue
' ' DdlActivoFijoSIG.Items.Clear() : DdlActivoFijoSIG.Items.Add(New ListItem("Seleccione", "0"))
' ' DdlActivoFijoSIG.DataSource = DtCuentasContablesSIG : DdlActivoFijoSIG.DataBind() : DdlActivoFijoSIG.SelectedValue = Seleccionado
' ' DdlActivoFijoSIG.AutoPostBack = False : DdlActivoFijoSIG.Attributes.Remove("onclick") : DdlActivoFijoSIG.CssClass &= " select2me"
' End Select
'End Sub
'Public Sub CargaDDLs()
' DdlIVAxAcreditar.AutoPostBack = True
' DdlIVAAcreditable.AutoPostBack = True
' DdlIVAxTrasladar.AutoPostBack = True
' DdlIVATrasladado.AutoPostBack = True
' DdlIVARetenciones.AutoPostBack = True
' DdlISRCirculacion.AutoPostBack = True
' DdlProveedores.AutoPostBack = True
' DdlClientes.AutoPostBack = True
' DdlInventario.AutoPostBack = True
' DdlGasto.AutoPostBack = True
' DdlBancos.AutoPostBack = True
' DdlDeudores.AutoPostBack = True
' DdlAcreedores.AutoPostBack = True
' DdlDocxPagar.AutoPostBack = True
' DdlAnticipoCliente.AutoPostBack = True
' DdlAnticipoProveedores.AutoPostBack = True
' DdlCaja.AutoPostBack = True
' DdlFyE.AutoPostBack = True
' DddlCuentaGananciaCambiaria.AutoPostBack = True
' DdlCuentaPerdidaCambiaria.AutoPostBack = True
' DdlActivoFijo.AutoPostBack = True
' DdlIEPSxAcreditar.AutoPostBack = True
' DdlIEPSAcreditable.AutoPostBack = True
' DdlIEPSxTrasladar.AutoPostBack = True
' DdlIEPSTrasladado.AutoPostBack = True
' DdlCuentaDescuentoVenta.AutoPostBack = True
' DdlCuentaOtrosIngresos.AutoPostBack = True
' ''CUENTAS PADRES SIG
' 'DdlProveedoresSIG.AutoPostBack = True
' 'DdlClientesSIG.AutoPostBack = True
' 'DdlInventarioSIG.AutoPostBack = True
' 'DdlGastoSIG.AutoPostBack = True
' 'DdlBancosSIG.AutoPostBack = True
' 'DdlDeudoresSIG.AutoPostBack = True
' 'DdlAcreedoresSIG.AutoPostBack = True
' 'DdlDocxPagarSIG.AutoPostBack = True
' 'DdlAnticipoClienteSIG.AutoPostBack = True
' 'DdlAnticipoProveedoresSIG.AutoPostBack = True
' 'DdlCajaSIG.AutoPostBack = True
' 'DdlFyESIG.AutoPostBack = True
' 'DdlActivoFijoSIG.AutoPostBack = True
' DdlIVAxAcreditar.Attributes.Add("onclick", "CargaCuentas(1);")
' DdlIVAAcreditable.Attributes.Add("onclick", "CargaCuentas(2);")
' DdlIVAxTrasladar.Attributes.Add("onclick", "CargaCuentas(3);")
' DdlIVATrasladado.Attributes.Add("onclick", "CargaCuentas(4);")
' DdlIVARetenciones.Attributes.Add("onclick", "CargaCuentas(5);")
' DdlISRCirculacion.Attributes.Add("onclick", "CargaCuentas(6);")
' DdlProveedores.Attributes.Add("onclick", "CargaCuentas(7);")
' DdlClientes.Attributes.Add("onclick", "CargaCuentas(8);")
' DdlInventario.Attributes.Add("onclick", "CargaCuentas(9);")
' DdlGasto.Attributes.Add("onclick", "CargaCuentas(10);")
' DdlBancos.Attributes.Add("onclick", "CargaCuentas(11);")
' DdlDeudores.Attributes.Add("onclick", "CargaCuentas(12);")
' DdlAcreedores.Attributes.Add("onclick", "CargaCuentas(13);")
' DdlDocxPagar.Attributes.Add("onclick", "CargaCuentas(14);")
' DdlAnticipoCliente.Attributes.Add("onclick", "CargaCuentas(15);")
' DdlAnticipoProveedores.Attributes.Add("onclick", "CargaCuentas(16);")
' DdlCaja.Attributes.Add("onclick", "CargaCuentas(17);")
' DdlFyE.Attributes.Add("onclick", "CargaCuentas(18);")
' DddlCuentaGananciaCambiaria.Attributes.Add("onclick", "CargaCuentas(19);")
' DdlCuentaPerdidaCambiaria.Attributes.Add("onclick", "CargaCuentas(20);")
' DdlActivoFijo.Attributes.Add("onclick", "CargaCuentas(33);")
' DdlDSV.Attributes.Add("onclick", "CargaCuentas(34);")
' DdlImpuestosLocales.Attributes.Add("onclick", "CargaCuentas(35);")
' DdlIEPSxAcreditar.Attributes.Add("onclick", "CargaCuentas(36);")
' DdlIEPSAcreditable.Attributes.Add("onclick", "CargaCuentas(37);")
' DdlIEPSxTrasladar.Attributes.Add("onclick", "CargaCuentas(38);")
' DdlIEPSTrasladado.Attributes.Add("onclick", "CargaCuentas(39);")
' DdlCuentaDescuentoVenta.Attributes.Add("onclick", "CargaCuentas(40);")
' DdlCuentaOtrosIngresos.Attributes.Add("onclick", "CargaCuentas(41);")
' ''CUENTAS PADRES
' 'DdlProveedoresSIG.Attributes.Add("onclick", "CargaCuentas(42);")
' 'DdlClientesSIG.Attributes.Add("onclick", "CargaCuentas(43);")
' 'DdlInventarioSIG.Attributes.Add("onclick", "CargaCuentas(44);")
' 'DdlGastoSIG.Attributes.Add("onclick", "CargaCuentas(45);")
' 'DdlBancosSIG.Attributes.Add("onclick", "CargaCuentas(46);")
' 'DdlDeudoresSIG.Attributes.Add("onclick", "CargaCuentas(47);")
' 'DdlAcreedoresSIG.Attributes.Add("onclick", "CargaCuentas(48);")
' 'DdlDocxPagarSIG.Attributes.Add("onclick", "CargaCuentas(49);")
' 'DdlAnticipoClienteSIG.Attributes.Add("onclick", "CargaCuentas(50);")
' 'DdlAnticipoProveedoresSIG.Attributes.Add("onclick", "CargaCuentas(51);")
' 'DdlCajaSIG.Attributes.Add("onclick", "CargaCuentas(52);")
' 'DdlFyESIG.Attributes.Add("onclick", "CargaCuentas(53);")
' 'DdlActivoFijoSIG.Attributes.Add("onclick", "CargaCuentas(54);")
' UpDatos.Update()
'End Sub
Public Sub CargaFuncionalidad(CveFuncionalidad As Integer, ByRef Ddl As DropDownList)
Dim Dr As DataRow = DtFuncionalidades.FiltroPrimero($"CveFuncionalidad = {CveFuncionalidad}")
If Dr IsNot Nothing Then
Dim DrC As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", Dr("Valor").ToString))
If Not IsNothing(DrC) Then
Ddl.Items.Add(New ListItem(DrC("CtaCodigo").ToString, Dr("Valor").ToString))
End If
Ddl.SelectedValue = Dr("Valor").ToString
End If
End Sub
Private Sub CargaDdlPac()
Dim Objeto As New ClsSisEmpresas
If Objeto.GetPacs() Then
'DdlCvePac.DataSource = Objeto.DtResultados
'DdlCvePac.DataBind()
'DdlCvePac.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
Objeto.Dispose()
End Sub
Private Sub CargaRegimenFiscal()
Dim ObjSis As New ClsSisEmpresas
If ObjSis.GetRegimenFiscal(-1) Then
DdlRegimen.DataSource = ObjSis.DtResultados
DdlRegimen.DataBind()
DdlRegimen.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
ObjSis.Dispose()
End Sub
'#Region "TAB - INDICADORES "
' Public Sub CargaGridIndicadores()
' Dim Objeto As New ClsIndicadores
' If Objeto.GetEmpresasIndicadores(UsuarioActual.CveEmpresa) Then
' GvIndicadores.DataSource = Objeto.DtResultados
' End If
' GvIndicadores.DataBind()
' Objeto.Dispose()
' End Sub
' Private Sub GvIndicadores_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvIndicadores.RowDataBound
' If e.Row.RowType = DataControlRowType.DataRow Then
' If e.Row.DBCampo("CveEmpresa") <> "" Then
' e.Row.FCCheckBox("chkIndicador").Checked = True
' End If
' End If
' End Sub
'#End Region
#Region "P L A N T I L L A C O R R E O"
Private Sub BtnGuardarPlantilla_Click(sender As Object, e As EventArgs) Handles BtnGuardarPlantilla.Click
If UsuarioActual.Empresa.PlantillaMailVenta.Length > 0 Then
End If
Dim ObjEmpresa As New ClsSisEmpresas()
If ObjEmpresa.UpdatePlantillaMail("AsuntoPlantillaMailVenta", TxtAsunto.Text.Trim, "PlantillaMailVenta", TxtPlantillaVenta.Text.Trim, UsuarioActual.CveEmpresa) Then
If ObjEmpresa.UpdatePlantillaMail("AsuntoPlantillaMailVentaCotizacion", TxtAsuntoCotizacion.Text.Trim, "PlantillaMailVentaCotizacion", TxtPlantillaCotizacion.Text.Trim, UsuarioActual.CveEmpresa) Then
End If
Alert("La plantilla de mail de ventas se guardó correctamente.", TipoMensaje.MsgInformacion)
UsuarioActual.Empresa.PlantillaMailVenta = TxtPlantillaVenta.Text.Trim
UsuarioActual.Empresa.AsuntoPlantillaMailVenta = TxtAsunto.Text.Trim
UsuarioActual.Empresa.AsuntoPlantillaMailVentaCotizacion = TxtPlantillaCotizacion.Text.Trim
UsuarioActual.Empresa.PlantillaMailVentaCotizacion = TxtAsuntoCotizacion.Text.Trim
'TxtPlantillaVenta.Text = ""
'TxtAsunto.Text = ""
End If
ObjEmpresa.Dispose()
Alert(TxtPlantillaVenta.Text.Trim, TipoMensaje.MsgInformacion)
End Sub
#End Region
#Region "TAB CONTABILIDAD - CLASIFICACION DE IVA"
Private Sub ActualizaNombresCuentas()
For Each Dr As DataRow In DtClasificacionIVA.Rows
If Dr("IdCtaIVAXAcreditar").ToString.ToEntero > 0 Then
'Dr("CuentaXAcreditar") = DtCuentas.FiltraParametros($"Id = {Dr("IdCtaIVAXAcreditar").ToString}").Rows(0)("CtaCodigo").ToString
Dr("CuentaXAcreditar") = DtCuentas.FiltroPrimeroValor("CtaCodigo", $"Id = {Dr("IdCtaIVAXAcreditar").ToString}").ToString.ToEntero
End If
If Dr("IdCtaIVAAcreditable").ToString.ToEntero > 0 Then
'Dr("CuentaAcreditable") = DtCuentas.FiltraParametros($"Id = {Dr("IdCtaIVAAcreditable").ToString}").Rows(0)("CtaCodigo").ToString
Dr("CuentaAcreditable") = DtCuentas.FiltroPrimeroValor("CtaCodigo", $"Id = {Dr("IdCtaIVAAcreditable").ToString}").ToString.ToEntero
End If
If Dr("IdCtaIVAXTrasladar").ToString.ToEntero > 0 Then
'Dr("CuentaXTrasladar") = DtCuentas.FiltraParametros($"Id = {Dr("IdCtaIVAXTrasladar").ToString}").Rows(0)("CtaCodigo").ToString
Dr("CuentaXTrasladar") = DtCuentas.FiltroPrimeroValor("CtaCodigo", $"Id = {Dr("IdCtaIVAXTrasladar").ToString}").ToString.ToEntero
End If
If Dr("IdCtaIVATrasladado").ToString.ToEntero > 0 Then
'Dr("CuentaTrasladado") = DtCuentas.FiltraParametros($"Id = {Dr("IdCtaIVATrasladado").ToString}").Rows(0)("CtaCodigo").ToString
Dr("CuentaTrasladado") = DtCuentas.FiltroPrimeroValor("CtaCodigo", $"Id = {Dr("IdCtaIVATrasladado").ToString}").ToString.ToEntero
End If
Next
DtClasificacionIVA.AcceptChanges()
End Sub
'Private Sub InicializaClasificacionIVA(ObjEmpresas As ClsSisEmpresas)
' CreaDtClasificacionIVA()
' CargaCuentasIVA(ObjEmpresas)
' CargaClasificaciones()
' CargaClasificacionesIVA()
'End Sub
'Private Sub CargaClasificacionesIVA()
' Dim ObjGral As New ClsGenerales
' If ObjGral.GetClasificacionPorcentaje(UsuarioActual.CveEmpresa, Opcion:=2) Then
' DtClasificacionIVA = ObjGral.DtResultados.Copy
' ActualizaNombresCuentas()
' GvClasificacionIVA.DataSource = DtClasificacionIVA
' End If
' ObjGral.Dispose()
' GvClasificacionIVA.DataBind()
' UpClasificacionIVA.Update()
'End Sub
'Private Sub CargaClasificaciones()
' DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
' DdlClasificacion.DataBind()
' DdlClasificacion.Items.Insert(0, New ListItem("-", "-1"))
'End Sub
'Private Sub CreaDtClasificacionIVA()
' DtClasificacionIVA = New DataTable
' DtClasificacionIVA.Columns.Add("CveClasificacionPorcentaje", GetType(Integer))
' DtClasificacionIVA.Columns.Add("CveClasificacion", GetType(Integer))
' DtClasificacionIVA.Columns.Add("Clasificacion", GetType(String))
' DtClasificacionIVA.Columns.Add("PorcentajeIVA", GetType(Double))
' DtClasificacionIVA.Columns.Add("CuentaXAcreditar", GetType(String))
' DtClasificacionIVA.Columns.Add("IdCtaIVAXAcreditar", GetType(Integer))
' DtClasificacionIVA.Columns.Add("CuentaAcreditable", GetType(String))
' DtClasificacionIVA.Columns.Add("IdCtaIVAAcreditable", GetType(Integer))
' DtClasificacionIVA.Columns.Add("CuentaXTrasladar", GetType(String))
' DtClasificacionIVA.Columns.Add("IdCtaIVAXTrasladar", GetType(Integer))
' DtClasificacionIVA.Columns.Add("CuentaTrasladado", GetType(String))
' DtClasificacionIVA.Columns.Add("IdCtaIVATrasladado", GetType(Integer))
'End Sub
'Private Sub CargaCuentasIVA(ByRef ObjEmpresas As ClsSisEmpresas)
' If ObjEmpresas.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
' If ObjEmpresas.Empresa.UsaContabilidad And ObjEmpresas.Empresa.TipoContabilidad = 2 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
' Try
' DdlIVAXAcreditarModal.DataSource = DtCuentas : DdlIVAXAcreditarModal.DataBind()
' Catch ex As Exception
' End Try
' Try
' DdlIVAAcreditableModal.DataSource = DtCuentas : DdlIVAAcreditableModal.DataBind()
' Catch ex As Exception
' End Try
' Try
' DdlIVAXTrasladarModal.DataSource = DtCuentas : DdlIVAXTrasladarModal.DataBind()
' Catch ex As Exception
' End Try
' Try
' DdlIVATrasladadoModal.DataSource = DtCuentas : DdlIVATrasladadoModal.DataBind()
' Catch ex As Exception
' End Try
' End If
' End If
' 'ObjEmpresas.Dispose()
' DdlIVAXAcreditarModal.Items.Insert(0, New ListItem("-", "-1"))
' DdlIVAAcreditableModal.Items.Insert(0, New ListItem("-", "-1"))
' DdlIVAXTrasladarModal.Items.Insert(0, New ListItem("-", "-1"))
' DdlIVATrasladadoModal.Items.Insert(0, New ListItem("-", "-1"))
'End Sub
'Protected Sub LnkEliminarClasificacionIVA_Click(sender As Object, e As EventArgs)
' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
' If DtClasificacionIVA.Rows(gvRow.RowIndex)("CveClasificacionPorcentaje").ToString.ToEntero = 0 Then
' DtClasificacionIVA.Rows(gvRow.RowIndex).Delete()
' Else
' DtClasificacionIVA.Rows(gvRow.RowIndex)("CveClasificacion") = -1
' End If
' DtClasificacionIVA.AcceptChanges()
' GvClasificacionIVA.DataSource = DtClasificacionIVA
' GvClasificacionIVA.DataBind()
' UpClasificacionIVA.Update()
'End Sub
'Protected Sub LnkAgregarClasificacionIVA_Click(sender As Object, e As EventArgs)
' LimpiaClasificacionIVA()
' Modalidad = "A"
' RegistraScript("$('#DModalClasificacionIVA').modal()")
' UpModalClasificacionIVA.Update()
'End Sub
'Protected Sub LnkEditarClasificacionIVA_Click(sender As Object, e As EventArgs)
' LimpiaClasificacionIVA()
' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
' Modalidad = "U"
' Index = gvRow.RowIndex
' CveClasificacionPorcentaje = gvRow.DataKey("CveClasificacionPorcentaje").ToEntero()
' DdlClasificacion.SelectedValueExist(gvRow.DataKey("CveClasificacion"))
' TxtPorcentajeIVA.Text = gvRow.DataKey("PorcentajeIVA")
' DdlIVAXAcreditarModal.SelectedValueExist(gvRow.DataKey("IdCtaIVAXAcreditar"))
' DdlIVAAcreditableModal.SelectedValueExist(gvRow.DataKey("IdCtaIVAAcreditable"))
' DdlIVAXTrasladarModal.SelectedValueExist(gvRow.DataKey("IdCtaIVAXTrasladar"))
' DdlIVATrasladadoModal.SelectedValueExist(gvRow.DataKey("IdCtaIVATrasladado"))
' RegistraScript("$('#DModalClasificacionIVA').modal()")
' UpModalClasificacionIVA.Update()
'End Sub
'Private Sub LimpiaClasificacionIVA()
' TxtPorcentajeIVA.Text = ""
' DdlClasificacion.SelectedIndex = 0
' DdlIVAXAcreditarModal.SelectedIndex = 0
' DdlIVAAcreditableModal.SelectedIndex = 0
' DdlIVAXTrasladarModal.SelectedIndex = 0
' DdlIVATrasladadoModal.SelectedIndex = 0
' UpModalClasificacionIVA.Update()
'End Sub
'Protected Sub BtnClasificacionIVA_Click(sender As Object, e As EventArgs)
' If Modalidad = "A" Then
' Dim Row As DataRow = DtClasificacionIVA.NewRow()
' Row("CveClasificacionPorcentaje") = 0
' Row("CveClasificacion") = DdlClasificacion.SelectedValue.ToEntero
' Row("Clasificacion") = DdlClasificacion.SelectedItem.Text
' Row("PorcentajeIVA") = TxtPorcentajeIVA.Text.ToDouble
' Row("CuentaXAcreditar") = DdlIVAXAcreditarModal.SelectedItem.Text
' Row("IdCtaIVAXAcreditar") = DdlIVAXAcreditarModal.SelectedValue.ToEntero
' Row("CuentaAcreditable") = DdlIVAAcreditableModal.SelectedItem.Text
' Row("IdCtaIVAAcreditable") = DdlIVAAcreditableModal.SelectedValue.ToEntero
' Row("CuentaXTrasladar") = DdlIVAXTrasladarModal.SelectedItem.Text
' Row("IdCtaIVAXTrasladar") = DdlIVAXTrasladarModal.SelectedValue.ToEntero
' Row("CuentaTrasladado") = DdlIVATrasladadoModal.SelectedItem.Text
' Row("IdCtaIVATrasladado") = DdlIVATrasladadoModal.SelectedValue.ToEntero
' DtClasificacionIVA.Rows.InsertAt(Row, DtClasificacionIVA.Rows.Count)
' ElseIf Modalidad = "U" Then
' DtClasificacionIVA.Rows(Index)("CveClasificacion") = DdlClasificacion.SelectedValue.ToEntero
' DtClasificacionIVA.Rows(Index)("Clasificacion") = DdlClasificacion.SelectedItem.Text
' DtClasificacionIVA.Rows(Index)("PorcentajeIVA") = TxtPorcentajeIVA.Text.ToDouble
' DtClasificacionIVA.Rows(Index)("CuentaXAcreditar") = DdlIVAXAcreditarModal.SelectedItem.Text
' DtClasificacionIVA.Rows(Index)("IdCtaIVAXAcreditar") = DdlIVAXAcreditarModal.SelectedValue.ToEntero
' DtClasificacionIVA.Rows(Index)("CuentaAcreditable") = DdlIVAAcreditableModal.SelectedItem.Text
' DtClasificacionIVA.Rows(Index)("IdCtaIVAAcreditable") = DdlIVAAcreditableModal.SelectedValue.ToEntero
' DtClasificacionIVA.Rows(Index)("CuentaXTrasladar") = DdlIVAXTrasladarModal.SelectedItem.Text
' DtClasificacionIVA.Rows(Index)("IdCtaIVAXTrasladar") = DdlIVAXTrasladarModal.SelectedValue.ToEntero
' DtClasificacionIVA.Rows(Index)("CuentaTrasladado") = DdlIVATrasladadoModal.SelectedItem.Text
' DtClasificacionIVA.Rows(Index)("IdCtaIVATrasladado") = DdlIVATrasladadoModal.SelectedValue.ToEntero
' End If
' DtClasificacionIVA.AcceptChanges()
' ActualizaNombresCuentas()
' GvClasificacionIVA.DataSource = DtClasificacionIVA
' GvClasificacionIVA.DataBind()
' UpClasificacionIVA.Update()
' RegistraScript("$('#DModalClasificacionIVA').modal('hide')")
'End Sub
'Protected Sub GvClasificacionIVA_RowDataBound(sender As Object, e As GridViewRowEventArgs)
' If e.Row.RowType = DataControlRowType.DataRow Then
' If Not e.Row.DBCampo("CveClasificacion").ToEntero > 0 Then
' e.Row.Visible = False
' End If
' End If
'End Sub
#End Region
'Protected Sub LnkOpenModalDatosFiel_Click(sender As Object, e As EventArgs)
' TxtFielPass.Text = ""
' TxtFielArchivoCER.Text = ""
' TxtFielArchivoKey.Text = ""
' RegistraScript("$('#ModalUpFiel').modal();")
'End Sub
'Protected Sub LnkUpDatosFiel_Click(sender As Object, e As EventArgs)
' Dim Password As String = TxtFielPass.Text
' Dim akey As String
' Dim acer As String
' Dim pemkey As String
' Dim pemcer As String
' Dim pfxname As String
' Dim Archivopfx As String
' Dim Archivokey As Archivo = Nothing
' Dim Archivocer As Archivo = Nothing
' Dim dirbase = ""
' Dim dirbasepfx = ""
' If EmpresaEditar IsNot Nothing Then
' dirbase = String.Format("{0}Certificados\Fiel\", EmpresaEditar.Ruta)
' dirbasepfx = String.Format("{0}Certificados\", EmpresaEditar.Ruta)
' Else
' dirbase = String.Format("{0}Empresas\{1}\Certificados\Fiel\", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)
' dirbasepfx = String.Format("{0}Empresas\{1}\Certificados\", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa)
' End If
' If (Not Directory.Exists(dirbase)) Then
' Directory.CreateDirectory(dirbase)
' End If
' Dim Filesgral As List(Of Archivo) = TxtFielArchivoCER.getfiles().Archivos
' If Filesgral.Count > 0 Then
' Archivocer = Filesgral(0)
' End If
' Filesgral = TxtFielArchivoKey.getfiles().Archivos
' If Filesgral.Count > 0 Then
' Archivokey = Filesgral(0)
' End If
' If Not IsNothing(Archivokey) AndAlso Not IsNothing(Archivocer) And Password.Length > 0 Then
' akey = String.Format("{0}{1}", dirbase, Archivokey.filenameO)
' If File.Exists(akey) Then
' File.Delete(akey)
' End If
' File.Copy(Archivokey.FileUrl, akey)
' acer = String.Format("{0}{1}", dirbase, Archivocer.filenameO)
' If File.Exists(acer) Then
' File.Delete(acer)
' End If
' File.Copy(Archivocer.FileUrl, acer)
' Archivopfx = Archivokey.filenameO.Substring(0, Archivokey.filenameO.Length - 4)
' pemkey = String.Format("{0}{1}.pem", dirbase, Archivopfx)
' pfxname = String.Format("{0}{1}.pfx", dirbasepfx, Archivopfx)
' pemcer = String.Format("{0}{1}.pem", dirbase, Archivokey.filenameO.Substring(0, Archivocer.filenameO.Length - 4))
' If File.Exists(pemkey) Then
' File.Delete(pemkey)
' End If
' If File.Exists(pfxname) Then
' File.Delete(pfxname)
' End If
' If File.Exists(pemcer) Then
' File.Delete(pemcer)
' End If
' Dim resultado As New StringBuilder
' resultado.AppendLine("<br/>PAso 1:<br/>")
' resultado.AppendLine(execCommand({"cd C:\Generar PFX\", String.Format("openssl.exe x509 -inform DER -in ""{0}"" -out ""{1}""", acer, pemcer)}))
' resultado.AppendLine("<br/>PAso 2:<br/>")
' resultado.AppendLine(execCommand({"cd C:\Generar PFX\", String.Format("openssl pkcs8 -inform DER -in ""{0}"" -passin pass:""{1}"" -out ""{2}""", akey, Password, pemkey)}))
' resultado.AppendLine("<br/>Paso 3:<br/>")
' resultado.AppendLine(execCommand({"cd C:\Generar PFX\", String.Format("openssl pkcs12 -export -out ""{0}"" -inkey ""{1}"" -in ""{2}"" -passout pass:""{3}""", pfxname, pemkey, pemcer, Password)}))
' resultado.AppendLine("<br/>")
' 'Alert(resultado.ToString())
' If File.Exists(pemkey) Then
' File.Delete(pemkey)
' End If
' If File.Exists(pemcer) Then
' File.Delete(pemcer)
' End If
' If File.Exists(acer) Then
' File.Delete(acer)
' End If
' If File.Exists(akey) Then
' File.Delete(akey)
' End If
' If File.Exists(Archivocer.FileUrl) Then
' File.Delete(Archivocer.FileUrl)
' End If
' If File.Exists(Archivokey.FileUrl) Then
' File.Delete(Archivokey.FileUrl)
' End If
' If Not File.Exists(pfxname) Then
' Archivopfx = ""
' Password = ""
' End If
' Dim objempresa As New ClsSisEmpresas
' objempresa.UpEmpresaFiel(UsuarioActual.CveEmpresa, Password, $"{Archivopfx}.pfx")
' objempresa.Dispose()
' lblPassFiel.Text = Password
' LblPfx.Text = $"{Archivopfx}.pfx"
' Alert("La Fiel se ha actualizado")
' UpmodalFiel.Update()
' RegistraScript("$('#ModalUpFiel').modal('hide');")
' Else
' Alert("Favor de llenar todos los campos : <br/>-Contraseña<br/>-Archivo CER<br/>-Archivo KEY", TipoMensaje.MsgAdvertencia)
' End If
'End Sub
'Public Function execCommand(command As String()) As String
' Dim proceso As Diagnostics.Process = New Diagnostics.Process()
' proceso.StartInfo.FileName = "cmd.exe"
' proceso.StartInfo.CreateNoWindow = True
' proceso.StartInfo.RedirectStandardInput = True
' proceso.StartInfo.RedirectStandardOutput = True
' proceso.StartInfo.UseShellExecute = False
' proceso.Start()
' For Each c As String In command
' proceso.StandardInput.WriteLine(c)
' Next
' proceso.StandardInput.Flush()
' proceso.StandardInput.Close()
' proceso.WaitForExit()
' Return proceso.StandardOutput.ReadToEnd()
'End Function
'Private Sub CargaTareasProgramadas()
' Dim objTP As New ClsTareasProgramadas()
' ChkDescargaMasivaSat.Checked = False
' If objTP.GetTareasProgramadas(UsuarioActual.CveEmpresa) AndAlso objTP.DtResultados.Rows.Count > 0 Then
' ChkDescargaMasivaSat.Checked = (objTP.DtResultados.COUNT("CveTareaProgramada", "CveTareaProgramada=1") > 0)
' End If
' objTP.Dispose()
'End Sub
'Protected Sub ChkDescargaMasivaSat_CheckedChanged(sender As Object, e As EventArgs)
' Dim objTP As New ClsTareasProgramadas()
' If ChkDescargaMasivaSat.Checked Then
' If objTP.AddTareasProgramadas(UsuarioActual.CveEmpresa, 1, DateTime.Now.ToString("yyyy/MM/dd"), "", 0, "", DateTime.Now.ToString("yyyy/MM/dd"), DateTime.Now.ToString("yyyy/MM/dd"), "", "", 0, 1) Then
' Alert("La tarea programada de descarga masiva del sat a agregado satisfactoriamente")
' End If
' Else
' If objTP.RemoveTareasProgramadas(1, UsuarioActual.CveEmpresa) Then
' Alert("La tarea programada de descarga masiva del sat se ha removido satisfactoriamente")
' End If
' End If
' objTP.Dispose()
'End Sub
Protected Sub LnkRegistrarPAC3_Click(sender As Object, e As EventArgs)
If UsuarioActual.CveEmpresa > 0 Then
RegistrarPAC3()
Else
Alert("Debe registrar la empresa para poder registrarla en el PAC", TipoMensaje.MsgAdvertencia)
End If
End Sub
Private Sub RegistrarPAC3()
Try
Dim Credenciales As String = "vSGxMFWnNRy/nDoowxqrqw==|Sia123654"
Dim ArchivoLLave As String = String.Format("{0}\Certificados\{1}", EmpresaEditar.Ruta, EmpresaEditar.ArchivoKey)
Dim ArchivoCertificado As String = String.Format("{0}\Certificados\{1}", EmpresaEditar.Ruta, EmpresaEditar.ArchivoCer)
Dim llaveByte = System.IO.File.ReadAllBytes(ArchivoLLave)
Dim certByte = System.IO.File.ReadAllBytes(ArchivoCertificado)
Dim RFCEmisor = TxtRFC.Text.Trim()
Dim contrasena = TxtContraseñaKey.Text.Trim()
Dim conector As New Profact.TimbraCFDI33.Conector(EmpresaEditar.FacturaProduccion)
If Not EmpresaEditar.FacturaProduccion OrElse EmpresaEditar.CveEmpresa = 1 Then
conector.EstableceCredenciales("mvpNUXmQfK8=")
Else
conector.EstableceCredenciales(Credenciales)
End If
Dim result = conector.RegistraEmisor(RFCEmisor, certByte, llaveByte, contrasena)
If result.Exitoso Then
Alert("El emisor se registró correctamente.<br>" & result.Descripcion)
Else
Alert("Ocurrió un error al registrar el emisor.<br>" & result.Descripcion & ".<br> Numero Error: " & result.NumeroError, TipoMensaje.MsgError)
End If
Catch ex As Exception
OnError("Ocurrió un error al registrar el emisor", ex)
End Try
End Sub
Protected Sub LnkArchivoKey_Click(sender As Object, e As EventArgs) Handles LnkArchivoKey.Click
TxtCargaImg.getfiles().Archivos = Nothing
TxtCargaImg.Text = "[]"
OpActualizaArchivosCer = EnumOpActualizaArchivosCer.KEY
LblModalCertificadosTitulo.Text = "Archivo KEY"
UpModalCertificados.Update()
RegistraScript(String.Format("$('#{0}').modal();", "ModalArchvivo"))
End Sub
Protected Sub LnkArchivoCer_Click(sender As Object, e As EventArgs) Handles LnkArchivoCer.Click
TxtCargaImg.getfiles().Archivos = Nothing
TxtCargaImg.Text = "[]"
OpActualizaArchivosCer = EnumOpActualizaArchivosCer.CER
LblModalCertificadosTitulo.Text = "Archivo CER"
UpModalCertificados.Update()
RegistraScript(String.Format("$('#{0}').modal();", "ModalArchvivo"))
End Sub
Protected Sub LnkArchivoPfx_Click(sender As Object, e As EventArgs) Handles LnkArchivoPfx.Click
TxtCargaImg.getfiles().Archivos = Nothing
TxtCargaImg.Text = "[]"
OpActualizaArchivosCer = EnumOpActualizaArchivosCer.PFX
LblModalCertificadosTitulo.Text = "Archivo PFX"
UpModalCertificados.Update()
RegistraScript(String.Format("$('#{0}').modal();", "ModalArchvivo"))
End Sub
Protected Sub BtnGuardarArchivo_Click(sender As Object, e As EventArgs)
Dim FileExtension As String = "-1"
Dim filesgral As List(Of Archivo) = TxtCargaImg.getfiles().Archivos
Dim filemove As String = ""
Dim TieneError As Boolean = False
For Each fileItem As Archivo In filesgral
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
filemove = fileItem.filename
Dim Patron As String = "(^\d{1,}-)|(\.\w{1,}$)"
Dim NombreArchivo As String = Regex.Replace(filemove, Patron, "")
Dim yaExistente As String = String.Format("{0}Empresas\{1}\Certificados\{2}.{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, NombreArchivo, FileExtension)
Dim ArchivoCertificado As String = $"{NombreArchivo}.{FileExtension}"
If File.Exists(yaExistente) Then
File.Delete(yaExistente)
End If
Try
If filemove <> "" Then
Dim Ruta As String = String.Format("Empresas\{0}\Certificados\", UsuarioActual.CveEmpresa)
filemove.FilesMove(NombreArchivo, Ruta)
End If
Catch ex As Exception
TieneError = True
End Try
If UsuarioActual.CveEmpresa > 0 AndAlso Not TieneError Then
Dim ObjEmpresas As New ClsSisEmpresas
Dim ArchivoKey As String = "-1"
Dim ArchivoCer As String = "-1"
Dim ArchivoPfx As String = "-1"
If OpActualizaArchivosCer = EnumOpActualizaArchivosCer.KEY Then
ArchivoKey = ArchivoCertificado
TxtArchivoKey.Text = ArchivoKey
ElseIf OpActualizaArchivosCer = EnumOpActualizaArchivosCer.CER Then
ArchivoCer = ArchivoCertificado
TxtArchivoCer.Text = ArchivoCer
ElseIf OpActualizaArchivosCer = EnumOpActualizaArchivosCer.PFX Then
ArchivoPfx = ArchivoCertificado
TxtArchivoPfx.Text = ArchivoPfx
End If
If Not ObjEmpresas.UpdateEmpresasCertificados(ArchivoKey, ArchivoCer, ArchivoPfx, UsuarioActual.CveEmpresa) Then
TieneError = True
End If
ObjEmpresas.Dispose()
End If
Next
If Not TieneError Then
Alert("Certificado cargado con exito")
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalArchvivo"))
End If
TxtCargaImg.getfiles().Archivos = Nothing
UpAddArchivo.Update()
End Sub
Protected Sub LbArchivoKeyDescarga_Download(sender As Object, e As EventArgs) Handles LbArchivoKeyDescarga.Click
Dim NombreArchivo As String = TxtArchivoKey.Text
DescargarArchivo(NombreArchivo)
End Sub
Protected Sub LbArchivoCerDescarga_Download(sender As Object, e As EventArgs) Handles LbArchivoCerDescarga.Click
Dim NombreArchivo As String = TxtArchivoCer.Text
DescargarArchivo(NombreArchivo)
End Sub
Protected Sub LbArchivoPfxDescarga_Download(sender As Object, e As EventArgs) Handles LbArchivoPfxDescarga.Click
Dim NombreArchivo As String = TxtArchivoPfx.Text
DescargarArchivo(NombreArchivo)
End Sub
Private Sub DescargarArchivo(NombreArchivo As String)
Dim FilePath As String = String.Format("{0}Empresas\{1}\Certificados\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, NombreArchivo)
Dim byteArray As Byte() = File.ReadAllBytes(FilePath)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "application/octet-stream"
HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", NombreArchivo))
HttpContext.Current.Response.AddHeader("Content-Length", byteArray.Length.ToString())
HttpContext.Current.Response.OutputStream.Write(byteArray, 0, byteArray.Length)
HttpContext.Current.Response.End()
End Sub
End Class