diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb index 8de6639ec..4c37e7adf 100644 --- a/App_Code/CFDITimbre.vb +++ b/App_Code/CFDITimbre.vb @@ -241,7 +241,7 @@ Public Class CFDIComprobante Public Property MetodoPago As String = "" Public Property Exportacion As String = "01" '01-No Aplica Public Property LugarExpedicion As String = "" - Public Property NumCuentaPago As String = "" + 'Public Property NumCuentaPago As String = "" Public Property Confirmacion As String = "" End Class @@ -305,7 +305,7 @@ Public Class CFDINominaReceptor Public Property Departamento As String = "" Public Property Puesto As String = "" Public Property CodigoRiesgoPuesto As String = "" - Public Property TipoPeriodo As String = "" + Public Property PeriodicidadPago As String = "" Public Property CodigoBanco As String = "" Public Property NumeroCuenta As String = "" Public Property SDI As Decimal = 0 diff --git a/App_Code/ClsContPAQi.vb b/App_Code/ClsContPAQi.vb index 818c0babc..f0169db98 100644 --- a/App_Code/ClsContPAQi.vb +++ b/App_Code/ClsContPAQi.vb @@ -3374,8 +3374,8 @@ Public Class ClsContPAQi StrSQL.Append(" ELSE 'Otras' ") StrSQL.Append(" END AS Clasificacion, CAST (C.Id AS varCHAR(10)) + '||' + C.Nombre AS IdNombre, CASE WHEN ISNUMERIC (C.Codigo) = 1 THEN FORMAT (CAST (C.Codigo AS DECIMAL(35,0)),REPLACE (Mascarilla, 'X', '0') ) ELSE C.Codigo END CuentaFormato, ") StrSQL.Append(" CFad.Id AS IdPadre, CFad.Codigo AS CodigoPadre, CFad.Nombre AS NombrePadre, CASE WHEN ISNUMERIC (C.Codigo) = 1 THEN FORMAT (CAST (C.Codigo AS DECIMAL(35,0)), REPLACE (Mascarilla, 'X', '0') ) ELSE C.Codigo END + ' - ' + C.Nombre + ' ' + CASE WHEN C.Afectable = 1 THEN '(Afec)' ELSE '(No Afect)' END AS CtaCodigoPadre ") - StrSQL.Append(" , CASE WHEN CtaSup IN ('_ACTIVO','_BPASIVO','_CAPITAL','_UTILIDAD','_RACREEDOR','_RDEUDOR','_CUADRE','_ORDEN') ") - StrSQL.Append(" AND NOT SubCtade IN ('_ACTIVO','_BPASIVO','_CAPITAL','_UTILIDAD','_RACREEDOR','_RDEUDOR','_CUADRE') THEN 1 ELSE 0 END AS CtaInicial,") + StrSQL.Append(" , CASE WHEN CtaSup IN ('_ACTIVO','_BPASIVO','_PASIVO','_CAPITAL','_UTILIDAD','_RACREEDOR','_RDEUDOR','_CUADRE','_ORDEN') ") + StrSQL.Append(" AND NOT SubCtade IN ('_ACTIVO','_BPASIVO','_PASIVO','_CAPITAL','_UTILIDAD','_RACREEDOR','_RDEUDOR','_CUADRE') THEN 1 ELSE 0 END AS CtaInicial,") StrSQL.Append(" E.Nivel, E.Orden") StrSQL.Append(" FROM Estructura E") StrSQL.Append(" INNER JOIN Cuentas C ON C.Id = E.IdSubCtade ") diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 5baf8f444..101f4b302 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -1537,7 +1537,7 @@ Public Class ClsMovimientos Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, Optional CveClienteClasificacion As Integer = -1, Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = MinFecha, Optional FechaAplicadoF As Date = MaxFecha, Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha, - Optional CveCondicionesPago As Integer = -1, Optional CveTipoTransaccion As Integer = -1) As Boolean + Optional CveCondicionesPago As Integer = -1, Optional CveTipoTransaccion As Integer = -1, Optional CveMoneda As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_RepRecuperacion") With SqlAdapter.SelectCommand.Parameters @@ -1569,6 +1569,7 @@ Public Class ClsMovimientos .Add("@FechaRegistroIEI", SqlDbType.Date).Value = FechaRegistroIEI.ToShortDateString .Add("@FechaRegistroIEF", SqlDbType.Date).Value = FechaRegistroIEF.ToShortDateString + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 46f8dd8db..3ad022eb2 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -6873,26 +6873,26 @@ Public Class ClsPaginas RptParametro.Add(New ReportParameter("Puesto", Puesto)) 'DATOS NOMINA If ObjNomina.GetNom_Nominas(CveNomina, CvePersonal, CvePeriodo, 1, CveEmpresa) Then - RptParametro.Add(New ReportParameter("ReciboNomina", ObjNomina.Folio.ToString)) - RptParametro.Add(New ReportParameter("Serie", ObjNomina.Serie)) - RptParametro.Add(New ReportParameter("Fecha", ObjNomina.Fecha.ToString)) - RptParametro.Add(New ReportParameter("Periodo", ObjNomina.TipoPeriodo)) - RptParametro.Add(New ReportParameter("DiasPagados", ObjNomina.DiasPagados.ToString)) - RptParametro.Add(New ReportParameter("MetodoPago", ObjNomina.MetodoPago)) '"""PUE"" (Pago en una sola exhibición)" - RptParametro.Add(New ReportParameter("FormaPago", """99"" (Por definir)")) - RptParametro.Add(New ReportParameter("Cantidad", "1")) - RptParametro.Add(New ReportParameter("Unidad", "ACT")) - RptParametro.Add(New ReportParameter("Descripcion", "PAGO DE NÓMINA")) - RptParametro.Add(New ReportParameter("Total", If(indemnizacion, ajusteindemnizacion, ObjNomina.Total - ajusteindemnizacion).ToString())) - Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - cQr = CBB.GenerarCBBBytes(UsuarioActual.Empresa.RFC, ObjPersonal.RFC, ObjNomina.Total.ToString().ToDecimal(), FolioFiscal) - RptParametro.Add(New ReportParameter("ImporteLetra", ObjNomina.Total.ToString.ToDouble.Texto2Letras)) - RptParametro.Add(New ReportParameter("Clave", "84111505")) - Else - TieneError = True - End If + RptParametro.Add(New ReportParameter("ReciboNomina", ObjNomina.Folio.ToString)) + RptParametro.Add(New ReportParameter("Serie", ObjNomina.Serie)) + RptParametro.Add(New ReportParameter("Fecha", ObjNomina.Fecha.ToString)) + RptParametro.Add(New ReportParameter("Periodo", ObjNomina.TipoPeriodo)) + RptParametro.Add(New ReportParameter("DiasPagados", ObjNomina.DiasPagados.ToString)) + RptParametro.Add(New ReportParameter("MetodoPago", ObjNomina.MetodoPago)) '"""PUE"" (Pago en una sola exhibición)" + RptParametro.Add(New ReportParameter("FormaPago", """99"" (Por definir)")) + RptParametro.Add(New ReportParameter("Cantidad", "1")) + RptParametro.Add(New ReportParameter("Unidad", "ACT")) + RptParametro.Add(New ReportParameter("Descripcion", "PAGO DE NÓMINA")) + RptParametro.Add(New ReportParameter("Total", If(indemnizacion, ajusteindemnizacion, ObjNomina.Total - ajusteindemnizacion).ToString())) + Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() + cQr = CBB.GenerarCBBBytes(UsuarioActual.Empresa.RFC, ObjPersonal.RFC, ObjNomina.Total.ToString().ToDecimal(), FolioFiscal) + RptParametro.Add(New ReportParameter("ImporteLetra", ObjNomina.Total.ToString.ToDouble.Texto2Letras)) + RptParametro.Add(New ReportParameter("Clave", "84111505")) Else TieneError = True + End If + Else + TieneError = True End If If Not TieneError Then If ObjNomina.GetPeriodos(-1, CveEmpresa, -1, -1, CvePeriodo) Then @@ -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) @@ -9325,7 +9326,15 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/RepCancelacionesVentas.aspx".ToUpper(), 1325) PaginaDict.Add("/Ventas/RepLineasAdicionales.aspx".ToUpper(), 1331) PaginaDict.Add("/Ventas/RepLineasAdicionales.aspx?OP=OP".ToUpper(), 1332) + PaginaDict.Add("/Ventas/FacturacionAcarreos.aspx".ToUpper(), 774) + + + PaginaDict.Add("/Ventas/RepIndicadoresPorProyecto.aspx".ToUpper(), 617) + + + + #End Region #Region "Varios" 'Portal Cliente/Proveedor 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/ClsSisMail.vb b/App_Code/ClsSisMail.vb index 232d38e36..6bdb5ef93 100644 --- a/App_Code/ClsSisMail.vb +++ b/App_Code/ClsSisMail.vb @@ -33,7 +33,7 @@ Public Class ClsSisMail Return Resultado End Function - Public Function SendMail(ObjEmpresa As Empresa, Para As String, Asunto As String, Body As String, Optional CCP As String = "", Optional Archivos As List(Of ArchivoMail) = Nothing, Optional Displayname As String = "") As Boolean + Public Function SendMail(ObjEmpresa As Empresa, Para As String, Asunto As String, Body As String, Optional CCP As String = "", Optional Archivos As List(Of ArchivoMail) = Nothing, Optional Displayname As String = "", Optional CCO As String = "") As Boolean Dim ObjMail As New Mail ObjMail.ObjEmpresa = ObjEmpresa ObjMail.De = If(Displayname.Trim = String.Empty, "", Displayname) @@ -41,6 +41,7 @@ Public Class ClsSisMail ObjMail.CCP = CCP ObjMail.Asunto = Asunto ObjMail.Body = Body + ObjMail.CCO = CCO If Archivos IsNot Nothing AndAlso Archivos.Count > 0 Then ' si tiene adjuntos, me crea el objeto ObjMail.Archivos = New List(Of ArchivoMail) @@ -85,6 +86,7 @@ Public Class ClsSisMail Dim Mensaje As String = String.Empty Dim ArrayPara() As String = ObjMail.Para.Replace(",", ";").Split(";"c) Dim ArrayCCP() As String = ObjMail.CCP.Replace(",", ";").Split(";"c) + Dim ArrayBCC() As String = ObjMail.CCO.Replace(",", ";").Split(";"c) '"sgd.facturacion@adsistemas.mx" If ObjMail.De = String.Empty Then @@ -103,6 +105,12 @@ Public Class ClsSisMail For Each CorreoCCPPara As String In ArrayCCP.Distinct If IsMail(CorreoCCPPara.Trim) Then Correo.To.Add(CorreoCCPPara.Trim) Next + End If + + If ArrayBCC IsNot Nothing AndAlso ArrayBCC.Length > 0 Then + For Each CorreoCCOPara As String In ArrayBCC.Distinct + If IsMail(CorreoCCOPara.Trim) Then Correo.Bcc.Add(CorreoCCOPara.Trim) + Next End If Correo.Subject = ObjMail.Asunto @@ -120,7 +128,6 @@ Public Class ClsSisMail Correo.Body = Mensaje & ObjMail.Body Correo.IsBodyHtml = True Correo.Priority = Net.Mail.MailPriority.Normal - If ObjMail.Archivos IsNot Nothing Then For Each Item As ArchivoMail In ObjMail.Archivos If Item.ArchivoBinario IsNot Nothing Then @@ -190,6 +197,7 @@ Public Class ClsSisMail Public Property Para As String Public Property Asunto As String Public Property CCP As String + Public Property CCO As String Public Property Body As String Public Property Archivos As List(Of ArchivoMail) End Class 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/ClsVentas.vb b/App_Code/ClsVentas.vb index 0ecf1a268..fd66b4b7e 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -5850,7 +5850,7 @@ Public Class ClsVentas .Add("@CamionRemolque2", SqlDbType.VarChar).Value = CamionRemolque2 .Add("@Distancia", SqlDbType.Decimal).Value = Distancia .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@ErrorMSG", SqlDbType.VarChar, 300).Direction = ParameterDirection.Output + .Add("@ErrorMSG", SqlDbType.VarChar, 5000).Direction = ParameterDirection.Output End With Try 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 30212760e..57ddbf5e6 100644 --- a/App_Code/LogicNominas.vb +++ b/App_Code/LogicNominas.vb @@ -137,7 +137,7 @@ Public Class LogicNominas Dim Departamento As String = "" Dim Puesto As String = "" Dim CveSATRiesgoPuesto As String = "" - Dim TipoPeriodoPago As String = "" + Dim PeriodicidadPago As String = "" Dim ClaveBanco As String = "" Dim BancoNumCuenta As String = "" Dim SDI As Decimal = 0 @@ -203,17 +203,16 @@ Public Class LogicNominas Departamento = objPersonal.Departamento Puesto = objPersonal.Puesto CveSATRiesgoPuesto = objPersonal.CveSATRiesgoPuesto.ToString() - TipoPeriodoPago = objPersonal.TipoPeriodoPago - If Not MetodoPagoFijo Then - ClaveBanco = objPersonal.ClaveBanco - BancoNumCuenta = objPersonal.BancoNumCuenta - End If + 'If Not MetodoPagoFijo Then + ' ClaveBanco = objPersonal.ClaveBanco + ' BancoNumCuenta = objPersonal.BancoNumCuenta + + 'End If SDI = objPersonal.SDI SalarioDiarioSS = objPersonal.SalarioDiarioSS ClaveEstado = objPersonal.ClaveEstado - AntiguedadSemanas = DateDiff(DateInterval.Weekday, objPersonal.FechaIngreso, Now).ToEntero() FormatoReciboCFDi = objPersonal.FormatoReciboCFDi Else If continuar Then GetError = "No se pudo obtener la información del empleado" 'si continuar= true el error se origino en este nodo y le asigno el error @@ -266,6 +265,8 @@ Public Class LogicNominas FechaFin = DrPeriodo("FechaFin").ToString().ToDate() FechaPago = DrPeriodo("FechaPago").ToString().ToDate() + PeriodicidadPago = DrPeriodo("ClavePerioricidadPago").ToString() + AntiguedadSemanas = DateDiff(DateInterval.Weekday, objPersonal.FechaIngreso, FechaFin).ToEntero() If Not TimbreIndemnizacion Then FechaInicio = DrPeriodo("FechaInicio").ToString().ToDate() @@ -474,7 +475,7 @@ Public Class LogicNominas cfdi.Comprobante.CondicionesdePago = "" '"CONTADO" cfdi.Comprobante.FormadePago = If(versionTimbre = VersionTimbradoEnum.Version4_0, "", "99") cfdi.Comprobante.LugarExpedicion = UsuarioActual.Empresa.CP.ToString() ' AHORITA SOLO SE REQUIERE ESPECIFICAR EL CODIGO POSTAL - cfdi.Comprobante.NumCuentaPago = "" 'objPersonal.BancoNumCuenta + 'cfdi.Comprobante.NumCuentaPago = "" 'objPersonal.BancoNumCuenta '4.0 cfdi.Receptor.DomicilioFiscalReceptor = CodigoPostal cfdi.Receptor.RegimenFiscalReceptor = "605" @@ -491,7 +492,7 @@ Public Class LogicNominas cfdi.Nomina.Receptor.Departamento = Departamento cfdi.Nomina.Receptor.Puesto = Puesto cfdi.Nomina.Receptor.CodigoRiesgoPuesto = CveSATRiesgoPuesto.ToString() - cfdi.Nomina.Receptor.TipoPeriodo = TipoPeriodoPago + cfdi.Nomina.Receptor.PeriodicidadPago = PeriodicidadPago cfdi.Nomina.Receptor.CodigoBanco = ClaveBanco cfdi.Nomina.Receptor.NumeroCuenta = BancoNumCuenta cfdi.Nomina.Receptor.SDI = SDI diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index fd0e8afac..2b83f2fa6 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -516,7 +516,7 @@ Public Class Timbrado Dim UrlServicio As String = "http://generacfdi.com.mx/rvltimbrado/service1.asmx?WSDL" Dim AmbienteProductivo As Boolean = True - If Not Empresa.FacturaProduccion OrElse Empresa.CveEmpresa = 1 Then + If Not Empresa.FacturaProduccion OrElse Empresa.CveEmpresa = 1 OrElse Not ClsPaginas.EsProduccion Then UsuarioServicio = "fgomez" ClaveServicio = "12121212" Clave = "12345678a" @@ -713,12 +713,15 @@ Public Class Timbrado Dim UsuarioServicio As String = "rene.molina@adssistemas.mx" Dim ClaveServicio As String = "Facturacion2021#" - If Not Empresa.FacturaProduccion OrElse Empresa.CveEmpresa = 1 Then - EmisorRFC = "ZUÑ920208KL4" - ArchivoLLave = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key" - ArchivoCertificado = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.cer" + If Not Empresa.FacturaProduccion OrElse Empresa.CveEmpresa = 1 OrElse Not ClsPaginas.EsProduccion Then + EmisorRFC = "EKU9003173C9" + ArchivoLLave = $"{Extensiones.ModExtensiones.DirectorioEmpresas}1\Certificados\EKU9003173C9.key" + ArchivoCertificado = $"{Extensiones.ModExtensiones.DirectorioEmpresas}1\Certificados\EKU9003173C9.cer" + Clave = "12345678a" TimbraProduccion = False + UsuarioServicio = "UserTest" + ClaveServicio = "1234567890" End If Dim llaveByte As Byte(), certByte As Byte() @@ -1325,7 +1328,7 @@ Public Class Timbrado If Not Directory.Exists(RutaArchivo) Then Directory.CreateDirectory(RutaArchivo) - If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then + If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 OrElse Not ClsPaginas.EsProduccion Then AmbienteProductivo = False Clave = "12345678a" EmisorRFC = "EKU9003173C9" @@ -1362,7 +1365,7 @@ Public Class Timbrado Dim cfdi As New Profact.TimbraCFDI40.Conector(AmbienteProductivo) Dim comprobante As New Profact.TimbraCFDI40.Comprobante() - If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then + If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 OrElse Not ClsPaginas.EsProduccion Then cfdi.EstableceCredenciales("mvpNUXmQfK8=") Else cfdi.EstableceCredenciales($"vSGxMFWnNRy/nDoowxqrqw==|Sia123654") @@ -2326,8 +2329,8 @@ Public Class Timbrado Nom.Receptor.Puesto = ObjCFDITimbre.Nomina.Receptor.Puesto Nom.Receptor.RiesgoPuestoSpecified = True Nom.Receptor.RiesgoPuesto = ObjCFDITimbre.Nomina.Receptor.CodigoRiesgoPuesto - Nom.Receptor.PeriodicidadPago = ObjCFDITimbre.Nomina.Receptor.TipoPeriodo - If ObjCFDITimbre.Nomina.Receptor.CodigoBanco <> "" Then + Nom.Receptor.PeriodicidadPago = ObjCFDITimbre.Nomina.Receptor.PeriodicidadPago + If ObjCFDITimbre.Nomina.Receptor.CodigoBanco <> "" AndAlso ObjCFDITimbre.Nomina.Receptor.NumeroCuenta <> "" Then Nom.Receptor.BancoSpecified = True Nom.Receptor.Banco = ObjCFDITimbre.Nomina.Receptor.CodigoBanco Nom.Receptor.CuentaBancaria = ObjCFDITimbre.Nomina.Receptor.NumeroCuenta @@ -2403,30 +2406,62 @@ Public Class Timbrado FolioFiscal = resultadoTimbre.FolioUUID If FolioFiscal <> "" Then resultadoTimbre.GuardaXml(RutaArchivo, NombreArchivoXML) + '---------------------- - If ObjCFDITimbre.Comprobante.TipoComprobante <> "P" Then + Select Case ObjCFDITimbre.Comprobante.TipoComprobante + Case "N" + Using ObjNomina2 As New ClsNominas() - 'Actualiza Estatus Factura - If Ventas.CveVenta > 0 Then + If ObjNomina2.UpdateEstatusNomNominas(3, UsuarioActual.Empresa.CvePAC, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0, isFiniquito:=Ventas.Timbre.IStimbreFiniquito) Then + Retorno = "" + Else + Retorno = "Error" + End If + End Using - - Dim ObjVentas As New ClsVentas() - If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", Now, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC, RFCReceptor:=ObjCFDITimbre.Receptor.RFC, CFDIVersion:="4.0") Then + Case "T" + Dim objGrales As New ClsGenerales + If objGrales.UpdateTimbreTimbrado(Ventas.CveTimbre, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.CvePAC, "4.0") Then Retorno = "" Else Retorno = "Error" End If - ObjVentas.Dispose() + objGrales.Dispose() + Using ObjInv As New ClsInventarios() + If ObjInv.UpdateMovimientoTimbrado(Ventas.Inv_CveMovimiento, 1, FolioFiscal, MinFecha) Then + Retorno = "" + Else + Retorno = "Error" + End If + End Using + Case Else - ''Actualiza Cliente (NumeroCuenta) - 'If Not UsuarioActual.CveEmpresa.Contiene(72, 80) Then - ' Dim Hilo2 As New System.Threading.Thread(Sub() ActualizaCliente(UsuarioActual.CveUsuario, Ventas.Cliente.NumCtaPago, Ventas.CveMetodoPago, Ventas.CveCliente)) - ' Hilo2.Start() - 'End If + 'Actualiza Estatus Factura + If Ventas.CveVenta > 0 Then - End If - End If + Using ObjVentas As New ClsVentas() + + If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC, RFCReceptor:=ObjCFDITimbre.Receptor.RFC, CFDIVersion:="4.0") Then + Retorno = "" + Else + Retorno = "Error" + End If + End Using + + 'Genero la addenda Ford + If Ventas.Cliente.Ford_GSDB <> "" Then + + Dim RutaCadena As String = String.Format("{0}{1}.xml", RutaArchivo, NombreArchivoXML) 'If(UsuarioActual.Empresa.FacturaProduccion, String.Format("{0}XML\{1}\{2}.xml", Ruta, Ventas.SerieFolio), String.Format("{0}XML\{1}\{2}.xml", Ruta, Ventas.TipoDocto, Ventas.SerieFolio)) + + Dim FolioFactura As String = "" + If UsuarioActual.CveEmpresa = 8 Then FolioFactura = Ventas.Folio.ToString ' sogo, pordefault manda el folio de la factura + GeneraAddendaFord(RutaCadena, FolioFactura, Ventas.FordASN, Ventas.FordGSDB) + + End If + End If + End Select + '---------------------- If Not IO.Directory.Exists($"{UsuarioActual.Empresa.Ruta}CBB\") Then IO.Directory.CreateDirectory($"{UsuarioActual.Empresa.Ruta}CBB\") @@ -2445,25 +2480,6 @@ Public Class Timbrado End If - If ObjCFDITimbre.Comprobante.TipoComprobante = "T" Then - Dim objGrales As New ClsGenerales - If objGrales.UpdateTimbreTimbrado(Ventas.CveTimbre, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.CvePAC, "4.0") Then - Retorno = "" - Else - Retorno = "Error" - End If - objGrales.Dispose() - - Using ObjInv As New ClsInventarios() - If ObjInv.UpdateMovimientoTimbrado(Ventas.Inv_CveMovimiento, 1, FolioFiscal, MinFecha) Then - Retorno = "" - Else - Retorno = "Error" - End If - End Using - - End If - 'Pendiente. Ruta guardar archivos sw.Stop() swTiempo.AppendFormat("Actualizado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds) @@ -2950,7 +2966,7 @@ Public Class Timbrado ObjCFDITimbre.Nomina.Receptor.Departamento, ObjCFDITimbre.Nomina.Receptor.Puesto, ObjCFDITimbre.Nomina.Receptor.CodigoRiesgoPuesto, - If(ObjCFDITimbre.Nomina.TipoNomina = "E", "99", ObjCFDITimbre.Nomina.Receptor.TipoPeriodo), + ObjCFDITimbre.Nomina.Receptor.PeriodicidadPago, ObjCFDITimbre.Nomina.Receptor.CodigoBanco, ObjCFDITimbre.Nomina.Receptor.NumeroCuenta, ObjCFDITimbre.Nomina.Receptor.SBC, @@ -3075,18 +3091,18 @@ Public Class Timbrado UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL" - If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then + If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 OrElse Not ClsPaginas.EsProduccion Then EmisorRFC = "EKU9003173C9" UsuarioActual.Empresa.Empresa = "ESCUELA KEMPER URGATE" - ArchivoLLave = $"{UsuarioActual.Empresa.Ruta}Certificados\EKU9003173C9.key" - ArchivoCertificado = $"{UsuarioActual.Empresa.Ruta}Certificados\EKU9003173C9.cer" + ArchivoLLave = $"{Extensiones.ModExtensiones.DirectorioEmpresas}1\Certificados\EKU9003173C9.key" + ArchivoCertificado = $"{Extensiones.ModExtensiones.DirectorioEmpresas}1\Certificados\EKU9003173C9.cer" Clave = "12345678a" TimbraProduccion = False UsuarioServicio = "UserTest" ClaveServicio = "1234567890" - + UsuarioActual.Empresa.CodigoRegimenFiscal = "601" End If #Region "Valida" @@ -3298,15 +3314,18 @@ Public Class Timbrado If Not Directory.Exists(RutaArchivo) Then Directory.CreateDirectory(RutaArchivo) - If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then + If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 OrElse Not ClsPaginas.EsProduccion Then EmisorRFC = "EKU9003173C9" UsuarioActual.Empresa.Empresa = "ESCUELA KEMPER URGATE" - ArchivoLLave = $"{UsuarioActual.Empresa.Ruta}Certificados\EKU9003173C9.key" - ArchivoCertificado = $"{UsuarioActual.Empresa.Ruta}Certificados\EKU9003173C9.cer" + ArchivoLLave = $"{Extensiones.ModExtensiones.DirectorioEmpresas}1\Certificados\EKU9003173C9.key" + ArchivoCertificado = $"{Extensiones.ModExtensiones.DirectorioEmpresas}1\Certificados\EKU9003173C9.cer" Clave = "12345678a" TimbraProduccion = False + UsuarioServicio = "UserTest" + ClaveServicio = "1234567890" + End If #Region "Valida" diff --git a/App_Code/Usuario.vb b/App_Code/Usuario.vb index f7601a29b..4cc510cf0 100644 --- a/App_Code/Usuario.vb +++ b/App_Code/Usuario.vb @@ -46,7 +46,8 @@ Public Class Usuario Public Property ModoSimulacion As Boolean = False Public Property NombreAbreviatura As String Public Property SessionId As String - Private Property ListaSesion As Hashtable + Private Property ListaSesion As Hashtable + Public Property ListaPersonalizacion As Hashtable Public Property Acceso As Integer Public Property TipoControl As Integer @@ -100,6 +101,18 @@ Public Class Usuario End Set End Property + Public Property Personalizaciones(NombrePersonalizacion As String) As String + Get + If ListaPersonalizacion Is Nothing Then ListaPersonalizacion = New Hashtable + Personalizaciones = If(ListaPersonalizacion.Item(NombrePersonalizacion) IsNot Nothing, ListaPersonalizacion.Item(NombrePersonalizacion).ToString, "") + End Get + Set(value As String) + If ListaPersonalizacion Is Nothing Then ListaPersonalizacion = New Hashtable + 'Sino existe el valor, se crea. + If ListaPersonalizacion.Item(NombrePersonalizacion) IsNot Nothing Then ListaPersonalizacion.Item(NombrePersonalizacion) = value Else ListaPersonalizacion.Add(NombrePersonalizacion, value) + + End Set + End Property #End Region diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index 9e87ebed5..7428ce2a6 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -130,7 +130,7 @@ Public Class E141 : Implements IHttpHandler End If Catch ex As Exception - GuardaLogAD("Ocurrió un error al descargar el pdf. " + ex.ToString() + ".parametros: " + Params, "LogE141") + GuardaLogAD("Ocurrió un error al descargar el pdf. " + ex.ToString() + ".parametros: " + Params, "LogE141Descargas") End Try Else @@ -250,6 +250,16 @@ Public Class E141 : Implements IHttpHandler Else retorno = "False" End If + Case "EnviarCorreoAltasSemanal" + GuardaLogAD("CA-Inicia envio de correo semanal", "LogE141") + respuesta = EnviarCorreoActualizarProductos() + GuardaLogAD("CA-Finaliza envio de correo semanal", "LogE141") + If respuesta Then + retorno = "True" + Else + retorno = "False" + End If + End Select End If @@ -268,6 +278,27 @@ Public Class E141 : Implements IHttpHandler End Try End Sub + Private Sub EnviarCorreoNotificacion(TareaNotificar As String, Cuerpo As String) + Dim ResultadoMail As Integer = 0 + Dim CorreoDestino As String = "atencion@fidelityapps.mx" + Dim MailCC As String = "citas@econollantas.com;sixrogs@hotmail.com;ffelix@econollantas.com" + Dim MailCCO As String = "jonathan.perez@adssistemas.mx;rene.molina@adsistemas.mx" + + If Not EsProduccion Then + CorreoDestino = "jonathan.perez@adssistemas.mx" + MailCC = "rene.molina@adsistemas.mx" + MailCCO = "japmx95@gmail.com" + End If + + Dim ObjMail As New ClsSisMail + If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, CorreoDestino, TareaNotificar, Cuerpo, CCP:=MailCC, CCO:=MailCCO) Then + GuardaLogAD($"EC-Envio de correo exitoso. Tarea: {TareaNotificar}", "LogE141") + Else + GuardaLogAD($"EC-No se pudo enviar el correo. Tarea: {TareaNotificar}", "LogE141") + End If + + End Sub + Private Function ValidarSolicitud(ByVal context As HttpContext) As AuthMessage Dim unauthorized As Boolean = True Dim respuesta As New AuthMessage @@ -1729,6 +1760,38 @@ Public Class E141 : Implements IHttpHandler 'End Function #Region "C R E A C I Ó N / A C T U A L I Z A C I Ó N - P R O D U C T O S" + Private Function EnviarCorreoActualizarProductos() As Boolean + Dim Retorno As Boolean = True + + Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 + + Dim DtPS As DataTable = Nothing + Using ObjPS As New ClsProductosServicios + 'OBTENER LOS PRODUCTOS NUEVOS EN LA ULTIMA SEMANA + If ObjPS.GetProductosModificados(CveEmpresa, 44, HorasDiferencia:=(24 * 7)) Then + DtPS = ObjPS.DtResultados + End If + End Using + + If DtPS IsNot Nothing Then + Dim sb As New StringBuilder + For Each Row As DataRow In DtPS.Rows + sb.AppendFormat("- {0}.
", Row("CodigoPS")) + Next + Dim msg As String = "" + + If sb.Length > 0 Then + msg = $"Se enviaron los siguientes productos:
{sb.ToString()}
Fecha y hora: {Now.ToString("dd/MM/yyyy hh:mm:ss tt")}" + Else + msg = $"No se enviaron productos esta semana
Fecha y hora: {Now.ToString("dd/MM/yyyy hh:mm:ss tt")}" + End If + + EnviarCorreoNotificacion("SIG - Productos enviados en la semana", msg) + End If + + Return Retorno + End Function + Private Function CrearActualizarProductos(Todos As Boolean) As Boolean Dim Retorno As Boolean = False Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 @@ -1738,6 +1801,8 @@ Public Class E141 : Implements IHttpHandler 'OBTERNER PRECIOS DE PUBLICO GENERAL If ObjPS.GetProductosModificados(CveEmpresa, 44, If(Todos, -1, 26)) Then DtPS = ObjPS.DtResultados.Copy() + Else + GuardaLogAD($"NP-Ocurrió un error al obtener los productos", "LogE141") End If End Using @@ -1759,10 +1824,10 @@ Public Class E141 : Implements IHttpHandler CountPeticionesExitosas += 1 GuardaLogAD("NP-Creacion/actualizacion de productos exitosa", "LogE141") Else - GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${respuesta.ToString()}", "LogE141") + GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${respuesta.ToString()}", "LogE141") End If Else - GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${resp}", "LogE141") + GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${resp}", "LogE141") End If Else @@ -1799,16 +1864,18 @@ Public Class E141 : Implements IHttpHandler CountPeticionesExitosas += 1 GuardaLogAD("NP-Creacion/actualizacion de productos exitosa", "LogE141") Else - GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${respuesta.ToString()}", "LogE141") + GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${respuesta.ToString()}", "LogE141") End If Else - GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${resp}", "LogE141") + GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${resp}", "LogE141") End If Threading.Thread.Sleep(1000) End While End If - + If DtPS.Rows.Count > 0 Then + EnviarCorreoNotificacion("SIG - Actualización de productos", $"Se ejecuto la tarea de actualización de productos.
Fecha y hora: {Now.ToString("dd/MM/yyyy hh:mm:ss tt")}") + End If End If If CountPeticionesExitosas = CountPeticiones Then @@ -1826,7 +1893,7 @@ Public Class E141 : Implements IHttpHandler Dim DtPS As DataTable = Nothing Using ObjPS As New ClsProductosServicios 'OBTERNER PRECIOS DE PUBLICO GENERAL - If ObjPS.GetProductosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then + If ObjPS.GetProductosModificados(CveEmpresa, 44, If(Todos, -1, 26)) Then DtPS = ObjPS.DtResultados.Copy() End If End Using @@ -1890,6 +1957,12 @@ Public Class E141 : Implements IHttpHandler Private Function ActualizarPrecios(Todos As Boolean) As Boolean Dim Retorno As Boolean = False + 'ENVIAR PRECIOS SOLO DE 8am a 7pm + If Now.Hour < 7 OrElse Now.Hour > 21 Then + Retorno = True + Return Retorno + End If + Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 Dim DtPS As DataTable = Nothing @@ -1897,6 +1970,8 @@ Public Class E141 : Implements IHttpHandler 'OBTERNER PRECIOS DE PUBLICO GENERAL If ObjPS.GetPreciosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then DtPS = ObjPS.DtResultados.Copy() + Else + GuardaLogAD($"AP-Ocurrió un error al obtener los precios", "LogE141") End If End Using @@ -1965,8 +2040,13 @@ Public Class E141 : Implements IHttpHandler End While End If + If DtPS.Rows.Count > 0 Then + EnviarCorreoNotificacion("SIG - Actualización de precios", $"Se ejecuto la tarea de actualización de precios.
Fecha y hora: {Now.ToString("dd/MM/yyyy hh:mm:ss tt")}") + End If + End If + Return Retorno End Function @@ -2017,11 +2097,19 @@ Public Class E141 : Implements IHttpHandler Dim Retorno As Boolean = False Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 + 'ENVIAR SOLO DE 8am a 8pm + If Now.Hour < 7 OrElse Now.Hour > 21 Then + Retorno = True + Return Retorno + End If + Dim DtPS As DataTable = Nothing Using ObjPS As New ClsProductosServicios 'OBTERNER PRECIOS DE PUBLICO GENERAL If ObjPS.GetExistenciasEmpresa("-1", CveEmpresa) Then DtPS = ObjPS.DtResultados.Copy() + Else + GuardaLogAD($"AE-Ocurrió un error al obtener las existencias", "LogE141") End If End Using @@ -2087,6 +2175,10 @@ Public Class E141 : Implements IHttpHandler Threading.Thread.Sleep(1000) End While End If + + If DtPS.Rows.Count > 0 Then + EnviarCorreoNotificacion("SIG - Actualización de existencias", $"Se ejecuto la tarea de actualización de existencias.
Fecha y hora: {Now.ToString("dd/MM/yyyy hh:mm:ss tt")}") + End If End If If CountPeticionesExitosas = CountPeticiones Then diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 22713526d..0df8b0f83 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -869,13 +869,13 @@ Partial Class Bancos_IE End Try - CveIEDeposito = ObjIE.DtResultados(0)("CveIEDepositoPadre").ToString.ToEntero CuentaDepositoPadre = ObjIE.DtResultados(0)("CuentaDepositoPadre").ToString Cuenta = ObjIE.DtResultados(0)("NumCuenta").ToString CveIEDeposito2 = ObjIE.DtResultados(0)("CveIEDeposito2").ToString.ToEntero NumComplementos = ObjIE.DtResultados(0)("NumComplementos").ToString.ToEntero + Dim CveIEEstadoCuenta As Integer = ObjIE.DtResultados(0)("CveIEEstadoCuenta").ToString.ToEntero If UsuarioActual.TienePermisoProceso(99) Then 'BtnActualizar.Visible = True @@ -936,6 +936,7 @@ Partial Class Bancos_IE 'ChkImpreso.Checked = ObjIE.FueImpreso ChkConciliado.Checked = ObjIE.FueConciliado + DdlEstatusIE.SelectedValue = ObjIE.CveEstatusIE.ToString DdlEstatusIE.Visible = False LblEstatusIE.Visible = True @@ -1087,6 +1088,9 @@ Partial Class Bancos_IE If UsuarioActual.TienePermisoProceso(85) AndAlso Not ObjIE.FueConciliado Then LnkCancelar.Visible = True + ' si fue conciliado manual, pero no relacionado al IEEstadocuenta, porque es conciliación bancaria + If UsuarioActual.TienePermisoProceso(85) AndAlso UsuarioActual.CveEmpresa = 119 AndAlso ObjIE.FueConciliado AndAlso CveIEEstadoCuenta = 0 Then LnkCancelar.Visible = True + ''COMENTAR - solo para pruebas 'If UsuarioActual.TienePermisoProceso(85) Then LnkCancelar.Visible = True 'If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True diff --git a/Bancos/PopIECompras.aspx.vb b/Bancos/PopIECompras.aspx.vb index f866d48c7..7887db559 100644 --- a/Bancos/PopIECompras.aspx.vb +++ b/Bancos/PopIECompras.aspx.vb @@ -1428,7 +1428,7 @@ Partial Class Bancos_PopIECompras Select Case RBLContado.SelectedValue Case "1" ' Bancos - Dim ImporteBancos As Decimal = TxtImporte.Text.ToDecimal + Dim ImporteBancos As Decimal = TxtImporte.Text.ToDecimal.RoundSQL CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, Fecha, TxtFolio.Text.Trim, TxtPagueseA.Text.Trim, ImporteBancos, CveMoneda, 11, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1), CveCuentaDeposito:=CveCuentaDeposito, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), ConceptoCIE:=If(TxtConceptoCIE.Text.Trim.Length > 0, TxtConceptoCIE.Text, "-1")) If Not CveIE > 0 Then MsgError = "Ocurrio un Error al registrarse el movimiento bancario." diff --git a/Bancos/RepCobrado.aspx.vb b/Bancos/RepCobrado.aspx.vb index 9e30438c3..c6e43162a 100644 --- a/Bancos/RepCobrado.aspx.vb +++ b/Bancos/RepCobrado.aspx.vb @@ -27,6 +27,9 @@ Partial Class Ventas_RepRecuperacion End If End Sub + + + Private Sub CargaCombos() 'CARGA PROVEEDORES DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) diff --git a/Bin/ADSNetLibrary.dll b/Bin/ADSNetLibrary.dll index 91c5f029d..effde59a8 100644 Binary files a/Bin/ADSNetLibrary.dll and b/Bin/ADSNetLibrary.dll differ diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 91c7efaf2..abeb32861 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -6635,7 +6635,7 @@ Partial Class Compras_Compras End If End If Next - Dim diferenciaTransito As Decimal = 0 + For Each Gvr As GridViewRow In GVNCInvAlmacen.Rows If Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDouble > 0 Then Dim importeMNTemp As Decimal = 0 @@ -6643,6 +6643,7 @@ Partial Class Compras_Compras ErrorMovInv = True Exit For End If + Dim DifTC As Decimal = tipoCambioActual - Gvr.DataKey("TipoCambio").ToDecimal 'diferenciaTransito = DifTC * (Gvr.DataKey("IVA").ToDecimal / Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDecimal) 'diferenciaTransito += DifTC * (Gvr.DataKey("IEPSPS").ToDecimal / Gvr.FCTextBox("TxtCantidadNCInv").Text.ToDecimal) @@ -6654,23 +6655,28 @@ Partial Class Compras_Compras End If End If Next + + 'si se marca que no se va a recibir, falta validación + If Not ErrorMovInv AndAlso Not ObjCompras.UpdateEstatusAlmacen(CveCompra, 1, UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + Dim diferenciaTransito As Decimal = 0 'la diferencia se va aplicar sobre los - 'Dim diferenciaTransito As Decimal = ImporteTransito - importeMN.RoundSQL - If diferenciaTransito <> 0 Then - Dim tCveCon As Integer = 65 - If diferenciaTransito < 0 Then - tCveCon = 64 - End If - diferenciaTransito = Math.Abs(diferenciaTransito) + Dim tCveCon As Integer = 65 + If diferenciaTransito < 0 Then + tCveCon = 64 + End If + diferenciaTransito = Math.Abs(diferenciaTransito) - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, If(tCveCon = 64, True, False), diferenciaTransito, Referencia, tCveCon, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=diferenciaTransito, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=1, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza, CveSubProyecto:=CveSubProyecto) Then - ErrorPrepoliza = True + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, If(tCveCon = 64, True, False), diferenciaTransito, Referencia, tCveCon, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=diferenciaTransito, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=1, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza, CveSubProyecto:=CveSubProyecto) Then + ErrorPrepoliza = True + End If End If - End If - Else - Dim DiferenciaDevolucion As Decimal = importeMovimiento - TotalRealDevolucion + Else + Dim DiferenciaDevolucion As Decimal = importeMovimiento - TotalRealDevolucion If TotalRealDevolucion <> 0 Then If Math.Abs(DiferenciaDevolucion) > 0 Then 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/Compras/RepCxP.aspx.vb b/Compras/RepCxP.aspx.vb index 3df3654b1..5a081efb4 100644 --- a/Compras/RepCxP.aspx.vb +++ b/Compras/RepCxP.aspx.vb @@ -92,6 +92,7 @@ Partial Class Compras_RepCxP If Not Page.IsPostBack Then CargaCombos() CargaGvPersonalizarRaqngoColumnas() + ProcesaRequest() CargaDatos() If UsuarioActual.CveRol = 1 Then @@ -101,6 +102,36 @@ Partial Class Compras_RepCxP End Sub #Region "CARGAS" + + Private Sub ProcesaRequest() + + If Request("FechaInicio") IsNot Nothing AndAlso IsDate(Request("FechaInicio")) Then + txtFechaI.Text = Request("FechaInicio") + End If + If Request("FechaFin") IsNot Nothing AndAlso IsDate(Request("FechaFin")) Then + txtFechaF.Text = Request("FechaFin") + End If + + If Request("TipoDocto") IsNot Nothing AndAlso Request("TipoDocto").Length > 0 Then + Dim tipodoctos As String() = Request("TipoDocto").Split(","c) + + For Each itemTipoDocto As ListItem In DdlTipoDocto.Items + For Each tipoDocto As String In tipodoctos + itemTipoDocto.Selected = (tipoDocto.ToUpper = itemTipoDocto.Value.ToUpper) + Next + Next + + End If + + If Request("CveMoneda") IsNot Nothing AndAlso Request("CveMoneda").ToEntero <> 0 Then + DdlMoneda.SelectedValueExist(Request("CveMoneda").ToEntero) + End If + + If Request("CveSubProyecto") IsNot Nothing AndAlso Request("CveSubProyecto").ToEntero <> 0 Then + DdlSubProyecto.SelectedValueExist(Request("CveSubProyecto").ToEntero) + End If + + End Sub Private Sub CargaCombos() If (UsuarioActual.Empresa.Funcionalidad(105) = "1") Then diff --git a/Compras/RepPagado.aspx.cs b/Compras/RepPagado.aspx.cs index 23dc27109..77cf1f13a 100644 --- a/Compras/RepPagado.aspx.cs +++ b/Compras/RepPagado.aspx.cs @@ -31,6 +31,7 @@ public partial class Compras_RepPagado : ClsPaginas if (!IsPostBack) { InicializaValores(); + ProcesaRequest(); } } @@ -73,6 +74,50 @@ public partial class Compras_RepPagado : ClsPaginas TxtFechaFCompra.Text = DateTime.Now.ToShortDateString(); } + + private void ProcesaRequest() + { + if (DateTime.TryParse(Request["FechaInicio"], out DateTime fechaInicio)) + { + txtFechaI.Text = fechaInicio.ToString("yyyy-MM-dd"); + } + + if (DateTime.TryParse(Request["FechaFin"], out DateTime fechaFin)) + { + txtFechaF.Text = fechaFin.ToString("yyyy-MM-dd"); + } + + //if (Request["TipoDocto"] != null && Request["TipoDocto"].Length > 0) + //{ + // string[] tipodoctos = Request["TipoDocto"].Split(','); + // foreach (ListItem itemTipoDocto in DdlTipoDocto.Items) + // { + // foreach (string tipoDocto in tipodoctos) + // { + // itemTipoDocto.Selected = tipoDocto.ToUpper() == itemTipoDocto.Value.ToUpper(); + // } + // } + //} + + if (Request["CveMoneda"] != null && Request["CveMoneda"].ToEntero() != 0) + { + DdlMoneda.SelectedValueExist(Request["CveMoneda"].ToEntero()); + } + + if (Request["CveSubProyecto"] != null && Request["CveSubProyecto"].ToEntero() != 0) + { + DdlSubProyecto.SelectedValueExist(Request["CveSubProyecto"].ToEntero()); + } + + + + if ((DateTime.TryParse(Request["FechaInicio"], out DateTime fechaInicio2)) && (DateTime.TryParse(Request["FechaFin"], out DateTime fechaFin2))) + { + CargaDatos(); + } + } + + private void CargaCuentasBancarias() { DdlCuentaBancaria.Items.Clear(); diff --git a/CxC/RepCxC.aspx.vb b/CxC/RepCxC.aspx.vb index be381b986..4d164ee30 100644 --- a/CxC/RepCxC.aspx.vb +++ b/CxC/RepCxC.aspx.vb @@ -91,20 +91,56 @@ Partial Class RepCxC #End Region - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then Index = 0 Modalidad = "" CargaCombos() CargaGvPersonalizarRaqngoColumnas() + ProcesaRequest() CargaDatos() If UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119) Then ChkAnticipos.Visible = True ActivaEnviarEstadoCuenta() If UsuarioActual.CveRol = 1 Or UsuarioActual.TienePermisoProceso(243) Then LnkDescargarSegmentos.Visible = True End If + End Sub #Region "CARGAS" + + + Private Sub ProcesaRequest() + + If Request("FechaInicio") IsNot Nothing AndAlso IsDate(Request("FechaInicio")) Then + txtFechaI.Text = Request("FechaInicio") + End If + If Request("FechaFin") IsNot Nothing AndAlso IsDate(Request("FechaFin")) Then + txtFechaF.Text = Request("FechaFin") + End If + + If Request("TipoDocto") IsNot Nothing AndAlso Request("TipoDocto").Length > 0 Then + Dim tipodoctos As String() = Request("TipoDocto").Split(","c) + + For Each itemTipoDocto As ListItem In DdlTipoDocto.Items + For Each tipoDocto As String In tipodoctos + itemTipoDocto.Selected = (tipoDocto.ToUpper = itemTipoDocto.Value.ToUpper) + Next + Next + + End If + + If Request("CveMoneda") IsNot Nothing AndAlso Request("CveMoneda").ToEntero <> 0 Then + DdlMoneda.SelectedValueExist(Request("CveMoneda").ToEntero) + End If + + If Request("CveSubProyecto") IsNot Nothing AndAlso Request("CveSubProyecto").ToEntero <> 0 Then + DdlSubProyecto.SelectedValueExist(Request("CveSubProyecto").ToEntero) + End If + + + End Sub + Private Sub CargaCombos() 'CargaClientes If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then 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 + + + + + + + + + + + + + + +
+
+
+
+
+ + Datos de la Empresa +
+
+
+
+
+
+ +
+
+
+ +
+
+
+ + + + + +
+
+
+
+ + + + + +
+
+
+ + +
+ +
+
+
+ + + + + +
+
+
+
+ + + +
+
+
+ +
+
+
+ + + +
+
+
+
+ + + + + +
+
+
+ + +
+
+
+ + + + + + +
+
+
+
+ + + + + +
+
+
+ +
+
+
+ + + + + + +
+
+
+
+ + + +
+
+
+ +
+
+
+ + + + + +
+
+ +
+ + +
+
+
+ + + + + +
+
+
+
+ + + + + + + + +
+
+ +
+ +
+
+
+ + + + + +
+
+
+
+ + + +
+
+
+ +
+
+
+ + + + + +
+
+
+
+ + + + + + + +
+
+
+ +
+
+ + +
+
+ + +
+ +
+ +
+
+
+ + + + +
+
+
+ +
+
+ +
+
+
+
+
+ +
+ + +
+
+
+ + Certificados +
+
+
+
+
+
+ +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + + + +
+
+ + + +
+
+
+
+ + + +
+
+ +
+ + + + + +
+
+ +
+ + +
+
+
+ + + +
+
+ +
+ + + + + +
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ +
+
+ Registrar en ProFact +
+
+
+ + + + + +
+
+
+ + + + + +
+
+
+
+ + + + +
+
+
+
+
+ + Envio de Correos +
+
+
+
+
+
+ +
+
+
+ + +
+
+
+ + + + + +
+
+
+
+ + + +
+
+
+ +
+
+
+ + + +
+
+
+
+ + + + +
+
+
+
+ +
+
+ + + + + + + +
+
+ + +
+
+ + +
+
+ +
+
+
+ + + +
+
+ +
+
+
+ + Recepción de Correos +
+
+
+
+
+
+ +
+
+
+ + +
+
+
+ + + + + +
+
+
+
+ + + +
+
+
+ +
+
+
+ + + + +
+
+
+
+ + +
+
+
+ +
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+
+
+
+ + +
+
+
+
+
+ + Configuraciones +
+
+
+
+
+
+ +
+
+
+ + + +
+
+
+ + + + + + + + + + + + +
+
+
+
+ + + + +
+
+
+ + +
+
+
+ + + + +
+
+
+
+ + + + +
+
+
+
+
+
+
+
+ + NÓMINA +
+
+
+
+
+
+ +
+
+
+ +
+
+
+ + + +
+
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+ + Recursos Humanos +
+
+
+
+
+
+ +
+
+
+ + +
+
+
+ + +
+
+ +
+
+ + + + +
+
+
+
+
+ +
+
+
+ + Centro de Costos +
+
+
+
+
+
+ +
+
+
+ + +
+
+
+ + +
+
+ +
+
+ + + + + + + + + +
+
+
+ +
+ +
+
+ + + + + + + +
+
+
+
+ + + +
+
+
+ + +
+
+ + + + + + + + +
+ +
+
+
+
+ + Plantilla Manda Correo Venta +
+
+
+
+
+ +
+
+ + +
+
+ + + + Asunto: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ +
+
+
+
+ + Plantilla Manda Correo Cotización +
+
+
+ +
+
+ +
+
+ +
+
+ + Asunto: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+
+
+
+
+ + + +
+
+ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Sistemas/Empresa2.aspx.vb b/Sistemas/Empresa2.aspx.vb new file mode 100644 index 000000000..29353fd60 --- /dev/null +++ b/Sistemas/Empresa2.aspx.vb @@ -0,0 +1,2048 @@ +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 + + + + + End If + End Sub + + Private Function ValidaCveEmpresaUsaurio(CveUsuario As Integer, CveEmpresaValidar As Integer) As Boolean + + Dim Respuesta As Boolean = False + Using ObjEmpresas As New ClsSisEmpresas() + If ObjEmpresas.GetEmpresas(-1, "-1", "-1", "-1", "-1", UsuarioActual.CveUsuario) Then + If ObjEmpresas.DtResultados.FiltraParametros($"CveEmpresa = {CveEmpresaValidar}").Rows.Count = 1 Then + Respuesta = True + End If + End If + End Using + Return Respuesta + + End Function + + Private Sub CargaDatos() + + Dim ObjEmpresas As New ClsSisEmpresas() + If ObjEmpresas.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then + If ObjEmpresas.DtResultados.Rows.Count > 0 Then + Me.EmpresaEditar = ObjEmpresas.Empresa + With ObjEmpresas.Empresa + + 'Campos para Modificación + + TxtEmpresa.Text = .Empresa : LtlTitulo.Text = "Consulta de Empresa: " & .Empresa + TxtNombreCorto.Text = .NombreCorto + TxtDireccion.Text = .Direccion + TxtNoExt.Text = .NoExt + TxtNoInt.Text = .NoInt + TxtColonia.Text = .Colonia + TxtCiudad.Text = .Ciudad + TxtEstado.Text = .Estado + TxtCP.Text = .CP.ToString + TxtRFC.Text = .RFC + TxtTelefono.Text = .Telefono + TxtContacto.Text = .Contacto 'Representante legal + TxtMail.Text = .Mail + 'TxtBIUsuario.Text = .BIUsuario + 'TxtBIContraseña.Text = .BIContraseña + TxtContraseñaKey.Text = .ContraseñaKey + TxtArchivoKey.Text = .ArchivoKey + TxtArchivoCer.Text = .ArchivoCer + TxtArchivoPfx.Text = .ArchivoPfx + Estatus = .Estatus + 'TxtFecha.Text = .FechaIng.ToString + 'TxtCveUsuario.Text = .Usuario + FacturaProduccion = .FacturaProduccion + TxtSendMail.Text = .SendMail + TxtSendMailPassword.Text = .SendMailPassword + TxtSendMailServer.Text = .SendMailServer + TxtSendMailPort.Text = .SendMailPuerto.ToString + ChkSendMailSSL.Checked = .SendMailSSL + ChkMostrarRetIVA.Checked = .MostrarRetIVA + ChkMostrarRetISR.Checked = .MostrarRetISR + 'TxtRegimen.Text = .Regimen + EstatusFacturacion = .EstatusFacturacion + 'TxtTimbres.Text = .Timbres.ToString + UsaContabilidad = .UsaContabilidad + UsaBancos = .UsaBancos + UsaVentas = .UsaVentas + UsaCxC = .UsaCxC + UsaCompras = .UsaCompras + UsaInventarios = .UsaInventarios + UsaRH = .UsaRH + UsaNomina = .UsaNomina + UsaOS = .UsaOS + 'TxtBDContPAQi.Text = .BDContPAQi + 'TxtServerContPAQi.Text = .ServerContPAQi + 'TxtUsrContPAQi.Text = .UsrContPAQi + 'TxtPwdContPAQi.Text = .PwdContPAQi + TxtBuzon_Mail.Text = .Buzon_Mail + TxtBuzon_Server.Text = .Buzon_Server + TxtBuzon_Puerto.Text = .Buzon_Puerto.ToString + ChkBuzon_SSL.Checked = .Buzon_SSL + TxtBuzon_USR.Text = .Buzon_USR + TxtBuzon_PWD.Text = .Buzon_PWD + 'TxtMailSoporte.Text = .Soporte_Mail + 'TxtServidorSoporte.Text = .Soporte_Server + 'TxtPuertoSoporte.Text = .Soporte_Puerto.ToString + SSLSoporte = .Soporte_SSL + 'TxtUsuarioSoporte.Text = .Soporte_USR + 'DdlProtocoloSoporte.SelectedValue = .Soporte_Tipo + 'TxtContraseñaSoporte.Text = .Soporte_PWD + 'DdlCvePac.SelectedValueExist(.CvePAC.ToString) + DdlRegimen.SelectedValue = .CveRegimenFiscal.ToString + TxtCURP.Text = .CURP + TxtImporte.Text.ToDecimal + TxtCIEC.Text = .CIEC + 'DdlPlataforma.SelectedValue = .CvePlataforma.ToString + UsaAC = .UsaAC + TxtPorDepreciacion.Text = .PorDepreciacion.ToString + TxtExtension.Text = .Extension + TxtLocalidad.Text = .Localidad + DdlMetodoInventario.SelectedValue = .CveMetodoInventario.ToString + AsientoContable = .AsientoContableComprasContado + TxtPeriodoActual.Text = .PeriodoActual.ToString + TxtEjercicioActual.Text = .EjercicioActual.ToString + ChkDefaultAsistencias.Checked = .DefaultAsistencias + TxtDiasPermitidos.Text = .DiasPermitidos.ToString + DdlTipoCentroDeCostos.SelectedValue = .Tipo_CentroCosto.ToString + ChkReqCentroCostos.Checked = .RequiereCentroCostos + DdlTerminalTipo.SelectedValue = .PV_TerminalTipo.ToString + TxtImporte.Text = .Importe.ToString + TipoContabilidad = .TipoContabilidad + + TxtPlantillaVenta.Text = .PlantillaMailVenta + TxtAsunto.Text = .AsuntoPlantillaMailVenta + + TxtPlantillaCotizacion.Text = .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, "CFDi", "-1", + "-1", TxtContraseñaKey.Text.Trim, TxtArchivoKey.Text.Trim, TxtArchivoCer.Text.Trim, TxtArchivoPfx.Text.Trim, "", Estatus, + FacturaProduccion, ChkMostrarRetIVA.Checked, ChkMostrarRetISR.Checked, "-1", EstatusFacturacion, TxtSendMail.Text.Trim, + TxtSendMailPassword.Text.Trim, TxtSendMailServer.Text.Trim, TxtSendMailPort.Text.Trim.ToEntero, ChkSendMailSSL.Checked, UsaContabilidad, UsaBancos, + UsaVentas, UsaCxC, UsaCompras, UsaInventarios, UsaRH, UsaNomina, UsaOS, "-1", + "-1", "-1", "-1", TxtBuzon_Mail.Text.Trim, TxtBuzon_Server.Text.Trim, TxtBuzon_Puerto.Text.Trim.ToEntero, + ChkBuzon_SSL.Checked, TxtBuzon_USR.Text.Trim, TxtBuzon_PWD.Text.Trim, UsuarioActual.CveEmpresa, DdlProtocolo.SelectedValue, + "-1", "-1", -1, SSLSoporte, "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, "", TxtAreaGeografica.Text.Trim, + -1, -1, TxtNombreCorto.Text, TxtCURP.Text.Trim, DdlRegimen.SelectedValue.ToEntero, 1, + TxtImporte.Text.ToDecimal, TxtCIEC.Text, 1, UsaAC, + TxtPorDepreciacion.Text.ToDecimal, TxtExtension.Text, TxtLocalidad.Text, DdlMetodoInventario.SelectedValue.ToEntero, AsientoContable, TxtPeriodoActual.Text.ToEntero, + TxtEjercicioActual.Text.ToEntero, ChkDefaultAsistencias.Checked, TxtDiasPermitidos.Text.ToEntero, DdlTipoCentroDeCostos.SelectedValue.ToEntero, ChkReqCentroCostos.Checked, + DdlTerminalTipo.SelectedValue.ToEntero, IdCuentaDSV:=-1, IdCuentaImpuestosLocales:=-1, IdCuentaIEPSxAcreditar:=-1, IdCuentaIEPSAcreditable:=-1, + IdCuentaIEPSxTrasladar:=-1, IdCuentaIEPSTrasladado:=-1) Then + + 'Movemos el Archivo Fisicamente + If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString) Then + Dim Extension As String = Path.GetExtension(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString) + If File.Exists(Request.PhysicalApplicationPath + "Banners\" & UsuarioActual.CveEmpresa & Extension) Then + File.Delete(Request.PhysicalApplicationPath + "Banners\" & UsuarioActual.CveEmpresa & Extension) + File.Move(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString, Request.PhysicalApplicationPath + "Banners\" & UsuarioActual.CveEmpresa & Extension) + Else + File.Move(Request.PhysicalApplicationPath + "Banners\Temp\" & Session("FileUpload").ToString, Request.PhysicalApplicationPath + "Banners\" & UsuarioActual.CveEmpresa & Extension) + End If + End If + + TextoOK = "Los cambios de guardaron correctamente." + Else + TextoError = "Ocurrió un error al guardar los cambios de la empresa" + End If + + 'Agregar Indicadores + 'For Each Row As GridViewRow In GvIndicadores.Rows + ' If Row.DataKey("CveIndicador") <> "" AndAlso Row.DataKey("CveEmpresa") <> "" And Row.FCCheckBox("chkIndicador").Checked = False Then + ' If Not Indicador.RemoveIndicadoresEmpresas(Row.DataKey("CveIndicador").ToEntero, UsuarioActual.CveEmpresa) Then + ' Exit For + ' End If + ' End If + + ' If Row.DataKey("CveIndicador") <> "" And Row.DataKey("CveEmpresa") = "" Then + ' If Row.FCCheckBox("chkIndicador").Checked Then + ' If Not Indicador.AddIndicadorEmpresa(Row.DataKey("CveIndicador").ToEntero, UsuarioActual.CveEmpresa) Then + ' Exit For + ' End If + ' End If + ' End If + 'Next + + End If + + 'CLASIFICACIONES DE IVAS + If DtClasificacionIVA IsNot Nothing OrElse DtClasificacionIVA.Rows.Count > 0 Then + For Each Dr As DataRow In DtClasificacionIVA.Rows + If Not Dr("CveClasificacion").ToString.ToEntero > 0 Then + If Not ObjGral.RemoveClasificacionPorcentaje(Dr("CveClasificacionPorcentaje").ToString.ToEntero) Then + TextoError = "Ocurrió un error al guardar los cambios de la empresa" + End If + ElseIf Dr("CveClasificacionPorcentaje").ToString.ToEntero = 0 Then + If Not ObjGral.AddClasificacionPorcentaje(Dr("CveClasificacion").ToString.ToEntero, Dr("PorcentajeIVA").ToString.ToDouble, + Dr("IdCtaIVAXAcreditar").ToString.ToEntero, Dr("IdCtaIVAAcreditable").ToString.ToEntero, + Dr("IdCtaIVAXTrasladar").ToString.ToEntero, Dr("IdCtaIVATrasladado").ToString.ToEntero, UsuarioActual.CveEmpresa) Then + TextoError = "Ocurrió un error al guardar los cambios de la empresa" + End If + ElseIf Dr("CveClasificacionPorcentaje").ToString.ToEntero > 0 Then + If Not ObjGral.UpdateClasificacionPorcentaje(Dr("CveClasificacionPorcentaje").ToString.ToEntero, Dr("CveClasificacion").ToString.ToEntero, Dr("PorcentajeIVA").ToString.ToDouble, + Dr("IdCtaIVAXAcreditar").ToString.ToEntero, Dr("IdCtaIVAAcreditable").ToString.ToEntero, + Dr("IdCtaIVAXTrasladar").ToString.ToEntero, Dr("IdCtaIVATrasladado").ToString.ToEntero) Then + TextoError = "Ocurrió un error al guardar los cambios de la empresa" + End If + End If + Next + End If + + 'RECARGA EMPRESA + If TextoError = "" Then + If ObjEmpresas.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then + GlobalDTEmpresas(UsuarioActual.CveEmpresa) = Nothing + + 'verifico si existe la carpeta de la empresa, sino la crea + For Each dr As Data.DataRow In ObjEmpresas.DtResultados.Rows + If Not IO.Directory.Exists(String.Format("{0}\{1}", ModExtensiones.DirectorioBaseEmpresas, dr("CveEmpresa"))) Then + IO.Directory.CreateDirectory(String.Format("{0}Empresas\{1}", ModExtensiones.DirectorioBaseEmpresas, dr("CveEmpresa"))) + End If + Next + End If + + ' GlobalDTClasificacionPorcentaje(CveEmpresa) = Nothing + + End If + + 'AGREGAR FUNCIONALIDADES + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 201, DdlProveedores) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 211, DdlClientes) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 208, DdlInventario) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 216, DdlGasto) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 209, DdlBancos) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 205, DdlDeudores) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 202, DdlAcreedores) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 203, DdlDocxPagar) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 212, DdlAnticipoCliente) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 204, DdlAnticipoProveedores) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 218, DdlCaja) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 215, DdlFyE) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 221, DdlActivoFijo) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 246, DdlClientes) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 237, DdlAnticipoCliente) + + ''AGREGAR FUNCIONALIDADES + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 232, DdlProveedoresSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 233, DdlClientesSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 239, DdlInventarioSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 240, DdlGastoSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 241, DdlBancosSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 234, DdlDeudoresSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 235, DdlAcreedoresSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 236, DdlDocxPagarSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 237, DdlAnticipoClienteSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 238, DdlAnticipoProveedoresSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 242, DdlCajaSIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 243, DdlFyESIG) + 'If TextoError = "" Then TextoError = AgregarFuncionalidad(ObjEmpresas, 244, DdlActivoFijoSIG) + + 'TRIGGER + 'If TextoError = "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" Then + + ' If UsuarioActual.Empresa.UsaContabilidad Then + + ' If UsuarioActual.Empresa.TipoContabilidad = 2 Then + ' 'CREA OBJETO EMPRESA + ' If ObjEmpresas.GetEmpresas(TxtCveEmpresa.Text.ToEntero, "-1", "-1", "-1", "-1") Then + ' Dim Empresa As New Empresa + ' Empresa = ObjEmpresas.Empresa + + ' ObjContPAQ = New ClsContPAQi(Empresa) + + ' If ObjContPAQ.Conectado Then + ' 'ADD + ' If BDContPAQ = "" Then + ' If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then + ' TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" + ' End If + ' End If + + ' 'UPDATE + ' If BDContPAQ <> "" And (BDContPAQ <> TxtBDContPAQi.Text.Trim Or ServerContPAQ <> TxtServerContPAQi.Text.Trim) Then + ' If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then + ' TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" + ' End If + ' End If + ' Else + ' TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" + ' End If + ' End If + ' End If + + ' Else + ' Alert("La empresa tiene la información para el uso de contabilidad pero no se tiene activada", TipoMensaje.MsgAdvertencia) + ' End If + 'End If + + If TextoError = "" Then + ObjEmpresas.Commit() + If ObjContPAQ IsNot Nothing Then ObjContPAQ.Commit() + Alert(TextoOK, TipoMensaje.MsgInformacion, "document.location.href=""/Sistemas/Empresa2.aspx"";") + Session("FileUpload") = "" + CargaDatos() + UpDatos.Update() + Else + ObjEmpresas.RollBack() + If ObjContPAQ IsNot Nothing Then ObjContPAQ.RollBack() + Alert(TextoError, TipoMensaje.MsgError) + End If + + ObjEmpresas.Dispose() + ObjGral.Dispose() + If ObjContPAQ IsNot Nothing Then ObjContPAQ.Dispose() + End Sub + Private Function AgregarFuncionalidad(ObjEmpresas As ClsSisEmpresas, CveFuncionalidad As Integer, ByRef Ddl As DropDownList) As String + Dim Retorno = "" + + If Not ObjEmpresas.AddUpdateEmpresaFuncionalidades(UsuarioActual.CveEmpresa, CveFuncionalidad, Ddl.SelectedValue) Then + Retorno = "Ocurrió un error al vincular la cuenta contable" + End If + + Return Retorno + End Function + + + 'Nuevo Código + Private Sub CargaCuentasContables(Optional IdCuentaPadre As Integer = -1) + DtCuentasContables = Nothing + + If UsuarioActual.Empresa.UsaContabilidad Then + Dim ObjEmpresa As New ClsSisEmpresas + Dim Empresa As Empresa = Nothing + If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then + + Empresa = ObjEmpresa.Empresa + + If Empresa.TipoContabilidad = 2 Then + Dim ObjContabilidad As New ClsContPAQi(Empresa) + If ObjContabilidad.GetCuentas(-1, "-1", -1, IdPadre:=IdCuentaPadre) Then + DtCuentasContables = ObjContabilidad.DtResultados + End If + ObjContabilidad.Dispose() + End If + + + + End If + ObjEmpresa.Dispose() + End If + End Sub + + Private Sub CargaCuentasContablesSIG(Optional IdCuentaPadre As Integer = -1) + DtCuentasContablesSIG = Nothing + + Dim ObjEmpresa As New ClsSisEmpresas + Dim Empresa As Empresa = Nothing + If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then + Empresa = ObjEmpresa.Empresa + Dim ObjContabilidad As New ClsContabilidad + If ObjContabilidad.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa, CvePadre:=IdCuentaPadre) Then + DtCuentasContablesSIG = ObjContabilidad.DtResultados + End If + ObjContabilidad.Dispose() + End If + ObjEmpresa.Dispose() + End Sub + + 'Protected Sub BtnCargarCuentas_Click(sender As Object, e As EventArgs) Handles BtnCargarCuentas.Click + ' If DtCuentasContables Is Nothing Then + + ' End If + ' Dim Seleccionado As String + ' Select Case HdnCuenta.Value + ' Case "1" + ' If DdlIVAxAcreditar.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlIVAxAcreditar.SelectedValue + ' DdlIVAxAcreditar.Items.Clear() : DdlIVAxAcreditar.Items.Add(New ListItem("Seleccione", "0")) + ' DdlIVAxAcreditar.DataSource = DtCuentasContables : DdlIVAxAcreditar.DataBind() : DdlIVAxAcreditar.SelectedValueExist(Seleccionado) + ' DdlIVAxAcreditar.AutoPostBack = False : DdlIVAxAcreditar.Attributes.Remove("onclick") : DdlIVAxAcreditar.CssClass &= " select2me" + ' Case "2" + ' If DdlIVAAcreditable.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlIVAAcreditable.SelectedValue + ' DdlIVAAcreditable.Items.Clear() : DdlIVAAcreditable.Items.Add(New ListItem("Seleccione", "0")) + ' DdlIVAAcreditable.DataSource = DtCuentasContables : DdlIVAAcreditable.DataBind() : DdlIVAAcreditable.SelectedValue = Seleccionado + ' DdlIVAAcreditable.AutoPostBack = False : DdlIVAAcreditable.Attributes.Remove("onclick") : DdlIVAAcreditable.CssClass &= " select2me" + ' Case "3" + ' If DdlIVAxTrasladar.Attributes("onclick") <> "" Then CargaCuentasContables(-1) + ' Seleccionado = DdlIVAxTrasladar.SelectedValue + ' DdlIVAxTrasladar.Items.Clear() : DdlIVAxTrasladar.Items.Add(New ListItem("Seleccione", "0")) + ' DdlIVAxTrasladar.DataSource = DtCuentasContables : DdlIVAxTrasladar.DataBind() : DdlIVAxTrasladar.SelectedValue = Seleccionado + ' DdlIVAxTrasladar.AutoPostBack = False : DdlIVAxTrasladar.Attributes.Remove("onclick") : DdlIVAxTrasladar.CssClass &= " select2me" + ' Case "4" + ' If DdlIVATrasladado.Attributes("onclick") <> "" Then CargaCuentasContables(-1) + ' Seleccionado = DdlIVATrasladado.SelectedValue + ' DdlIVATrasladado.Items.Clear() : DdlIVATrasladado.Items.Add(New ListItem("Seleccione", "0")) + ' DdlIVATrasladado.DataSource = DtCuentasContables : DdlIVATrasladado.DataBind() : DdlIVATrasladado.SelectedValue = Seleccionado + ' DdlIVATrasladado.AutoPostBack = False : DdlIVATrasladado.Attributes.Remove("onclick") : DdlIVATrasladado.CssClass &= " select2me" + ' Case "5" + ' If DdlIVARetenciones.Attributes("onclick") <> "" Then CargaCuentasContables(-1) + ' Seleccionado = DdlIVARetenciones.SelectedValue + ' DdlIVARetenciones.Items.Clear() : DdlIVARetenciones.Items.Add(New ListItem("Seleccione", "0")) + ' DdlIVARetenciones.DataSource = DtCuentasContables : DdlIVARetenciones.DataBind() : DdlIVARetenciones.SelectedValue = Seleccionado + ' DdlIVARetenciones.AutoPostBack = False : DdlIVARetenciones.Attributes.Remove("onclick") : DdlIVARetenciones.CssClass &= " select2me" + ' Case "6" + ' If DdlISRCirculacion.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlISRCirculacion.SelectedValue + ' DdlISRCirculacion.Items.Clear() : DdlISRCirculacion.Items.Add(New ListItem("Seleccione", "0")) + ' DdlISRCirculacion.DataSource = DtCuentasContables : DdlISRCirculacion.DataBind() : DdlISRCirculacion.SelectedValue = Seleccionado + ' DdlISRCirculacion.AutoPostBack = False : DdlISRCirculacion.Attributes.Remove("onclick") : DdlISRCirculacion.CssClass &= " select2me" + ' Case "7" + ' If DdlProveedores.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlProveedores.SelectedValue + ' DdlProveedores.Items.Clear() : DdlProveedores.Items.Add(New ListItem("Seleccione", "0")) + ' DdlProveedores.DataSource = DtCuentasContables : DdlProveedores.DataBind() : DdlProveedores.SelectedValueExist(Seleccionado) + ' DdlProveedores.AutoPostBack = False : DdlProveedores.Attributes.Remove("onclick") : DdlProveedores.CssClass &= " select2me" + ' Case "8" + ' If DdlClientes.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlClientes.SelectedValue + ' DdlClientes.Items.Clear() : DdlClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlClientes.DataSource = DtCuentasContables : DdlClientes.DataBind() : DdlClientes.SelectedValueExist(Seleccionado) + ' DdlClientes.AutoPostBack = False : DdlClientes.Attributes.Remove("onclick") : DdlClientes.CssClass &= " select2me" + ' Case "9" + ' If DdlInventario.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlInventario.SelectedValue + ' DdlInventario.Items.Clear() : DdlInventario.Items.Add(New ListItem("Seleccione", "0")) + ' DdlInventario.DataSource = DtCuentasContables : DdlInventario.DataBind() : DdlInventario.SelectedValue = Seleccionado + ' DdlInventario.AutoPostBack = False : DdlInventario.Attributes.Remove("onclick") : DdlInventario.CssClass &= " select2me" + ' Case "10" + ' If DdlGasto.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlGasto.SelectedValue + ' DdlGasto.Items.Clear() : DdlGasto.Items.Add(New ListItem("Seleccione", "0")) + ' DdlGasto.DataSource = DtCuentasContables : DdlGasto.DataBind() : DdlGasto.SelectedValue = Seleccionado + ' DdlGasto.AutoPostBack = False : DdlGasto.Attributes.Remove("onclick") : DdlGasto.CssClass &= " select2me" + ' Case "11" + ' If DdlBancos.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlBancos.SelectedValue + ' DdlBancos.Items.Clear() : DdlBancos.Items.Add(New ListItem("Seleccione", "0")) + ' DdlBancos.DataSource = DtCuentasContables : DdlBancos.DataBind() : DdlBancos.SelectedValue = Seleccionado + ' DdlBancos.AutoPostBack = False : DdlBancos.Attributes.Remove("onclick") : DdlBancos.CssClass &= " select2me" + ' Case "12" + ' If DdlDeudores.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlDeudores.SelectedValue + ' DdlDeudores.Items.Clear() : DdlDeudores.Items.Add(New ListItem("Seleccione", "0")) + ' DdlDeudores.DataSource = DtCuentasContables : DdlDeudores.DataBind() : DdlDeudores.SelectedValue = Seleccionado + ' DdlDeudores.AutoPostBack = False : DdlDeudores.Attributes.Remove("onclick") : DdlDeudores.CssClass &= " select2me" + ' Case "13" + ' If DdlAcreedores.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlAcreedores.SelectedValue + ' DdlAcreedores.Items.Clear() : DdlAcreedores.Items.Add(New ListItem("Seleccione", "0")) + ' DdlAcreedores.DataSource = DtCuentasContables : DdlAcreedores.DataBind() : DdlAcreedores.SelectedValue = Seleccionado + ' DdlAcreedores.AutoPostBack = False : DdlAcreedores.Attributes.Remove("onclick") : DdlAcreedores.CssClass &= " select2me" + ' Case "14" + ' If DdlDocxPagar.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlDocxPagar.SelectedValue + ' DdlDocxPagar.Items.Clear() : DdlDocxPagar.Items.Add(New ListItem("Seleccione", "0")) + ' DdlDocxPagar.DataSource = DtCuentasContables : DdlDocxPagar.DataBind() : DdlDocxPagar.SelectedValue = Seleccionado + ' DdlDocxPagar.AutoPostBack = False : DdlDocxPagar.Attributes.Remove("onclick") : DdlDocxPagar.CssClass &= " select2me" + ' Case "15" + ' If DdlAnticipoCliente.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlAnticipoCliente.SelectedValue + ' DdlAnticipoCliente.Items.Clear() : DdlAnticipoCliente.Items.Add(New ListItem("Seleccione", "0")) + ' DdlAnticipoCliente.DataSource = DtCuentasContables : DdlAnticipoCliente.DataBind() : DdlAnticipoCliente.SelectedValue = Seleccionado + ' DdlAnticipoCliente.AutoPostBack = False : DdlAnticipoCliente.Attributes.Remove("onclick") : DdlAnticipoCliente.CssClass &= " select2me" + ' Case "16" + ' If DdlAnticipoProveedores.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlAnticipoProveedores.SelectedValue + ' DdlAnticipoProveedores.Items.Clear() : DdlAnticipoProveedores.Items.Add(New ListItem("Seleccione", "0")) + ' DdlAnticipoProveedores.DataSource = DtCuentasContables : DdlAnticipoProveedores.DataBind() : DdlAnticipoProveedores.SelectedValue = Seleccionado + ' DdlAnticipoProveedores.AutoPostBack = False : DdlAnticipoProveedores.Attributes.Remove("onclick") : DdlAnticipoProveedores.CssClass &= " select2me" + ' Case "17" + ' If DdlCaja.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlCaja.SelectedValue + ' DdlCaja.Items.Clear() : DdlCaja.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCaja.DataSource = DtCuentasContables : DdlCaja.DataBind() : DdlCaja.SelectedValue = Seleccionado + ' DdlCaja.AutoPostBack = False : DdlCaja.Attributes.Remove("onclick") : DdlCaja.CssClass &= " select2me" + ' Case "18" + ' If DdlFyE.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlFyE.SelectedValue + ' DdlFyE.Items.Clear() : DdlFyE.Items.Add(New ListItem("Seleccione", "0")) + ' DdlFyE.DataSource = DtCuentasContables : DdlFyE.DataBind() : DdlFyE.SelectedValue = Seleccionado + ' DdlFyE.AutoPostBack = False : DdlFyE.Attributes.Remove("onclick") : DdlFyE.CssClass &= " select2me" + ' Case "19" + ' If DddlCuentaGananciaCambiaria.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DddlCuentaGananciaCambiaria.SelectedValue + ' DddlCuentaGananciaCambiaria.Items.Clear() : DddlCuentaGananciaCambiaria.Items.Add(New ListItem("Seleccione", "0")) + ' DddlCuentaGananciaCambiaria.DataSource = DtCuentasContables : DddlCuentaGananciaCambiaria.DataBind() : DddlCuentaGananciaCambiaria.SelectedValueExist(Seleccionado) + ' DddlCuentaGananciaCambiaria.AutoPostBack = False : DddlCuentaGananciaCambiaria.Attributes.Remove("onclick") : DddlCuentaGananciaCambiaria.CssClass &= " select2me" + ' Case "20" + ' If DdlCuentaPerdidaCambiaria.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlCuentaPerdidaCambiaria.SelectedValue + ' DdlCuentaPerdidaCambiaria.Items.Clear() : DdlCuentaPerdidaCambiaria.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCuentaPerdidaCambiaria.DataSource = DtCuentasContables : DdlCuentaPerdidaCambiaria.DataBind() : DdlCuentaPerdidaCambiaria.SelectedValue = Seleccionado + ' DdlCuentaPerdidaCambiaria.AutoPostBack = False : DdlCuentaPerdidaCambiaria.Attributes.Remove("onclick") : DdlCuentaPerdidaCambiaria.CssClass &= " select2me" + + ' 'CUENTAS PADRES + + ' Case "21" + ' If DdlProveedores.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlProveedores.SelectedValue + ' DdlProveedores.Items.Clear() : DdlProveedores.Items.Add(New ListItem("Seleccione", "0")) + ' DdlProveedores.DataSource = DtCuentasContables : DdlProveedores.DataBind() : DdlProveedores.SelectedValue = Seleccionado + ' DdlProveedores.AutoPostBack = False : DdlProveedores.Attributes.Remove("onclick") : DdlProveedores.CssClass &= " select2me" + ' Case "22" + ' If DdlClientes.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlClientes.SelectedValue + ' DdlClientes.Items.Clear() : DdlClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlClientes.DataSource = DtCuentasContables : DdlClientes.DataBind() : DdlClientes.SelectedValue = Seleccionado + ' DdlClientes.AutoPostBack = False : DdlClientes.Attributes.Remove("onclick") : DdlClientes.CssClass &= " select2me" + ' Case "23" + ' If DdlInventario.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlInventario.SelectedValue + ' DdlInventario.Items.Clear() : DdlInventario.Items.Add(New ListItem("Seleccione", "0")) + ' DdlInventario.DataSource = DtCuentasContables : DdlInventario.DataBind() : DdlInventario.SelectedValue = Seleccionado + ' DdlInventario.AutoPostBack = False : DdlInventario.Attributes.Remove("onclick") : DdlInventario.CssClass &= " select2me" + ' Case "24" + ' If DdlGasto.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlGasto.SelectedValue + ' DdlGasto.Items.Clear() : DdlGasto.Items.Add(New ListItem("Seleccione", "0")) + ' DdlGasto.DataSource = DtCuentasContables : DdlGasto.DataBind() : DdlGasto.SelectedValue = Seleccionado + ' DdlGasto.AutoPostBack = False : DdlGasto.Attributes.Remove("onclick") : DdlGasto.CssClass &= " select2me" + ' Case "25" + ' If DdlBancos.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlBancos.SelectedValue + ' DdlBancos.Items.Clear() : DdlBancos.Items.Add(New ListItem("Seleccione", "0")) + ' DdlBancos.DataSource = DtCuentasContables : DdlBancos.DataBind() : DdlBancos.SelectedValue = Seleccionado + ' DdlBancos.AutoPostBack = False : DdlBancos.Attributes.Remove("onclick") : DdlBancos.CssClass &= " select2me" + ' Case "26" + ' If DdlDeudores.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlDeudores.SelectedValue + ' DdlDeudores.Items.Clear() : DdlDeudores.Items.Add(New ListItem("Seleccione", "0")) + ' DdlDeudores.DataSource = DtCuentasContables : DdlDeudores.DataBind() : DdlDeudores.SelectedValue = Seleccionado + ' DdlDeudores.AutoPostBack = False : DdlDeudores.Attributes.Remove("onclick") : DdlDeudores.CssClass &= " select2me" + ' Case "27" + ' If DdlAcreedores.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlAcreedores.SelectedValue + ' DdlAcreedores.Items.Clear() : DdlAcreedores.Items.Add(New ListItem("Seleccione", "0")) + ' DdlAcreedores.DataSource = DtCuentasContables : DdlAcreedores.DataBind() : DdlAcreedores.SelectedValue = Seleccionado + ' DdlAcreedores.AutoPostBack = False : DdlAcreedores.Attributes.Remove("onclick") : DdlAcreedores.CssClass &= " select2me" + ' Case "28" + ' If DdlDocxPagar.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlDocxPagar.SelectedValue + ' DdlDocxPagar.Items.Clear() : DdlDocxPagar.Items.Add(New ListItem("Seleccione", "0")) + ' DdlDocxPagar.DataSource = DtCuentasContables : DdlDocxPagar.DataBind() : DdlDocxPagar.SelectedValue = Seleccionado + ' DdlDocxPagar.AutoPostBack = False : DdlDocxPagar.Attributes.Remove("onclick") : DdlDocxPagar.CssClass &= " select2me" + ' Case "29" + ' If DdlAnticipoCliente.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlAnticipoCliente.SelectedValue + ' DdlAnticipoCliente.Items.Clear() : DdlAnticipoCliente.Items.Add(New ListItem("Seleccione", "0")) + ' DdlAnticipoCliente.DataSource = DtCuentasContables : DdlAnticipoCliente.DataBind() : DdlAnticipoCliente.SelectedValue = Seleccionado + ' DdlAnticipoCliente.AutoPostBack = False : DdlAnticipoCliente.Attributes.Remove("onclick") : DdlAnticipoCliente.CssClass &= " select2me" + ' Case "30" + ' If DdlAnticipoProveedores.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlAnticipoProveedores.SelectedValue + ' DdlAnticipoProveedores.Items.Clear() : DdlAnticipoProveedores.Items.Add(New ListItem("Seleccione", "0")) + ' DdlAnticipoProveedores.DataSource = DtCuentasContables : DdlAnticipoProveedores.DataBind() : DdlAnticipoProveedores.SelectedValue = Seleccionado + ' DdlAnticipoProveedores.AutoPostBack = False : DdlAnticipoProveedores.Attributes.Remove("onclick") : DdlAnticipoProveedores.CssClass &= " select2me" + ' Case "31" + ' If DdlCaja.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlCaja.SelectedValue + ' DdlCaja.Items.Clear() : DdlCaja.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCaja.DataSource = DtCuentasContables : DdlCaja.DataBind() : DdlCaja.SelectedValue = Seleccionado + ' DdlCaja.AutoPostBack = False : DdlCaja.Attributes.Remove("onclick") : DdlCaja.CssClass &= " select2me" + ' Case "32" + ' If DdlFyE.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlFyE.SelectedValue + ' DdlFyE.Items.Clear() : DdlFyE.Items.Add(New ListItem("Seleccione", "0")) + ' DdlFyE.DataSource = DtCuentasContables : DdlFyE.DataBind() : DdlFyE.SelectedValue = Seleccionado + ' DdlFyE.AutoPostBack = False : DdlFyE.Attributes.Remove("onclick") : DdlFyE.CssClass &= " select2me" + ' Case "33" + ' If DdlActivoFijo.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlActivoFijo.SelectedValue + ' DdlActivoFijo.Items.Clear() : DdlActivoFijo.Items.Add(New ListItem("Seleccione", "0")) + ' DdlActivoFijo.DataSource = DtCuentasContables : DdlActivoFijo.DataBind() : DdlActivoFijo.SelectedValue = Seleccionado + ' DdlActivoFijo.AutoPostBack = False : DdlActivoFijo.Attributes.Remove("onclick") : DdlActivoFijo.CssClass &= " select2me" + ' Case "34" + ' If DdlDSV.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlDSV.SelectedValue + ' DdlDSV.Items.Clear() : DdlDSV.Items.Add(New ListItem("Seleccione", "0")) + ' DdlDSV.DataSource = DtCuentasContables : DdlDSV.DataBind() : DdlDSV.SelectedValue = Seleccionado + ' DdlDSV.AutoPostBack = False : DdlDSV.Attributes.Remove("onclick") : DdlDSV.CssClass &= " select2me" + ' Case "35" + ' If DdlImpuestosLocales.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlImpuestosLocales.SelectedValue + ' DdlImpuestosLocales.Items.Clear() : DdlImpuestosLocales.Items.Add(New ListItem("Seleccione", "0")) + ' DdlImpuestosLocales.DataSource = DtCuentasContables : DdlImpuestosLocales.DataBind() : DdlImpuestosLocales.SelectedValue = Seleccionado + ' DdlImpuestosLocales.AutoPostBack = False : DdlImpuestosLocales.Attributes.Remove("onclick") : DdlImpuestosLocales.CssClass &= " select2me" + + + ' 'IEPS + ' Case "36" + ' If DdlIEPSxAcreditar.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlIEPSxAcreditar.SelectedValue + ' DdlIEPSxAcreditar.Items.Clear() : DdlIEPSxAcreditar.Items.Add(New ListItem("Seleccione", "0")) + ' DdlIEPSxAcreditar.DataSource = DtCuentasContables : DdlIEPSxAcreditar.DataBind() : DdlIEPSxAcreditar.SelectedValue = Seleccionado + ' DdlIEPSxAcreditar.AutoPostBack = False : DdlIEPSxAcreditar.Attributes.Remove("onclick") : DdlIEPSxAcreditar.CssClass &= " select2me" + + ' Case "37" + ' If DdlIEPSAcreditable.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlIEPSAcreditable.SelectedValue + ' DdlIEPSAcreditable.Items.Clear() : DdlIEPSAcreditable.Items.Add(New ListItem("Seleccione", "0")) + ' DdlIEPSAcreditable.DataSource = DtCuentasContables : DdlIEPSAcreditable.DataBind() : DdlIEPSAcreditable.SelectedValue = Seleccionado + ' DdlIEPSAcreditable.AutoPostBack = False : DdlIEPSAcreditable.Attributes.Remove("onclick") : DdlIEPSAcreditable.CssClass &= " select2me" + ' Case "38" + ' If DdlIEPSxTrasladar.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlIEPSxTrasladar.SelectedValue + ' DdlIEPSxTrasladar.Items.Clear() : DdlIEPSxTrasladar.Items.Add(New ListItem("Seleccione", "0")) + ' DdlIEPSxTrasladar.DataSource = DtCuentasContables : DdlIEPSxTrasladar.DataBind() : DdlIEPSxTrasladar.SelectedValue = Seleccionado + ' DdlIEPSxTrasladar.AutoPostBack = False : DdlIEPSxTrasladar.Attributes.Remove("onclick") : DdlIEPSxTrasladar.CssClass &= " select2me" + ' Case "39" + ' If DdlIEPSTrasladado.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlIEPSTrasladado.SelectedValue + ' DdlIEPSTrasladado.Items.Clear() : DdlIEPSTrasladado.Items.Add(New ListItem("Seleccione", "0")) + ' DdlIEPSTrasladado.DataSource = DtCuentasContables : DdlIEPSTrasladado.DataBind() : DdlIEPSTrasladado.SelectedValue = Seleccionado + ' DdlIEPSTrasladado.AutoPostBack = False : DdlIEPSTrasladado.Attributes.Remove("onclick") : DdlIEPSTrasladado.CssClass &= " select2me" + ' Case "40" + ' If DdlCuentaDescuentoVenta.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlCuentaDescuentoVenta.SelectedValue + ' DdlCuentaDescuentoVenta.Items.Clear() : DdlCuentaDescuentoVenta.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCuentaDescuentoVenta.DataSource = DtCuentasContables : DdlCuentaDescuentoVenta.DataBind() : DdlCuentaDescuentoVenta.SelectedValue = Seleccionado + ' DdlCuentaDescuentoVenta.AutoPostBack = False : DdlCuentaDescuentoVenta.Attributes.Remove("onclick") : DdlCuentaDescuentoVenta.CssClass &= " select2me" + ' Case "41" + ' If DdlCuentaOtrosIngresos.Attributes("onclick") <> "" Then CargaCuentasContables() + ' Seleccionado = DdlCuentaOtrosIngresos.SelectedValue + ' DdlCuentaOtrosIngresos.Items.Clear() : DdlCuentaOtrosIngresos.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCuentaOtrosIngresos.DataSource = DtCuentasContables : DdlCuentaOtrosIngresos.DataBind() : DdlCuentaOtrosIngresos.SelectedValue = Seleccionado + ' DdlCuentaOtrosIngresos.AutoPostBack = False : DdlCuentaOtrosIngresos.Attributes.Remove("onclick") : DdlCuentaOtrosIngresos.CssClass &= " select2me" + + + ' ' 'PADRES SIG + ' 'Case "42" + ' ' If DdlProveedoresSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlProveedoresSIG.SelectedValue + ' ' DdlProveedoresSIG.Items.Clear() : DdlProveedoresSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlProveedoresSIG.DataSource = DtCuentasContablesSIG : DdlProveedoresSIG.DataBind() : DdlProveedoresSIG.SelectedValue = Seleccionado + ' ' DdlProveedoresSIG.AutoPostBack = False : DdlProveedoresSIG.Attributes.Remove("onclick") : DdlProveedoresSIG.CssClass &= " select2me" + ' 'Case "43" + ' ' If DdlClientesSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlClientesSIG.SelectedValue + ' ' DdlClientesSIG.Items.Clear() : DdlClientesSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlClientesSIG.DataSource = DtCuentasContablesSIG : DdlClientesSIG.DataBind() : DdlClientesSIG.SelectedValue = Seleccionado + ' ' DdlClientesSIG.AutoPostBack = False : DdlClientesSIG.Attributes.Remove("onclick") : DdlClientesSIG.CssClass &= " select2me" + ' 'Case "44" + ' ' If DdlInventarioSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlInventarioSIG.SelectedValue + ' ' DdlInventarioSIG.Items.Clear() : DdlInventarioSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlInventarioSIG.DataSource = DtCuentasContablesSIG : DdlInventarioSIG.DataBind() : DdlInventarioSIG.SelectedValue = Seleccionado + ' ' DdlInventarioSIG.AutoPostBack = False : DdlInventarioSIG.Attributes.Remove("onclick") : DdlInventarioSIG.CssClass &= " select2me" + ' 'Case "45" + ' ' If DdlGastoSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlGasto.SelectedValue + ' ' DdlGastoSIG.Items.Clear() : DdlGastoSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlGastoSIG.DataSource = DtCuentasContablesSIG : DdlGastoSIG.DataBind() : DdlGastoSIG.SelectedValue = Seleccionado + ' ' DdlGastoSIG.AutoPostBack = False : DdlGastoSIG.Attributes.Remove("onclick") : DdlGastoSIG.CssClass &= " select2me" + ' 'Case "46" + ' ' If DdlBancosSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlBancosSIG.SelectedValue + ' ' DdlBancosSIG.Items.Clear() : DdlBancosSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlBancosSIG.DataSource = DtCuentasContablesSIG : DdlBancosSIG.DataBind() : DdlBancosSIG.SelectedValue = Seleccionado + ' ' DdlBancosSIG.AutoPostBack = False : DdlBancosSIG.Attributes.Remove("onclick") : DdlBancosSIG.CssClass &= " select2me" + ' 'Case "47" + ' ' If DdlDeudoresSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlDeudoresSIG.SelectedValue + ' ' DdlDeudoresSIG.Items.Clear() : DdlDeudoresSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlDeudoresSIG.DataSource = DtCuentasContablesSIG : DdlDeudoresSIG.DataBind() : DdlDeudoresSIG.SelectedValue = Seleccionado + ' ' DdlDeudoresSIG.AutoPostBack = False : DdlDeudoresSIG.Attributes.Remove("onclick") : DdlDeudoresSIG.CssClass &= " select2me" + ' 'Case "48" + ' ' If DdlAcreedoresSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlAcreedoresSIG.SelectedValue + ' ' DdlAcreedoresSIG.Items.Clear() : DdlAcreedoresSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlAcreedoresSIG.DataSource = DtCuentasContablesSIG : DdlAcreedoresSIG.DataBind() : DdlAcreedoresSIG.SelectedValue = Seleccionado + ' ' DdlAcreedoresSIG.AutoPostBack = False : DdlAcreedoresSIG.Attributes.Remove("onclick") : DdlAcreedoresSIG.CssClass &= " select2me" + ' 'Case "49" + ' ' If DdlDocxPagarSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlDocxPagarSIG.SelectedValue + ' ' DdlDocxPagarSIG.Items.Clear() : DdlDocxPagarSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlDocxPagarSIG.DataSource = DtCuentasContablesSIG : DdlDocxPagarSIG.DataBind() : DdlDocxPagarSIG.SelectedValue = Seleccionado + ' ' DdlDocxPagarSIG.AutoPostBack = False : DdlDocxPagarSIG.Attributes.Remove("onclick") : DdlDocxPagarSIG.CssClass &= " select2me" + ' 'Case "50" + ' ' If DdlAnticipoClienteSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlAnticipoClienteSIG.SelectedValue + ' ' DdlAnticipoClienteSIG.Items.Clear() : DdlAnticipoClienteSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlAnticipoClienteSIG.DataSource = DtCuentasContablesSIG : DdlAnticipoClienteSIG.DataBind() : DdlAnticipoClienteSIG.SelectedValue = Seleccionado + ' ' DdlAnticipoClienteSIG.AutoPostBack = False : DdlAnticipoClienteSIG.Attributes.Remove("onclick") : DdlAnticipoClienteSIG.CssClass &= " select2me" + ' 'Case "51" + ' ' If DdlAnticipoProveedoresSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlAnticipoProveedoresSIG.SelectedValue + ' ' DdlAnticipoProveedoresSIG.Items.Clear() : DdlAnticipoProveedoresSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlAnticipoProveedoresSIG.DataSource = DtCuentasContablesSIG : DdlAnticipoProveedoresSIG.DataBind() : DdlAnticipoProveedoresSIG.SelectedValue = Seleccionado + ' ' DdlAnticipoProveedoresSIG.AutoPostBack = False : DdlAnticipoProveedoresSIG.Attributes.Remove("onclick") : DdlAnticipoProveedoresSIG.CssClass &= " select2me" + ' 'Case "52" + ' ' If DdlCajaSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlCajaSIG.SelectedValue + ' ' DdlCajaSIG.Items.Clear() : DdlCajaSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlCajaSIG.DataSource = DtCuentasContablesSIG : DdlCajaSIG.DataBind() : DdlCajaSIG.SelectedValue = Seleccionado + ' ' DdlCajaSIG.AutoPostBack = False : DdlCajaSIG.Attributes.Remove("onclick") : DdlCajaSIG.CssClass &= " select2me" + ' 'Case "53" + ' ' If DdlFyESIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlFyESIG.SelectedValue + ' ' DdlFyESIG.Items.Clear() : DdlFyESIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlFyESIG.DataSource = DtCuentasContablesSIG : DdlFyESIG.DataBind() : DdlFyESIG.SelectedValue = Seleccionado + ' ' DdlFyESIG.AutoPostBack = False : DdlFyESIG.Attributes.Remove("onclick") : DdlFyESIG.CssClass &= " select2me" + ' 'Case "54" + ' ' If DdlActivoFijoSIG.Attributes("onclick") <> "" Then CargaCuentasContablesSIG() + ' ' Seleccionado = DdlActivoFijoSIG.SelectedValue + ' ' DdlActivoFijoSIG.Items.Clear() : DdlActivoFijoSIG.Items.Add(New ListItem("Seleccione", "0")) + ' ' DdlActivoFijoSIG.DataSource = DtCuentasContablesSIG : DdlActivoFijoSIG.DataBind() : DdlActivoFijoSIG.SelectedValue = Seleccionado + ' ' DdlActivoFijoSIG.AutoPostBack = False : DdlActivoFijoSIG.Attributes.Remove("onclick") : DdlActivoFijoSIG.CssClass &= " select2me" + + + ' End Select + + 'End Sub + 'Public Sub CargaDDLs() + ' DdlIVAxAcreditar.AutoPostBack = True + ' DdlIVAAcreditable.AutoPostBack = True + ' DdlIVAxTrasladar.AutoPostBack = True + ' DdlIVATrasladado.AutoPostBack = True + ' DdlIVARetenciones.AutoPostBack = True + ' DdlISRCirculacion.AutoPostBack = True + ' DdlProveedores.AutoPostBack = True + ' DdlClientes.AutoPostBack = True + ' DdlInventario.AutoPostBack = True + ' DdlGasto.AutoPostBack = True + ' DdlBancos.AutoPostBack = True + ' DdlDeudores.AutoPostBack = True + ' DdlAcreedores.AutoPostBack = True + ' DdlDocxPagar.AutoPostBack = True + ' DdlAnticipoCliente.AutoPostBack = True + ' DdlAnticipoProveedores.AutoPostBack = True + ' DdlCaja.AutoPostBack = True + ' DdlFyE.AutoPostBack = True + ' DddlCuentaGananciaCambiaria.AutoPostBack = True + ' DdlCuentaPerdidaCambiaria.AutoPostBack = True + ' DdlActivoFijo.AutoPostBack = True + ' DdlIEPSxAcreditar.AutoPostBack = True + ' DdlIEPSAcreditable.AutoPostBack = True + ' DdlIEPSxTrasladar.AutoPostBack = True + ' DdlIEPSTrasladado.AutoPostBack = True + ' DdlCuentaDescuentoVenta.AutoPostBack = True + ' DdlCuentaOtrosIngresos.AutoPostBack = True + + ' ''CUENTAS PADRES SIG + ' 'DdlProveedoresSIG.AutoPostBack = True + ' 'DdlClientesSIG.AutoPostBack = True + ' 'DdlInventarioSIG.AutoPostBack = True + ' 'DdlGastoSIG.AutoPostBack = True + ' 'DdlBancosSIG.AutoPostBack = True + ' 'DdlDeudoresSIG.AutoPostBack = True + ' 'DdlAcreedoresSIG.AutoPostBack = True + ' 'DdlDocxPagarSIG.AutoPostBack = True + ' 'DdlAnticipoClienteSIG.AutoPostBack = True + ' 'DdlAnticipoProveedoresSIG.AutoPostBack = True + ' 'DdlCajaSIG.AutoPostBack = True + ' 'DdlFyESIG.AutoPostBack = True + ' 'DdlActivoFijoSIG.AutoPostBack = True + + + ' DdlIVAxAcreditar.Attributes.Add("onclick", "CargaCuentas(1);") + ' DdlIVAAcreditable.Attributes.Add("onclick", "CargaCuentas(2);") + ' DdlIVAxTrasladar.Attributes.Add("onclick", "CargaCuentas(3);") + ' DdlIVATrasladado.Attributes.Add("onclick", "CargaCuentas(4);") + ' DdlIVARetenciones.Attributes.Add("onclick", "CargaCuentas(5);") + ' DdlISRCirculacion.Attributes.Add("onclick", "CargaCuentas(6);") + ' DdlProveedores.Attributes.Add("onclick", "CargaCuentas(7);") + ' DdlClientes.Attributes.Add("onclick", "CargaCuentas(8);") + ' DdlInventario.Attributes.Add("onclick", "CargaCuentas(9);") + ' DdlGasto.Attributes.Add("onclick", "CargaCuentas(10);") + ' DdlBancos.Attributes.Add("onclick", "CargaCuentas(11);") + ' DdlDeudores.Attributes.Add("onclick", "CargaCuentas(12);") + ' DdlAcreedores.Attributes.Add("onclick", "CargaCuentas(13);") + ' DdlDocxPagar.Attributes.Add("onclick", "CargaCuentas(14);") + ' DdlAnticipoCliente.Attributes.Add("onclick", "CargaCuentas(15);") + ' DdlAnticipoProveedores.Attributes.Add("onclick", "CargaCuentas(16);") + ' DdlCaja.Attributes.Add("onclick", "CargaCuentas(17);") + ' DdlFyE.Attributes.Add("onclick", "CargaCuentas(18);") + ' DddlCuentaGananciaCambiaria.Attributes.Add("onclick", "CargaCuentas(19);") + ' DdlCuentaPerdidaCambiaria.Attributes.Add("onclick", "CargaCuentas(20);") + ' DdlActivoFijo.Attributes.Add("onclick", "CargaCuentas(33);") + ' DdlDSV.Attributes.Add("onclick", "CargaCuentas(34);") + ' DdlImpuestosLocales.Attributes.Add("onclick", "CargaCuentas(35);") + ' DdlIEPSxAcreditar.Attributes.Add("onclick", "CargaCuentas(36);") + ' DdlIEPSAcreditable.Attributes.Add("onclick", "CargaCuentas(37);") + ' DdlIEPSxTrasladar.Attributes.Add("onclick", "CargaCuentas(38);") + ' DdlIEPSTrasladado.Attributes.Add("onclick", "CargaCuentas(39);") + ' DdlCuentaDescuentoVenta.Attributes.Add("onclick", "CargaCuentas(40);") + ' DdlCuentaOtrosIngresos.Attributes.Add("onclick", "CargaCuentas(41);") + + ' ''CUENTAS PADRES + ' 'DdlProveedoresSIG.Attributes.Add("onclick", "CargaCuentas(42);") + ' 'DdlClientesSIG.Attributes.Add("onclick", "CargaCuentas(43);") + ' 'DdlInventarioSIG.Attributes.Add("onclick", "CargaCuentas(44);") + ' 'DdlGastoSIG.Attributes.Add("onclick", "CargaCuentas(45);") + ' 'DdlBancosSIG.Attributes.Add("onclick", "CargaCuentas(46);") + ' 'DdlDeudoresSIG.Attributes.Add("onclick", "CargaCuentas(47);") + ' 'DdlAcreedoresSIG.Attributes.Add("onclick", "CargaCuentas(48);") + ' 'DdlDocxPagarSIG.Attributes.Add("onclick", "CargaCuentas(49);") + ' 'DdlAnticipoClienteSIG.Attributes.Add("onclick", "CargaCuentas(50);") + ' 'DdlAnticipoProveedoresSIG.Attributes.Add("onclick", "CargaCuentas(51);") + ' 'DdlCajaSIG.Attributes.Add("onclick", "CargaCuentas(52);") + ' 'DdlFyESIG.Attributes.Add("onclick", "CargaCuentas(53);") + ' 'DdlActivoFijoSIG.Attributes.Add("onclick", "CargaCuentas(54);") + + ' UpDatos.Update() + + 'End Sub + Public Sub CargaFuncionalidad(CveFuncionalidad As Integer, ByRef Ddl As DropDownList) + Dim Dr As DataRow = DtFuncionalidades.FiltroPrimero($"CveFuncionalidad = {CveFuncionalidad}") + If Dr IsNot Nothing Then + Dim DrC As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id = {0} ", Dr("Valor").ToString)) + If Not IsNothing(DrC) Then + Ddl.Items.Add(New ListItem(DrC("CtaCodigo").ToString, Dr("Valor").ToString)) + End If + Ddl.SelectedValue = Dr("Valor").ToString + End If + + + End Sub + Private Sub CargaDdlPac() + Dim Objeto As New ClsSisEmpresas + If Objeto.GetPacs() Then + 'DdlCvePac.DataSource = Objeto.DtResultados + 'DdlCvePac.DataBind() + 'DdlCvePac.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + Objeto.Dispose() + End Sub + Private Sub CargaRegimenFiscal() + Dim ObjSis As New ClsSisEmpresas + If ObjSis.GetRegimenFiscal(-1) Then + DdlRegimen.DataSource = ObjSis.DtResultados + DdlRegimen.DataBind() + DdlRegimen.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + ObjSis.Dispose() + End Sub + + + + '#Region "TAB - INDICADORES " + ' Public Sub CargaGridIndicadores() + ' Dim Objeto As New ClsIndicadores + ' If Objeto.GetEmpresasIndicadores(UsuarioActual.CveEmpresa) Then + ' GvIndicadores.DataSource = Objeto.DtResultados + ' End If + ' GvIndicadores.DataBind() + ' Objeto.Dispose() + ' End Sub + + ' Private Sub GvIndicadores_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvIndicadores.RowDataBound + ' If e.Row.RowType = DataControlRowType.DataRow Then + ' If e.Row.DBCampo("CveEmpresa") <> "" Then + ' e.Row.FCCheckBox("chkIndicador").Checked = True + ' End If + ' End If + ' End Sub + + + + '#End Region + +#Region "P L A N T I L L A C O R R E O" + + Private Sub BtnGuardarPlantilla_Click(sender As Object, e As EventArgs) Handles BtnGuardarPlantilla.Click + If UsuarioActual.Empresa.PlantillaMailVenta.Length > 0 Then + + End If + Dim ObjEmpresa As New ClsSisEmpresas() + If ObjEmpresa.UpdatePlantillaMail("AsuntoPlantillaMailVenta", TxtAsunto.Text.Trim, "PlantillaMailVenta", TxtPlantillaVenta.Text.Trim, UsuarioActual.CveEmpresa) Then + + If ObjEmpresa.UpdatePlantillaMail("AsuntoPlantillaMailVentaCotizacion", TxtAsuntoCotizacion.Text.Trim, "PlantillaMailVentaCotizacion", TxtPlantillaCotizacion.Text.Trim, UsuarioActual.CveEmpresa) Then + + End If + Alert("La plantilla de mail de ventas se guardó correctamente.", TipoMensaje.MsgInformacion) + + UsuarioActual.Empresa.PlantillaMailVenta = TxtPlantillaVenta.Text.Trim + UsuarioActual.Empresa.AsuntoPlantillaMailVenta = TxtAsunto.Text.Trim + + UsuarioActual.Empresa.AsuntoPlantillaMailVentaCotizacion = TxtPlantillaCotizacion.Text.Trim + UsuarioActual.Empresa.PlantillaMailVentaCotizacion = TxtAsuntoCotizacion.Text.Trim + + 'TxtPlantillaVenta.Text = "" + 'TxtAsunto.Text = "" + End If + ObjEmpresa.Dispose() + Alert(TxtPlantillaVenta.Text.Trim, TipoMensaje.MsgInformacion) + End Sub + + +#End Region + +#Region "TAB CONTABILIDAD - CLASIFICACION DE IVA" + Private Sub ActualizaNombresCuentas() + + + + For Each Dr As DataRow In DtClasificacionIVA.Rows + If Dr("IdCtaIVAXAcreditar").ToString.ToEntero > 0 Then + 'Dr("CuentaXAcreditar") = DtCuentas.FiltraParametros($"Id = {Dr("IdCtaIVAXAcreditar").ToString}").Rows(0)("CtaCodigo").ToString + Dr("CuentaXAcreditar") = DtCuentas.FiltroPrimeroValor("CtaCodigo", $"Id = {Dr("IdCtaIVAXAcreditar").ToString}").ToString.ToEntero + End If + If Dr("IdCtaIVAAcreditable").ToString.ToEntero > 0 Then + 'Dr("CuentaAcreditable") = DtCuentas.FiltraParametros($"Id = {Dr("IdCtaIVAAcreditable").ToString}").Rows(0)("CtaCodigo").ToString + Dr("CuentaAcreditable") = DtCuentas.FiltroPrimeroValor("CtaCodigo", $"Id = {Dr("IdCtaIVAAcreditable").ToString}").ToString.ToEntero + End If + If Dr("IdCtaIVAXTrasladar").ToString.ToEntero > 0 Then + 'Dr("CuentaXTrasladar") = DtCuentas.FiltraParametros($"Id = {Dr("IdCtaIVAXTrasladar").ToString}").Rows(0)("CtaCodigo").ToString + Dr("CuentaXTrasladar") = DtCuentas.FiltroPrimeroValor("CtaCodigo", $"Id = {Dr("IdCtaIVAXTrasladar").ToString}").ToString.ToEntero + End If + If Dr("IdCtaIVATrasladado").ToString.ToEntero > 0 Then + 'Dr("CuentaTrasladado") = DtCuentas.FiltraParametros($"Id = {Dr("IdCtaIVATrasladado").ToString}").Rows(0)("CtaCodigo").ToString + Dr("CuentaTrasladado") = DtCuentas.FiltroPrimeroValor("CtaCodigo", $"Id = {Dr("IdCtaIVATrasladado").ToString}").ToString.ToEntero + End If + Next + DtClasificacionIVA.AcceptChanges() + End Sub + 'Private Sub InicializaClasificacionIVA(ObjEmpresas As ClsSisEmpresas) + ' CreaDtClasificacionIVA() + ' CargaCuentasIVA(ObjEmpresas) + ' CargaClasificaciones() + ' CargaClasificacionesIVA() + 'End Sub + 'Private Sub CargaClasificacionesIVA() + ' Dim ObjGral As New ClsGenerales + ' If ObjGral.GetClasificacionPorcentaje(UsuarioActual.CveEmpresa, Opcion:=2) Then + ' DtClasificacionIVA = ObjGral.DtResultados.Copy + ' ActualizaNombresCuentas() + ' GvClasificacionIVA.DataSource = DtClasificacionIVA + ' End If + ' ObjGral.Dispose() + ' GvClasificacionIVA.DataBind() + ' UpClasificacionIVA.Update() + 'End Sub + 'Private Sub CargaClasificaciones() + ' DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + ' DdlClasificacion.DataBind() + ' DdlClasificacion.Items.Insert(0, New ListItem("-", "-1")) + 'End Sub + 'Private Sub CreaDtClasificacionIVA() + ' DtClasificacionIVA = New DataTable + ' DtClasificacionIVA.Columns.Add("CveClasificacionPorcentaje", GetType(Integer)) + ' DtClasificacionIVA.Columns.Add("CveClasificacion", GetType(Integer)) + ' DtClasificacionIVA.Columns.Add("Clasificacion", GetType(String)) + ' DtClasificacionIVA.Columns.Add("PorcentajeIVA", GetType(Double)) + ' DtClasificacionIVA.Columns.Add("CuentaXAcreditar", GetType(String)) + ' DtClasificacionIVA.Columns.Add("IdCtaIVAXAcreditar", GetType(Integer)) + ' DtClasificacionIVA.Columns.Add("CuentaAcreditable", GetType(String)) + ' DtClasificacionIVA.Columns.Add("IdCtaIVAAcreditable", GetType(Integer)) + ' DtClasificacionIVA.Columns.Add("CuentaXTrasladar", GetType(String)) + ' DtClasificacionIVA.Columns.Add("IdCtaIVAXTrasladar", GetType(Integer)) + ' DtClasificacionIVA.Columns.Add("CuentaTrasladado", GetType(String)) + ' DtClasificacionIVA.Columns.Add("IdCtaIVATrasladado", GetType(Integer)) + 'End Sub + 'Private Sub CargaCuentasIVA(ByRef ObjEmpresas As ClsSisEmpresas) + + ' If ObjEmpresas.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then + ' If ObjEmpresas.Empresa.UsaContabilidad And ObjEmpresas.Empresa.TipoContabilidad = 2 Then + + ' 'If ObjEmpresas.Empresa.TipoContabilidad = 2 Then + ' Dim Cuenta As New ClsContPAQi(ObjEmpresas.Empresa) + ' If Cuenta.GetCuentas(-1, "-1", -1) Then + ' DtCuentas = Cuenta.DtResultados + ' End If + ' Cuenta.Dispose() + ' 'End If + + ' Try + ' DdlIVAXAcreditarModal.DataSource = DtCuentas : DdlIVAXAcreditarModal.DataBind() + ' Catch ex As Exception + ' End Try + ' Try + ' DdlIVAAcreditableModal.DataSource = DtCuentas : DdlIVAAcreditableModal.DataBind() + ' Catch ex As Exception + ' End Try + ' Try + ' DdlIVAXTrasladarModal.DataSource = DtCuentas : DdlIVAXTrasladarModal.DataBind() + ' Catch ex As Exception + ' End Try + ' Try + ' DdlIVATrasladadoModal.DataSource = DtCuentas : DdlIVATrasladadoModal.DataBind() + ' Catch ex As Exception + ' End Try + ' End If + + + ' End If + + ' 'ObjEmpresas.Dispose() + ' DdlIVAXAcreditarModal.Items.Insert(0, New ListItem("-", "-1")) + ' DdlIVAAcreditableModal.Items.Insert(0, New ListItem("-", "-1")) + ' DdlIVAXTrasladarModal.Items.Insert(0, New ListItem("-", "-1")) + ' DdlIVATrasladadoModal.Items.Insert(0, New ListItem("-", "-1")) + 'End Sub + 'Protected Sub LnkEliminarClasificacionIVA_Click(sender As Object, e As EventArgs) + ' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + ' If DtClasificacionIVA.Rows(gvRow.RowIndex)("CveClasificacionPorcentaje").ToString.ToEntero = 0 Then + ' DtClasificacionIVA.Rows(gvRow.RowIndex).Delete() + ' Else + ' DtClasificacionIVA.Rows(gvRow.RowIndex)("CveClasificacion") = -1 + ' End If + ' DtClasificacionIVA.AcceptChanges() + ' GvClasificacionIVA.DataSource = DtClasificacionIVA + ' GvClasificacionIVA.DataBind() + ' UpClasificacionIVA.Update() + 'End Sub + 'Protected Sub LnkAgregarClasificacionIVA_Click(sender As Object, e As EventArgs) + ' LimpiaClasificacionIVA() + ' Modalidad = "A" + ' RegistraScript("$('#DModalClasificacionIVA').modal()") + ' UpModalClasificacionIVA.Update() + 'End Sub + 'Protected Sub LnkEditarClasificacionIVA_Click(sender As Object, e As EventArgs) + ' LimpiaClasificacionIVA() + ' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + ' Modalidad = "U" + ' Index = gvRow.RowIndex + ' CveClasificacionPorcentaje = gvRow.DataKey("CveClasificacionPorcentaje").ToEntero() + ' DdlClasificacion.SelectedValueExist(gvRow.DataKey("CveClasificacion")) + ' TxtPorcentajeIVA.Text = gvRow.DataKey("PorcentajeIVA") + ' DdlIVAXAcreditarModal.SelectedValueExist(gvRow.DataKey("IdCtaIVAXAcreditar")) + ' DdlIVAAcreditableModal.SelectedValueExist(gvRow.DataKey("IdCtaIVAAcreditable")) + ' DdlIVAXTrasladarModal.SelectedValueExist(gvRow.DataKey("IdCtaIVAXTrasladar")) + ' DdlIVATrasladadoModal.SelectedValueExist(gvRow.DataKey("IdCtaIVATrasladado")) + ' RegistraScript("$('#DModalClasificacionIVA').modal()") + ' UpModalClasificacionIVA.Update() + 'End Sub + + 'Private Sub LimpiaClasificacionIVA() + ' TxtPorcentajeIVA.Text = "" + ' DdlClasificacion.SelectedIndex = 0 + ' DdlIVAXAcreditarModal.SelectedIndex = 0 + ' DdlIVAAcreditableModal.SelectedIndex = 0 + ' DdlIVAXTrasladarModal.SelectedIndex = 0 + ' DdlIVATrasladadoModal.SelectedIndex = 0 + ' UpModalClasificacionIVA.Update() + 'End Sub + + 'Protected Sub BtnClasificacionIVA_Click(sender As Object, e As EventArgs) + ' If Modalidad = "A" Then + ' Dim Row As DataRow = DtClasificacionIVA.NewRow() + ' Row("CveClasificacionPorcentaje") = 0 + ' Row("CveClasificacion") = DdlClasificacion.SelectedValue.ToEntero + ' Row("Clasificacion") = DdlClasificacion.SelectedItem.Text + ' Row("PorcentajeIVA") = TxtPorcentajeIVA.Text.ToDouble + ' Row("CuentaXAcreditar") = DdlIVAXAcreditarModal.SelectedItem.Text + ' Row("IdCtaIVAXAcreditar") = DdlIVAXAcreditarModal.SelectedValue.ToEntero + ' Row("CuentaAcreditable") = DdlIVAAcreditableModal.SelectedItem.Text + ' Row("IdCtaIVAAcreditable") = DdlIVAAcreditableModal.SelectedValue.ToEntero + ' Row("CuentaXTrasladar") = DdlIVAXTrasladarModal.SelectedItem.Text + ' Row("IdCtaIVAXTrasladar") = DdlIVAXTrasladarModal.SelectedValue.ToEntero + ' Row("CuentaTrasladado") = DdlIVATrasladadoModal.SelectedItem.Text + ' Row("IdCtaIVATrasladado") = DdlIVATrasladadoModal.SelectedValue.ToEntero + ' DtClasificacionIVA.Rows.InsertAt(Row, DtClasificacionIVA.Rows.Count) + ' ElseIf Modalidad = "U" Then + ' DtClasificacionIVA.Rows(Index)("CveClasificacion") = DdlClasificacion.SelectedValue.ToEntero + ' DtClasificacionIVA.Rows(Index)("Clasificacion") = DdlClasificacion.SelectedItem.Text + ' DtClasificacionIVA.Rows(Index)("PorcentajeIVA") = TxtPorcentajeIVA.Text.ToDouble + ' DtClasificacionIVA.Rows(Index)("CuentaXAcreditar") = DdlIVAXAcreditarModal.SelectedItem.Text + ' DtClasificacionIVA.Rows(Index)("IdCtaIVAXAcreditar") = DdlIVAXAcreditarModal.SelectedValue.ToEntero + ' DtClasificacionIVA.Rows(Index)("CuentaAcreditable") = DdlIVAAcreditableModal.SelectedItem.Text + ' DtClasificacionIVA.Rows(Index)("IdCtaIVAAcreditable") = DdlIVAAcreditableModal.SelectedValue.ToEntero + ' DtClasificacionIVA.Rows(Index)("CuentaXTrasladar") = DdlIVAXTrasladarModal.SelectedItem.Text + ' DtClasificacionIVA.Rows(Index)("IdCtaIVAXTrasladar") = DdlIVAXTrasladarModal.SelectedValue.ToEntero + ' DtClasificacionIVA.Rows(Index)("CuentaTrasladado") = DdlIVATrasladadoModal.SelectedItem.Text + ' DtClasificacionIVA.Rows(Index)("IdCtaIVATrasladado") = DdlIVATrasladadoModal.SelectedValue.ToEntero + ' End If + ' DtClasificacionIVA.AcceptChanges() + ' ActualizaNombresCuentas() + ' GvClasificacionIVA.DataSource = DtClasificacionIVA + ' GvClasificacionIVA.DataBind() + ' UpClasificacionIVA.Update() + ' RegistraScript("$('#DModalClasificacionIVA').modal('hide')") + 'End Sub + + 'Protected Sub GvClasificacionIVA_RowDataBound(sender As Object, e As GridViewRowEventArgs) + ' If e.Row.RowType = DataControlRowType.DataRow Then + ' If Not e.Row.DBCampo("CveClasificacion").ToEntero > 0 Then + ' e.Row.Visible = False + ' End If + ' End If + 'End Sub + +#End Region + + + + + 'Protected Sub LnkOpenModalDatosFiel_Click(sender As Object, e As EventArgs) + ' TxtFielPass.Text = "" + ' TxtFielArchivoCER.Text = "" + ' TxtFielArchivoKey.Text = "" + ' RegistraScript("$('#ModalUpFiel').modal();") + 'End Sub + + 'Protected Sub LnkUpDatosFiel_Click(sender As Object, e As EventArgs) + ' Dim Password As String = TxtFielPass.Text + ' Dim akey As String + ' Dim acer As String + ' Dim pemkey As String + ' Dim pemcer As String + ' Dim pfxname As String + ' Dim Archivopfx As String + ' Dim Archivokey As Archivo = Nothing + ' Dim Archivocer As Archivo = Nothing + + ' Dim dirbase = "" + ' Dim dirbasepfx = "" + ' If EmpresaEditar IsNot Nothing Then + ' dirbase = String.Format("{0}Certificados\Fiel\", EmpresaEditar.Ruta) + ' dirbasepfx = String.Format("{0}Certificados\", EmpresaEditar.Ruta) + ' Else + ' dirbase = String.Format("{0}Empresas\{1}\Certificados\Fiel\", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) + ' dirbasepfx = String.Format("{0}Empresas\{1}\Certificados\", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa) + ' End If + + ' If (Not Directory.Exists(dirbase)) Then + ' Directory.CreateDirectory(dirbase) + ' End If + + ' Dim Filesgral As List(Of Archivo) = TxtFielArchivoCER.getfiles().Archivos + ' If Filesgral.Count > 0 Then + ' Archivocer = Filesgral(0) + ' End If + ' Filesgral = TxtFielArchivoKey.getfiles().Archivos + ' If Filesgral.Count > 0 Then + ' Archivokey = Filesgral(0) + ' End If + ' If Not IsNothing(Archivokey) AndAlso Not IsNothing(Archivocer) And Password.Length > 0 Then + ' akey = String.Format("{0}{1}", dirbase, Archivokey.filenameO) + ' If File.Exists(akey) Then + ' File.Delete(akey) + ' End If + ' File.Copy(Archivokey.FileUrl, akey) + ' acer = String.Format("{0}{1}", dirbase, Archivocer.filenameO) + ' If File.Exists(acer) Then + ' File.Delete(acer) + ' End If + ' File.Copy(Archivocer.FileUrl, acer) + ' Archivopfx = Archivokey.filenameO.Substring(0, Archivokey.filenameO.Length - 4) + ' pemkey = String.Format("{0}{1}.pem", dirbase, Archivopfx) + ' pfxname = String.Format("{0}{1}.pfx", dirbasepfx, Archivopfx) + ' pemcer = String.Format("{0}{1}.pem", dirbase, Archivokey.filenameO.Substring(0, Archivocer.filenameO.Length - 4)) + + ' If File.Exists(pemkey) Then + ' File.Delete(pemkey) + ' End If + + ' If File.Exists(pfxname) Then + ' File.Delete(pfxname) + ' End If + + ' If File.Exists(pemcer) Then + ' File.Delete(pemcer) + ' End If + + ' Dim resultado As New StringBuilder + ' resultado.AppendLine("
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/CatClasificaciones.aspx b/Ventas/CatClasificaciones.aspx index 97ef17863..64d68ffe9 100644 --- a/Ventas/CatClasificaciones.aspx +++ b/Ventas/CatClasificaciones.aspx @@ -76,7 +76,7 @@
+ DataKeyNames="CveClasificacion, CveCategoria, Clasificacion, UsoClasificacion, CuentaGasto, CuentaCostos, CuentaIngresos, IdCuentaGasto, IdCuentaCostos, IdCuentaIngresos,RequiereSerieLote,CveSATPS,SATClaveProductoServicio, RequiereAFCompra, RequiereAFInsumo, RequierePersonal, Estatus,EsAcumulador,TopVentas,TopCompras,PrecioBaseCosto,CveCuentaAsignacionGasto, CveCuentaGasto" EmptyDataText="No se encontraron Clasificaciones Registradas" ToolTip="Listado de Clasificaciones" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None"> @@ -233,13 +233,13 @@
-
+
-
+
diff --git a/Ventas/CatClasificaciones.aspx.vb b/Ventas/CatClasificaciones.aspx.vb index 3bf583f94..fe7b3af49 100644 --- a/Ventas/CatClasificaciones.aspx.vb +++ b/Ventas/CatClasificaciones.aspx.vb @@ -109,25 +109,15 @@ Partial Class CatClasificaciones End If UpModalClasif.Update() - If UsuarioActual.Empresa.TipoContabilizacion = 1 Then - ''COMENTADO DF 30 JUNIO 2017 - 'Dim Cuenta As New ClsContPAQi(UsuarioActual.Empresa) - 'If Cuenta.GetCuentas(-1, "-1", 1, 20000) Then - ' DtCuentas = Cuenta.DtResultados - 'End If - 'Cuenta.Dispose() - Else - If UsuarioActual.Empresa.TipoContabilidad = 2 Then - DivCuentaIngresos.Visible = False - DivCuentaCostos.Visible = False - DivCuentaGasto.Visible = False - - GvDatos.Columns(1).Visible = False - GvDatos.Columns(2).Visible = False - GvDatos.Columns(3).Visible = False - End If + If UsuarioActual.Empresa.TipoContabilidad = 1 Then + DivCuentaIngresos.Visible = False + DivCuentaCostos.Visible = False + 'DivCuentaGasto.Visible = False + ' GvDatos.Columns(1).Visible = False + GvDatos.Columns(2).Visible = False + GvDatos.Columns(3).Visible = False End If DdlCuentaGasto.Items.Insert(0, New ListItem("-", "-1")) @@ -174,6 +164,7 @@ Partial Class CatClasificaciones If DdlCuentaCostos.SelectedValue.ToEntero > 0 Then objConta.AddCuentasAsignaciones(69, UsuarioActual.CveEmpresa, DdlCuentaCostos.SelectedValue.ToEntero, CveClasificacion:=ObjClasificaciones.CveClasificacion) If DdlCuentaIngresos.SelectedValue.ToEntero > 0 Then objConta.AddCuentasAsignaciones(4, UsuarioActual.CveEmpresa, DdlCuentaIngresos.SelectedValue.ToEntero, CveClasificacion:=ObjClasificaciones.CveClasificacion) End If + ObjClasificaciones.Commit() TxtClasificacion.Text = "" TxtPrecioBaseCosto.Text = "" DdlCuentaGasto.SelectedValueExist("0") @@ -181,6 +172,9 @@ Partial Class CatClasificaciones DdlCuentaIngresos.SelectedValueExist("0") RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalClasificaciones")) Alert("La nueva Clasificación se guardó correctamente.", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrió un error al agregar la clasificación. Por favor vuelva a intentar.", TipoMensaje.MsgError) + ObjClasificaciones.RollBack() End If ElseIf HdnModalidadClasificacion.Value = "U" Then @@ -226,14 +220,12 @@ Partial Class CatClasificaciones DdlCuentaGasto.DataValueField = "CveCuenta" DdlCuentaGasto.DataTextField = "Cuenta" - Dim ObjContabilidad As New ClsContabilidad - If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then - DtCuentasContables = ObjContabilidad.DtResultados - 'Cuenta, CtaCodigo - DtCuentasContables.Columns("CtaCodigo").ColumnName = "Cuenta" - End If - ObjContabilidad.Dispose() - ElseIf UsuarioActual.Empresa.TipoContabilidad = 1 Then + + DtCuentasContables = GlobalDTContaCuentasContables(UsuarioActual.CveEmpresa, Afectable:=1) + 'Cuenta, CtaCodigo + DtCuentasContables.Columns("CtaCodigo").ColumnName = "Cuenta" + + ElseIf UsuarioActual.Empresa.TipoContabilidad = 2 Then Dim ObjEmpresa As New ClsSisEmpresas Dim Empresa As Empresa = Nothing @@ -319,7 +311,7 @@ Partial Class CatClasificaciones If e.Row.DBCampo("CuentaIngresos") = "Seleccione" Or e.Row.DBCampo("CuentaIngresos") = "" Then e.Row.FCLabel("LtlCuentaIngresos").Text = "-" e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - If UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.CveEmpresa.Contiene(13, 83) Then e.Row.FCLabel("LtlClasificacion").Text = String.Format("{1}", e.Row.DBCampo("CveClasificacion"), e.Row.DBCampo("Clasificacion")) End If @@ -328,18 +320,15 @@ Partial Class CatClasificaciones Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting Dim ObjClasificaciones As New ClsClasificaciones - If ObjClasificaciones.RemoveClasificacion(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then GvDatos.EditIndex = -1 - ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) GlobalDTClasificaciones(UsuarioActual.CveEmpresa) = Nothing + CargaDatos() Alert("La Clasificación se eliminó correctamente.", TipoMensaje.MsgInformacion) Else Alert("Ocurrió un error al eliminar la clasificación. Por favor vuelva a intentar.", TipoMensaje.MsgError) End If - ObjClasificaciones.Dispose() - CargaGrid() End Sub @@ -420,7 +409,14 @@ Partial Class CatClasificaciones If CuentaGasto.Length > 1 And CargaGastos Then DdlCuentaGasto.Items.Insert(0, New ListItem(CuentaGasto, CveCuentaGastoActual.ToString)) DdlCuentaGasto.SelectedIndex = 0 - CargaGastos = False + + If UsuarioActual.Empresa.TipoContabilidad = 1 Then + DdlCuentaGasto.Items.Clear() : DdlCuentaGasto.Items.Add(New ListItem("-", "-1")) + 'DdlCuentaGasto.Text = "" + DdlCuentaGasto.DataSource = GlobalDTContaCuentasContables(UsuarioActual.CveEmpresa, Afectable:=1) : DdlCuentaGasto.DataBind() + DdlCuentaGasto.SelectedValueExist(GvRow.DataKey("CveCuentaGasto")) + End If + Else DdlCuentaGasto.SelectedValueExist(CveCuentaGastoActual) End If diff --git a/Ventas/FacturacionAcarreos.aspx.vb b/Ventas/FacturacionAcarreos.aspx.vb index 550ef5cf8..586a7d3df 100644 --- a/Ventas/FacturacionAcarreos.aspx.vb +++ b/Ventas/FacturacionAcarreos.aspx.vb @@ -107,23 +107,37 @@ Partial Class Ventas_FacturacionAcarreos ObjVentas.IniciaTransacSQL() Dim TieneError As Boolean = False Try - Dim DtPS As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + If dt.Rows.Count = 0 Then + TieneError = True + MsgFacturacionAcarreos.Append("No hay datos para procesar") + RowsNoCargados += 1 + End If + For Each row As DataRow In dt.Rows - Dim msg As String = ObjVentas.AddFacturacionAcarreos(row("Sucursal").ToString(), row("RFC").ToString(), row("Cantidad").ToString().ToDecimal(), row("ProductoGeneral").ToString(), - row("Origen").ToString(), row("Destino").ToString(), row("FechaSalida").ToString().ToDateTime(), row("FechaLlegada").ToString().ToDateTime(), - row("Unidad").ToString(), row("Chofer").ToString(), row("Configuración").ToString(), row("Remolque1").ToString(), row("Remolque2").ToString(), - row("Distancia").ToString().ToDecimal(), UsuarioActual.CveEmpresa) + Dim FechaSalida As DateTime = MinFecha + Dim FechaLlegada As DateTime = MinFecha + + If row("FechaSalida").ToString().ToDateTime() > FechaSalida Then + FechaSalida = row("FechaSalida").ToString().ToDateTime() + End If + If row("FechaLlegada").ToString().ToDateTime() > FechaLlegada Then + FechaLlegada = row("FechaLlegada").ToString().ToDateTime() + End If + + Dim msg As String = ObjVentas.AddFacturacionAcarreos(row("Sucursal").ToString(), row("RFC").ToString(), row("Cantidad").ToString().ToDecimal(), row("ProductoGeneral").ToString(), row("Origen").ToString(), + row("Destino").ToString(), FechaSalida, FechaLlegada, row("Unidad").ToString(), row("Chofer").ToString(), row("Configuración").ToString(), + row("Remolque1").ToString(), row("Remolque2").ToString(), row("Distancia").ToString().ToDecimal(), UsuarioActual.CveEmpresa) If msg = "Correcto" Then RowsCargados += 1 Else TieneError = True - MsgFacturacionAcarreos.AppendFormat("{0}", msg) + MsgFacturacionAcarreos.AppendFormat("Ocurrió un error al procesar la fila: {0}
{1}", row("NoExcel"), msg) RowsNoCargados += 1 Exit For End If Next Catch ex As Exception - OnError("Ocurrió un error al cargar los precios.", ex) + OnError("Ocurrió un error al cargar los datos.", ex) Finally Dim MensajeFinal As New StringBuilder() If RowsNoCargados = 0 AndAlso RowsCargados > 0 Then @@ -147,7 +161,6 @@ Partial Class Ventas_FacturacionAcarreos CargaDatos() - End If End Sub @@ -179,15 +192,21 @@ Partial Class Ventas_FacturacionAcarreos End If Next + dataTable.Columns.Add("NoExcel", GetType(String)) + While curRow < worksheet.Rows.Count - columns = New String(cols - 1) {} + columns = New String(cols) {} - For curCol = 0 To cols - 1 - - If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then - columns(curCol) = "" - Else - columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString() + For curCol = 0 To cols + + If curCol = cols Then + columns(curCol) = worksheet.Rows(curRow).Name + Else + If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then + columns(curCol) = "" + Else + columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString() + End If End If Next diff --git a/Ventas/RepIndicadoresPorProyecto.aspx b/Ventas/RepIndicadoresPorProyecto.aspx new file mode 100644 index 000000000..10c7d027c --- /dev/null +++ b/Ventas/RepIndicadoresPorProyecto.aspx @@ -0,0 +1,339 @@ +<%@ Page Title="Indicadores por Proyecto" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepIndicadoresPorProyecto.aspx.vb" Inherits="Ventas_RepIndicadoresPorProyecto" %> + + + + + + + + + + + + + + + Indicadores por Proyecto + + + + + + + + +
+
+
+ +
+
+
+ + Sucursal: +
+ + + +
+ +
+
+ + + + +
+ + + + + + +
+ +
+
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+
+ + + + + + + + + +
+
+ +
+
+ +
+ + CxC +
+ +
+ +
+ +
+ + +
+ +
+
+ + + + + + + +
+
+ + + + + +
+
+ +
+
+
+ + CxP +
+
+ +
+ +
+ + +
+
+
+ + + + + + + +
+
+ + + +
+
+ + +
+
+ + + +
+
+
+ + Cobrado +
+
+ +
+ +
+ + +
+
+
+ + + + + + +
+
+ + + + +
+
+ +
+
+
+ + Pagado +
+
+ +
+ +
+ + +
+
+
+ + + + + + +
+
+ + + +
+
+ +
+
+ Margen Bruto: MXN +
+
+ +
+
+ + + +
+
+
+ + Ingresos Facturas +
+ <%--
+
+
+
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+ +
+
+
--%> +
+ +
+ +
+ + +
+
+
+ + + + + + + + +
+
+ + + + +
+
+ + + +
+
+
+ + Costos y Gastos +
+ <%--
+
+
+
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+ +
+
+
--%> +
+ +
+ +
+ + +
+
+
+ + + + + + + +
+
+ + + +
+
+ + +
+
+ + +
+ + diff --git a/Ventas/RepIndicadoresPorProyecto.aspx.vb b/Ventas/RepIndicadoresPorProyecto.aspx.vb new file mode 100644 index 000000000..29af6b202 --- /dev/null +++ b/Ventas/RepIndicadoresPorProyecto.aspx.vb @@ -0,0 +1,204 @@ +Option Explicit On +Option Strict On + +Imports Extensiones +Imports System.Data +Imports ADSNetLibrary.SIGAPI.Services.Generales +Imports ADSNetLibrary.SIGAPI.Models.Generales.Request +Imports ADSNetLibrary.SIGAPI.Models.Generales.Response +Imports MoreLinq + +Partial Class Ventas_RepIndicadoresPorProyecto + Inherits ClsPaginas + +#Region "Propiedades" + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + InicializaValores() + End If + End Sub + +#Region " INICIALIZA VALORES " + + Private Sub InicializaValores() + txtFechaI.Text = FirstDayOfMonth(Now).ToShortDateString + txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString + CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto) + End Sub + +#End Region + +#Region " CARGA DATOS " + Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click + CargaDatos() + End Sub + Private Sub CargaDatos() + + If Not IsDate(txtFechaI.Text) Then + Alert("La fecha inicial no es valida.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If Not IsDate(txtFechaF.Text) Then + Alert("La fecha final no es valida.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + + + GvResumenCxC.DataSource = Nothing + GvResumenCxP.DataSource = Nothing + GvRepCobrado.DataSource = Nothing + GvRepPagado.DataSource = Nothing + GvRepIngresosFact.DataSource = Nothing + GvRepCostosGastos.DataSource = Nothing + + Dim gralService = New GeneralesService(System.Configuration.ConfigurationManager.ConnectionStrings("Conexion").ConnectionString) + + + Dim DatResumenCxC = gralService.GetResumenCxC(New RequestResumenCxC() With {.tipoDocto = "Ing", + .cveUsuario = UsuarioActual.CveUsuario, + .cveEmpresa = UsuarioActual.CveEmpresa, + .cveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero, + .fechaInicial = txtFechaI.Text, + .fechaFinal = txtFechaF.Text}) + + Dim DatResumenCxP = gralService.GetResumenCxP(New RequestResumenCxP() With {.tipoDocto = "Fac", + .cveUsuario = UsuarioActual.CveUsuario, + .cveEmpresa = UsuarioActual.CveEmpresa, + .cveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero, + .fechaInicial = txtFechaI.Text, + .fechaFinal = txtFechaF.Text}) + + Dim DatRepCobrado = gralService.RepCobrado(New RequestRepCobrado() With {.tipoDocto = "Ing", + .cveUsuario = UsuarioActual.CveUsuario, + .cveEmpresa = UsuarioActual.CveEmpresa, + .cveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero, + .fechaInicial = txtFechaI.Text, + .fechaFinal = txtFechaF.Text}) + + Dim DatRepPagado = gralService.RepPagado(New RequestRepPagado() With {.tipoDocto = "Fac", + .cveUsuario = UsuarioActual.CveUsuario, + .cveEmpresa = UsuarioActual.CveEmpresa, + .cveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero, + .fechaInicial = txtFechaI.Text, + .fechaFinal = txtFechaF.Text}) + + Dim DatRepIngresosFact = gralService.RepIngresosFact(New RequestRepIngresosFact() With {.tipoDocto = "Ing", + .cveUsuario = UsuarioActual.CveUsuario, + .cveEmpresa = UsuarioActual.CveEmpresa, + .cveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero, + .fechaInicial = txtFechaI.Text, + .fechaFinal = txtFechaF.Text}) + + Dim DatRepCostosGastos = gralService.RepCostosGastos(New RequestRepCostosGastos() With {.tipoDocto = "Fac", + .cveUsuario = UsuarioActual.CveUsuario, + .cveEmpresa = UsuarioActual.CveEmpresa, + .cveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero, + .fechaInicial = txtFechaI.Text, + .fechaFinal = txtFechaF.Text}) + + If DatResumenCxC.Result.Count > 0 Then + GvResumenCxC.DataSource = DatResumenCxC.Result.ToDataTable + SPResumenCxC.InnerText = $"Total: {DatResumenCxC.Result.ToDataTable.SUMD("saldoMN").ToString("###,###,###.00")} MXN" + End If + If DatResumenCxP.Result.Count > 0 Then + GvResumenCxP.DataSource = DatResumenCxP.Result.ToDataTable + SPResumenCxP.InnerText = $"Total: {DatResumenCxP.Result.ToDataTable.SUMD("saldoMN").ToString("###,###,###.00")} MXN" + End If + If DatRepCobrado.Result.Count > 0 Then + GvRepCobrado.DataSource = DatRepCobrado.Result.ToDataTable + SPRepCobrado.InnerText = $"Total: {DatRepCobrado.Result.ToDataTable.SUMD("cobradoMN").ToString("###,###,###.00")} MXN" + End If + If DatRepPagado.Result.Count > 0 Then + GvRepPagado.DataSource = DatRepPagado.Result.ToDataTable + SPRepPagado.InnerText = $"Total: {DatRepPagado.Result.ToDataTable.SUMD("pagadoMN").ToString("###,###,###.00")} MXN" + End If + If DatRepIngresosFact.Result.Count > 0 Then + GvRepIngresosFact.DataSource = DatRepIngresosFact.Result.ToDataTable.FiltraParametros("nRow <= 50") + SPRepIngresosFact.InnerText = $"Total: {DatRepIngresosFact.Result.ToDataTable.SUMD("importeMN").ToString("###,###,###.00")} MXN" + End If + If DatRepCostosGastos.Result.Count > 0 Then + GvRepCostosGastos.DataSource = DatRepCostosGastos.Result.ToDataTable.FiltraParametros("nRow <= 50") + SPRepCostosGastos.InnerText = $"Total: {DatRepCostosGastos.Result.ToDataTable.SUMD("importeMN").ToString("###,###,###.00")} MXN" + End If + + + LblMargenBruto.Text = $"{(DatRepIngresosFact.Result.ToDataTable.SUMD("importeMN") - DatRepCostosGastos.Result.ToDataTable.SUMD("importeMN")).ToString("###,###,###.00")}" + + GvResumenCxC.DataBind() + GvResumenCxP.DataBind() + GvRepCobrado.DataBind() + GvRepPagado.DataBind() + GvRepIngresosFact.DataBind() + GvRepCostosGastos.DataBind() + + DVMargenBruto.Visible = True + + UpDatos.Update() + + End Sub + + Private Sub GvResumenCxC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvResumenCxC.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + Dim liga As String = $"../CxC/RepCxC.aspx?CveSubProyecto={DdlSubProyecto.SelectedValue}&FechaInicio={txtFechaI.Text}&FechaFin={txtFechaF.Text}&CveMoneda={e.Row.DataKey("CveMoneda")}&TipoDocto=Ing" + e.Row.Cells(0).Text = $"{e.Row.Cells(0).Text}" + e.Row.Cells(1).Text = $"{e.Row.Cells(1).Text}" + e.Row.Cells(2).Text = $"{e.Row.Cells(2).Text}" + End If + + End Sub + Private Sub GvResumenCxP_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvResumenCxP.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim liga As String = $"../Compras/RepCxP.aspx?CveSubProyecto={DdlSubProyecto.SelectedValue}&FechaInicio={txtFechaI.Text}&FechaFin={txtFechaF.Text}&CveMoneda={e.Row.DataKey("CveMoneda")}&TipoDocto=Fac" + e.Row.Cells(0).Text = $"{e.Row.Cells(0).Text}" + e.Row.Cells(1).Text = $"{e.Row.Cells(1).Text}" + e.Row.Cells(2).Text = $"{e.Row.Cells(2).Text}" + End If + End Sub + Private Sub GvRepCobrado_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRepCobrado.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim liga As String = $"../Ventas/RepRecuperacion.aspx?CveSubProyecto={DdlSubProyecto.SelectedValue}&FechaInicio={txtFechaI.Text}&FechaFin={txtFechaF.Text}&CveMoneda={e.Row.DataKey("CveMoneda")}&TipoDocto=Ing" + e.Row.Cells(0).Text = $"{e.Row.Cells(0).Text}" + e.Row.Cells(1).Text = $"{e.Row.Cells(1).Text}" + End If + End Sub + Private Sub GvRepPagado_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRepPagado.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim liga As String = $"../Compras/RepPagado.aspx?CveSubProyecto={DdlSubProyecto.SelectedValue}&FechaInicio={txtFechaI.Text}&FechaFin={txtFechaF.Text}&CveMoneda={e.Row.DataKey("CveMoneda")}&TipoDocto=Fac" + e.Row.Cells(0).Text = $"{e.Row.Cells(0).Text}" + e.Row.Cells(1).Text = $"{e.Row.Cells(1).Text}" + End If + End Sub + + Private Sub GvRepIngresosFact_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRepIngresosFact.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DataKey("Fecha").ToString.Trim = "01/01/0001 12:00:00 a. m." Then + e.Row.CssClass = "Totales" + e.Row.Cells(0).Text = "" + End If + End If + End Sub + Private Sub GvRepCostosGastos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRepCostosGastos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DataKey("CveClasificacion").ToString.Trim.ToEntero = 0 Then + e.Row.CssClass = "Totales" + End If + End If + End Sub + + +#End Region + +#Region " GV DATOS " + + +#End Region + + + +End Class diff --git a/Ventas/RepProductosServiciosDetalle.aspx b/Ventas/RepProductosServiciosDetalle.aspx index e7aac2a0a..038f2ae22 100644 --- a/Ventas/RepProductosServiciosDetalle.aspx +++ b/Ventas/RepProductosServiciosDetalle.aspx @@ -54,8 +54,11 @@ --%> +
  • + PDF +
  • - Generar + Excel
  • Personalizar @@ -63,9 +66,7 @@
  • Ver Dlls en pesos
  • -
  • - Imprimir -
  • +
  • diff --git a/Ventas/RepRecuperacion.aspx b/Ventas/RepRecuperacion.aspx index 0c1243e8e..bd0cc58e1 100644 --- a/Ventas/RepRecuperacion.aspx +++ b/Ventas/RepRecuperacion.aspx @@ -249,7 +249,19 @@ +
  • + +
    + Moneda: +
    +
    + + + + + +
    diff --git a/Ventas/RepRecuperacion.aspx.vb b/Ventas/RepRecuperacion.aspx.vb index 8eb1e5fc5..bea502913 100644 --- a/Ventas/RepRecuperacion.aspx.vb +++ b/Ventas/RepRecuperacion.aspx.vb @@ -48,12 +48,51 @@ Partial Class Ventas_RepRecuperacion Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then CargaCombos() - 'CargaDatos() + ProcesaRequest() + 'CargaDatos() End If - End Sub - + End Sub + #Region "CARGAS" - + + + Private Sub ProcesaRequest() + + If Request("FechaInicio") IsNot Nothing AndAlso IsDate(Request("FechaInicio")) Then + txtFechaI.Text = Request("FechaInicio") + End If + If Request("FechaFin") IsNot Nothing AndAlso IsDate(Request("FechaFin")) Then + txtFechaF.Text = Request("FechaFin") + End If + + If Request("TipoDocto") IsNot Nothing AndAlso Request("TipoDocto").Length > 0 Then + Dim tipodoctos As String() = Request("TipoDocto").Split(","c) + + For Each itemTipoDocto As ListItem In DdlTipoDocto.Items + For Each tipoDocto As String In tipodoctos + itemTipoDocto.Selected = (tipoDocto.ToUpper = itemTipoDocto.Value.ToUpper) + Next + Next + + End If + + If Request("CveMoneda") IsNot Nothing AndAlso Request("CveMoneda").ToEntero <> 0 Then + DdlMoneda.SelectedValueExist(Request("CveMoneda").ToEntero) + End If + + If Request("CveSubProyecto") IsNot Nothing AndAlso Request("CveSubProyecto").ToEntero <> 0 Then + DdlSubProyecto.SelectedValueExist(Request("CveSubProyecto").ToEntero) + End If + + UPFiltros.Update() + + If IsDate(txtFechaF.Text) AndAlso IsDate(txtFechaF.Text) Then + CargaDatos() + End If + + End Sub + + Private Sub CargaCombos() 'Carga Clientes If (UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1") Then @@ -138,7 +177,8 @@ Partial Class Ventas_RepRecuperacion If ObjMovtos.GetRepRecuperacion(txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlClientes.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, -1, "-1", UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue.ToString, CveBanco:=DdlBanco.SelectedValue.ToEntero, CveCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero, EstatusCliente:=DdlEstatusCliente.SelectedValue.ToEntero, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoCambio:=RblTipoCambio.SelectedValue.ToEntero, TCEspecifico:=TCEspecifico, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, - EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero(), FechaAplicadoI:=FechaAplicadoI, FechaAplicadoF:=FechaAplicadoF, FechaRegistroIEI:=FechaRegistroIEI, FechaRegistroIEF:=FechaRegistroIEF, CveCondicionesPago:=DdlCondicionesPago.SelectedValue.ToEntero) Then + EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero(), FechaAplicadoI:=FechaAplicadoI, FechaAplicadoF:=FechaAplicadoF, FechaRegistroIEI:=FechaRegistroIEI, FechaRegistroIEF:=FechaRegistroIEF, CveCondicionesPago:=DdlCondicionesPago.SelectedValue.ToEntero, + CveMoneda:=DdlMoneda.SelectedValue.ToEntero) Then GvDatos.DataSource = ObjMovtos.DtResultados DtDatos = ObjMovtos.DtResultados Else 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