diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index cad37fe3c..3ad022eb2 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -9207,6 +9207,7 @@ Public Class ClsPaginas 'PaginaDict.Add("/Sistemas/CatEmpresas.aspx".ToUpper(), 2) PaginaDict.Add("/Sistemas/CatEmpresas.aspx".ToUpper(), 24) PaginaDict.Add("/Sistemas/Empresa.aspx".ToUpper(), 2) + PaginaDict.Add("/Sistemas/Empresa2.aspx".ToUpper(), -1) PaginaDict.Add("/Sistemas/CatUsuarios.aspx".ToUpper(), 20) PaginaDict.Add("/Sistemas/Usuarios.aspx".ToUpper(), 20) PaginaDict.Add("/Sistemas/UsuarioDetalle.aspx".ToUpper(), 20) diff --git a/App_Code/ClsSisEmpresas.vb b/App_Code/ClsSisEmpresas.vb index b02ff2491..1b4a964ed 100644 --- a/App_Code/ClsSisEmpresas.vb +++ b/App_Code/ClsSisEmpresas.vb @@ -443,6 +443,10 @@ Public Class ClsSisEmpresas _Empresa.GrupoEmpresa = Data.Rows(0)("GrupoEmpresa").ToString.ToEntero _Empresa.PlantillaMailVenta = Data.Rows(0)("PlantillaMailVenta").ToString _Empresa.AsuntoPlantillaMailVenta = Data.Rows(0)("AsuntoPlantillaMailVenta").ToString + + _Empresa.PlantillaMailVentaCotizacion = Data.Rows(0)("PlantillaMailVentaCotizacion").ToString + _Empresa.AsuntoPlantillaMailVentaCotizacion = Data.Rows(0)("AsuntoPlantillaMailVentaCotizacion").ToString + _Empresa.CvePlataforma = Data.Rows(0)("CvePlataforma").ToString.ToEntero _Empresa.CveDistribuidor = Data.Rows(0)("CveDistribuidor").ToString.ToEntero _Empresa.DiasPermitidos = Data.Rows(0)("DiasPermitidos").ToString.ToEntero diff --git a/App_Code/ClsSisUsuarios.vb b/App_Code/ClsSisUsuarios.vb index 299054caa..1a79d3b39 100644 --- a/App_Code/ClsSisUsuarios.vb +++ b/App_Code/ClsSisUsuarios.vb @@ -301,7 +301,7 @@ Public Class ClsSisUsuarios Retorno.CveTipoDocumento = "-1" End If - + Retorno.ListaPersonalizacion = CargaPersonalizacionUsuario(Retorno.CveUsuario) End If @@ -313,6 +313,21 @@ Public Class ClsSisUsuarios Return Retorno End Function + Public Function CargaPersonalizacionUsuario(CveUsuarioParamerto As Integer) As Hashtable + + Dim Retorno As New Hashtable + If GetUsuariosPersonalizaciones(CveUsuarioParamerto) Then + + For Each drow As DataRow In Data.Rows + Retorno.Add(drow("PersonalizacionNombre").ToString, drow("PersonalizacionValor").ToString) + Next + + End If + + Return Retorno + + End Function + Public Function ValidaUsuarioAsignacion(CveUsuario As Integer, CveEmpresa As Integer) As Usuario Dim Retorno As Usuario = Nothing @@ -2951,6 +2966,56 @@ Public Class ClsSisUsuarios #End Region +#Region "PERSONALIZACIÓN COLUMNAS USUARIO" + Public Function GetUsuariosPersonalizaciones(ByVal CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Sis_UsuariosPersonalizacionesGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la personalización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Retorno = False + End Try + + Return Retorno + + End Function + + + Public Function AddUsuariosPersonalizaciones(ByRef UsuarioActual As Usuario, PersonalizacionNombre As String, PersonalizacionValor As String) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Sis_UsuariosPersonalizacionesAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUsuario", SqlDbType.Int).Value = UsuarioActual.CveUsuario + .Add("@PersonalizacionNombre", SqlDbType.VarChar).Value = PersonalizacionNombre + .Add("@PersonalizacionValor", SqlDbType.VarChar).Value = PersonalizacionValor + End With + + Try + SqlAdapter.Fill(Data) + UsuarioActual.ListaPersonalizacion = CargaPersonalizacionUsuario(UsuarioActual.CveUsuario) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar la personalización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Retorno = False + End Try + + Return Retorno + + End Function + +#End Region + #Region "IDisposable Support" Protected Overridable Sub Dispose(disposing As Boolean) If Not Me.disposedValue Then diff --git a/App_Code/Empresa.vb b/App_Code/Empresa.vb index 062318423..f851093dc 100644 --- a/App_Code/Empresa.vb +++ b/App_Code/Empresa.vb @@ -140,8 +140,9 @@ Public Class Empresa Public Property CveEncuestaCRM As Integer Public Property FielPassword As String - Public Property FielPFX As String - + Public Property FielPFX As String + Public Property AsuntoPlantillaMailVentaCotizacion As String + Public Property PlantillaMailVentaCotizacion As String Dim Funcionalidades As HybridDictionary 'HybridDictionary, no se puede serializar, por eso no es propiedad, y se utilizar el setfuncionalidad, para asignarle valor Public Sub SetFuncionalidades(HD As HybridDictionary) diff --git a/App_Code/LogicNominas.vb b/App_Code/LogicNominas.vb index 41d0f19e8..e05779805 100644 --- a/App_Code/LogicNominas.vb +++ b/App_Code/LogicNominas.vb @@ -204,11 +204,11 @@ Public Class LogicNominas Puesto = objPersonal.Puesto CveSATRiesgoPuesto = objPersonal.CveSATRiesgoPuesto.ToString() TipoPeriodoPago = objPersonal.TipoPeriodoPago - If Not MetodoPagoFijo Then - ClaveBanco = objPersonal.ClaveBanco - BancoNumCuenta = objPersonal.BancoNumCuenta + 'If Not MetodoPagoFijo Then + ' ClaveBanco = objPersonal.ClaveBanco + ' BancoNumCuenta = objPersonal.BancoNumCuenta - End If + 'End If SDI = objPersonal.SDI SalarioDiarioSS = objPersonal.SalarioDiarioSS ClaveEstado = objPersonal.ClaveEstado diff --git a/App_Code/Usuario.vb b/App_Code/Usuario.vb index dd88e9a40..4cc510cf0 100644 --- a/App_Code/Usuario.vb +++ b/App_Code/Usuario.vb @@ -47,7 +47,7 @@ Public Class Usuario Public Property NombreAbreviatura As String Public Property SessionId As String Private Property ListaSesion As Hashtable - Private Property ListaPersonalizacion As Hashtable + Public Property ListaPersonalizacion As Hashtable Public Property Acceso As Integer Public Property TipoControl As Integer diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb index ab0edc788..cd6da19c0 100644 --- a/Compras/ReembolsosComprobaciones.aspx.vb +++ b/Compras/ReembolsosComprobaciones.aspx.vb @@ -413,11 +413,13 @@ Partial Class Compras_ReembolsosComprobaciones Dim FechaFactura As Date = gvRowVal.DataKey("FechaCompra").ToDate Dim FechaDocumento As Date - If DDlCheques.SelectedValue.ToEntero = -1 Then + + If DDlCheques.SelectedValue.ToEntero = -1 And Not ChkReembolsarSinBancos.Checked Then FechaDocumento = TxtFechaDocumento.Text.ToDate Else FechaDocumento = TxtFechaPrePoliza.Text.ToDate End If + Dim AnioFactura As Integer = FechaFactura.Year Dim MesFactura As Integer = FechaFactura.Month Dim AnioDocumento As Integer = FechaDocumento.Year diff --git a/Empresas/Grales/Formatos/RepTraspasoAlmacen.rdlc b/Empresas/Grales/Formatos/RepTraspasoAlmacen.rdlc index 614ca69ca..37dd8f1c3 100644 --- a/Empresas/Grales/Formatos/RepTraspasoAlmacen.rdlc +++ b/Empresas/Grales/Formatos/RepTraspasoAlmacen.rdlc @@ -1,5 +1,5 @@  - + 0 @@ -65,6 +65,10 @@ Valor System.Decimal + + Disponible + System.Decimal + DataSet @@ -811,7 +815,6 @@ 2pt - true @@ -823,7 +826,7 @@ - =Fields!Cantidad.Value + =Fields!Disponible .Value + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Sistemas/Empresa2.aspx.vb b/Sistemas/Empresa2.aspx.vb new file mode 100644 index 000000000..a941c0174 --- /dev/null +++ b/Sistemas/Empresa2.aspx.vb @@ -0,0 +1,2066 @@ +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_Empresa2 + 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 + + + ConfiguracionEmpresa() + + 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 + TxtCveEmpresa.Text = .CveEmpresa.ToString + 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 + DdlTipoFacturacion.SelectedValue = .TipoFacturacion + '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 = .AsuntoPlantillaMailVentaCotizacion + TxtAsuntoCotizacion.Text = .PlantillaMailVentaCotizacion + + '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, DdlTipoFacturacion.SelectedItem.ToString, "-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, TxtCveEmpresa.Text.Trim.ToEntero, 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, + TxtImporte.Text.ToDecimal, TxtCIEC.Text, DdlPlataforma.SelectedValue.ToEntero, 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/Empresa.aspx?CveEmpresa=" & TxtCveEmpresa.Text.Trim & """;") + 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(TxtCveEmpresa.Text.Trim.ToEntero, CveFuncionalidad, Ddl.SelectedValue) Then + Retorno = "Ocurrió un error al vincular la cuenta contable" + End If + + Return Retorno + End Function + Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click + Dim ObjEmpresas As New ClsSisEmpresas + If ObjEmpresas.RemoveEmpresa(UsuarioActual.CveEmpresa) Then + GlobalDTEmpresas = ObjEmpresas.DtResultados + Alert("La Empresa se Eliminó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Sistemas/Empresa.aspx"";") + End If + ObjEmpresas.Dispose() + End Sub + + '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 "CONFIGURACION EMPRESA" + Private Sub ConfiguracionEmpresa() + If UsuarioActual.CveRol <> 1 Then + 'TabSistema.Visible = False + BtnCancelar.Visible = False + BtnEliminar.Visible = False + ' BiInform.Visible = False + End If + + End Sub +#End Region + + '#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("
PAso 1:
") + ' resultado.AppendLine(execCommand({"cd C:\Generar PFX\", String.Format("openssl.exe x509 -inform DER -in ""{0}"" -out ""{1}""", acer, pemcer)})) + ' resultado.AppendLine("
PAso 2:
") + ' 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("
Paso 3:
") + ' 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("
") + ' '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 :
-Contraseña
-Archivo CER
-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.
" & result.Descripcion) + Else + Alert("Ocurrió un error al registrar el emisor.
" & result.Descripcion & ".
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 diff --git a/Ventas/RepVentaDetalle.aspx b/Ventas/RepVentaDetalle.aspx index c6a069f88..8f57510c5 100644 --- a/Ventas/RepVentaDetalle.aspx +++ b/Ventas/RepVentaDetalle.aspx @@ -60,7 +60,8 @@ Excel Personalizado
  • - Personalizar Columnas + <%-- Personalizar Columnas--%> + Personalizar Columnas
  • Descarga PDFs @@ -332,178 +333,226 @@ + <%-- 0--%> + <%-- 1--%> + <%-- 2--%> + <%-- 3--%> + <%-- 4--%> + <%-- 5--%> + <%-- 6--%> + <%-- 7--%> + <%-- 8--%> + <%-- 9--%> + <%-- 10--%> + <%-- 11--%> + <%-- 12--%> + <%-- 13--%> + <%-- 14--%> + <%-- 15--%> + <%-- 16--%> + <%-- 17--%> + <%-- 18--%> + <%-- 19--%> + <%-- 20--%> + <%-- 21--%> + <%-- 22--%> + <%-- 23--%> + <%-- 24--%> + <%-- 25--%> + <%-- 26--%> + <%-- 27--%> + <%-- 28--%> + <%-- 29--%> + <%-- 30--%> + <%-- 31--%> + <%-- 32--%> + <%-- 33--%> + + <%-- 34--%> + + + + + + <%-- 35--%> + + + + + + @@ -576,102 +625,92 @@ - - - - - + + + - - - - - - + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + - - - - - + + + + - - - - - + + + + + + + + + + - - - - - - + + + + -
    - - - -
    - - - -
    - - - -
    -
    - - -
    - - - -
    - - - -
    - - - -
    - - - - &nbst
    + + + diff --git a/Ventas/RepVentaDetalle.aspx.vb b/Ventas/RepVentaDetalle.aspx.vb index 303f97a9a..e3c411985 100644 --- a/Ventas/RepVentaDetalle.aspx.vb +++ b/Ventas/RepVentaDetalle.aspx.vb @@ -28,6 +28,9 @@ Partial Class RepVentaDetalle End Property Private Property DtVentas As DataTable Get + If ViewState("DtVentas") Is Nothing Then + ViewState("DtVentas") = New DataTable + End If Return DirectCast(ViewState("DtVentas"), DataTable) End Get Set(value As DataTable) @@ -94,6 +97,20 @@ Partial Class RepVentaDetalle End Set End Property + + Public Property Primeracontsulta As Boolean + Get + If ViewState("Primeracontsulta") Is Nothing Then + ViewState("Primeracontsulta") = True + End If + Return Boolean.Parse(ViewState("Primeracontsulta").ToString) + + End Get + Set(value As Boolean) + ViewState("Primeracontsulta") = value + End Set + End Property + #End Region 'pRivate ReadOnly Property ColumnasVisibles As Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load @@ -111,6 +128,8 @@ Partial Class RepVentaDetalle DVServicioDomicilio.Visible = True End If + PrePersonalizacion() + CargaPersonalizacion() End If End Sub @@ -407,6 +426,16 @@ Partial Class RepVentaDetalle ImgImprimir.Enabled = True GvDatos.DataSource = AddRows(ObjVentas.DtResultados) GvVsh.DataSource = ObjVentas.DtResultados.FiltraParametros("CveVenta > 0") + + If DtVentas.SUMD("Descuento") <= 0 Then + GvDatos.Columns(5).Visible = False ' se oculta descuentos, si está vac+io + Else + If Primeracontsulta Then + GvDatos.Columns(5).Visible = True + ChkDescuento.Checked = True + End If + End If + Else GvDatos.DataSource = Nothing GvVsh.DataSource = Nothing @@ -416,8 +445,19 @@ Partial Class RepVentaDetalle If DtVentas IsNot Nothing AndAlso DtVentas.Rows.Count > 0 AndAlso DtVentas.SUMD("Descuento") <= 0 Then GvDatos.Columns(5).Visible = False ' se oculta descuentos, si está vac+io Agrupador = DdlGrupo.SelectedItem.Text - GvDatos.DataBind() + GvDatosDataBind() GvVsh.DataBind() + + Primeracontsulta = False + + End Sub + + Private Sub GvDatosDataBind() + + GvDatos.DataSource = DtVentas + GvDatos.DataBind() + UPDatos.Update() + End Sub #End Region @@ -526,8 +566,388 @@ Partial Class RepVentaDetalle #Region "PERSONALIZAR COLUMNAS" + Private Sub PrePersonalizacion() + + If UsuarioActual.Empresa.Funcionalidad(713) = "1" Then + ChkIEPS.Visible = True + Else + ChkIEPS.Visible = False + GvDatos.Columns(9).Visible = False + End If + End Sub + + Private Sub PersonalizaDefault() + + ChkTipoDocto.Checked = True + ChkFolio.Checked = True + ChkFecha.Checked = True + ChkSubTotal.Checked = True + + If DtVentas.Rows.Count > 0 AndAlso DtVentas.SUMD("Descuento") > 0 Then + ChkDescuento.Checked = True + End If + + ChkIVA.Checked = True + If UsuarioActual.Empresa.Funcionalidad(713) = "1" Then + ChkIEPS.Checked = True + End If + + ChkTotal.Checked = True + ChkMoneda.Checked = True + ChkSucursal.Checked = True + ChkEstatusFactura.Checked = True + ChkCliente.Checked = True + + End Sub + + Protected Sub LnkPersonalizar_Click(sender As Object, e As EventArgs) + + ChkGuardarPersonalizacion.Checked = False + RegistraScript("$('#DivPersonalizar').modal('show')") + + End Sub + Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click + If ChkGuardarPersonalizacion.Checked Then + GuardaPersonalizacion() + End If + + Personaliza() + GvDatosDataBind() + UPDatos.Update() + + End Sub + + Private Sub GuardaPersonalizacion() + + Dim objUsuario As New ClsSisUsuarios + Dim ListPersonalizada As New List(Of String) + + If ChkOrdenCompra.Checked Then + ListPersonalizada.Add("OrdenCompra") + End If + + If ChkFolio.Checked Then + ListPersonalizada.Add("Folio") + End If + + If ChkPedidoContrato.Checked Then + ListPersonalizada.Add("PedidoContrato") + End If + + + If ChkFolio.Checked Then + ListPersonalizada.Add("Folio") + End If + + If ChkFecha.Checked Then + ListPersonalizada.Add("Fecha") + End If + + If ChkCliente.Checked Then + ListPersonalizada.Add("Cliente") + End If + + If ChkSubTotal.Checked Then + ListPersonalizada.Add("SubTotal") + End If + + If ChkDescuento.Checked Then + ListPersonalizada.Add("Descuento") + End If + + If ChlMotivoDescuento.Checked Then + ListPersonalizada.Add("MotivoDescuento") + End If + + If ChkAmortizacion.Checked Then + ListPersonalizada.Add("Amortizacion") + End If + + If ChkIVA.Checked Then + ListPersonalizada.Add("IVA") + End If + + If ChkIEPS.Checked Then + ListPersonalizada.Add("IEPS") + End If + + If ChkRetIVA.Checked Then + ListPersonalizada.Add("RetIVA") + End If + + If ChkRetISR.Checked Then + ListPersonalizada.Add("RetISR") + End If + + If ChkTotalImpuestos.Checked Then + ListPersonalizada.Add("TotalImpuestos") + End If + + If ChkTotal.Checked Then + ListPersonalizada.Add("Total") + End If + + If ChkMoneda.Checked Then + ListPersonalizada.Add("Moneda") + End If + + If ChkSucursal.Checked Then + ListPersonalizada.Add("Sucursal") + End If + + If ChkSucursalEjecucion.Checked Then + ListPersonalizada.Add("SucursalEjecucion") + End If + + If ChkCodigo.Checked Then + ListPersonalizada.Add("Codigo") + End If + + If ChkSucursalCliente.Checked Then + ListPersonalizada.Add("SucursalCliente") + End If + + If ChkSucursalCobranza.Checked Then + ListPersonalizada.Add("SucursalCobranza") + End If + + If ChkVendedor.Checked Then + ListPersonalizada.Add("Vendedor") + End If + + If ChkEstatusFactura.Checked Then + ListPersonalizada.Add("EstatusFactura") + End If + + If ChkMotivoCancelacion.Checked Then + ListPersonalizada.Add("MotivoCancelacion") + End If + + If ChkSeTimbro.Checked Then + ListPersonalizada.Add("SeTimbro") + End If + + If ChkSeEnvioMail.Checked Then + ListPersonalizada.Add("SeEnvioMail") + End If + + If ChkCuentaContable.Checked Then + ListPersonalizada.Add("CuentaContable") + End If + + If ChkUsuario.Checked Then + ListPersonalizada.Add("Usuario") + End If + + If ChkObservaciones.Checked Then + ListPersonalizada.Add("Observaciones") + End If + + If ChkFolioFiscal.Checked Then + ListPersonalizada.Add("FolioFiscal") + End If + + If ChkMailCliente.Checked Then + ListPersonalizada.Add("MailCliente") + End If + + If ChkEstatusFacturacion.Checked Then + ListPersonalizada.Add("EstatusFacturacion") + End If + + If ChkFolioFacturacion.Checked Then + ListPersonalizada.Add("FolioFacturacion") + End If + + If ChkSaldo.Checked Then + ListPersonalizada.Add("Saldo") + End If + + If objUsuario.AddUsuariosPersonalizaciones(UsuarioActual, "RepVentaDetalles.aspx", String.Join("|", ListPersonalizada)) Then + 'Alert("Personalizacion guardada") + End If + + objUsuario.Dispose() + + End Sub + + + Private Sub CargaPersonalizacion() + + Dim strBasePersonalizacion As String = UsuarioActual.Personalizaciones("RepVentaDetalles.aspx") + + If strBasePersonalizacion.Trim.Length > 0 Then + + ChkTipoDocto.Checked = False + ChkOrdenCompra.Checked = False + ChkPedidoContrato.Checked = False + + ChkFolio.Checked = False + ChkFecha.Checked = False + ChkCliente.Checked = False + ChkSubTotal.Checked = False + ChkDescuento.Checked = False + ChlMotivoDescuento.Checked = False + ChkAmortizacion.Checked = False + ChkIVA.Checked = False + ChkIEPS.Checked = False + ChkRetIVA.Checked = False + ChkRetISR.Checked = False + ChkTotalImpuestos.Checked = False + ChkTotal.Checked = False + ChkMoneda.Checked = False + ChkSucursal.Checked = False + ChkSucursalEjecucion.Checked = False + ChkCodigo.Checked = False + ChkSucursalCliente.Checked = False + ChkSucursalCobranza.Checked = False + ChkSucursalEjecucion.Checked = False + ChkVendedor.Checked = False + ChkEstatusFactura.Checked = False + ChkMotivoCancelacion.Checked = False + ChkSeTimbro.Checked = False + ChkSeEnvioMail.Checked = False + ChkCuentaContable.Checked = False + ChkUsuario.Checked = False + ChkObservaciones.Checked = False + ChkFolioFiscal.Checked = False + ChkMailCliente.Checked = False + ChkEstatusFacturacion.Checked = False + ChkFolioFacturacion.Checked = False + ChkSaldo.Checked = False + + Dim Personalizaciones As String() = strBasePersonalizacion.Split("|"c) + + For Each personalizacion As String In Personalizaciones + Select Case personalizacion + Case "TipoDocto" + ChkTipoDocto.Checked = True + Exit Select + Case "OrdenCompra" + ChkOrdenCompra.Checked = True + Exit Select + Case "PedidoContrato" + ChkPedidoContrato.Checked = True + Exit Select + Case "Folio" + ChkFolio.Checked = True + Exit Select + Case "Fecha" + ChkFecha.Checked = True + Exit Select + Case "Cliente" + ChkCliente.Checked = True + Exit Select + Case "SubTotal" + ChkSubTotal.Checked = True + Exit Select + Case "Descuento" + ChkDescuento.Checked = True + Exit Select + Case "MotivoDescuento" + ChlMotivoDescuento.Checked = True + Exit Select + Case "Amortizacion" + ChkAmortizacion.Checked = True + Exit Select + Case "IVA" + ChkIVA.Checked = True + Exit Select + Case "IEPS" + ChkIEPS.Checked = True + Exit Select + Case "RetIVA" + ChkRetIVA.Checked = True + Exit Select + Case "RetISR" + ChkRetISR.Checked = True + Exit Select + Case "TotalImpuestos" + ChkTotalImpuestos.Checked = True + Exit Select + Case "Total" + ChkTotal.Checked = True + Exit Select + Case "Moneda" + ChkMoneda.Checked = True + Exit Select + Case "Sucursal" + ChkSucursal.Checked = True + Exit Select + Case "SucursalEjecucion" + ChkSucursalEjecucion.Checked = True + Exit Select + Case "Codigo" + ChkCodigo.Checked = True + Exit Select + Case "SucursalCliente" + ChkSucursalCliente.Checked = True + Exit Select + Case "SucursalCobranza" + ChkSucursalCobranza.Checked = True + Exit Select + Case "SucursalEjecucion" + ChkSucursalEjecucion.Checked = True + Exit Select + Case "Vendedor" + ChkVendedor.Checked = True + Exit Select + Case "EstatusFactura" + ChkEstatusFactura.Checked = True + Exit Select + Case "MotivoCancelacion" + ChkMotivoCancelacion.Checked = True + Exit Select + Case "SeTimbro" + ChkSeTimbro.Checked = True + Exit Select + Case "SeEnvioMail" + ChkSeEnvioMail.Checked = True + Exit Select + Case "CuentaContable" + ChkCuentaContable.Checked = True + Exit Select + Case "Usuario" + ChkUsuario.Checked = True + Exit Select + Case "Observaciones" + ChkObservaciones.Checked = True + Exit Select + Case "FolioFiscal" + ChkFolioFiscal.Checked = True + Exit Select + Case "MailCliente" + ChkMailCliente.Checked = True + Exit Select + Case "EstatusFacturacion" + ChkEstatusFacturacion.Checked = True + Exit Select + Case "FolioFacturacion" + ChkFolioFacturacion.Checked = True + Exit Select + Case "Saldo" + ChkSaldo.Checked = True + Exit Select + Case Else + Exit Select + End Select + Next + + Personaliza() + Else + PersonalizaDefault() + End If + + UPPersonalizar.Update() + + End Sub + + + Private Sub Personaliza() + + GvDatos.Columns(0).Visible = ChkTipoDocto.Checked GvDatos.Columns(1).Visible = ChkFolio.Checked GvDatos.Columns(2).Visible = ChkFecha.Checked GvDatos.Columns(3).Visible = ChkCliente.Checked @@ -561,6 +981,8 @@ Partial Class RepVentaDetalle GvDatos.Columns(31).Visible = ChkEstatusFacturacion.Checked GvDatos.Columns(32).Visible = ChkFolioFacturacion.Checked GvDatos.Columns(33).Visible = ChkSaldo.Checked + GvDatos.Columns(34).Visible = ChkOrdenCompra.Checked + GvDatos.Columns(35).Visible = ChkPedidoContrato.Checked Personalizo = 1 If Personalizo = 1 Then @@ -568,7 +990,7 @@ Partial Class RepVentaDetalle Else ImgExcelPersonalizado.Visible = False End If - UPDatos.Update() + End Sub #End Region @@ -871,4 +1293,6 @@ Partial Class RepVentaDetalle #End Region + + End Class diff --git a/Ventas/RepVentas.aspx b/Ventas/RepVentas.aspx index 4335aa294..05c643949 100644 --- a/Ventas/RepVentas.aspx +++ b/Ventas/RepVentas.aspx @@ -69,10 +69,19 @@ +
  • - Personalizar + Excel Personalizado +
  • + +
  • + Personalizar Columnas + <%-- Personalizar--%>
  • + + + @@ -344,34 +353,51 @@ + <%--0--%> + <%--1--%> + <%--2--%> + <%--3--%> + <%--4--%> - + <%--5--%> - + <%--6--%> + <%--7--%> + <%--8--%> + <%--9--%> + <%--10--%> + <%--11--%> + <%--12--%> + <%--13--%> + <%--14--%> + <%--15--%> + <%--16--%> + <%--17--%> + <%--18--%> @@ -397,46 +423,127 @@ - + - + + - + + - + + - + + - + + + - + + - + + - + + - + + - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ventas/RepVentas.aspx.vb b/Ventas/RepVentas.aspx.vb index 65a96a42d..bfcb41745 100644 --- a/Ventas/RepVentas.aspx.vb +++ b/Ventas/RepVentas.aspx.vb @@ -61,6 +61,9 @@ Partial Class Ventas_RepVentas End Property Private Property DtVentas As DataTable Get + If ViewState("DtVentas") Is Nothing Then + ViewState("DtVentas") = New DataTable + End If Return DirectCast(ViewState("DtVentas"), DataTable) End Get Set(value As DataTable) @@ -68,6 +71,28 @@ Partial Class Ventas_RepVentas End Set End Property + Private Property Personalizo As Integer + Get + Return ViewState("Personalizo").ToString.ToEntero + End Get + + Set(value As Integer) + ViewState("Personalizo") = value + End Set + End Property + + Public Property Primeracontsulta As Boolean + Get + If ViewState("Primeracontsulta") Is Nothing Then + ViewState("Primeracontsulta") = True + End If + Return Boolean.Parse(ViewState("Primeracontsulta").ToString) + + End Get + Set(value As Boolean) + ViewState("Primeracontsulta") = value + End Set + End Property #End Region @@ -76,7 +101,8 @@ Partial Class Ventas_RepVentas If Not IsPostBack Then If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx") TipoCambio = 1 - TCEspecifico = -1 + TCEspecifico = -1 + Personalizo = 0 CargaCombos() ConfiguraEmpresa() @@ -121,7 +147,10 @@ Partial Class Ventas_RepVentas DVServicioDomicilio.Visible = True DivLblDistr.Visible = True DivDistr.Visible = True - End If + End If + + PrePersonalizacion() + CargaPersonalizacion() End If @@ -254,12 +283,34 @@ Partial Class Ventas_RepVentas GvDatos.DataSource = Nothing End If - If DtVentas.SUMD("Descuento") <= 0 Then GvDatos.Columns(3).Visible = False ' se oculta descuentos, si está vac+io + If DtVentas.SUMD("Descuento") <= 0 Then + GvDatos.Columns(3).Visible = False ' se oculta descuentos, si está vac+io + 'ChkDescuentos.Visible = False + Else + If Primeracontsulta Then + GvDatos.Columns(3).Visible = True + ChkDescuentos.Checked = True + End If + End If + UPPersonalizar.Update() Agrupador = DdlGrupo.SelectedItem.Text CveProyecto = DdlProyecto.SelectedValue.ToEntero - ObjVentas.Dispose() - GvDatos.DataBind() + ObjVentas.Dispose() + + + GvDatosDataBind() + + + Primeracontsulta = False + End Sub + + Private Sub GvDatosDataBind() + + GvDatos.DataSource = DtVentas + GvDatos.DataBind() + UPDatos.Update() + End Sub #End Region @@ -474,25 +525,261 @@ Partial Class Ventas_RepVentas #End Region #Region " PERSONALIZAR " - Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) - Personaliza() + + + Private Sub PrePersonalizacion() + 'ChkDescuentos.Visible = False + If UsuarioActual.Empresa.Funcionalidad(713) = "1" Then + ChkIEPS.Visible = True + Else + ChkIEPS.Visible = False + GvDatos.Columns(7).Visible = False + End If + End Sub + + Protected Sub LnkPErsonalizar_Click(sender As Object, e As EventArgs) + ChkGuardarPersonalizacion.Checked = False + RegistraScript("$('#DivPersonalizar').modal('show')") + End Sub + Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) + + If ChkGuardarPersonalizacion.Checked Then + GuardaPersonalizacion() + End If + + Personaliza() + GvDatosDataBind() End Sub + Private Sub GuardaPersonalizacion() + + Dim objUsuario As New ClsSisUsuarios + Dim ListPersonalizada As New List(Of String) + + 'ChkCantidad.Checked = False + 'ChkSubtotal.Checked = False + 'ChkDescuentos.Checked = False + 'ChkIVA.Checked = False + 'ChkTotal.Checked = False + + If ChkCantidad.Checked Then + ListPersonalizada.Add("Cantidad") + End If + + If ChkSubtotal.Checked Then + ListPersonalizada.Add("Subtotal") + End If + + If ChkDescuentos.Checked Then + ListPersonalizada.Add("Descuentos") + End If + + If ChkIVA.Checked Then + ListPersonalizada.Add("IVA") + End If + + If ChkTotal.Checked Then + ListPersonalizada.Add("Total") + End If + + If ChkSubTotal2.Checked Then + ListPersonalizada.Add("SubTotal2") + End If + If ChkIEPS.Checked Then + ListPersonalizada.Add("IEPS") + End If + If ChkRetIVA.Checked Then + ListPersonalizada.Add("RetIVA") + End If + If ChkRetISR.Checked Then + ListPersonalizada.Add("RetISR") + End If + If ChkImpLoc.Checked Then + ListPersonalizada.Add("ImpLoc") + End If + If ChkMinSub.Checked Then + ListPersonalizada.Add("MinSub") + End If + If ChkAVGSub.Checked Then + ListPersonalizada.Add("AVGSub") + End If + If ChkMaxSub.Checked Then + ListPersonalizada.Add("MaxSub") + End If + If ChkMaxTot.Checked Then + ListPersonalizada.Add("MaxTot") + End If + If ChkAvgTot.Checked Then + ListPersonalizada.Add("AvgTot") + End If + If ChkMinTot.Checked Then + ListPersonalizada.Add("MinTot") + End If + If CheckRefacturado.Checked Then + ListPersonalizada.Add("CheckRefacturado") + End If + + If ChkCantidad.Checked Then + ListPersonalizada.Add("Cantidad") + End If + + + If objUsuario.AddUsuariosPersonalizaciones(UsuarioActual, "RepVentas.aspx", String.Join("|", ListPersonalizada)) Then + 'Alert("Personalizacion guardada") + End If + + objUsuario.Dispose() + + End Sub + + + Private Sub CargaPersonalizacion() + + + Dim strBasePersonalizacion As String = UsuarioActual.Personalizaciones("RepVentas.aspx") + + If strBasePersonalizacion.Trim.Length > 0 Then + + ChkCantidad.Checked = False + ChkSubtotal.Checked = False + ChkDescuentos.Checked = False + ChkIVA.Checked = False + ChkTotal.Checked = False + + ChkSubTotal2.Checked = False + ChkIEPS.Checked = False + ChkRetIVA.Checked = False + ChkRetISR.Checked = False + ChkImpLoc.Checked = False + ChkMinSub.Checked = False + ChkAVGSub.Checked = False + ChkMaxSub.Checked = False + ChkMaxTot.Checked = False + ChkAvgTot.Checked = False + ChkMinTot.Checked = False + CheckRefacturado.Checked = False + + Dim Personalizaciones As String() = strBasePersonalizacion.Split("|"c) + + For Each personalizacion As String In Personalizaciones + + Select Case personalizacion + + Case "Cantidad" + ChkCantidad.Checked = True + Exit Select + Case "Subtotal" + ChkSubtotal.Checked = True + Exit Select + Case "Descuentos" + ChkDescuentos.Checked = True + Exit Select + Case "IVA" + ChkIVA.Checked = True + Exit Select + Case "Total" + ChkTotal.Checked = True + Exit Select + Case "SubTotal2" + ChkSubTotal2.Checked = True + Exit Select + Case "IEPS" + ChkIEPS.Checked = True + Exit Select + Case "RetIVA" + ChkRetIVA.Checked = True + Exit Select + Case "RetISR" + ChkRetISR.Checked = True + Exit Select + Case "ImpLoc" + ChkImpLoc.Checked = True + Exit Select + Case "MinSub" + ChkMinSub.Checked = True + Exit Select + Case "AVGSub" + ChkAVGSub.Checked = True + Exit Select + Case "MaxSub" + ChkMaxSub.Checked = True + Exit Select + Case "MaxTot" + ChkMaxTot.Checked = True + Exit Select + Case "AvgTot" + ChkAvgTot.Checked = True + Exit Select + Case "MinTot" + ChkMinTot.Checked = True + Exit Select + Case "CheckRefacturado" + CheckRefacturado.Checked = True + Exit Select + Case Else + Exit Select + End Select + + Next + + + Personaliza() + Else + PersonalizaDefault() + End If + UPPersonalizar.Update() + + End Sub + + Private Sub PersonalizaDefault() + ChkCantidad.Checked = True + 'ChkSubtotal.Checked = True + + If DtVentas.Rows.Count > 0 AndAlso DtVentas.SUMD("Descuento") > 0 Then + ChkDescuentos.Checked = True + End If + + ChkSubTotal2.Checked = True + ChkIVA.Checked = True + If UsuarioActual.Empresa.Funcionalidad(713) = "1" Then + ChkIEPS.Checked = True + End If + 'ChkRetIVA.Checked = True + 'ChkRetISR.Checked = True + 'ChkImpLoc.Checked = True + ChkTotal.Checked = True + End Sub + Private Sub Personaliza() + + GvDatos.Columns(1).Visible = ChkCantidad.Checked + GvDatos.Columns(2).Visible = ChkSubtotal.Checked + GvDatos.Columns(3).Visible = ChkDescuentos.Checked + GvDatos.Columns(6).Visible = ChkIVA.Checked + GvDatos.Columns(11).Visible = ChkTotal.Checked + GvDatos.Columns(5).Visible = ChkSubTotal2.Checked GvDatos.Columns(7).Visible = ChkIEPS.Checked GvDatos.Columns(8).Visible = ChkRetIVA.Checked GvDatos.Columns(9).Visible = ChkRetISR.Checked GvDatos.Columns(10).Visible = ChkImpLoc.Checked - GvDatos.Columns(12).Visible = ChkMinSub.Checked + GvDatos.Columns(12).Visible = ChkMaxSub.Checked GvDatos.Columns(13).Visible = ChkAVGSub.Checked - GvDatos.Columns(14).Visible = ChkMaxSub.Checked + + GvDatos.Columns(14).Visible = ChkMinSub.Checked + GvDatos.Columns(15).Visible = ChkMaxTot.Checked GvDatos.Columns(16).Visible = ChkAvgTot.Checked GvDatos.Columns(17).Visible = ChkMinTot.Checked GvDatos.Columns(18).Visible = CheckRefacturado.Checked + Personalizo = 1 + If Personalizo = 1 Then + ImgExcelPersonalizado.Visible = True + Else + ImgExcelPersonalizado.Visible = False + End If UPDatos.Update() End Sub @@ -510,7 +797,7 @@ Partial Class Ventas_RepVentas Private Sub GenerarPDF(Optional Formato As String = "PDF") If DtVentas IsNot Nothing Then Dim StrFiltro As New StringBuilder - StrFiltro.AppendFormat(" Agrupado por: {0}", DdlGrupo.SelectedItem.Text) + StrFiltro.AppendFormat(" Agrupado por: {0}", DdlGrupo.SelectedItem.Text) Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepVentas.rdlc", UsuarioActual.Empresa.Ruta)) Dim ruta As String = "" @@ -743,5 +1030,13 @@ Partial Class Ventas_RepVentas End Sub + Protected Sub ImgExcelPersonalizado_Click(sender As Object, e As EventArgs) Handles ImgExcelPersonalizado.Click + 'GvVsh.Visible = True + 'GvVsh.ExportToExcel("DetalleVentas_" & Now.ToShortDateString) + 'GvVsh.Visible = False + GvDatos.ExportToExcel("Ventas_" & Now.ToShortDateString & ".xls") + 'GvDatos.ExportToExcelG("DetalleVentas_" & Now.ToShortDateString & ".xlsx") + End Sub + End Class