From c5e145ffad3cace4f1ba357393521dd8c521163b Mon Sep 17 00:00:00 2001 From: rrene Date: Sun, 12 Feb 2023 11:22:23 -0700 Subject: [PATCH 01/26] =?UTF-8?q?--=20unificaci=C3=B3n=20modulo=20circular?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsPaginas.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 3ee4bfbb3..cf7ce05c0 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -8547,8 +8547,8 @@ Public Class ClsPaginas PaginaDict.Add("/Compras/RepEvaluacionesProveedores.aspx".ToUpper(), 754) PaginaDict.Add("/Ventas/RepTopClientesVentas.aspx".ToUpper(), 755) PaginaDict.Add("/OI/Circular.aspx".ToUpper(), 756) - PaginaDict.Add("/OI/CircularDetalle.aspx".ToUpper(), 757) - PaginaDict.Add("/OI/CircularDetalleB.aspx".ToUpper(), 757) + PaginaDict.Add("/OI/CircularDetalle.aspx".ToUpper(), 756) + PaginaDict.Add("/OI/CircularDetalleB.aspx".ToUpper(), 756) PaginaDict.Add("/Compras/CatTipoGasto.aspx".ToUpper(), 759) #End Region #Region "Contabilidad" From 6fad08d43a0691ec01d9d0c97eb659f3c4e22b73 Mon Sep 17 00:00:00 2001 From: rrene Date: Sun, 12 Feb 2023 21:45:58 -0700 Subject: [PATCH 02/26] -- mejoras parametros --- Prospectos/CatProspectosRedes.aspx.vb | 2 +- Prospectos/ProspectoExpediente.aspx.vb | 4 ++-- Prospectos/ProspectosG15.aspx.vb | 4 ++-- Prospectos/ProspectosSIP.aspx.vb | 4 ++-- Prospectos/RepEncuestasDetalle.aspx.vb | 2 +- Prospectos/RepProspectosRedes.aspx.vb | 2 +- Sistemas/CatSesiones.aspx.vb | 7 ++++--- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Prospectos/CatProspectosRedes.aspx.vb b/Prospectos/CatProspectosRedes.aspx.vb index 99b56048f..59bf6ff30 100644 --- a/Prospectos/CatProspectosRedes.aspx.vb +++ b/Prospectos/CatProspectosRedes.aspx.vb @@ -34,7 +34,7 @@ Partial Class Prospectos_CatProspectos DdlClasificacion.DataSource = GlobalDTProspectosClasificaciones(UsuarioActual.CveEmpresa) : DdlClasificacion.DataBind() DdlZona.DataSource = GlobalDTProspectosSupervisores(UsuarioActual.CveEmpresa) : DdlZona.DataBind() DdlRegion.DataSource = GlobalDTProspectosCoordinadores(DdlZona.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) : DdlRegion.DataBind() - DdlMunicipioFiltro.DataSource = GlobalDTGralMunicipios(26) : DdlMunicipioFiltro.DataBind() + DdlMunicipioFiltro.DataSource = GlobalDTGralMunicipios("26") : DdlMunicipioFiltro.DataBind() CargaDatos(True) ImgPersonalizar.Attributes.Add("onclick", "$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');") diff --git a/Prospectos/ProspectoExpediente.aspx.vb b/Prospectos/ProspectoExpediente.aspx.vb index afc5a3463..2d90f538f 100644 --- a/Prospectos/ProspectoExpediente.aspx.vb +++ b/Prospectos/ProspectoExpediente.aspx.vb @@ -197,11 +197,11 @@ Partial Class Prospectos_ProspectoExpediente End Sub Private Sub CargaEstados(ddl As DropDownList, CvePais As Integer) - ddl.DataSource = GlobalDTGralEstados(CvePais) : ddl.DataBind() + ddl.DataSource = GlobalDTGralEstados("-1", CvePais) : ddl.DataBind() End Sub Private Sub CargaMunicipios(ddl As DropDownList, CveEstado As Integer) - ddl.DataSource = GlobalDTGralMunicipios(CveEstado) : ddl.DataBind() + ddl.DataSource = GlobalDTGralMunicipios("-1", CveEstado) : ddl.DataBind() End Sub Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click diff --git a/Prospectos/ProspectosG15.aspx.vb b/Prospectos/ProspectosG15.aspx.vb index c03bba0eb..2502f1005 100644 --- a/Prospectos/ProspectosG15.aspx.vb +++ b/Prospectos/ProspectosG15.aspx.vb @@ -153,11 +153,11 @@ Partial Class Prospectos_ProspectosG15 Private Sub CargaEstados(ddl As DropDownList, CvePais As Integer) - ddl.DataSource = GlobalDTGralEstados(CvePais) : ddl.DataBind() + ddl.DataSource = GlobalDTGralEstados("-1", CvePais) : ddl.DataBind() End Sub Private Sub CargaMunicipios(ddl As DropDownList, CveEstado As Integer) - ddl.DataSource = GlobalDTGralMunicipios(CveEstado) : ddl.DataBind() + ddl.DataSource = GlobalDTGralMunicipios("-1", CveEstado) : ddl.DataBind() End Sub Private Sub CargaCoordinadores(ddl As DropDownList, CveSupervisor As Integer) diff --git a/Prospectos/ProspectosSIP.aspx.vb b/Prospectos/ProspectosSIP.aspx.vb index 6eb2749cf..08bbe2ee7 100644 --- a/Prospectos/ProspectosSIP.aspx.vb +++ b/Prospectos/ProspectosSIP.aspx.vb @@ -137,11 +137,11 @@ Partial Class Prospectos_ProspectosSIP End Sub Private Sub CargaEstados(ddl As DropDownList, CvePais As Integer) - ddl.DataSource = GlobalDTGralEstados(CvePais) : ddl.DataBind() + ddl.DataSource = GlobalDTGralEstados("-1", CvePais) : ddl.DataBind() End Sub Private Sub CargaMunicipios(ddl As DropDownList, CveEstado As Integer) - ddl.DataSource = GlobalDTGralMunicipios(CveEstado) : ddl.DataBind() + ddl.DataSource = GlobalDTGralMunicipios("-1", CveEstado) : ddl.DataBind() End Sub Private Sub CargaCoordinadores(ddl As DropDownList, CveSupervisor As Integer) diff --git a/Prospectos/RepEncuestasDetalle.aspx.vb b/Prospectos/RepEncuestasDetalle.aspx.vb index bed3ee7ef..06f088d48 100644 --- a/Prospectos/RepEncuestasDetalle.aspx.vb +++ b/Prospectos/RepEncuestasDetalle.aspx.vb @@ -24,7 +24,7 @@ Partial Class Prospectos_RepEncuestasDetalle If CveMunicipio > 0 Then - Dim dr As DataRow = GlobalDTGralMunicipios(-1).FiltroPrimero("CveMunicipio =" & CveMunicipio) + Dim dr As DataRow = GlobalDTGralMunicipios("-1", CveEstado:=-1).FiltroPrimero("CveMunicipio =" & CveMunicipio) If dr IsNot Nothing Then LblMunicipio.Text = dr("Municipio").ToString() End If LblSeccion.Text = Seccion.ToString diff --git a/Prospectos/RepProspectosRedes.aspx.vb b/Prospectos/RepProspectosRedes.aspx.vb index 19bc8fc91..e30de1116 100644 --- a/Prospectos/RepProspectosRedes.aspx.vb +++ b/Prospectos/RepProspectosRedes.aspx.vb @@ -36,7 +36,7 @@ Partial Class Prospectos_RepProspectosRedes DdlClasificacion.DataSource = GlobalDTProspectosClasificaciones(UsuarioActual.CveEmpresa) : DdlClasificacion.DataBind() DdlZona.DataSource = GlobalDTProspectosSupervisores(UsuarioActual.CveEmpresa) : DdlZona.DataBind() DdlRegion.DataSource = GlobalDTProspectosCoordinadores(DdlZona.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) : DdlRegion.DataBind() - DdlMunicipioFiltro.DataSource = GlobalDTGralMunicipios(26) : DdlMunicipioFiltro.DataBind() + DdlMunicipioFiltro.DataSource = GlobalDTGralMunicipios("26") : DdlMunicipioFiltro.DataBind() DdlEscolaridad.DataSource = GlobalDTGralEscolaridades : DdlEscolaridad.DataBind() CargaDatos(True) diff --git a/Sistemas/CatSesiones.aspx.vb b/Sistemas/CatSesiones.aspx.vb index a8b3bda14..f309669f8 100644 --- a/Sistemas/CatSesiones.aspx.vb +++ b/Sistemas/CatSesiones.aspx.vb @@ -489,9 +489,10 @@ Partial Class Sistemas_CatSesiones End Sub Private Sub CargaOCEstatus() - Dim ObjOC As New ClsOC - If ObjOC.GetEstatus() Then Application("GlobalDTOCEstatus") = ObjOC.DtResultados Else Application("GlobalDTOCEstatus") = Nothing - ObjOC.Dispose() + 'Dim ObjOC As New ClsOC + 'If ObjOC.GetEstatus() Then Application("GlobalDTOCEstatus") = ObjOC.DtResultados Else Application("GlobalDTOCEstatus") = Nothing + 'ObjOC.Dispose() + GlobalDTOCEstatus(UsuarioActual.CveEmpresa) = Nothing End Sub Private Sub CargaOCEstatusUsuarios() From ecf9688e34773ffb1d440961a5ea430bdf30aac0 Mon Sep 17 00:00:00 2001 From: rrene Date: Sun, 12 Feb 2023 22:15:21 -0700 Subject: [PATCH 03/26] cambios de GlobalDT --- App_Code/ClsPaginas.vb | 30 ++++++++++++++---------------- Sistemas/UsuarioDetalle.aspx.vb | 24 +++++++----------------- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index cf7ce05c0..13673a7c3 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -2315,7 +2315,6 @@ Public Class ClsPaginas Public Shared Property GlobalDTVtaCobranzaEstatus(CveEmpresa As Integer, Optional CveCobranzaEstatus As Integer = -1) As DataTable Get Dim AppNombre As String = $"GlobalDTVtaCobranzaEstatus-{CveEmpresa}" - 'sino existe, recarga los datos If HttpContext.Current.Application(AppNombre) Is Nothing Then Dim ObjVentas As New ClsVentas If ObjVentas.GetCobranzaEstatus(-1, CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjVentas.DtResultados @@ -2438,20 +2437,22 @@ Public Class ClsPaginas #Region "***********************************************************************DT ACTIVOS FIJOS**********************************************************************************" Property GlobalDTActivoFijos(CveEmpresa As Integer, Optional CveSubTipoActivoFijo As Integer = -1, Optional CveActivoFijo As Integer = -1) As DataTable Get - Dim dt As DataTable = Nothing - 'Dim Str As New StringBuilder - 'Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - 'If CveSubTipoActivoFijo <> -1 Then Str.AppendFormat(" AND CveSubTipoActivoFijo = {0}", CveSubTipoActivoFijo) - Dim ObjAF As New ClsAF - 'If ObjAF.GetActivosFijos(CveActivoFijo, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, -1, "-1", -1, -1, -1, -1, -1) Then - If ObjAF.GetActivosFijos(CveActivoFijo, CveEmpresa, "-1", "-1", -1, CveSubTipoActivoFijo, "-1", -1, -1, -1, -1, -1, "", -1) Then - dt = ObjAF.DtResultados + Dim AppNombre As String = $"GlobalDTActivoFijo-{CveEmpresa}" + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjActivosFijos As New ClsAF + If ObjActivosFijos.GetActivosFijos(-1, CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "", -1) Then HttpContext.Current.Application(AppNombre) = ObjActivosFijos.DtResultados + ObjActivosFijos.Dispose() End If - ObjAF.Dispose() - GlobalDTActivoFijos = dt + Dim Str As New StringBuilder + If CveSubTipoActivoFijo <> -1 Then Str.AppendFormat(" CveSubTipoActivoFijo = {0} ", CveSubTipoActivoFijo) + If CveActivoFijo > 0 Then Str.AppendFormat("{0} CveActivoFijo = {1}", IIf(Str.Length > 0, " AND ", ""), CveActivoFijo) + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + GlobalDTActivoFijos = Dv.ToTable + Dv.Dispose() End Get Set(ByVal value As DataTable) - Application("GlobalDTActivoFijos") = value + Dim AppNombre As String = $"GlobalDTActivoFijo-{CveEmpresa}" + Application(AppNombre) = value End Set End Property Public Shared Property GlobalDTEstadoActivoFijo() As DataTable @@ -2488,7 +2489,6 @@ Public Class ClsPaginas Public Shared Property GlobalDTModeloActivoFijo(CveEmpresa As Integer, CveMarca As Integer) As DataTable Get Dim AppNombre As String = $"GlobalDTModeloActivoFijo-{CveEmpresa}" - 'sino existe, recarga los datos If HttpContext.Current.Application(AppNombre) Is Nothing Then Dim ObjActivosFijos As New ClsAF If ObjActivosFijos.GetModelosActivosFijos(CveEmpresa, -1) Then HttpContext.Current.Application(AppNombre) = ObjActivosFijos.DtResultados @@ -2510,7 +2510,6 @@ Public Class ClsPaginas Public Shared Property GlobalDTSubTipoActivoFijo(CveEmpresa As Integer, Optional CveTipoActivoFijo As Integer = -1) As DataTable Get Dim AppNombre As String = $"GlobalDTSubTipoActivoFijo-{CveEmpresa}" - 'sino existe, recarga los datos If HttpContext.Current.Application(AppNombre) Is Nothing Then Dim ObjSubTipos As New ClsAF If ObjSubTipos.GetSubTiposActivosFijos(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjSubTipos.DtResultados @@ -2531,10 +2530,9 @@ Public Class ClsPaginas Public Shared Property GlobalDTTipoActivoFijo(CveEmpresa As Integer) As DataTable Get Dim AppNombre As String = $"GlobalDTTipoActivoFijo-{CveEmpresa}" - 'sino existe, recarga los datos If HttpContext.Current.Application(AppNombre) Is Nothing Then Dim GetTiposActivosFijos As New ClsAF - If GetTiposActivosFijos.GetCaracteristicas(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = GetTiposActivosFijos.DtResultados + If GetTiposActivosFijos.GetTiposActivosFijos(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = GetTiposActivosFijos.DtResultados GetTiposActivosFijos.Dispose() End If GlobalDTTipoActivoFijo = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) diff --git a/Sistemas/UsuarioDetalle.aspx.vb b/Sistemas/UsuarioDetalle.aspx.vb index 8105b1328..f485c6faa 100644 --- a/Sistemas/UsuarioDetalle.aspx.vb +++ b/Sistemas/UsuarioDetalle.aspx.vb @@ -473,17 +473,9 @@ Partial Class Sistemas_UsuarioDetalle CargaEmpresasAsignaciones() CreaDtAsignacionesMultiEmpresa() CveEmpresaAnterior = DdlEmpresaAsignaciones.SelectedValue.ToEntero - - Using ObjOc As New ClsOC - - If ObjOc.GetEstatus() Then - DTOCEstatus = ObjOc.DtResultados - Else - DTOCEstatus = New DataTable - End If - - End Using - + DTOCEstatus = GlobalDTOCEstatus(UsuarioActual.CveEmpresa) + + End If End Sub @@ -1371,12 +1363,10 @@ Partial Class Sistemas_UsuarioDetalle 'RECARGA GLOBAL BANCOS 'If ObjBancos.GetBancosCuentasUsuarios(-1) Then - GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa) = Nothing 'ObjBancos.DtResultados - ' End If - - 'RECARGA GLOBAL ESTATUS - If ObjOC.GetEstatus() Then Application("GlobalDTOCEstatus") = ObjOC.DtResultados Else Application("GlobalDTOCEstatus") = Nothing - + GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa) = Nothing 'ObjBancos.DtResultados + ' End If + + 'RECARGA GLOBAL ESTATUS GlobalDTOCEstatusUsuarios(UsuarioActual.CveEmpresa) = Nothing 'If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, -1) Then Application("GlobalDTOCEstatusUsuarios") = ObjOC.DtResultados Else Application("GlobalDTOCEstatusUsuarios") = Nothing From 59e5031c8334e4e75be5e4764594cb93126ce863 Mon Sep 17 00:00:00 2001 From: rrene Date: Sun, 12 Feb 2023 22:15:52 -0700 Subject: [PATCH 04/26] -- mejora en tipo dato --- Contabilidad2/MovimientosconProveedores.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contabilidad2/MovimientosconProveedores.aspx.vb b/Contabilidad2/MovimientosconProveedores.aspx.vb index a4d29fda1..a54167118 100644 --- a/Contabilidad2/MovimientosconProveedores.aspx.vb +++ b/Contabilidad2/MovimientosconProveedores.aspx.vb @@ -54,7 +54,7 @@ Partial Class MovimientosconProveedores End Property Private Property CveSubProyecto As Integer Get - CveSubProyecto = ViewState("CveSubProyecto").ToString + CveSubProyecto = ViewState("CveSubProyecto").ToString.ToEntero End Get Set(value As Integer) ViewState("CveSubProyecto") = value From e3e64ce00d46ac6f05f90096418f74bed22f9f75 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Mon, 13 Feb 2023 09:12:07 -0700 Subject: [PATCH 05/26] --- Contabilidad2/MovimientosconProveedores.aspx.vb | 2 +- Nomina/ReportePTU.aspx.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Contabilidad2/MovimientosconProveedores.aspx.vb b/Contabilidad2/MovimientosconProveedores.aspx.vb index a4d29fda1..3f990190e 100644 --- a/Contabilidad2/MovimientosconProveedores.aspx.vb +++ b/Contabilidad2/MovimientosconProveedores.aspx.vb @@ -54,7 +54,7 @@ Partial Class MovimientosconProveedores End Property Private Property CveSubProyecto As Integer Get - CveSubProyecto = ViewState("CveSubProyecto").ToString + CveSubProyecto = ViewState("CveSubProyecto").ToString().ToEntero() End Get Set(value As Integer) ViewState("CveSubProyecto") = value diff --git a/Nomina/ReportePTU.aspx.vb b/Nomina/ReportePTU.aspx.vb index e41cef5ff..5fbbcfe24 100644 --- a/Nomina/ReportePTU.aspx.vb +++ b/Nomina/ReportePTU.aspx.vb @@ -156,7 +156,7 @@ Partial Class Nomina_ReportePTU If Not IsNothing(rowc) Then CveConcepto = rowc("CveConcepto").ToString().ToEntero() Else - CveConcepto = objNomina.AddConcepto("PTU", "Utilidades", "P", "", True, True, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, 0, -1, 0, 0, 0, 0, 0) + CveConcepto = objNomina.AddConcepto("PTU", "Utilidades", "P", "", True, True, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, 0, -1, 0, 0, 0, 0, 0, -1, 1, -1, -1, -1, -1) End If If CveConcepto < 1 Then continuar = False From 2c67f8ba0211f0ce13e8f9a3f0536ecd7402026e Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 13 Feb 2023 10:16:04 -0700 Subject: [PATCH 06/26] Refacturacion de facturas no timbradas --- App_Code/Modelos.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 47d5bf7b6..5e0d0eaea 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -5031,7 +5031,7 @@ Namespace Modelos 'SI YA ESTA TIMBRADA, NUEVO PROCESO REFACTURACION, ASIGNA LA CANCELACION PENDIENTE 'EL ESTATUS REFACTURACION 4 ES PARA LAS QUE NO SE PUDIERON CANCELAR, DEBE OBLIGAR A CANCELAR ANTE EL SAT - If EsRefacturacion AndAlso Me.CveEstatusFactura = 3 AndAlso CveMotivoCancelacion > 0 AndAlso CveEstatusRefacturacion <> 4 Then + If EsRefacturacion AndAlso Me.CveEstatusFactura.Contiene(2, 3) AndAlso CveMotivoCancelacion > 0 AndAlso CveEstatusRefacturacion <> 4 Then CveEstatusFacturaAsignado = 23 End If From 1d7ab74791f4aa66be4bea57037eb25925fc7abc Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 13 Feb 2023 10:16:38 -0700 Subject: [PATCH 07/26] Aplicacion de NC concepto 294 --- Ventas/Ventas.aspx.vb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 9a0ea378f..85d999ca5 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -13939,7 +13939,10 @@ Partial Class Ventas Dim ImporteConcepto12 As Decimal = 0 Dim ImporteAcumulado91 As Decimal = 0 Dim CveUltimaVenta As Integer = 0 - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" + If tipoCambio > 1 Then + Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" + ConceptoContable = 293 + End If If tipoCambio = 1 Then IdCtaContable = ObjFactura.Cliente.IdCtaContClientes ElseIf UsaComplementariaClientes Then @@ -14054,7 +14057,13 @@ Partial Class Ventas Exit For End If End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then + Dim CveConceptoAplicacionNC As Integer = 91 + 'SI LA NOTA DE CREDITO ES EN MONEDA EXTRANGERA UTILIZAR EL CONCEPTO DE APLICACION ME + If ConceptoContable = 293 Then + CveConceptoAplicacionNC = 294 + End If + + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, CveConceptoAplicacionNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then ErrorPrepoliza = True Exit For End If From ad00d309cb9bcf8331a98217702ff2cdbbd8ddef Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 13 Feb 2023 10:17:32 -0700 Subject: [PATCH 08/26] EMD. Aprovechar mas espacion en RDLC de factura --- Empresas/13/Formatos/Factura.rdlc | 699 +++++++++++++++--------------- 1 file changed, 357 insertions(+), 342 deletions(-) diff --git a/Empresas/13/Formatos/Factura.rdlc b/Empresas/13/Formatos/Factura.rdlc index a096913df..cae98ad77 100644 --- a/Empresas/13/Formatos/Factura.rdlc +++ b/Empresas/13/Formatos/Factura.rdlc @@ -1044,6 +1044,7 @@ true + true true @@ -1060,9 +1061,9 @@ Textbox1 - 7.70772cm - 14.63922cm - 0.54708cm + 8.26648cm + 14.6392cm + 0.34478cm 5.65062cm 5 - - External - =Parameters!QR.Value - FitProportional - 3.05943in - 0.13977in - 0.68104in - 0.78032in - 30 - - - - - - true - true - - - - - Serie del Certificado del Emisor - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Folio Fiscal - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - No. de Serie del Certificado de l SAT - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Fecha y Hora de Certificación - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!CertificadoContribuyente.Value - - - - - - - Textbox2 - 7.89591cm - 8.37312cm - 0.35889cm - 5.62289cm - 35 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!FolioFiscal.Value - - - - - - - Textbox2 - 8.29008cm - 8.37312cm - 0.40122cm - 5.62289cm - 36 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!SerieCertificadoSAT.Value - - - - - - - Textbox2 - 8.72658cm - 8.37312cm - 0.3536cm - 5.62289cm - 37 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!FechaCertificacion.Value - - - - - - - Textbox2 - 9.12251cm - 8.37312cm - 0.31479cm - 5.62289cm - 38 - - - 2pt - 2pt - 2pt - 2pt - - true true @@ -2494,11 +2200,11 @@ Textbox19 - 3.26381in + 3.39026in 14.1724cm - 0.47666in + 0.13921in 2.40844in - 39 + 30 @@ -2615,11 +2321,11 @@ Textbox19 - 4.24278in - 0.10195in + 4.2506in + 0.05612in 0.1296in 7.86825in - 42 + 33 @@ -2693,11 +2399,11 @@ Textbox19 - 4.55448in - 0.09839in + 4.5498in + 0.05256in 0.11805in 7.86825in - 44 + 35 @@ -3204,10 +2910,10 @@ true - 12.06599cm + 11.9011cm 1.93497cm 20.28984cm - 46 + 37 =Microsoft.VisualBasic.Interaction.IIF(First(Fields!SerieFolio.Value, "DataSet4") <> "", False, True) @@ -3378,10 +3084,10 @@ true - 5.71625cm + 5.65275cm 1.2341cm 20.2229cm - 47 + 38 = Not iif(IsNothing(Parameters!TieneCartaPorte), True, iif(Parameters!TieneCartaPorte.Value , True, False)) @@ -3416,7 +3122,7 @@ 10.5005cm 0.17222in 0.82757in - 48 + 39 + + + + External + =Parameters!QR.Value + FitProportional + 0.06848in + 0.0372in + 0.51336in + 0.79074in + + + + + + true + true + + + + + Serie del Certificado del Emisor + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Folio Fiscal + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + No. de Serie del Certificado de l SAT + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha y Hora de Certificación + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!CertificadoContribuyente.Value + + + + + + + Textbox2 + 0cm + 8.1126cm + 0.35889cm + 5.62289cm + 5 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FolioFiscal.Value + + + + + + + Textbox2 + 0.39417cm + 8.1126cm + 0.33067cm + 5.62289cm + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!SerieCertificadoSAT.Value + + + + + + + Textbox2 + 0.76717cm + 8.1126cm + 0.3536cm + 5.62289cm + 7 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FechaCertificacion.Value + + + + + + + Textbox2 + 1.1631cm + 8.1126cm + 0.31479cm + 5.62289cm + 8 + + + 2pt + 2pt + 2pt + 2pt + + + + true + 7.84409cm + 0.19628cm + 1.6525cm + 13.9708cm + 41 + + + + - 14.00096cm + 13.83608cm - - - - - Catálogo de Cuentas Contables - - - - - - - - - - - - -
-
- Cuentas -
-
- - -
-
-
-
- -
- - - - -
-
-
-
- - - - - diff --git a/PyME/Contabilidad/CatCuentas.aspx.vb b/PyME/Contabilidad/CatCuentas.aspx.vb deleted file mode 100644 index 4028f0a9f..000000000 --- a/PyME/Contabilidad/CatCuentas.aspx.vb +++ /dev/null @@ -1,289 +0,0 @@ -Imports System.Data -Imports Extensiones - -Partial Class Contabilidad_CatCuentas - Inherits ClsPaginas - -#Region "Propiedades" - - Private Property DtDatos As DataTable - Get - Return CType(ViewState("DtDatos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtDatos") = value - End Set - End Property - Private Property IDSelected As Integer - Get - Return ViewState("idsel").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("idsel") = value - End Set - End Property - -#End Region - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - CargaMonedas() - CargaDatos() - CargaAgrupadorSAT() - End If - End Sub - - Private Sub CargaMonedas() - DdlMoneda.DataSource = GlobalDTMonedas - DdlMoneda.DataBind() - End Sub - - Private Sub CargaAgrupadorSAT() - Dim ObjConta As New ClsContabilidad - - If ObjConta.GetAgrupadoresSAT() Then - DdlAgrupadorSAT.DataSource = ObjConta.DtResultados - End If - - ObjConta.Dispose() - DdlAgrupadorSAT.DataBind() - DdlAgrupadorSAT.Items.Insert(0, New ListItem("Seleccione", "-1")) - End Sub - - Private Sub CargaDatos() - Dim ObjConta As New ClsContabilidad - - If ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then - DtDatos = ObjConta.DtResultados - End If - - 'para obtener la mascara, tomo el primer dato y reemplazo los numeros por cero - Dim Mascara As String = "####-####-###" - If DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then - Mascara = "0000" - End If - - MEECuenta.Mask = Mascara.Replace("0", "9") - MEECuenta.AutoComplete = True - MEECuenta.AutoCompleteValue = Mascara - - ArbolCuentas.DataSource = DtDatos - ArbolCuentas.nivel = "CtaInicial" - ArbolCuentas.nodoid = "CveCuenta" - ArbolCuentas.padre = "CvePadre" - ArbolCuentas.titulo = "CtaCodigo" - - ObjConta.Dispose() - End Sub - - Private Function getNodospadreHijos(nodo As Integer) As DataTable - Return DtDatos.FiltraParametros(String.Format("CveCuenta = {0}", nodo)) - End Function - - Protected Sub agregar_Click(sender As Object, e As EventArgs) Handles ArbolCuentas.addclick - - Dim dt As New DataTable - Dim obj As ADServerControl.DragableItem = DirectCast(sender, ADServerControl.DragableItem) - - LimpiarCampos() - - IDSelected = obj.Cve - dt = getNodospadreHijos(IDSelected) - - If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - Dim dr As DataRow = dt.Rows(0) - Tcuenta.Text = Trim(dr("CuentaFormato").ToString.Replace("-", "").ToString) - Tsubcuenta.Text = dr("CuentaFormato").ToString() - DTcuenta.SelectedValue = dr("Tipo").ToString() - DcuentaMayor.SelectedValue = dr("CtaMayor").ToString - LblSubCuenta.Text = dr("Nombre").ToString - End If - - Tcuenta.Enabled = True - nuevacuenta.Visible = True - UpDatos.Visible = True - UpDatos.Update() - - End Sub - - Protected Sub editar_Click(sender As Object, e As EventArgs) Handles ArbolCuentas.editclick - Dim dt As DataTable - Dim obj As ADServerControl.DragableItem = DirectCast(sender, ADServerControl.DragableItem) - - LimpiarCampos() - - IDSelected = obj.Cve - dt = getNodospadreHijos(IDSelected) - - If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - Dim dr As DataRow = dt.Rows(0) - Dim drt As DataRow - Dim Hijos As Integer - - Tcuenta.Text = dr("CuentaFormato").ToString.Replace("-", "").ToString - Tnombre.Text = dr("Nombre").ToString() - DTcuenta.SelectedValue = dr("Tipo").ToString() - DcuentaMayor.SelectedValue = dr("CtaMayor").ToString - DdlMoneda.SelectedValue = dr("CveMoneda").ToString - - If dr("CveAgrupadorSAT").ToString.ToEntero = 0 Then - DdlAgrupadorSAT.SelectedValue = -1 - Else - DdlAgrupadorSAT.SelectedValue = dr("CveAgrupadorSAT").ToString - End If - - TxtDigAgrup.Text = dr("DigAgrup").ToString - TxtNomIngles.Text = dr("NomIdioma").ToString - - Hijos = DtDatos.FiltraParametros(String.Format("CvePadre = {0}", IDSelected)).Rows.Count - - If Hijos = 0 Then BtnEliminar.Visible = True - - dt = getNodospadreHijos(dr("CvePadre").ToString.ToEntero) - If dt.Rows.Count > 0 Then - drt = dt.Rows(0) - Tsubcuenta.Text = drt("Codigo").ToString - LblSubCuenta.Text = drt("Nombre").ToString - End If - - End If - - Guardar.Visible = True - UpDatos.Visible = True - UpDatos.Update() - - End Sub - - Protected Sub Guardar_Click(sender As Object, e As EventArgs) Handles Guardar.Click - - Dim ObjConta As New ClsContabilidad - Dim customerRow As Data.DataRow - Dim item As CheckBox - - If Tnombre.Text.Trim = "" Then Alert("Se debe ingresar un nombre a la Cuenta.", TipoMensaje.MsgError) : Exit Sub - - If Not ObjConta.UpdateCuenta(IDSelected.ToEntero, Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToString.ToEntero, DdlAgrupadorSAT.SelectedValue.ToEntero, TxtNomIngles.Text.ToString) Then - Alert("Ocurrió un error al actualizar la Cuenta.", TipoMensaje.MsgError) - Exit Sub - End If - ObjConta.Dispose() - - customerRow = DtDatos.Select(String.Format("CveCuenta = {0}", IDSelected))(0) - customerRow("Nombre") = Tnombre.Text - DtDatos.AcceptChanges() - - CargaDatos() - ArbolCuentas.DataSource = DtDatos - - item = DirectCast(ArbolCuentas.FindControl(String.Format("chk{0}", IDSelected)), CheckBox) - item.Text = String.Format("{0} - {1}", customerRow("CuentaFormato").ToString, Tnombre.Text) - LimpiarCampos() - UpDatos.Update() - - Alert("La Cuenta se guardó correctamente.") - - End Sub - Protected Sub nuevacuenta_Click(sender As Object, e As EventArgs) Handles nuevacuenta.Click - - If Tnombre.Text.Trim = "" Then Alert("Se debe asignar un nombre a la Cuenta.", TipoMensaje.MsgError) : Exit Sub - If Tcuenta.Text.Trim = "" Then Alert("Se debe asignar una Cuenta", TipoMensaje.MsgError) : Exit Sub - - Dim ObjConta As New ClsContabilidad - Dim CuentaEfectivo As Integer = 0 - Dim Afectable As Integer = If(DcuentaMayor.SelectedValue <> 2, 0, 1) ' cuando sea tipo 2, va a ser afectable - - Dim idnew = ObjConta.AddCuenta(IDSelected, Tcuenta.Text.Replace("-", ""), Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, - DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToEntero, DdlAgrupadorSAT.SelectedValue.ToEntero, TxtNomIngles.Text.ToString) - - If idnew > 0 Then - Dim dr As DataRow = DtDatos.NewRow - Dim item As ADServerControl.DragableItem - Dim objul As ADServerControl.DragableUL - - dr("CveCuenta") = idnew - dr("CuentaFormato") = Tcuenta.Text - dr("Nombre") = Tnombre.Text - dr("CtaCodigo") = String.Format("{0} - {1}", Tcuenta.Text, Tnombre.Text) - dr("Tipo") = DTcuenta.SelectedValue.ToString - dr("CtaMayor") = DcuentaMayor.SelectedValue.ToString - dr("CvePadre") = IDSelected - dr("Codigo") = Tnombre.Text - dr("CveMoneda") = DdlMoneda.SelectedValue.ToEntero - dr("DigAgrup") = TxtDigAgrup.Text.Trim.ToEntero - dr("NomIdioma") = TxtNomIngles.Text.Trim - - DtDatos.Rows.Add(dr) - ArbolCuentas.DataSource = DtDatos - - item = DirectCast(ArbolCuentas.FindControl(String.Format("{0}", IDSelected)), ADServerControl.DragableItem) - objul = DirectCast(ArbolCuentas.FindControl(String.Format("ul{0}", IDSelected)), ADServerControl.DragableUL) - - item.Attributes.Item("data-hijos") = item.Attributes.Item("data-hijos").ToEntero + 1 - - If (IsNothing(objul)) Then - objul = New ADServerControl.DragableUL - objul.ID = String.Format("ul{0}", item.Cve) - item.Controls.Add(objul) - End If - - ArbolCuentas.additem(objul, idnew, IDSelected, String.Format("{0} - {1}", Tcuenta.Text, Tnombre.Text)) - - LimpiarCampos() - - UpDatos.Update() - CargaDatos() - - Alert("La Cuenta se guardó correctamente.") - End If - - ObjConta.Dispose() - End Sub - Private Sub LimpiarCampos() - Tcuenta.Text = "" - Tnombre.Text = "" - DTcuenta.SelectedValue = "-1" - DcuentaMayor.SelectedValue = "-1" - DdlAgrupadorSAT.SelectedValue = "-1" - DdlMoneda.SelectedValue = "1" - TxtDigAgrup.Text = "" - TxtNomIngles.Text = "" - Guardar.Visible = False - nuevacuenta.Visible = False - Tcuenta.Enabled = False - BtnEliminar.Visible = False - End Sub - - Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click - Dim customerRow As Data.DataRow - Dim item As ADServerControl.DragableItem - Dim padre As ADServerControl.DragableItem - Dim ObjConta As New ClsContabilidad - - ObjConta.IniciaTransacSQL() - - If ObjConta.RemoveCuenta(IDSelected.ToEntero) Then - - customerRow = DtDatos.Select(String.Format("CveCuenta = {0}", IDSelected))(0) - customerRow("CvePadre") = "-5" - DtDatos.AcceptChanges() - - ArbolCuentas.DataSource = DtDatos - item = DirectCast(ArbolCuentas.FindControl(String.Format("{0}", IDSelected)), ADServerControl.DragableItem) - padre = DirectCast(ArbolCuentas.FindControl(String.Format("{0}", item.CvePadre)), ADServerControl.DragableItem) - padre.Attributes.Item("data-hijos") = padre.Attributes.Item("data-hijos").ToEntero - 1 - ArbolCuentas.Controls.Remove(item) - RegistraScript(String.Format("$('#{0}').click();", editar.ClientID)) - - LimpiarCampos() - UpCuentas.Update() - - ObjConta.Commit() - Alert("La Cuenta ha sido eliminada", TipoMensaje.MsgInformacion) - Else - ObjConta.RollBack() - Alert("La Cuenta no pudo ser eliminada", TipoMensaje.MsgError) - End If - - ObjConta.Dispose() - End Sub -End Class \ No newline at end of file diff --git a/PyME/Contabilidad/ContabilizacionCompras.aspx b/PyME/Contabilidad/ContabilizacionCompras.aspx deleted file mode 100644 index 0a6f7f2ea..000000000 --- a/PyME/Contabilidad/ContabilizacionCompras.aspx +++ /dev/null @@ -1,471 +0,0 @@ -<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ContabilizacionCompras.aspx.cs" Inherits="Contabilidad_ContabilizacionCompras" %> - - - - - - - - - Diario de Movimientos - - - - - - -
-
-
- - - -
-
-
- -
- - - -
- -
-
- - - - - - - - - - -   -
-
- -
-
- - - - - - - - - - -   -
-
-
-
-
- -
> -
- -
- - - -
-
- -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
Fecha: - Concepto: - Poliza: -
Factura: - Proveedor: - Fecha: - Total: - -
-
-
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
Fecha: - Concepto: - Poliza: -
Número: - Pagador: - Fecha: - Total: - -
-
-
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
Fecha: - Concepto: - Poliza: -
Número: - Pagador: - Fecha: - Total: - -
-
-
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
Fecha: - Concepto: - Poliza: -
Factura: - Proveedor: - Fecha: - Total: - -
-
-
-
-
-
-
-
- -
-
- -
-
-
- -
- - - - diff --git a/PyME/Contabilidad/ContabilizacionCompras.aspx.cs b/PyME/Contabilidad/ContabilizacionCompras.aspx.cs deleted file mode 100644 index 39ecaa2a7..000000000 --- a/PyME/Contabilidad/ContabilizacionCompras.aspx.cs +++ /dev/null @@ -1,267 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Extensiones; -using System.Data; - -public partial class Contabilidad_ContabilizacionCompras : ClsPaginas -{ - private DataTable DTmpC - { - get - { - return (DataTable)ViewState["DTmpC"]; - } - set - { - ViewState["DTmpC"] = value; - } - } - - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - ClsContabilidad ObjCont = new ClsContabilidad(); - ObjCont.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa); - string[] columnas = new string[3] { "CveCuenta", "CuentaFormato", "Nombre" }; - DTmpC = ObjCont.DtResultados.FiltraParametros("", "", columnas); - ObjCont.Dispose(); - - DdlProveedores.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa); - DdlProveedores.DataBind(); - - DdlPersonal.DataSource = get_GlobalDTRHPersonal(UsuarioActual.CveEmpresa); - DdlPersonal.DataBind(); - - txtFechaI.Text = DateTime.Now.FirstDayOfMonth().AddMonths(-1).ToShortDateString(); - txtFechaF.Text = DateTime.Now.ToShortDateString(); - //CargaDatos(); - } - - BtnConsultar.Click += new EventHandler(this.BtnConsultar_Click); - BtnContabilizarCompras.Click += new EventHandler(this.BtnGuardarCompras_Click); - BtnContabilizarPagos.Click += new EventHandler(this.BtnGuardarPagos_Click); - BtnContabilizarAnticipos.Click += new EventHandler(this.BtnGuardarAnticipos_Click); - BtnContabilizarAmortizaciones.Click += new EventHandler(this.BtnGuardarAmortizaciones_Click); - } - - protected void OnRowDataBound(object sender, GridViewRowEventArgs e) - { - - if (e.Row.RowType == DataControlRowType.DataRow) - { - GridView GvD = e.Row.FCGridView("GvD"); - int CvePrePoliza = e.Row.DataKey("CvePrePoliza").ToEntero(); - - e.Row.Cells[0].ToolTip = CvePrePoliza.ToString(); - - ClsContabilidad contP = new ClsContabilidad(); - - if (contP.GetContabilizacionDiarioDetalle(CvePrePoliza)) - { - Double Abonos = 0; - Double Cargos = 0; - - Abonos = contP.DtResultados.SUM("Abono"); - Cargos = contP.DtResultados.SUM("Cargo"); - - if (Cargos != Abonos) - { - e.Row.FCCheckBox("Chk").Visible = false; - } - - GvD.DataSource = contP.DtResultados; - } - - if (UsuarioActual.CveRol == 1 || UsuarioActual.CveUsuario == 17 ) - { - e.Row.FCHyperLink("HplEdicion").Visible = true; - } - - contP.Dispose(); - GvD.DataBind(); - - } - - - } - - private void Contabilizar(int CvePrepoliza, DateTime Fecha, string Concepto, ClsContabilidad Obj) - { - if (Obj.ContabilizarPrePoliza(CvePrepoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, Fecha, Concepto)) - { - } - } - - private void BtnGuardarCompras_Click(object sender, EventArgs e) - { - ClsContabilidad ObjMov = new ClsContabilidad(); - - foreach (GridViewRow row in GvPrePolizaCompras.Rows) - { - CheckBox chk = row.FCCheckBox("Chk"); - TextBox txtFecha = row.FCTextBox("TxtFechaCompras"); - TextBox txtConcepto = row.FCTextBox("TxtConceptoCompras"); - - if (chk != null && chk.Checked) - { - DateTime Fecha = txtFecha.Text.ToDate(); - int CvePrepoliza = GvPrePolizaCompras.DataKeys[row.RowIndex]["CvePrePoliza"].ToString().ToEntero(); - string Concepto = txtConcepto.Text; - - Contabilizar(CvePrepoliza, Fecha, Concepto, ObjMov); - } - } - ObjMov.Dispose(); - - Alert("Se Contabilizaron Correctamente los Siguientes Folios:
" + ObjMov.AlertaMensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion); - CargaDatos(); - } - - private void BtnGuardarPagos_Click(object sender, EventArgs e) - { - ClsContabilidad ObjMov = new ClsContabilidad(); - - foreach (GridViewRow row in GvPrePolizaPagos.Rows) - { - CheckBox chk = row.FCCheckBox("Chk"); - TextBox txtFecha = row.FCTextBox("TxtFechaPagos"); - TextBox txtConcepto = row.FCTextBox("TxtConceptoPagos"); - - if (chk != null && chk.Checked) - { - DateTime Fecha = txtFecha.Text.ToDate(); - int CvePrepoliza = GvPrePolizaPagos.DataKeys[row.RowIndex]["CvePrePoliza"].ToString().ToEntero(); - string Concepto = txtConcepto.Text; - - Contabilizar(CvePrepoliza, Fecha, Concepto, ObjMov); - } - } - ObjMov.Dispose(); - - Alert("Se Contabilizaron Correctamente los Siguientes Folios:
" + ObjMov.AlertaMensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion); - CargaDatos(); - } - - private void BtnGuardarAnticipos_Click(object sender, EventArgs e) - { - ClsContabilidad ObjMov = new ClsContabilidad(); - - foreach (GridViewRow row in GvPrePolizaAnticipos.Rows) - { - CheckBox chk = row.FCCheckBox("Chk"); - TextBox txtFecha = row.FCTextBox("TxtFechaAnticipos"); - TextBox txtConcepto = row.FCTextBox("TxtConceptoAnticipos"); - - if (chk != null && chk.Checked) - { - DateTime Fecha = txtFecha.Text.ToDate(); - int CvePrepoliza = GvPrePolizaAnticipos.DataKeys[row.RowIndex]["CvePrePoliza"].ToString().ToEntero(); - string Concepto = txtConcepto.Text; - - Contabilizar(CvePrepoliza, Fecha, Concepto, ObjMov); - } - } - ObjMov.Dispose(); - - Alert("Se Contabilizaron Correctamente los Siguientes Folios:
" + ObjMov.AlertaMensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion); - CargaDatos(); - } - - private void BtnGuardarAmortizaciones_Click(object sender, EventArgs e) - { - ClsContabilidad ObjMov = new ClsContabilidad(); - foreach (GridViewRow row in GvPrePolizaAmortizaciones.Rows) - { - CheckBox chk = row.FCCheckBox("Chk"); - TextBox txtFecha = row.FCTextBox("TxtFechaAmortizaciones"); - TextBox txtConcepto = row.FCTextBox("TxtConceptoAmortizaciones"); - - if (chk != null && chk.Checked) - { - DateTime Fecha = txtFecha.Text.ToDate(); - int CvePrepoliza = GvPrePolizaAmortizaciones.DataKeys[row.RowIndex]["CvePrePoliza"].ToString().ToEntero(); - string Concepto = txtConcepto.Text; - - Contabilizar(CvePrepoliza, Fecha, Concepto, ObjMov); - } - } - ObjMov.Dispose(); - - Alert("Se Contabilizaron Correctamente los Siguientes Folios:
" + ObjMov.AlertaMensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion); - CargaDatos(); - } - - protected void BtnConsultar_Click(object sender, EventArgs e) - { - CargaDatos(); - } - - private void CargaDatos() - { - DateTime FechaI = txtFechaI.Text.ToDate(); - DateTime FechaF = txtFechaF.Text.ToDate(); - - ClsContabilidad cont = new ClsContabilidad(); - - // Cargamos las Compras - if (cont.GetContabilizacionDiario(UsuarioActual.CveEmpresa, 1, FechaI, FechaF, DdlProveedores.SelectedValue.ToEntero(), DdlPersonal.SelectedValue.ToEntero())) - { - GvPrePolizaCompras.DataSource = cont.DtResultados; - GvPrePolizaCompras.DataBind(); - } - - // Cargamos los pagos - if (cont.GetContabilizacionDiario(UsuarioActual.CveEmpresa, 2, FechaI, FechaF, DdlProveedores.SelectedValue.ToEntero(), DdlPersonal.SelectedValue.ToEntero())) - { - - GvPrePolizaPagos.DataSource = cont.DtResultados; - GvPrePolizaPagos.DataBind(); - } - - // Cargamos las amortizaciones - if (cont.GetContabilizacionDiario(UsuarioActual.CveEmpresa, 101, FechaI, FechaF, DdlProveedores.SelectedValue.ToEntero(), DdlPersonal.SelectedValue.ToEntero())) - { - GvPrePolizaAmortizaciones.DataSource = cont.DtResultados; - GvPrePolizaAmortizaciones.DataBind(); - } - - cont.Dispose(); - - UpGvCompras.Update(); - UpGvPagos.Update(); - UpGvAnticipos.Update(); - UpGvAmortizaciones.Update(); - } - - protected void GvD_RowDataBound(object sender, GridViewRowEventArgs e) - { - if (e.Row.RowType == DataControlRowType.DataRow) - { - int cuenta = e.Row.DataKey("IdCtaContable").ToString().ToEntero(); - - - if (cuenta > 0) - { - DataRow dr = DTmpC.FiltroPrimero(String.Format("CveCuenta = {0}", cuenta)); - - if (dr != null) e.Row.Cells[3].Text = string.Format("{0}
{1}", dr["CuentaFormato"], dr["Nombre"]); - } - else - { - e.Row.Cells[0].ForeColor = System.Drawing.Color.Red; - - ((GridViewRow)((GridView)e.Row.NamingContainer).BindingContainer).FCCheckBox("Chk").Visible = false; - } - - if (Convert.ToDecimal(e.Row.DataKey("Cargo").ToString()) == 0) e.Row.Cells[4].Text = ""; - - if (Convert.ToDecimal(e.Row.DataKey("Abono").ToString()) == 0) e.Row.Cells[5].Text = ""; - } - } - -} \ No newline at end of file diff --git a/PyME/Contabilidad/ContabilizacionVentas.aspx b/PyME/Contabilidad/ContabilizacionVentas.aspx deleted file mode 100644 index d13a4ed48..000000000 --- a/PyME/Contabilidad/ContabilizacionVentas.aspx +++ /dev/null @@ -1,423 +0,0 @@ -<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ContabilizacionVentas.aspx.cs" Inherits="Contabilidad_ContabilizacionVentas" %> - - - - - - - - - Diario de Ventas - - - - - - -
-
-
- -
-
-
- -
- - - -
- -
-
- - - - - - - - - - -   -
-
- -
-
- - - - - - - - - - -
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Fecha: - Concepto: - Poliza:
Factura: - Cliente: - Fecha: - Total: - -
-
-
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Fecha: - Concepto: - Poliza:
Número: - Pagador: - Fecha: - Total: - -
-
-
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Fecha: - Concepto: - Poliza:
Número: - Pagador: - Fecha: - Total: - -
-
-
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Fecha: - Concepto: - Poliza:
Factura: - Cliente: - Fecha: - Total: - -
-
-
-
-
-
-
-
- -
-
- -
-
-
- -
- - - - diff --git a/PyME/Contabilidad/ContabilizacionVentas.aspx.cs b/PyME/Contabilidad/ContabilizacionVentas.aspx.cs deleted file mode 100644 index 831b2c44b..000000000 --- a/PyME/Contabilidad/ContabilizacionVentas.aspx.cs +++ /dev/null @@ -1,298 +0,0 @@ -using System; -using System.Web.UI.WebControls; -using Extensiones; -using System.Data; - -public partial class Contabilidad_ContabilizacionVentas : ClsPaginas -{ - private DataTable DTmpC - { - get - { - return (DataTable)ViewState["DTmpC"]; - } - set - { - ViewState["DTmpC"] = value; - } - } - - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - ClsContabilidad ObjCont = new ClsContabilidad(); - ObjCont.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa); - string[] columnas = new string[3] { "CveCuenta", "CuentaFormato", "Nombre"}; - DTmpC = ObjCont.DtResultados.FiltraParametros("", "", columnas); - ObjCont.Dispose(); - - DdlClientes.DataSource = get_GlobalDTCliente(UsuarioActual.CveEmpresa); - DdlClientes.DataBind(); - - txtFechaI.Text = DateTime.Now.AddMonths(-1).FirstDayOfMonth().ToShortDateString(); - txtFechaF.Text = DateTime.Now.ToShortDateString(); - - //cargaPolizas(); - } - - BtnContabilizarVentas.Click += new EventHandler(this.BtnGuardarVentas_Click); - BtnContabilizarPagos.Click += new EventHandler(this.BtnGuardarPagos_Click); - BtnContabilizarAnticipos.Click += new EventHandler(this.BtnGuardarAnticipos_Click); - BtnContabilizarAmortizaciones.Click += new EventHandler(this.BtnGuardarAmortizaciones_Click); - //BtnConsultar.Click += new EventHandler(this.BtnConsultar_Click); - } - - protected void OnRowDataBound(object sender, GridViewRowEventArgs e) - { - if (e.Row.RowType == DataControlRowType.DataRow) - { - GridView GvD = e.Row.FCGridView("GvD"); - int CvePrePoliza = e.Row.DataKey("CvePrePoliza").ToEntero(); - - ClsContabilidad contP = new ClsContabilidad(); - - if (contP.GetContabilizacionDiarioDetalle(CvePrePoliza)) - { - Double Abonos = 0; - Double Cargos = 0; - - Abonos = contP.DtResultados.SUM("Abono"); - Cargos = contP.DtResultados.SUM("Cargo"); - - if (Cargos != Abonos) - { - e.Row.FCCheckBox("Chk").Visible = false; - } - - GvD.DataSource = contP.DtResultados; - } - - if (UsuarioActual.CveRol == 1 || UsuarioActual.CveUsuario == 17) - { - e.Row.FCHyperLink("HplEdicion").Visible = true; - } - - contP.Dispose(); - GvD.DataBind(); - - } - } - - private void Contabilizar(int CvePrepoliza, DateTime Fecha, string Concepto, ClsContabilidad Obj) - { - if (Obj.ContabilizarPrePoliza(CvePrepoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, Fecha, Concepto)) - { - - } - } - - private void BtnGuardarVentas_Click(object sender, EventArgs e) - { - ClsContabilidad ObjMov = new ClsContabilidad(); - - foreach (GridViewRow row in GvV.Rows) - { - CheckBox chk = row.FCCheckBox("Chk"); - TextBox txtFecha = row.FCTextBox("TxtFechaVentas"); - TextBox txtConcepto = row.FCTextBox("TxtConceptoVentas"); - - if (chk != null && chk.Checked) - { - DateTime Fecha = txtFecha.Text.ToDate(); - int CvePrepoliza = GvV.DataKeys[row.RowIndex]["CvePrePoliza"].ToString().ToEntero(); - string Concepto = txtConcepto.Text; - - Contabilizar(CvePrepoliza, Fecha, Concepto, ObjMov); - } - } - ObjMov.Dispose(); - - Alert("Se Contabilizaron Correctamente los Siguientes Folios:
" + ObjMov.AlertaMensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion); - cargaPolizas(); - - } - - private void BtnGuardarPagos_Click(object sender, EventArgs e) - { - ClsContabilidad ObjMov = new ClsContabilidad(); - - foreach (GridViewRow row in GvP.Rows) - { - CheckBox chk = row.FCCheckBox("Chk"); - TextBox txtFecha = row.FCTextBox("TxtFechaPagos"); - TextBox txtConcepto = row.FCTextBox("TxtConceptoPagos"); - - if (chk != null && chk.Checked) - { - DateTime Fecha = txtFecha.Text.ToDate(); - int CvePrepoliza = GvP.DataKeys[row.RowIndex]["CvePrePoliza"].ToString().ToEntero(); - string Concepto = txtConcepto.Text; - - Contabilizar(CvePrepoliza, Fecha, Concepto, ObjMov); - } - } - ObjMov.Dispose(); - - Alert("Se Contabilizaron Correctamente los Siguientes Folios:
" + ObjMov.AlertaMensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion); - cargaPolizas(); - - } - - private void BtnGuardarAnticipos_Click(object sender, EventArgs e) - { - ClsContabilidad ObjMov = new ClsContabilidad(); - - foreach (GridViewRow row in GvA.Rows) - { - CheckBox chk = row.FCCheckBox("Chk"); - TextBox txtFecha = row.FCTextBox("TxtFechaAnticipos"); - TextBox txtConcepto = row.FCTextBox("TxtConceptoAnticipos"); - - if (chk != null && chk.Checked) - { - DateTime Fecha = txtFecha.Text.ToDate(); - int CvePrepoliza = GvA.DataKeys[row.RowIndex]["CvePrePoliza"].ToString().ToEntero(); - string Concepto = txtConcepto.Text; - - Contabilizar(CvePrepoliza, Fecha, Concepto, ObjMov); - } - } - ObjMov.Dispose(); - - Alert("Se Contabilizaron Correctamente los Siguientes Folios:
" + ObjMov.AlertaMensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion); - cargaPolizas(); - - } - - private void BtnGuardarAmortizaciones_Click(object sender, EventArgs e) - { - ClsContabilidad ObjMov = new ClsContabilidad(); - - foreach (GridViewRow row in GvPrePolizaAmortizaciones.Rows) - { - CheckBox chk = row.FCCheckBox("Chk"); - TextBox txtFecha = row.FCTextBox("TxtFechaAmortizaciones"); - TextBox txtConcepto = row.FCTextBox("TxtConceptoAmortizaciones"); - - if (chk != null && chk.Checked) - { - DateTime Fecha = txtFecha.Text.ToDate(); - int CvePrepoliza = GvPrePolizaAmortizaciones.DataKeys[row.RowIndex]["CvePrePoliza"].ToString().ToEntero(); - string Concepto = txtConcepto.Text; - - Contabilizar(CvePrepoliza, Fecha, Concepto, ObjMov); - } - } - ObjMov.Dispose(); - - Alert("Se Contabilizaron Correctamente los Siguientes Folios:
" + ObjMov.AlertaMensaje.ToString(), ModExtensiones.TipoMensaje.MsgInformacion); - cargaPolizas(); - - } - - private void cargaPolizas() - { - - DateTime FechaI = txtFechaI.Text.ToDate(); - DateTime FechaF = txtFechaF.Text.ToDate(); - - ClsContabilidad cont = new ClsContabilidad(); - - // Cargamos las ventas - if (cont.GetContabilizacionDiario(UsuarioActual.CveEmpresa, 4, FechaI, FechaF)) - { - if (DdlClientes.SelectedValue.ToEntero() > 0) - { - GvV.DataSource = cont.DtResultados.FiltraParametros($"CveCliente = {DdlClientes.SelectedValue}"); - } - else - { - GvV.DataSource = cont.DtResultados; - } - GvV.DataBind(); - } - - // Cargamos los pagos - if (cont.GetContabilizacionDiario(UsuarioActual.CveEmpresa, 11, FechaI, FechaF)) - { - if (DdlClientes.SelectedValue.ToEntero() > 0) - { - GvP.DataSource = cont.DtResultados.FiltraParametros($"CveCliente = {DdlClientes.SelectedValue}"); - } - else - { - GvP.DataSource = cont.DtResultados; - } - GvP.DataBind(); - } - - // Cargamos los anticipos - if (cont.GetContabilizacionDiario(UsuarioActual.CveEmpresa, 12, FechaI, FechaF)) - { - if (DdlClientes.SelectedValue.ToEntero() > 0) - { - GvA.DataSource = cont.DtResultados.FiltraParametros($"CveCliente = {DdlClientes.SelectedValue}"); - } - else - { - GvA.DataSource = cont.DtResultados; - } - GvA.DataBind(); - } - - // Cargamos las amortizaciones - if (cont.GetContabilizacionDiario(UsuarioActual.CveEmpresa, 10, FechaI, FechaF)) - { - if (DdlClientes.SelectedValue.ToEntero() > 0) - { - GvPrePolizaAmortizaciones.DataSource = cont.DtResultados.FiltraParametros($"CveCliente = {DdlClientes.SelectedValue}"); - } - else - { - GvPrePolizaAmortizaciones.DataSource = cont.DtResultados; - } - GvPrePolizaAmortizaciones.DataBind(); - } - - cont.Dispose(); - - UpGvVentas.Update(); - UpGvPagos.Update(); - UpGvAnticipos.Update(); - UpGvAmortizaciones.Update(); - UPPTabs.Update(); - } - - protected void BtnConsultar_Click(object sender, EventArgs e) - { - cargaPolizas(); - } - - - protected void GvD_RowDataBound(object sender, GridViewRowEventArgs e) - { - if (e.Row.RowType == DataControlRowType.DataRow) - { - int cuenta = e.Row.DataKey("IdCtaContable").ToString().ToEntero(); - - - if (cuenta > 0) { - DataRow dr = DTmpC.FiltroPrimero(String.Format("CveCuenta = {0}", cuenta)); - - if (dr != null) e.Row.Cells[3].Text = string.Format("{0}
{1}", dr["CuentaFormato"], dr["Nombre"]); - } - else - { - e.Row.Cells[0].ForeColor = System.Drawing.Color.Red; - - ((GridViewRow)((GridView)e.Row.NamingContainer).BindingContainer).FCCheckBox("Chk").Visible = false; - } - - if (Convert.ToDecimal(e.Row.DataKey("Cargo").ToString()) == 0) e.Row.Cells[4].Text = ""; - - if (Convert.ToDecimal(e.Row.DataKey("Abono").ToString()) == 0) e.Row.Cells[5].Text = ""; - } - } - -} \ No newline at end of file diff --git a/PyME/Contabilidad/PlantillasPolizas.aspx b/PyME/Contabilidad/PlantillasPolizas.aspx deleted file mode 100644 index a52700e8d..000000000 --- a/PyME/Contabilidad/PlantillasPolizas.aspx +++ /dev/null @@ -1,207 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PlantillasPolizas.aspx.vb" Inherits="Contabilidad_PlantillasPolizas" %> - -<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> - - - - - - - - - - -
  • - Registrar Plantilla Póliza - -
  • -
    -
    -
    - - Catálogo de Plantillas de Pólizas - - - - - - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PyME/Contabilidad/PlantillasPolizas.aspx.vb b/PyME/Contabilidad/PlantillasPolizas.aspx.vb deleted file mode 100644 index c639d8603..000000000 --- a/PyME/Contabilidad/PlantillasPolizas.aspx.vb +++ /dev/null @@ -1,124 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports System.Linq -Imports Extensiones - -Partial Class Contabilidad_PlantillasPolizas - Inherits ClsPaginas - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - CargaDatos() - End If - End Sub - - Public Sub CargaDatos() - Dim ObjPlantillaPolizas As New ClsContabilidad - If ObjPlantillaPolizas.GetConta_PlantillasPolizasEmpresas(-1, UsuarioActual.CveEmpresa) Then - - GvDatos.DataSource = ObjPlantillaPolizas.DtResultados - GvDatos.DataBind() - - If ObjPlantillaPolizas.GetConta_PlantillasPolizas(-1, -1) Then - DdlPlantillaPoliza.DataSource = ObjPlantillaPolizas.DtResultados.FiltraParametros("CvePlantillaPoliza NOT IN (1,2,3,4,7,10,11,12,32,60)", "", {"CvePlantillaPoliza", "PlantillaPoliza"}) - DdlPlantillaPoliza.DataBind() - End If - - If ObjPlantillaPolizas.GetConta_TiposPoliza(UsuarioActual.CveEmpresa) Then - DdlTiposPoliza.DataSource = ObjPlantillaPolizas.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa} OR CveEmpresa IS NULL") - DdlTipoPolizaModal.DataSource = ObjPlantillaPolizas.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa} OR CveEmpresa IS NULL") - DdlTiposPoliza.DataBind() - DdlTipoPolizaModal.DataBind() - End If - Else - Me.GvDatos.DataSource = Nothing - End If - OrdenaDatos() - UpDatos.Update() - ObjPlantillaPolizas.Dispose() - End Sub - - Private Sub BtnAgregarPoliza_Click(sender As Object, e As EventArgs) Handles BtnAgregarPoliza.Click - Dim ObjPlantillaPolizas As New ClsContabilidad - - If ObjPlantillaPolizas.AddConta_PlantillasPolizasEmpresas(DdlPlantillaPoliza.SelectedValue.ToEntero, DdlTipoPolizaModal.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - Response.Redirect(String.Format("/Contabilidad/PlantillasPolizasDetalle.aspx?CvePlantillaPoliza={0}", DdlPlantillaPoliza.SelectedValue)) - Else - Alert("Ocurrió un error al agregar la plantilla.", TipoMensaje.MsgError) - End If - - ObjPlantillaPolizas.Dispose() - End Sub - - Private Sub BtnActualizarPlantilla_Click(sender As Object, e As EventArgs) Handles BtnActualizarPlantilla.Click - Dim ObjPlantillaPolizas As New ClsContabilidad - - If ObjPlantillaPolizas.UpdateConta_PlantillasPolizasEmpresas(DdlPlantillaPoliza.SelectedValue.ToEntero, DdlTiposPoliza.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivActualizarPlantilla")) - CargaDatos() - Alert("La plantilla se actualizó correctamente.") - Else - Alert("Ocurrió un error al agregar la plantilla.", TipoMensaje.MsgError) - End If - - ObjPlantillaPolizas.Dispose() - End Sub - -#Region "G V D A T O S" - Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(5).Width = Unit.Pixel(40) - e.Row.Cells(6).Width = Unit.Pixel(40) - End If - - If e.Row.DataKey("CveEmpresa").ToEntero = 1 Then - e.Row.FCLinkButton("ImgE").Visible = False - e.Row.FCLinkButton("ImgD").Visible = False - End If - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - e.Row.FCLiteral("LtlPlantillaPoliza").Text = "" & e.Row.FCLiteral("LtlPlantillaPoliza").Text & "" - End If - End Sub - - Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - Dim ObjPlantillaPolizas As New ClsContabilidad - If ObjPlantillaPolizas.RemoveConta_PlantillasPolizasDetalle(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - If ObjPlantillaPolizas.RemoveConta_PlantillasPolizas(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero, UsuarioActual.CveEmpresa) Then - GvDatos.EditIndex = -1 - GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa) = ObjPlantillaPolizas.DtResultados - CargaDatos() - Alert("La Plantilla Poliza se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - End If - ObjPlantillaPolizas.Dispose() - End Sub - - Public Sub Edit_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - DdlTiposPoliza.SelectedValueExist(GvRow.DataKey("TipoPoliza")) - - UpModal.Update() - RegistraScript(String.Format("$('#{0}').modal();", "DivActualizarPlantilla")) - CargaDatos() - End Sub - -#End Region - - -#Region " O R D E N A M I E N T O JAVASCRIPT" - Private Sub OrdenaDatos() - If (GvDatos.Rows.Count > 0) Then - GvDatos.UseAccessibleHeader = True - GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader - RegistraScript("OrdenarGV();") - End If - End Sub -#End Region - - - - -End Class diff --git a/PyME/Contabilidad/PlantillasPolizasDetalle.aspx b/PyME/Contabilidad/PlantillasPolizasDetalle.aspx deleted file mode 100644 index 564613012..000000000 --- a/PyME/Contabilidad/PlantillasPolizasDetalle.aspx +++ /dev/null @@ -1,377 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PlantillasPolizasDetalle.aspx.vb" Inherits="Contabilidad_PlantillasPolizasDetalle" %> - -<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> - - - - - - - -
  • - Plantilla Póliza Listado -
  • - - -
    - - Catálogo de Pantillas de Pólizas - - - - -
  • - -
  • -
    -
    -
    - - - - - - - -
    - - - - - - - - - - - - -
    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - -
    - - - - - - - -
    - - - -
    - - - -
    - - - -
    -
    -
    -
    - - - - - - - -   - - - - - -   - - - - - -  > - - - - - - - - - - - - - - - - - - - - - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    - - - - - - - - -
    - - - - - - - - - - - diff --git a/PyME/Contabilidad/PlantillasPolizasDetalle.aspx.vb b/PyME/Contabilidad/PlantillasPolizasDetalle.aspx.vb deleted file mode 100644 index 56fd3a6bb..000000000 --- a/PyME/Contabilidad/PlantillasPolizasDetalle.aspx.vb +++ /dev/null @@ -1,418 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports System.Linq -Imports Extensiones - -Partial Class Contabilidad_PlantillasPolizasDetalle - Inherits ClsPaginas -#Region "PROPIEDADES" - - Private Property DTSubProyectos As DataTable - Get - Return CType(ViewState("DTSubProyectos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTSubProyectos") = value - End Set - End Property - - - Public Property DTCuentasContables As DataTable - Get - Return CType(ViewState("DTCuentasContables"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTCuentasContables") = value - End Set - End Property - Private ReadOnly Property CvePlantillaPoliza As Integer - Get - Return ViewState("CvePlantillaPoliza").ToString.ToEntero - End Get - End Property - Public Property DTDetalle As DataTable - Get - Return CType(ViewState("DTDetalle"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTDetalle") = value - End Set - End Property -#End Region - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - ViewState("Orden") = "" - TxtFechaIng.Text = Date.Today.ToString("dd/MM/yyyy") - TxtUsuario.Text = UsuarioActual.CveUsuario.ToString - CreadDTDetalle() - - Dim ObjPlantillaPolizasTipo As New ClsContabilidad - If ObjPlantillaPolizasTipo.GetConta_PlantillasPolizasTipo() Then - Dim row As DataRow = ObjPlantillaPolizasTipo.DtResultados().NewRow() - row("CveTipoPlantillaPoliza") = -1 - row("TipoPlantillaPoliza") = "Seleccione" - ObjPlantillaPolizasTipo.DtResultados.Rows.Add(row) - ObjPlantillaPolizasTipo.DtResultados.AcceptChanges() - DdlTPP.DataSource = ObjPlantillaPolizasTipo.DtResultados() - DdlTPP.DataBind() - End If - ObjPlantillaPolizasTipo.Dispose() - - Dim dt As DataTable = Nothing - If UsuarioActual.Empresa.UsaContabilidad Then - Dim Conta As New ClsContPAQi(UsuarioActual.Empresa) - - If Conta.GetCuentas(-1, "-1", 1) Then - dt = Conta.DtResultados - DTCuentasContables = Conta.DtResultados - Session("DtCuentas") = Conta.DtResultados - End If - Conta.Dispose() - End If - CargaCuenta() - CargaDDL() - CargaDDLProveedor() - CargarConcepto() - ViewState("CvePlantillaPoliza") = 0 - - If Request("CvePlantillaPoliza") IsNot Nothing AndAlso IsNumeric(Request("CvePlantillaPoliza")) AndAlso Request("CvePlantillaPoliza").ToEntero > 0 Then - ViewState("CvePlantillaPoliza") = Request("CvePlantillaPoliza") - TRClave.Visible = False - TxtPlantillaPoliza.Enabled = False - DdlTipoPoliza.Enabled = False - DdlTPP.Enabled = False - ChkEstatus.Enabled = False - BtnGuardar.Visible = False - tableopcional.Visible = False - CargaDatos() - CargaDatosPoliza(CvePlantillaPoliza) - Else - ViewState("CvePlantillaPoliza") = -1 - End If - End If - End Sub - -#Region "C A R G A - D A T O S" - Public Sub CargaDatos() - Dim ObjPlantillaPolizaDetalle As New ClsContabilidad - If ObjPlantillaPolizaDetalle.GetConta_PlantillasPolizasDetalle(CvePlantillaPoliza, UsuarioActual.CveEmpresa) Then - GvDatos.DataSource = ObjPlantillaPolizaDetalle.DtResultados - ObjPlantillaPolizaDetalle.Dispose() - GvDatos.DataBind() - Else - Me.GvDatos.DataSource = Nothing - End If - - OrdenaDatos() - End Sub - Public Sub CargaDatosPoliza(CvePlantillaPoliza As Integer) - Dim ObjPlantillaPolizas As New ClsContabilidad - If ObjPlantillaPolizas.GetConta_PlantillasPolizas(CvePlantillaPoliza, -1) Then - TxtPlantillaPoliza.Text = ObjPlantillaPolizas.PlantillaPoliza - DdlTipoPoliza.SelectedValue = ObjPlantillaPolizas.TipoPoliza.ToString - DdlTPP.SelectedValue = ObjPlantillaPolizas.CveTipoPlantillaPoliza.ToString - If ObjPlantillaPolizas.Estatus = "Activo" Then - ChkEstatus.Checked = True - End If - TxtFechaIng.Text = ObjPlantillaPolizas.FechaIng.ToShortDateString - TxtUsuario.Text = ObjPlantillaPolizas.Usuario - BtnGuardar.Text = "Actualizar" - Else - End If - - ObjPlantillaPolizas.Dispose() - End Sub - - Private Sub LimpiaDatos() - TxtPlantillaPoliza.Text = "" - DdlTipoPoliza.SelectedValue = "-1" - DdlTPP.SelectedValue = "-1" - ChkEstatus.Checked = False - ViewState("CvePlantillaPoliza") = -1 - GvDatos.DataSource = Nothing - GvDatos.DataBind() - UpDatos.Update() - End Sub - - Private Sub CargaCuenta() - DdlCtaContable.Items.Clear() - DdlCtaContable.DataSource = DTCuentasContables - DdlCtaContable.DataBind() - DdlCtaContable.Items.Insert(0, New ListItem("Seleccione", "-1")) - End Sub - - Private Sub CargarConcepto() - DdlConcepto.DataSource = GlobalDTContaConceptosContables(-1) - DdlConcepto.DataBind() - End Sub - - Private Sub CreadDTDetalle() - DTDetalle = New DataTable - DTDetalle.Columns.Add("CvePlantillaPolizaDetalle", GetType(Integer)) 'Consec - DTDetalle.Columns.Add("ConceptoContable", GetType(String)) - DTDetalle.Columns.Add("CveConcepto", GetType(Integer)) - DTDetalle.Columns.Add("TipoMovimiento", GetType(String)) - DTDetalle.Columns.Add("TipoMovto", GetType(Integer)) - DTDetalle.Columns.Add("IdCtaContable", GetType(Integer)) - DTDetalle.Columns.Add("Orden", GetType(String)) - DTDetalle.Columns.Add("Usuario", GetType(String)) - End Sub -#End Region - - Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) - Dim ObjPlantillaPoliza As New ClsContabilidad - Dim ErrorPlantilla = False - Dim CvePlantilla = -1 - ObjPlantillaPoliza.IniciaTransacSQL() - - If CvePlantillaPoliza < 0 Then - If ObjPlantillaPoliza.AddConta_PlantillasPolizas(TxtClave.Text.ToEntero, TxtPlantillaPoliza.Text.Trim, DdlTPP.SelectedValue.ToEntero, DdlTipoPoliza.SelectedValue.ToEntero, ChkEstatus.Checked, TxtFechaIng.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - CvePlantilla = ObjPlantillaPoliza.CvePlantillaPoliza - If DTDetalle.Rows.Count > 0 Then - For Each Row As DataRow In DTDetalle.Rows - If Not ObjPlantillaPoliza.AddConta_PlantillasPolizasDetalles(CvePlantilla, Row("CveConcepto").ToString.ToEntero, Row("TipoMovto").ToString.ToEntero, Row("IdCtaContable").ToString.ToEntero, Row("Orden").ToString.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DDLSubProyecto.SelectedValue.ToEntero, DDLProveedor.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero) Then - ErrorPlantilla = True - Exit For - End If - Next - End If - Else - ErrorPlantilla = True - End If - - Else - If ObjPlantillaPoliza.UpdateConta_PlantillasPolizas(TxtPlantillaPoliza.Text.Trim, DdlTPP.SelectedValue.ToEntero, DdlTipoPoliza.SelectedValue.ToEntero, ChkEstatus.Checked, CvePlantillaPoliza) Then - ObjPlantillaPoliza.Commit() - ObjPlantillaPoliza.Dispose() - LimpiaDatos() - Alert("La Plantilla Póliza y sus Detalles fueron Actualizados correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Contabilidad/PlantillasPolizas.aspx?"";") - Exit Sub - Else - ErrorPlantilla = True - End If - - End If - - If Not ErrorPlantilla Then - ObjPlantillaPoliza.Commit() - LimpiaDatos() - Alert("La Plantilla Póliza y su Detalle fue agregado correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Contabilidad/PlantillasPolizas.aspx?"";") - Else - ObjPlantillaPoliza.RollBack() - Alert("Error al agregar la Plantilla Póliza y el Detalle.", TipoMensaje.MsgError) - End If - ObjPlantillaPoliza.Dispose() - End Sub - Public Sub updatatos() - - Dim ObjPlantillaPolizaDetalle As New ClsContabilidad - If ObjPlantillaPolizaDetalle.GetConta_PlantillasPolizasDetalle(-1, -1) Then - ViewState("DTPlantillaPolizaDetalle") = ObjPlantillaPolizaDetalle.DtResultados.FiltraParametros(String.Format(" CvePlantillaPoliza={0} AND CveEmpresa = {1}", CvePlantillaPoliza, UsuarioActual.CveEmpresa)) - - GlobalDTContaPlantillasPolizasDetalle(CvePlantillaPoliza) = ObjPlantillaPolizaDetalle.DtResultados - End If - If ObjPlantillaPolizaDetalle.GetConta_PlantillasPolizas(-1, -1) Then - GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa) = ObjPlantillaPolizaDetalle.DtResultados - End If - ObjPlantillaPolizaDetalle.Dispose() - End Sub - Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click - OcultaDiv() - Dim ObjPlantillaPolizaDetalle As New ClsContabilidad - Dim Row As DataRow - Dim ErrorActualizar = False - Dim ErrorDetalle = False - - - If HdnModalidad.Value = "I" Then - If CvePlantillaPoliza > 0 Then - If ObjPlantillaPolizaDetalle.AddConta_PlantillasPolizasDetalles(CvePlantillaPoliza, DdlConcepto.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, TxtOrden.Text.Trim.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DDLSubProyecto.SelectedValue.ToEntero, DDLProveedor.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero) Then - TxtOrden.Text = "" - updatatos() - Alert("El nuevo Registro se guardó correctamente.", TipoMensaje.MsgInformacion) - UpTitulos.Update() - Else - ErrorDetalle = True - End If - Else - Try - Row = DTDetalle.NewRow - Row("CvePlantillaPolizaDetalle") = DTDetalle.Rows.Count + 1 - Row("ConceptoContable") = DdlConcepto.SelectedItem.ToString - Row("CveConcepto") = DdlConcepto.SelectedValue.ToEntero - Row("TipoMovimiento") = DdlTipoMovimiento.SelectedItem.ToString - Row("TipoMovto") = DdlTipoMovimiento.SelectedValue.ToEntero - Row("IdCtaContable") = DdlCtaContable.SelectedValue.ToEntero - Row("Orden") = TxtOrden.Text.Trim.ToEntero - Row("Usuario") = UsuarioActual.Usuario - - DTDetalle.Rows.Add(Row) - - TxtOrden.Text = "" - UpTitulos.Update() - Catch ex As Exception - ErrorDetalle = True - End Try - End If - Else - If HdnID.Value.ToEntero <> -1 Then - If CvePlantillaPoliza > 0 Then - If ObjPlantillaPolizaDetalle.UpdateConta_PlantillasPolizasDetalle(DdlConcepto.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, TxtOrden.Text.Trim.ToEntero, - HdnID.Value.ToEntero, DDLSubProyecto.SelectedValue.ToEntero, DDLProveedor.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero) Then - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - updatatos() - Else - ErrorActualizar = True - End If - Else - Try - Row = DTDetalle.NewRow - Row("CvePlantillaPolizaDetalle") = DTDetalle.Rows.Count + 1 - Row("ConceptoContable") = DdlConcepto.SelectedItem.ToString - Row("CveConcepto") = DdlConcepto.SelectedValue.ToEntero - Row("TipoMovimiento") = DdlTipoMovimiento.SelectedItem.ToString - Row("TipoMovto") = DdlTipoMovimiento.SelectedValue.ToEntero - Row("IdCtaContable") = DdlCtaContable.SelectedValue.ToEntero - Row("Orden") = TxtOrden.Text.Trim.ToEntero - Row("Usuario") = UsuarioActual.Usuario - DTDetalle.Rows.Add(Row) - Catch ex As Exception - ErrorActualizar = True - End Try - End If - End If - End If - - ObjPlantillaPolizaDetalle.Dispose() - - CargaDatos() - UpDatos.Update() - - End Sub - -#Region "G V - D A T O S" - - - - Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - Dim Cuenta As Integer = e.Row.DataKey("IdCtaContable").ToString.ToEntero - e.Row.FCLiteral("LtlCtaContable").Text = DTCuentasContables.FiltroPrimeroValor("Nombre", $"Id = {Cuenta}") - End If - End Sub - - - Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - Dim ObjPlantillaPolizaDetalle As New ClsContabilidad - If CvePlantillaPoliza > 0 Then - If ObjPlantillaPolizaDetalle.RemoveConta_PlantillasPolizasDetalle(CvePlantillaPoliza, GvDatos.Rows(e.RowIndex).DataKey("CvePlantillaPolizaDetalle").ToString.ToEntero) Then - GvDatos.EditIndex = -1 - updatatos() - Alert("El Concepto se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - Else - Dim index = GvDatos.Rows(e.RowIndex).DataKey("CvePlantillaPolizaDetalle").ToString.ToEntero - 1 - DTDetalle.Rows.RemoveAt(index) - End If - ObjPlantillaPolizaDetalle.Dispose() - CargaDatos() - End Sub - -#End Region - - - Public Sub CargaDDL() - - - DTSubProyectos = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - DDLSubProyecto.DataSource = DTSubProyectos - DDLSubProyecto.DataBind() - DDLSubProyecto.Items.Insert(0, New ListItem(" - ", "-1")) - - - End Sub - - - Private Sub CargaDDLProveedor() - DDLProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - DDLProveedor.DataBind() - DDLProveedor.Items.Insert(0, New ListItem(" - ", "-1")) - DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) - DdlPersonal.DataBind() - DdlPersonal.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - - Private Sub DdlConcepto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConcepto.SelectedIndexChanged - If DdlConcepto.SelectedValue.Contiene("130", "29") Then - DdlPersonal.Visible = True - LblPersonal.Visible = True - Else - DdlPersonal.Visible = False - LblPersonal.Visible = False - End If - End Sub - - - -#Region " O R D E N A M I E N T O JAVASCRIPT" - Private Sub OrdenaDatos() - If (GvDatos.Rows.Count > 0) Then - GvDatos.UseAccessibleHeader = True - GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader - RegistraScript("OrdenarGV();") - End If - End Sub -#End Region - - Private Sub OcultaDiv() - ScriptManager.RegisterStartupScript(Me, Me.GetType, "Llave", "HideDivRegistro();", True) - End Sub - - - Public Sub Edit_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - HdnModalidad.Value = "U" - HdnID.Value = GvRow.DataKey("CvePlantillaPolizaDetalle") - DdlConcepto.SelectedValueExist(GvRow.DataKey("CveConcepto")) - DdlTipoMovimiento.SelectedValueExist(IIf(GvRow.DataKey("TipoMovimiento") = "Abono", 1, 0).ToString) - DdlCtaContable.SelectedValueExist(GvRow.DataKey("IdCtaContable")) - DDLSubProyecto.SelectedValueExist(GvRow.DataKey("CveSubProyecto")) - TxtOrden.Text = GvRow.DataKey("Orden") - LbAgregar.Text = "Actualizar" - LtlTituloModal.Text = String.Format("{0}{1}", "Actualizar Concepto: ", DdlConcepto.SelectedItem) - - If DdlConcepto.SelectedValue.Contiene("130", "29") Then - DdlPersonal.SelectedValueExist(GvRow.DataKey("CvePersonal")) - DdlPersonal.Visible = True - LblPersonal.Visible = True - Else - DdlPersonal.SelectedIndex = 0 - DdlPersonal.Visible = False - LblPersonal.Visible = False - End If - UpModal.Update() - RegistraScript(String.Format("$('#{0}').modal();", "divAgregarSucursal")) - CargaDatos() - End Sub - - Public Sub BtnAgregarSucursalModal_Click(sender As Object, e As EventArgs) - DdlPersonal.Visible = False - LblPersonal.Visible = False - LbAgregar.Text = "Agregar" - LtlTituloModal.Text = "Agregar Concepto Contable" - DdlConcepto.SelectedIndex = 0 - DdlTipoMovimiento.SelectedIndex = 0 - DdlCtaContable.SelectedIndex = 0 - DDLSubProyecto.SelectedIndex = 0 - DDLProveedor.SelectedIndex = 0 - DdlPersonal.SelectedIndex = 0 - TxtOrden.Text = "" - UpModal.Update() - HdnModalidad.Value = "I" - RegistraScript(String.Format("$('#{0}').modal();", "divAgregarSucursal")) - End Sub - - -End Class diff --git a/PyME/Contabilidad/RegPoliza.aspx b/PyME/Contabilidad/RegPoliza.aspx deleted file mode 100644 index c54b62bb1..000000000 --- a/PyME/Contabilidad/RegPoliza.aspx +++ /dev/null @@ -1,1073 +0,0 @@ -<%@ Page Title="Contabilidad - Pólizas" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RegPoliza.aspx.vb" Inherits="RegPoliza" %> - - - - - - - - - - Pólizas - - - -
  • - - - Imprimir - - - -
  • -
  • - Agregar movtos de IVA -
  • -
  • - Causaciones IVA -
  • -
  • - -
  • - - -
    - - - - - -
    -
    -
    - -
    -
    -
    -
    -
    - -
    - - -
    -
    -
    - -
    -
    - - - - - - - - - -
    -
    -
    - -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - -
    -
    Fecha:
    - -
    -
    - - - - - - - - - -
    -
    - -
    Tipo Póliza:
    -
    - - - -
    - -
    - : -
    - -
    - - -
    -
    - -
    -
    Poliza Complementaria:
    -
    - -
    -
    - -
    -
    Concepto:
    -
    - - - -
    -
    - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - Referencia - - - - - - - Centro Costo - -  /  - Concepto - - - - - Cargo ME - - - - Abono ME - - - - - Cargo - - - - Abono - - - Comandos
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - - - - - - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   - - - - - - - - - - -
    -
    - - - - -
    - - - - - - - -
    Sumas Iguales:  - - - - - -
    - - - - - - -
    Diferencia:  - 0.00
    -
    -
    -
    - - - - - - - -
    - - - - -
    -
    -
    - - - - -
    - - -
    - - - - - diff --git a/PyME/Contabilidad/RegPoliza.aspx.vb b/PyME/Contabilidad/RegPoliza.aspx.vb deleted file mode 100644 index 492688cb2..000000000 --- a/PyME/Contabilidad/RegPoliza.aspx.vb +++ /dev/null @@ -1,1267 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports Extensiones - - -Partial Class RegPoliza - Inherits ClsPaginas - -#Region "P R O P E R T Y" - Private Shared missing As Object = System.Reflection.Missing.Value - Private Property RemoveMovimientos As New ArrayList() - - Private Property CvePoliza As Integer - Get - Return CType(ViewState("CvePoliza"), Integer) - End Get - Set(value As Integer) - ViewState("CvePoliza") = value - End Set - End Property - - Private Property Opcion As String - Get - Return CType(ViewState("Opcion"), String) - End Get - Set(value As String) - ViewState("Opcion") = value - End Set - End Property - - Private Property TmpDT As DataTable - Get - Return CType(ViewState("TmpDT"), DataTable) - End Get - Set(value As DataTable) - ViewState("TmpDT") = value - End Set - End Property - - Private Property DTCuentas As DataTable - Get - Return CType(ViewState("DTCuentas"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTCuentas") = value - End Set - End Property - - Private Property DTSegmentosNegocio As DataTable - Get - Return CType(ViewState("DTSegmentosNegocio"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTSegmentosNegocio") = value - End Set - End Property - - Private Property DtDevoluciones As DataTable - Get - DtDevoluciones = DirectCast(ViewState("DtDevoluciones"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtDevoluciones") = value - End Set - End Property - - Private Property DtProveedoresConta As DataTable - Get - DtProveedoresConta = DirectCast(ViewState("DtProveedoresConta"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtProveedoresConta") = value - End Set - End Property - - Private Property DrParametros As DataRow - Get - DrParametros = If(ViewState("drParametros") IsNot Nothing AndAlso DirectCast(ViewState("drParametros"), DataTable).Rows.Count > 0, DirectCast(ViewState("drParametros"), DataTable).Rows(0), Nothing) - End Get - Set(value As DataRow) - ViewState("drParametros") = value.Table - End Set - End Property - - Private Property UsaMonedaExtranjera As Boolean - Get - UsaMonedaExtranjera = CBool(ViewState("UsaMonedaExtranjera")) - End Get - Set(value As Boolean) - ViewState("UsaMonedaExtranjera") = value - End Set - End Property -#End Region - - Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.LoadComplete - If Not IsPostBack Then - ViewState("Orden0") = "" - ViewState("Orden1") = "" - Me.Form.DefaultButton = BtnConsultar.UniqueID - - TxtFecha.Text = Now.ToShortDateString - TxtFechaPoliza.Text = Now.ToShortDateString - - If Not UsuarioActual.Empresa.UsaAC Then - tdPolizaComplementaria.Visible = True - End If - - Dim ObjConta As New ClsContabilidad - If ObjConta.GetConta_TiposPoliza(UsuarioActual.CveEmpresa) Then - DdlTipo.DataSource = ObjConta.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa} OR CveEmpresa IS NULL") - DdlTipo.DataBind() - DdlTipoPoliza.DataSource = ObjConta.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa} OR CveEmpresa IS NULL") - DdlTipoPoliza.DataBind() - End If - - If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then - DTCuentas = ObjConta.DtResultados - End If - - DTSegmentosNegocio = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1) - - Dim dr As DataRow = DTSegmentosNegocio.NewRow - dr("CveSubProyecto") = "0" - dr("SubProyecto") = "" - DTSegmentosNegocio.Rows.InsertAt(dr, 0) - - DdlSegNeg.DataSource = DTSegmentosNegocio - DdlSegNeg.DataBind() - - If ObjConta.GetParametros(UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados IsNot Nothing AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - DrParametros = ObjConta.DtResultados.Rows(0) - 'vienen datos agruapdos ejemplo 'SSSSSSNNNNSSSSSS, Y un digito significa una opcion - UsaMonedaExtranjera = DrParametros("ParFunc").ToString.Substring(5, 1) = "S" - - If UsaMonedaExtranjera Then - GvDatos.Columns(5).Visible = True - GvDatos.Columns(6).Visible = True - td1CargoME.Visible = True - td1AbonoME.Visible = True - td2CargoME.Visible = True - td2AbonoME.Visible = True - End If - End If - End If - - ObjConta.Dispose() - - LblAbono.Text = "0.00" - LblCargo.Text = "0.00" - - If TmpDT Is Nothing Then CreaDTRegPoliza() - - If Request("CvePoliza") IsNot Nothing AndAlso Request("CvePoliza").ToEntero() > 0 Then - - ChkPolizaComplementaria.Enabled = False - CvePoliza = Request("CvePoliza").ToEntero() - - Limpia() - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString <> "" Then - Opcion = Request("Opcion").ToString - End If - - If Opcion = "Com" Then - CargaPolizaComplementaria(CvePoliza) - Else - CargaDatos(CvePoliza) - tdPolizaComplementaria.Visible = False - End If - - Else - TxtFechaPoliza.Text = Date.Now.ToShortDateString - CvePoliza = -1 - SiguienteFolio() - End If - - If UsuarioActual.Empresa.UsaAC Then - LBDevIVA.Visible = False - PnlDevIVA.Visible = False - End If - - End If - End Sub - - -#Region "C A R G A - V A L O R E S" - Private Sub CreaDTRegPoliza() - TmpDT = New DataTable - Dim column As DataColumn = New DataColumn("IdConsec", GetType(Integer)) - With column - .AutoIncrement = True - .AutoIncrementSeed = 1 - .AutoIncrementStep = 1 - End With - TmpDT.Columns.Add(column) - TmpDT.Columns.Add("CvePolizaDetalle", GetType(Integer)) - TmpDT.Columns.Add("CvePoliza", GetType(Integer)) - TmpDT.Columns.Add("Referencia", GetType(String)) - TmpDT.Columns.Add("CveCuenta", GetType(Integer)) - TmpDT.Columns.Add("Cuenta", GetType(String)) - TmpDT.Columns.Add("CtaCodigo", GetType(String)) - TmpDT.Columns.Add("CveSubProyecto", GetType(Integer)) - TmpDT.Columns.Add("SubProyecto", GetType(String)) - TmpDT.Columns.Add("Concepto", GetType(String)) - TmpDT.Columns.Add("Estado", GetType(String)) - TmpDT.Columns.Add("Cargo", GetType(Double)) - TmpDT.Columns.Add("Abono", GetType(Double)) - TmpDT.Columns.Add("CargoME", GetType(Double)) - TmpDT.Columns.Add("AbonoME", GetType(Double)) - TmpDT.Columns.Add("Folio", GetType(Integer)) - End Sub -#End Region - -#Region "G R I D - V I E W" - Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit - GvDatos.EditIndex = -1 - CargaGrid() - End Sub - - Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.RowIndex <= 4 Then 'mayor a cero, por si borran los primeros 3 renglones que se conserve el ancho - LblAbono.Text = TmpDT.FiltraParametros("Estado<>'D'").SUM("Abono").FormatoNumero - LblCargo.Text = TmpDT.FiltraParametros("Estado<>'D'").SUM("Cargo").FormatoNumero - LblDiferencia.Text = (LblCargo.Text.Trim.ToDouble - LblAbono.Text.Trim.ToDouble).FormatoNumero - End If - - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center - e.Row.Cells(2).Style.Add("text-align", "left") - e.Row.FCLiteral("LtlNo").Text = (e.Row.RowIndex + 1).ToString - - If e.Row.DBCampo("Cargo") = "0" AndAlso e.Row.FCLiteral("LtlCargo") IsNot Nothing Then e.Row.FCLiteral("LtlCargo").Text = "" - If e.Row.DBCampo("Abono") = "0" AndAlso e.Row.FCLiteral("LtlAbono") IsNot Nothing Then e.Row.FCLiteral("LtlAbono").Text = "" - - If e.Row.DBCampo("CargoME") = "0" AndAlso e.Row.FCLiteral("LtlCargoME") IsNot Nothing Then e.Row.FCLiteral("LtlCargoME").Text = "" - If e.Row.DBCampo("AbonoME") = "0" AndAlso e.Row.FCLiteral("LtlAbonoME") IsNot Nothing Then e.Row.FCLiteral("LtlAbonoME").Text = "" - - If e.Row.DBCampo("Cargo").ToDouble < 0 AndAlso e.Row.FCLiteral("LtlCargo") IsNot Nothing Then e.Row.FCLiteral("LtlCargo").Text = String.Format("{0}", e.Row.DBCampo("Cargo").FormatoNumero()) - If e.Row.DBCampo("Abono").ToDouble < 0 AndAlso e.Row.FCLiteral("LtlAbono") IsNot Nothing Then e.Row.FCLiteral("LtlAbono").Text = String.Format("{0}", e.Row.DBCampo("Abono").FormatoNumero()) - - If e.Row.DBCampo("Estado").ToString.Trim = "D" Then e.Row.Visible = False - - If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - e.Row.FCDropDownList("DdlCuenta").DataSource = DTCuentas.FiltraParametros("Afectable=1") - e.Row.FCDropDownList("DdlCuenta").DataBind() - e.Row.FCDropDownList("DdlCuenta").SelectedValue = e.Row.DBCampo("CveCuenta") - - e.Row.FCDropDownList("DdlSegNeg").DataSource = DTSegmentosNegocio - e.Row.FCDropDownList("DdlSegNeg").DataBind() - e.Row.FCDropDownList("DdlSegNeg").SelectedValue = e.Row.DBCampo("CveSubProyecto") - - e.Row.FCTextBox("TxtCargo").Text = e.Row.DBCampo("Cargo").ToString - e.Row.FCTextBox("TxtAbono").Text = e.Row.DBCampo("Abono").ToString - - e.Row.FCTextBox("TxtCargoME").Text = e.Row.DBCampo("CargoME").ToString - e.Row.FCTextBox("TxtAbonoME").Text = e.Row.DBCampo("AbonoME").ToString - Else - 'e.Row.FCHyperLink("Ref").NavigateUrl = e.Row.DBCampo("SIGReferencia").ContaReferenciaLiga - End If - End If - End Sub - - Protected Sub GvDatos_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - Dim dr() As DataRow = TmpDT.Select(String.Format("IdConsec = {0}", e.Keys("IdConsec"))) - - dr(0)("Estado") = "D" - TmpDT.AcceptChanges() - BtnNuevo.OnClientClick = "return confirm('Se han hecho cambios que no fueron guardados, ¿Continuar?');" - - CargaGrid() - End Sub - - Protected Sub GvDatos_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvDatos.RowEditing - GvDatos.EditIndex = e.NewEditIndex - CargaGrid() - End Sub - - Protected Sub GvDatos_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvDatos.RowUpdating - - If (GvDatos.Rows(e.RowIndex).FCTextBox("TxtCargo").Text.Length = 0 AndAlso - GvDatos.Rows(e.RowIndex).FCTextBox("TxtAbono").Text.Length = 0) OrElse - (GvDatos.Rows(e.RowIndex).FCTextBox("TxtCargo").Text.Trim.ToDouble > 0 AndAlso - GvDatos.Rows(e.RowIndex).FCTextBox("TxtAbono").Text.Trim.ToDouble > 0) Then - Alert("Debes asignar un valor para CARGO o para ABONO", TipoMensaje.MsgAdvertencia) - Else - Dim dr() As DataRow = TmpDT.Select(String.Format("IdConsec = {0}", e.Keys("IdConsec"))) - - BtnNuevo.OnClientClick = "return confirm('Se han hecho cambios que no fueron guardados, ¿Continuar?');" - dr(0)("Referencia") = GvDatos.Rows(e.RowIndex).FCTextBox("TxtReferencia").Text.Trim - dr(0)("CveCuenta") = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlCuenta").SelectedValue - dr(0)("CtaCodigo") = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlCuenta").SelectedItem.Text - dr(0)("Cuenta") = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlCuenta").SelectedItem.Text - dr(0)("CveSubProyecto") = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlSegNeg").SelectedValue - dr(0)("SubProyecto") = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlSegNeg").SelectedItem.Text - dr(0)("Concepto") = GvDatos.Rows(e.RowIndex).FCTextBox("TxtNombreConcepto").Text.Trim - dr(0)("Cargo") = GvDatos.Rows(e.RowIndex).FCTextBox("TxtCargo").Text.Trim.ToDouble - dr(0)("Abono") = GvDatos.Rows(e.RowIndex).FCTextBox("TxtAbono").Text.Trim.ToDouble - dr(0)("CargoME") = GvDatos.Rows(e.RowIndex).FCTextBox("TxtCargoME").Text.Trim.ToDouble - dr(0)("AbonoME") = GvDatos.Rows(e.RowIndex).FCTextBox("TxtAbonoME").Text.Trim.ToDouble - dr(0)("Estado") = "U" - TmpDT.AcceptChanges() - GvDatos.EditIndex = -1 - CargaGrid() - End If - - End Sub - - Public Function WSCuentas() As String - Dim Str As New StringBuilder - Dim i As Integer = 0 - Dim dt As DataTable = DTCuentas.FiltraParametros("Afectable = 1") - - If dt IsNot Nothing Then - For Each dr As DataRow In dt.Rows - i += 1 - Str.AppendFormat("{{value:""{0}"",label:""{1}""}}{2}", dr("CveCuenta"), dr("CtaCodigo").ToString.Replace("""", ""), If(i < dt.Rows.Count, ",", "")) - Next - End If - - Return Str.ToString - End Function - -#End Region - -#Region "O R D E N A M I E N T O" - Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) - Dim Orden As String = "" - Dim Campo As String = "" - Dim gvi As Integer = 0 - Dim Literal As Literal = Nothing - Const OrdenInicial As String = "" - Dim Arg(2) As String - - Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) - Campo = Arg(0) - gvi = Arg(1).ToEntero - Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal) - Campo = Campo.Substring(0, Campo.Length - 1) - - If ViewState(String.Format("O{0}", Campo, gvi)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo, gvi)).ToString = String.Format("{0} DESC", Campo) Then - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) - Literal.Text = String.Format("") - Else - ViewState(String.Format("O{0}", Campo, gvi)) = String.Format("{0} DESC", Campo) - Literal.Text = String.Format("") - End If - Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo, gvi)).ToString - ViewState("Orden") = Orden - CargaGridDevoluciones(Orden, gvi) - End Sub - - Protected Sub CargaGridDevoluciones(Orden As String, gvi As Integer) - Dim DV As DataView = Nothing - - DV = New DataView(DtDevoluciones, "", Orden, DataViewRowState.CurrentRows) - If Orden <> String.Empty Then - GvDevoluciones.DataSource = DV.ToTable() - Else - GvDevoluciones.DataSource = DtDevoluciones - End If - ViewState("Orden1") = Orden - - GvDevoluciones.DataBind() - UpDevoluciones.Update() - DV.Dispose() - End Sub - -#End Region - -#Region "I M A G E - B U T T O N Y L I N K S" - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click - Limpia() - CargaDatos(-1, DdlTipo.SelectedValue.ToEntero, TxtFecha.Text.Trim.ToDate, TxtNumero.Text.Trim.ToEntero) - End Sub - - Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click - If GvDatos.Rows.Count = 0 Then - Alert("Debe agregar movimientos a la póliza.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - If LblCargo.Text.Trim.ToDouble <> LblAbono.Text.Trim.ToDouble Then - Alert("El total del CARGO debe coincidir con el total del ABONO.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - BtnGuardar.OnClientClick = "FncVerifica();" - - If ChkPolizaComplementaria.Checked Then - If CvePoliza < 0 Then - GuardaPolizaComplementaria() - ElseIf HdnGuardar.Value = "" Or HdnGuardar.Value = "True" Then - ActualizaPolizaComplementaria() - ElseIf HdnGuardar.Value = "False" Then - Alert("Los datos no se guardaron", TipoMensaje.MsgError) - End If - Else - If CvePoliza < 0 Then - GuardaPoliza() - ElseIf HdnGuardar.Value = "" Or HdnGuardar.Value = "True" Then - ActualizaPoliza() - ElseIf HdnGuardar.Value = "False" Then - Alert("Los datos no se guardaron", TipoMensaje.MsgError) - End If - End If - - - End Sub - Protected Sub BtnNuevo_Click(sender As Object, e As EventArgs) Handles BtnNuevo.Click - CvePoliza = -1 - DdlTipo.SelectedIndex = 0 - DdlTipoPoliza.SelectedIndex = 0 - DdlSegNeg.SelectedIndex = 0 - - BtnGuardar.OnClientClick = "" - TxtFecha.Text = "" - TxtNumero.Text = "" - TxtFechaPoliza.Text = "" - TxtNumeroPoliza.Text = "" - TxtConcepto.Text = "" - TxtReferencia.Text = "" - TxtCuenta.Text = "" - HdnCveCuenta.Value = "" - TxtNombreConcepto.Text = "" - TxtCargo.Text = "" - TxtAbono.Text = "" - LblCargo.Text = "0.00" - LblAbono.Text = "0.00" - - HdnFechaPoliza.Value = TxtFechaPoliza.Text - HdnFolioPoliza.Value = TxtNumeroPoliza.Text - HdnTipoPoliza.Value = DdlTipoPoliza.SelectedValue - - BtnEliminar.Visible = False - - GvDatos.DataBind() - UpConsultar.Update() - UpTitulos.Update() - UpDatos.Update() - - If TmpDT Is Nothing Then CreaDTRegPoliza() Else TmpDT.Rows.Clear() - - Limpia() - End Sub - - Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click - If HdnCveCuenta.Value.ToEntero <= 0 Then Alert("Debe de seleccionar la cuenta.", TipoMensaje.MsgAdvertencia) : TxtCuenta.Focus() : Exit Sub - - If (TxtCargo.Text.Length = 0 And TxtAbono.Text.Length = 0) Or (TxtCargo.Text.Trim.ToDouble > 0 And TxtAbono.Text.Trim.ToDouble > 0) Then - Alert("Debes asignar un valor para CARGO o para ABONO", TipoMensaje.MsgAdvertencia) - Else - If TxtCargo.Text = "" Then TxtCargo.Text = "0" - If TxtAbono.Text = "" Then TxtAbono.Text = "0" - AddRegPolizaDetalle(-1, TxtReferencia.Text, HdnCveCuenta.Value.ToEntero, TxtCuenta.Text, DdlSegNeg.SelectedValue, DdlSegNeg.SelectedItem.Text, TxtNombreConcepto.Text, TxtCargo.Text.ToDouble, TxtAbono.Text.ToDouble) - CargaGrid() - UpDatos.Update() - TxtReferencia.Focus() - - DdlSegNeg.SelectedIndex = 0 - TxtCargo.Text = "" - TxtAbono.Text = "" - HdnCveCuenta.Value = "" - TxtCuenta.Text = "" - BtnNuevo.OnClientClick = "return confirm('Se han hecho cambios que no fueron guardados, ¿Continuar?')" - End If - End Sub - -#End Region - - Private Sub CargaGrid() - GvDatos.DataBind() - GvDatos.DataSource = TmpDT - GvDatos.DataBind() - - LblAbono.Text = TmpDT.SUM("Abono", "Estado<>'D'").FormatoNumero - LblCargo.Text = TmpDT.SUM("Cargo", "Estado<>'D'").FormatoNumero - LblDiferencia.Text = (LblCargo.Text.Trim.ToDouble - LblAbono.Text.Trim.ToDouble).FormatoNumero - - If LblDiferencia.Text.ToDouble >= 0 Then - LblDiferencia.ForeColor = Drawing.Color.Black - Else - BtnGuardar.Enabled = True - LblDiferencia.ForeColor = Drawing.Color.Red - End If - - End Sub - -#Region " P O L I Z A S - C O M P L E M E N T A R I A S " - Private Sub CargaPolizaComplementaria(tCvePoliza As Integer) - Dim ObjPoliza As New ClsContabilidad - Dim DT As DataTable = Nothing - - If ObjPoliza.GetPoliza(tCvePoliza, UsuarioActual.CveEmpresa) Then - DT = ObjPoliza.DtResultados - BtnGuardar.OnClientClick = "FncVerifica();" - - ChkPolizaComplementaria.Checked = True - - If DT.Rows.Count = 0 Then - TxtFechaPoliza.Text = Now.ToShortDateString - TxtNumeroPoliza.Text = "" - LblCargo.Text = "" - LblAbono.Text = "" - TxtConcepto.Text = "" - Alert("No se encontró ninguna póliza, verifique los datos.", TipoMensaje.MsgAdvertencia) - Else - Dim dr As DataRow = DT.Rows(0) - TxtFechaPoliza.Text = dr("FechaPol").ToString.ToDate.ToShortDateString - HdnFechaPoliza.Value = dr("FechaPol").ToString.ToDate.ToShortDateString - HdnTipoPoliza.Value = DdlTipoPoliza.SelectedValue - TxtNumeroPoliza.Text = dr("Folio").ToString - HdnFolioPoliza.Value = dr("Folio").ToString - TxtConcepto.Text = dr("ConceptoPoliza").ToString - HdnlCargo.Value = dr("Cargos").ToString - HdnlAbono.Value = dr("Abonos").ToString - LblCargo.Text = dr("Cargos").ToString - LblAbono.Text = dr("Abonos").ToString - LblNumPoliza.ToolTip = dr("CvePoliza").ToString - - If Math.Abs(dr("Cargos").ToString.ToDecimal - DT.SUM("Cargo")) > 0.001 OrElse Math.Abs(dr("Abonos").ToString.ToDecimal - DT.SUM("Abono")) > 0.001 Then - Dim Str As New StringBuilder - Str.AppendFormat("Los Totales de la póliza no coinciden con los movimientos
    Cargos en Póliza: {0} Cargos en Movimientos: {1}
    Abonos en Póliza: {2} Abonos en Movimientos: {3}
    ", dr("Cargos").ToString, DT.SUM("Cargo").ToString, dr("Abonos").ToString, DT.SUM("Abono").ToString) - Alert(Str.ToString, TipoMensaje.MsgError) - End If - - CvePoliza = dr("CvePoliza").ToString.ToEntero - End If - - End If - ObjPoliza.Dispose() - - If TmpDT Is Nothing Then CreaDTRegPoliza() - TmpDT.Clear() - If DT IsNot Nothing Then TmpDT.Merge(DT) - - If LblDiferencia.Text.Trim.ToDouble <> 0 Then - Alert("Verifique los cargos y abonos de los movimientos", TipoMensaje.MsgInformacion) - ElseIf HdnlCargo.Value.ToDouble <> LblCargo.Text.ToDouble Then - Alert("El cargo de la póliza " + HdnlCargo.Value + " no coincide con la sumatoria de cargos de los movimientos", TipoMensaje.MsgInformacion) - ElseIf HdnlAbono.Value.ToDouble <> LblAbono.Text.ToDouble Then - Alert("El abono de la póliza " + HdnlAbono.Value + " no coincide con la sumatoria de abonos de los movimientos", TipoMensaje.MsgInformacion) - End If - - CargaGrid() - UpTitulos.Update() - UpDatos.Update() - - If DT IsNot Nothing Then DT.Dispose() - End Sub - - Private Sub GuardaPolizaComplementaria() - Dim OcurrioError As Boolean = False - Dim ObjConta As New ClsContabilidad - Dim tCvePoliza As Integer - Dim NumPoliza As String = "-1" - Dim Tipo As String = "" - - ObjConta.IniciaTransacSQL() - - If TxtNumeroPoliza.Text.Trim <> "" Then - NumPoliza = TxtNumeroPoliza.Text.Trim - Tipo = "CHQ" - Else - - End If - - tCvePoliza = ObjConta.AddPoliza(DdlTipoPoliza.SelectedValue.ToEntero, TxtFolio.Text.ToEntero, TxtFechaPoliza.Text.Trim.ToDate, TxtConcepto.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - If tCvePoliza > 0 Then - - 'Agrega Movimientos de la poliza - For Each Row As DataRow In TmpDT.Rows - If Row("Cargo").ToString.ToDecimal <> 0 Then - If Not ObjConta.AddPolizaDetalle(tCvePoliza, Row("CveCuenta").ToString.ToEntero, Row("Cuenta").ToString, Row("CveSubProyecto").ToString.ToEntero, False, - Row("Cargo").ToString.ToDouble, Row("Referencia").ToString, Row("Concepto").ToString, - TxtFechaPoliza.Text.Trim.ToDate) Then - OcurrioError = True - End If - Else - If Not ObjConta.AddPolizaDetalle(tCvePoliza, Row("CveCuenta").ToString.ToEntero, Row("Cuenta").ToString, Row("CveSubProyecto").ToString.ToEntero, True, - Row("Abono").ToString.ToDouble, Row("Referencia").ToString, Row("Concepto").ToString, - TxtFechaPoliza.Text.Trim.ToDate) Then - OcurrioError = True - End If - End If - Next - - - If OcurrioError Then - ObjConta.RollBack() - Alert("Ocurrió un error al guardar la póliza.", TipoMensaje.MsgAdvertencia) - Else - Alert(String.Format("La información se guardó correctamente."), TipoMensaje.MsgInformacion) - ObjConta.Commit() - CvePoliza = tCvePoliza - Limpia() - CargaPolizaComplementaria(CvePoliza) - BtnNuevo.OnClientClick = "" - End If - End If - - UpTitulos.Update() - UpDatos.Update() - UpConsultar.Update() - ObjConta.Dispose() - End Sub - - Private Sub ActualizaPolizaComplementaria() - Dim OcurrioError As Boolean = False - Dim ObjConta As New ClsContabilidad - Dim Row As DataRow - ObjConta.IniciaTransacSQL() - - - If ObjConta.UpdatePoliza(TxtFechaPoliza.Text.Trim.ToDate, TxtNumeroPoliza.Text.ToEntero, CvePoliza, TxtConcepto.Text.Trim, DdlTipoPoliza.SelectedValue.ToEntero) Then - - For Each Row In TmpDT.Rows - If Row("Estado").ToString.Trim = "D" AndAlso Row("CvePolizaDetalle").ToString.ToEntero > 0 Then - ObjConta.RemovePolizaDetalle(Row("CvePolizaDetalle").ToString.ToEntero) - Else - Dim Importe As Double = If(Row("Cargo").ToString.ToDouble <> 0, Row("Cargo"), Row("Abono")).ToString.ToDouble - Dim TipoMovto As Boolean = Not Row("Cargo").ToString.ToDouble <> 0 - - If Row("CvePolizaDetalle").ToString.ToEntero <> -1 Then - - If Not ObjConta.UpdatePolizaDetalle(Row("CvePolizaDetalle").ToString.ToEntero, Row("CveCuenta").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, TipoMovto, Importe, Row("Referencia").ToString, Row("Concepto").ToString) Then - OcurrioError = True - End If - - Else - - If Not ObjConta.AddPolizaDetalle(CvePoliza.ToString.ToEntero, Row("CveCuenta").ToString.ToEntero, Row("Cuenta").ToString, Row("CveSubProyecto").ToString.ToEntero, TipoMovto, Importe, Row("Referencia").ToString, Row("Concepto").ToString, TxtFechaPoliza.Text.Trim.ToDate) Then - OcurrioError = True - End If - - End If - End If - Next - - If OcurrioError Then - ObjConta.RollBack() - Alert("Ocurrió un error al actualizar los movimientos de la póliza complementaria", TipoMensaje.MsgAdvertencia) - Else - Alert("La póliza se actualizó correctamente.", TipoMensaje.MsgInformacion) - ObjConta.Commit() - HdnFechaPoliza.Value = TxtFechaPoliza.Text.ToDate.ToShortDateString - HdnTipoPoliza.Value = DdlTipoPoliza.SelectedValue - CargaPolizaComplementaria(CvePoliza) - BtnNuevo.OnClientClick = "" - End If - Else - ObjConta.RollBack() - End If - - ObjConta.Dispose() - End Sub -#End Region - -#Region "P R O C E D I M I E N T O S" - Private Sub CargaDatos(tCvePoliza As Integer, Optional CveTipoPoliza As Integer = -1, Optional Fecha As Date = MinFecha, Optional Folio As Integer = -1) - Dim ObjPoliza As New ClsContabilidad - Dim DT As DataTable = Nothing - - If (tCvePoliza = -1 And ObjPoliza.GetPoliza(CveTipoPoliza, Fecha, Folio, UsuarioActual.CveEmpresa)) OrElse ObjPoliza.GetPoliza(tCvePoliza, UsuarioActual.CveEmpresa) Then - DT = ObjPoliza.DtResultados - - BtnGuardar.OnClientClick = "FncVerifica();" - - If DT.Rows.Count = 0 Then - TxtFechaPoliza.Text = Now.ToShortDateString - TxtNumeroPoliza.Text = "" - LblCargo.Text = "" - LblAbono.Text = "" - TxtConcepto.Text = "" - Alert("No se encontró ninguna Póliza, verifique los datos.", TipoMensaje.MsgAdvertencia) - Else - Dim dr As DataRow = DT.Rows(0) - - HLImprimir.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta($"OP=POL&CvePoliza={dr("CvePoliza").ToString.ToEntero}")) - - TxtFechaPoliza.Text = dr("Fecha").ToString.ToDate.ToShortDateString - HdnFechaPoliza.Value = dr("Fecha").ToString.ToDate.ToShortDateString - DdlTipoPoliza.SelectedValue = dr("CveTipoPoliza").ToString.Trim - HdnTipoPoliza.Value = DdlTipoPoliza.SelectedValue - TxtNumeroPoliza.Text = dr("Folio").ToString - HdnFolioPoliza.Value = dr("Folio").ToString - TxtConcepto.Text = dr("ConceptoPoliza").ToString - HdnlCargo.Value = dr("Cargos").ToString - HdnlAbono.Value = dr("Abonos").ToString - LblCargo.Text = dr("Cargos").ToString - LblAbono.Text = dr("Abonos").ToString - LblNumPoliza.ToolTip = dr("CvePoliza").ToString - - If Math.Abs(dr("Cargos").ToString.ToDecimal - DT.SUM("Cargo")) > 0.001 OrElse Math.Abs(dr("Abonos").ToString.ToDecimal - DT.SUM("Abono")) > 0.001 Then - Dim Str As New StringBuilder - Str.AppendFormat("Los Totales de la póliza no coinciden con los movimientos
    Cargos en Póliza: {0} Cargos en Movimientos: {1}
    Abonos en Póliza: {2} Abonos en Movimientos: {3}
    ", dr("Cargos").ToString, DT.SUM("Cargo").ToString, dr("Abonos").ToString, DT.SUM("Abono").ToString) - Alert(Str.ToString, TipoMensaje.MsgError) - End If - - CvePoliza = dr("CvePoliza").ToString.ToEntero - - If UsuarioActual.TienePermisoProceso(145) Then - BtnEliminar.Visible = True - End If - End If - End If - - ObjPoliza.Dispose() - - TmpDT = DT - TmpDT.Columns.Add("CtaCodigo", GetType(String)) - - For Each dr As DataRow In TmpDT.Rows - dr("CtaCodigo") = DTCuentas.FiltroPrimeroValor("CtaCodigo", $"CveCuenta={dr("CveCuenta")}") - Next - - TmpDT.AcceptChanges() - - If LblDiferencia.Text.Trim.ToDouble <> 0 Then - Alert("Verifique los cargos y abonos de los movimientos", TipoMensaje.MsgAdvertencia) - ElseIf HdnlCargo.Value.ToDouble <> LblCargo.Text.ToDouble Then - Alert("El cargo de la póliza " + HdnlCargo.Value + " no coincide con la sumatoria de cargos de los movimientos", TipoMensaje.MsgAdvertencia) - ElseIf HdnlAbono.Value.ToDouble <> LblAbono.Text.ToDouble Then - Alert("El abono de la póliza " + HdnlAbono.Value + " no coincide con la sumatoria de abonos de los movimientos", TipoMensaje.MsgAdvertencia) - End If - - RegistraScript("PrendeGVS();") 'Aseguramos que se cargue el gridViewScroll - CargaGrid() - - UpTitulos.Update() - UpDatos.Update() - - If DT IsNot Nothing Then DT.Dispose() - End Sub - - Private Sub GuardaPoliza() - Dim OcurrioError As Boolean = False - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - Dim tCvePoliza As Integer - Dim NumPoliza As String = TxtNumeroPoliza.Text.Trim - Dim Tipo As String = "" - - If Not TxtNumeroPoliza.Text.Trim <> "" Then - Tipo = "CHQ" - End If - - tCvePoliza = ObjConta.AddPoliza(DdlTipoPoliza.SelectedValue.ToEntero, NumPoliza.ToEntero, TxtFechaPoliza.Text.Trim.ToDate, TxtConcepto.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - If tCvePoliza > 0 Then - - 'Agrega Movimientos de la poliza - For Each Row As DataRow In TmpDT.Rows - If Row("Cargo").ToString.ToDecimal <> 0 Then - If Not ObjConta.AddPolizaDetalle(tCvePoliza, Row("CveCuenta").ToString.ToEntero, Row("Cuenta").ToString, Row("CveSubProyecto").ToString.ToEntero, False, - Row("Cargo").ToString.ToDouble, Row("Referencia").ToString, Row("Concepto").ToString, - TxtFechaPoliza.Text.Trim.ToDate) Then - OcurrioError = True - End If - Else - If Not ObjConta.AddPolizaDetalle(tCvePoliza, Row("CveCuenta").ToString.ToEntero, Row("Cuenta").ToString, Row("CveSubProyecto").ToString.ToEntero, True, - Row("Abono").ToString.ToDouble, Row("Referencia").ToString, Row("Concepto").ToString, - TxtFechaPoliza.Text.Trim.ToDate) Then - OcurrioError = True - End If - End If - Next - - If DtDevoluciones IsNot Nothing AndAlso DtDevoluciones.Rows.Count > 0 Then - 'Agrega Devoluciones - For Each row As DataRow In DtDevoluciones.Rows - If Not ObjConta.AddDevolucionesIVA(tCvePoliza, row("IdCuenta").ToString.ToEntero, row("IdProveedor").ToString.ToEntero, row("Tasa").ToString.ToDouble, row("ImporteBase").ToString.ToDouble, - row("ImporteIVA").ToString.ToDouble, row("RetIVA").ToString.ToDouble, row("RetISR").ToString.ToDouble, TxtFechaPoliza.Text.ToDate, row("Referencia").ToString, row("Serie").ToString, row("Folio").ToString.ToEntero, "") Then - OcurrioError = True - End If - Next - End If - - If Not OcurrioError Then - If Not ObjConta.AjustaPoliza(tCvePoliza) Then - OcurrioError = True - End If - End If - - If OcurrioError Then - ObjConta.RollBack() - Alert("Ocurrió un error al guardar la póliza.", TipoMensaje.MsgAdvertencia) - Else - ObjConta.Commit() - CvePoliza = tCvePoliza - Limpia() - CargaDatos(CvePoliza) - BtnNuevo.OnClientClick = "" - Alert(String.Format("La información se guardó correctamente con el numero de póliza: {0}", ObjConta.ContaFolio), TipoMensaje.MsgInformacion) - End If - End If - - UpTitulos.Update() - UpDatos.Update() - UpConsultar.Update() - ObjConta.Dispose() - End Sub - - Private Sub AddRegPolizaDetalle(CvePoliza As Integer, Referencia As String, CveCuenta As Integer, Cuenta As String, CveSubProyecto As String, SubProyecto As String, NombreConcepto As String, Cargo As Double, Abono As Double) - Dim Row As DataRow = Nothing - Row = TmpDT.NewRow() - Row("CvePoliza") = CvePoliza - Row("Referencia") = Referencia - Row("CveCuenta") = CveCuenta - Row("Cuenta") = Cuenta - Row("CtaCodigo") = Cuenta - Row("CveSubProyecto") = CveSubProyecto - Row("SubProyecto") = SubProyecto - Row("Concepto") = NombreConcepto - Row("Estado") = "I" - Row("Cargo") = Cargo - Row("Abono") = Abono - TmpDT.Rows.Add(Row) - CargaGrid() - End Sub - - Private Sub ActualizaPoliza() - Dim OcurrioError As Boolean = False - Dim ObjConta As New ClsContabilidad - Dim Row As DataRow - ObjConta.IniciaTransacSQL() - - If ObjConta.UpdatePoliza(TxtFechaPoliza.Text.Trim.ToDate, TxtNumeroPoliza.Text.ToEntero, CvePoliza.ToString.ToEntero, TxtConcepto.Text.Trim, DdlTipoPoliza.SelectedValue.ToEntero) Then - - For Each Row In TmpDT.Rows - - If Row("Estado").ToString.Trim = "D" AndAlso Row("CvePolizaDetalle").ToString.ToEntero > 0 Then - ObjConta.RemovePolizaDetalle(Row("CvePolizaDetalle").ToString.ToEntero) - Else - Dim Importe As Double = If(Row("Cargo").ToString.ToDouble <> 0, Row("Cargo"), Row("Abono")).ToString.ToDouble - Dim ImporteME As Double = If(Row("CargoME").ToString.ToDouble <> 0, Row("CargoME"), Row("AbonoME")).ToString.ToDouble - Dim TipoMovto As Boolean = Not Row("Cargo").ToString.ToDouble <> 0 - - If Row("CvePolizaDetalle").ToString.ToEntero > 0 Then - If Not ObjConta.UpdatePolizaDetalle(Row("CvePolizaDetalle").ToString.ToEntero, Row("CveCuenta").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, TipoMovto, Importe, Row("Referencia").ToString, Row("Concepto").ToString) Then - OcurrioError = True - End If - Else - If Not ObjConta.AddPolizaDetalle(CvePoliza.ToString.ToEntero, Row("CveCuenta").ToString.ToEntero, Row("Cuenta").ToString, Row("CveSubProyecto").ToString.ToEntero, TipoMovto, Importe, Row("Referencia").ToString, Row("Concepto").ToString, TxtFechaPoliza.Text.Trim.ToDate) Then - OcurrioError = True - End If - End If - - End If - - Next - - If OcurrioError Then - ObjConta.RollBack() - Alert("Ocurrió un error al actualizar los movimientos de la póliza", TipoMensaje.MsgAdvertencia) - Else - Alert("La póliza se actualizó correctamente.", TipoMensaje.MsgInformacion) - ObjConta.Commit() - HdnFechaPoliza.Value = TxtFechaPoliza.Text.ToDate.ToShortDateString - HdnTipoPoliza.Value = DdlTipoPoliza.SelectedValue - CargaDatos(CvePoliza) - BtnNuevo.OnClientClick = "" - End If - Else - ObjConta.RollBack() - End If - - - ObjConta.Dispose() - End Sub - -#End Region - - Private Sub Limpia() - HdnCveCuenta.Value = "" - HdnlAbono.Value = "" - HdnlCargo.Value = "" - LblDiferencia.Text = "" - DtDevoluciones = Nothing - GvDevoluciones.DataBind() - End Sub - - -#Region "G R I D - V I E W" - Protected Sub GvDevoluciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDevoluciones.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - e.Row.FCDropDownList("DdlProveedor").SelectedIndex = -1 - e.Row.FCDropDownList("DdlProveedor").DataSource = DtProveedoresConta - e.Row.FCDropDownList("DdlProveedor").DataBind() - e.Row.FCDropDownList("DdlProveedor").SelectedValueExist(e.Row.DataKey("IdProveedor")) - e.Row.FCTextBox("TxtImporteBase").Attributes.Add("onkeyup", String.Format("FormatoMoneda(this);CalculaImporteIVA({0},{1},{2});CalculaImporteSinRet({0},{2},{3});CalculaTotalErogacion({3},{4},{5},{6});", e.Row.FCTextBox("TxtImporteBase").ClientID, e.Row.FCDropDownList("DdlTasa").ClientID, e.Row.FCTextBox("TxtImporteIVA").ClientID, e.Row.FCLabel("LbImporteSinRet").ClientID, e.Row.FCTextBox("TxtRetIVA").ClientID, e.Row.FCTextBox("TxtRetISR").ClientID, e.Row.FCLabel("LbGranTotalAdd").ClientID)) - e.Row.FCTextBox("TxtImporteIVA").Attributes.Add("onkeyup", String.Format("FormatoMoneda(this);CalculaImporteSinRet({0},{2},{3});CalculaTotalErogacion({3},{4},{5},{6});", e.Row.FCTextBox("TxtImporteBase").ClientID, e.Row.FCDropDownList("DdlTasa").ClientID, e.Row.FCTextBox("TxtImporteIVA").ClientID, e.Row.FCLabel("LbImporteSinRet").ClientID, e.Row.FCTextBox("TxtRetIVA").ClientID, e.Row.FCTextBox("TxtRetISR").ClientID, e.Row.FCLabel("LbGranTotalAdd").ClientID)) - e.Row.FCTextBox("TxtRetIVA").Attributes.Add("onkeyup", String.Format("FormatoMoneda(this);CalculaTotalErogacion({3},{4},{5},{6});", e.Row.FCTextBox("TxtImporteBase").ClientID, e.Row.FCDropDownList("DdlTasa").ClientID, e.Row.FCTextBox("TxtImporteIVA").ClientID, e.Row.FCLabel("LbImporteSinRet").ClientID, e.Row.FCTextBox("TxtRetIVA").ClientID, e.Row.FCTextBox("TxtRetISR").ClientID, e.Row.FCLabel("LbGranTotalAdd").ClientID)) - e.Row.FCTextBox("TxtRetISR").Attributes.Add("onkeyup", String.Format("FormatoMoneda(this);CalculaTotalErogacion({3},{4},{5},{6});", e.Row.FCTextBox("TxtImporteBase").ClientID, e.Row.FCDropDownList("DdlTasa").ClientID, e.Row.FCTextBox("TxtImporteIVA").ClientID, e.Row.FCLabel("LbImporteSinRet").ClientID, e.Row.FCTextBox("TxtRetIVA").ClientID, e.Row.FCTextBox("TxtRetISR").ClientID, e.Row.FCLabel("LbGranTotalAdd").ClientID)) - End If - - End If - End Sub - - Protected Sub GvDevoluciones_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvDevoluciones.RowCancelingEdit - GvDevoluciones.EditIndex = -1 - CargaGridDevoluciones("", 0) - UpDevoluciones.Update() - End Sub - - 'Protected Sub GvDevoluciones_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvDevoluciones.RowDeleting - ' Dim ErrorEliminar = False - - ' If CvePoliza > 0 Then - ' Dim ObjConta As New ClsContabilidad - - ' If Not ObjConta.RemoveDevolucionesIVA(e.Keys("Id").ToString.ToEntero) Then - ' ErrorEliminar = True - ' End If - - ' ObjConta.Dispose() - ' CargaDevoluciones() - ' Else - ' DtDevoluciones.Rows().RemoveAt(e.Keys("Id").ToString.ToEntero - 1) - ' CargaGridDevoluciones("", 0) - ' End If - - ' If Not ErrorEliminar Then - ' Alert("La Devolución fue eliminada correctamente.", TipoMensaje.MsgInformacion) - ' Else - ' Alert("Ocurrió un error al eliminar la Devolución", TipoMensaje.MsgError) - ' End If - 'End Sub - - Protected Sub GvDevoluciones_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvDevoluciones.RowEditing - GvDevoluciones.EditIndex = e.NewEditIndex - CargaGridDevoluciones("", 0) - End Sub - - 'Protected Sub GvDevoluciones_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvDevoluciones.RowUpdating - ' Dim ErrorDevolucion = False - - ' If CvePoliza > 0 Then - ' Dim gvr As GridViewRow = GvDevoluciones.Rows(e.RowIndex) - ' Dim ObjConta As New ClsContabilidad - - ' If ObjConta.UpdateDevolucionesIVA(gvr.DataKey("Id").ToEntero, CvePoliza, DdlCuenta.SelectedValue.ToEntero, - ' gvr.FCDropDownList("DdlProveedor").SelectedValue.ToEntero, gvr.FCDropDownList("DdlTasa").SelectedValue.ToDouble, - ' gvr.FCTextBox("TxtImporteBase").Text.ToDouble, gvr.FCTextBox("TxtImporteIVA").Text.ToDouble, - ' gvr.FCTextBox("TxtRetIVA").Text.ToDouble, gvr.FCTextBox("TxtRetISR").Text.ToDouble, Date.Now, - ' gvr.FCTextBox("TxtReferenciaDevolucion").Text, gvr.FCTextBox("TxtSerie").Text, gvr.FCTextBox("TxtFolio").Text.ToEntero) Then - ' Alert("Devolución Actualizada con Éxito", TipoMensaje.MsgInformacion) - ' Else - ' Alert("Ocurrió un error al Actualizar la Devolución", TipoMensaje.MsgError) - ' ErrorDevolucion = True - ' End If - - ' ObjConta.Dispose() - - ' If Not ErrorDevolucion Then - ' GvDevoluciones.EditIndex = -1 - ' CargaDevoluciones() - ' End If - ' Else - ' Dim row() = DtDevoluciones.Select(String.Format("Id = {0}", e.Keys("Id"))) - - ' row(0)("IdProveedor") = GvDevoluciones.Rows(e.RowIndex).FCDropDownList("DdlProveedor").SelectedValue - ' row(0)("Tasa") = GvDevoluciones.Rows(e.RowIndex).FCDropDownList("DdlTasa").SelectedValue - ' row(0)("ImporteBase") = GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtImporteBase").Text - ' row(0)("ImporteIVA") = GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtImporteIVA").Text - ' row(0)("RetIVA") = GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtRetIVA").Text - ' row(0)("RetISR") = GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtRetISR").Text - ' row(0)("Referencia") = GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtReferenciaDevolucion").Text - ' row(0)("Serie") = GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtSerie").Text - ' row(0)("Folio") = GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtFolio").Text - ' row(0)("Proveedor") = GvDevoluciones.Rows(e.RowIndex).FCDropDownList("DdlProveedor").SelectedItem.Text - ' row(0)("ImporteAntesRet") = GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtImporteBase").Text.ToDouble + GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtImporteIVA").Text.ToDouble - ' row(0)("GranTotal") = row(0)("ImporteAntesRet").ToString.ToDouble - GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtRetIVA").Text.ToDouble - GvDevoluciones.Rows(e.RowIndex).FCTextBox("TxtRetISR").Text.ToDouble - - - ' GvDevoluciones.EditIndex = -1 - ' CargaGridDevoluciones("", 0) - ' End If - - 'End Sub - -#End Region - -#Region "D E V O L U C I O N E S - I V A" - Protected Sub LbAgregarDevolucion_Click(sender As Object, e As EventArgs) - ' Dim ErrorDevolucion = False - - ' If CvePoliza > 0 Then - ' Dim ObjConta As New ClsContabilidad - - ' If ObjConta.AddDevolucionesIVA(CvePoliza, DdlCuenta.SelectedValue.ToEntero, DdlProveedor.SelectedValue.ToEntero, DdlTasa.SelectedValue.ToDouble, TxtImporteBase.Text.ToDouble, TxtImporteIVA.Text.ToDouble, - ' TxtRetIVA.Text.ToDouble, TxtRetISR.Text.ToDouble, TxtFechaPoliza.Text.ToDate, TxtReferenciaDevolucion.Text, TxtSerie.Text, TxtFolio.Text.ToEntero, "") Then - ' Alert("Devolución Agregada con Éxito", TipoMensaje.MsgInformacion) - ' Else - ' ErrorDevolucion = True - ' Alert("Ocurrió un error al agregar la Devolución", TipoMensaje.MsgAdvertencia) - ' End If - - ' ObjConta.Dispose() - - ' If Not ErrorDevolucion Then - ' CargaDevoluciones() - ' End If - ' Else - ' Dim row = DtDevoluciones.NewRow - - ' row("ID") = (DtDevoluciones.Rows.Count + 1).ToString - ' row("IdProveedor") = DdlProveedor.SelectedValue - ' row("Tasa") = DdlTasa.SelectedValue - ' row("ImporteBase") = TxtImporteBase.Text - ' row("ImporteIVA") = TxtImporteIVA.Text - ' row("RetIVA") = TxtRetIVA.Text - ' row("RetISR") = TxtRetISR.Text - ' row("Referencia") = TxtReferenciaDevolucion.Text - ' row("Serie") = TxtSerie.Text - ' row("Folio") = TxtFolio.Text - ' row("Proveedor") = DdlProveedor.SelectedItem.Text - ' row("ImporteAntesRet") = TxtImporteBase.Text.ToDouble + TxtImporteIVA.Text.ToDouble - ' row("GranTotal") = row("ImporteAntesRet").ToString.ToDouble - TxtRetIVA.Text.ToDouble - TxtRetISR.Text.ToDouble - ' DtDevoluciones.Rows.Add(row) - - ' CargaGridDevoluciones("", 0) - - ' End If - - ' LimpiaDevoluciones() - End Sub - - Protected Sub LbAgregarCausacion_Click(sender As Object, e As EventArgs) - ' Dim ErrorDevolucion = False - - ' If CvePoliza > 0 Then - ' Dim ObjConta As New ClsContabilidad - - ' Dim TotalTasa16 As Double = TxtImporteTotalC.Text.ToDouble - ' Dim BaseTasa16 As Double = TxtImporteBaseC.Text.ToDouble - ' Dim IVATasa16 As Double = TxtIVAC.Text.ToDouble - ' Dim IVATasaNoAcreditable As Double = TxtIvaNoAcreditableC.Text.ToDouble - ' Dim ISRRetenido As Double = TxtISRRetenidoC.Text.ToDouble - ' Dim IVARetenido As Double = TxtIVARetenidoC.Text.ToDouble - ' Dim ietu As Double = TxtIETU.Text.ToDouble - ' Dim cuenta As String - ' Dim CuentasConcatenadas As New StringBuilder - ' Dim importeMaximo As Double - - ' If DrParametros IsNot Nothing Then - ' cuenta = DrParametros("CtaFlujo").ToString - - ' ObjConta.GetCuentasCausaciones(cuenta) - - ' For Each row As DataRow In ObjConta.DtResultados.Rows - ' Dim ct As String = row("IdSubCtade").ToString - ' CuentasConcatenadas.AppendFormat("{0},", ct) - - ' Next - ' End If - - ' importeMaximo = TmpDT.SUM("Cargo", String.Format("CveCuenta IN ( {0} )", CuentasConcatenadas.ToString.TrimEnd(","c))).ToString.ToDecimal - - ' If LbAgregarCausacion.Text = "Agregar" And importeMaximo = TotalTasa16 Then - ' If ObjConta.AddCausacionesIVA(CvePoliza, TotalTasa16, BaseTasa16, IVATasa16, IVATasaNoAcreditable, ISRRetenido, IVARetenido, ChkNoCausar.Checked, IETU:=ietu) Then - ' Alert("El movimiento se realizó correctamente", TipoMensaje.MsgInformacion) - ' End If - ' ElseIf LbAgregarCausacion.Text = "Actualizar" And importeMaximo = TotalTasa16 Then - ' If ObjConta.UpdateCausacionesIVA(CvePoliza, TotalTasa16, BaseTasa16, IVATasa16, IVATasaNoAcreditable, ISRRetenido, IVARetenido, ChkNoCausar.Checked, ietu:=ietu) Then - ' Alert("El movimiento se realizó correctamente", TipoMensaje.MsgInformacion) - ' End If - ' Else - ' Alert("El importe total desglosado con coincide con el importe de la cuenta de flujo de efectivo", TipoMensaje.MsgAdvertencia) - ' End If - - ' ObjConta.Dispose() - ' End If - - ' CargaCausaciones() - End Sub - - Private Sub LimpiaDevoluciones() - TxtSerie.Text = "" - TxtFolio.Text = "" - TxtReferenciaDevolucion.Text = "" - TxtImporteBase.Text = "" - TxtImporteIVA.Text = "" - TxtRetIVA.Text = "" - TxtRetISR.Text = "" - - DdlProveedor.SelectedValue = "-1" - TxtSerie.Focus() - End Sub - - 'Private Sub CargaDevoluciones() - - ' If CvePoliza > 0 Then - ' Dim ObjConta As New ClsContabilidad - - ' PnlDevIVA.Visible = True - - ' If ObjConta.GetDevolucionesIVA(-1, CvePoliza) Then - ' DtDevoluciones = ObjConta.DtResultados - ' Else - ' DtDevoluciones = Nothing - ' Alert("Ocurrió un error al cargar Devoluciones", TipoMensaje.MsgError) - ' End If - - ' If DtDevoluciones IsNot Nothing Then - ' CargaGridDevoluciones("", 0) - ' DdlCuenta.SelectedValueExist(DtDevoluciones.MAX("CveCuenta")) - ' End If - - ' ObjConta.Dispose() - ' Else - ' CreaDtDevoluciones() - ' End If - - 'End Sub - - 'Private Sub CargaCausaciones() - - ' If CvePoliza > 0 Then - ' Dim ObjConta As New ClsContabilidad - - ' PnlCauIVA.Visible = True - - ' If ObjConta.GetCausacionesIVA(-1, CvePoliza) Then - - ' If ObjConta.DtResultados IsNot Nothing AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - ' TxtImporteTotalC.Text = ObjConta.DtResultados.Rows(0)("ImporteTotal").ToString - ' TxtImporteBaseC.Text = ObjConta.DtResultados.Rows(0)("ImporteBase").ToString - ' TxtIVAC.Text = ObjConta.DtResultados.Rows(0)("IVA").ToString - ' TxtIvaNoAcreditableC.Text = ObjConta.DtResultados.Rows(0)("IVANoAcreditable").ToString - ' lblEjercicioTexto.Text = ObjConta.DtResultados.Rows(0)("Año").ToString - ' LblPeriodoTexto.Text = StrConv(MonthName(ObjConta.DtResultados.Rows(0)("Mes").ToString.ToEntero, False), VbStrConv.ProperCase) - ' TxtIVARetenidoC.Text = ObjConta.DtResultados.Rows(1)("ImporteTotal").ToString - ' TxtISRRetenidoC.Text = ObjConta.DtResultados.Rows(2)("ImporteTotal").ToString - ' LblTotalImporte.Text = ObjConta.DtResultados.Rows(3)("ImporteTotal").ToString - ' LblTotalBase.Text = ObjConta.DtResultados.Rows(3)("ImporteBase").ToString - ' LblTotalIVA.Text = ObjConta.DtResultados.Rows(3)("IVA").ToString - ' LblTotalIvaNoAcreditable.Text = ObjConta.DtResultados.Rows(3)("IVANoAcreditable").ToString - ' TxtIETU.Text = ObjConta.DtResultados.Rows(3)("ImporteBase").ToString - - ' If ObjConta.DtResultados.Rows(0)("NoCausar").ToString = "True" Then - ' ChkNoCausar.Checked = True - ' Else - ' ChkNoCausar.Checked = False - ' End If - - ' If TxtImporteTotalC.Text <> "" Then - ' LbAgregarCausacion.Text = "Actualizar" - ' End If - - ' End If - - ' Else - ' Alert("Ocurrió un error al cargar Causaciones", TipoMensaje.MsgError) - ' End If - - ' ObjConta.Dispose() - - ' End If - - 'End Sub - - Private Sub CreaDtDevoluciones() - DtDevoluciones = New DataTable - - DtDevoluciones.Columns.Add("IdProveedor", GetType(Integer)) - DtDevoluciones.Columns.Add("Tasa", GetType(String)) - DtDevoluciones.Columns.Add("ImporteBase", GetType(Double)) - DtDevoluciones.Columns.Add("ImporteIVA", GetType(Double)) - DtDevoluciones.Columns.Add("RetIVA", GetType(Double)) - DtDevoluciones.Columns.Add("RetISR", GetType(Double)) - DtDevoluciones.Columns.Add("Referencia", GetType(String)) - DtDevoluciones.Columns.Add("Serie", GetType(String)) - DtDevoluciones.Columns.Add("Folio", GetType(String)) - - DtDevoluciones.Columns.Add("Id", GetType(Integer)) - DtDevoluciones.Columns.Add("Proveedor", GetType(String)) - DtDevoluciones.Columns.Add("ImporteAntesRet", GetType(Double)) - DtDevoluciones.Columns.Add("GranTotal", GetType(Double)) - - End Sub -#End Region - - Protected Sub LBDevIVA_Click(sender As Object, e As EventArgs) - ' UpDevoluciones.Update() - ' RegistraScript("$get('divDevIVA').style.display='';") - - ' Dim cont As New ClsContabilidad - - ' If cont.GetProveedores() Then - ' DtProveedoresConta = cont.DtResultados - ' DdlProveedor.DataSource = DtProveedoresConta - ' DdlProveedor.DataBind() - ' DdlProveedor.Items.Insert(0, New ListItem("Seleccione uno", "-1")) - ' Else - ' DtProveedoresConta = Nothing - ' Alert("Ocurrió un error al cargar los Proveedores. Por favor recargue la página.", TipoMensaje.MsgError) - ' End If - - ' cont.Dispose() - - ' DdlCuenta.DataSource = DTCuentas - ' DdlCuenta.DataBind() - - ' CargaDevoluciones() - End Sub - - Protected Sub LBCauIVA_Click(sender As Object, e As EventArgs) - ' UpCausaciones.Update() - ' RegistraScript("$get('divCauIVA').style.display='';") - - ' CargaCausaciones() - End Sub - - Protected Sub DdlTipoPoliza_SelectedIndexChanged(sender As Object, e As EventArgs) - RegistraScript("ApagaGVS();") - SiguienteFolio() - End Sub - - Private Sub SiguienteFolio() - Dim ObjConta As New ClsContabilidad - Dim NumPoliza As Integer = 0 - - If ObjConta.GetNumeroPoliza(DdlTipoPoliza.SelectedValue.ToEntero, "", TxtFechaPoliza.Text.ToDate, UsuarioActual.CveEmpresa) Then - NumPoliza = ObjConta.DtResultados(0)("NumPoliza").ToString.ToEntero - If NumPoliza > 0 Then - TxtNumeroPoliza.Text = NumPoliza.ToString - Else - Alert("Ocurrió un error al obtener el número de póliza. Por favor recargue la página", TipoMensaje.MsgError) - End If - End If - - ObjConta.Dispose() - UpTitulos.Update() - End Sub - -#Region " ELIMINAR POLIZA " - Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - Dim ObjMov As New ClsContabilidad() - - If ObjConta.RemovePoliza(CvePoliza) Then - If ObjMov.DesvincularPrePolizaContabilizada(CvePoliza, UsuarioActual.CveEmpresa) Then - ObjConta.Commit() - Alert("La Póliza fue eliminada correctamente.", TipoMensaje.MsgInformacion) - BtnNuevo_Click(BtnNuevo, EventArgs.Empty) - Else - ObjConta.RollBack() - Alert("Ocurrió un error al eliminar la Póliza. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - Else - ObjConta.RollBack() - Alert("Ocurrió un error al eliminar la Póliza. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - - ObjConta.Dispose() - End Sub -#End Region - -End Class diff --git a/PyME/Contabilidad/RegPrePoliza.aspx b/PyME/Contabilidad/RegPrePoliza.aspx deleted file mode 100644 index 395402e56..000000000 --- a/PyME/Contabilidad/RegPrePoliza.aspx +++ /dev/null @@ -1,556 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RegPrePoliza.aspx.vb" Inherits="Contabilidad_RegPrePoliza" %> - - - - - - - - - - - - - - - - - - -
    - - - -
    -
    -
    - -
    -
    - - - - -
    - - - - - - - - -
    -
    - -
    - - -
    -
    -
    - -
    -
    -
    -
    - -
    - -
    - -
    - - -
    - - - -
    - -
    -
    - -
    - -
    -
    -
    - -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    ConceptoCta. ContableReferenciaDescripciónSubProyectoCargoAbonoComandos
    - -
    -
    - -
    -
    - - - - - -
    -
    - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - -
    CuentaReferenciaDescripciónSubProyectoRef. BancariaCargoAbono
    - -
    - - - - Cuenta - -
    - -
    - -
    - - Referencia - - - - - - - Concepto - - - - - - - SubProyecto - - - - - - - Ref. Bancaria - - - - - - - Cargo - - - - - - - Abono - - - - - - - - - - -
    - - - -
    -
    -
    -
    - - - - -
    - - - - Movimiento - -
    -
    - -
    - - Concepto - -
    -
    - -
    - - SubProyecto - -
    -
    - -
    - - Cuenta - -
    -
    - -
    - - Cargo - -
    - - -
    -
    - - Abono - -
    - - -
    -
    -
    - - - -
    -
    -
    -
    - - - - - - - - - - -
      - -
    - - - - - - -
    - - -
    - - - - diff --git a/PyME/Contabilidad/RegPrePoliza.aspx.vb b/PyME/Contabilidad/RegPrePoliza.aspx.vb deleted file mode 100644 index 43da76101..000000000 --- a/PyME/Contabilidad/RegPrePoliza.aspx.vb +++ /dev/null @@ -1,560 +0,0 @@ -Imports System.Data -Imports Extensiones -Imports System.Linq -Imports System.Web.Services - -Partial Class Contabilidad_RegPrePoliza - Inherits ClsPaginas - - -#Region "Propiedades" - - - Public Property ArregloMovs As ArrayList - Get - Return CType(ViewState("ArregloMovs"), ArrayList) - End Get - Set(value As ArrayList) - ViewState("ArregloMovs") = value - End Set - End Property - - Public Property DtMovimientos As DataTable - Get - Return CType(ViewState("DtMovimientos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtMovimientos") = value - End Set - End Property - - Public Property DtCuentasContables As DataTable - Get - Return CType(ViewState("DtCuentasContables"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtCuentasContables") = value - End Set - End Property - - Public Property TipoPlantilla As Integer - Get - Return CType(ViewState("TipoPlantilla"), Integer) - End Get - Set(value As Integer) - ViewState("TipoPlantilla") = value - End Set - End Property - - Public Property CveMoneda As Integer - Get - Return CType(ViewState("CveMoneda"), Integer) - End Get - Set(value As Integer) - ViewState("CveMoneda") = value - End Set - End Property - - Private ReadOnly Property CvePrePoliza As Integer - Get - Return ViewState("CvePrePoliza").ToString.ToEntero - End Get - End Property -#End Region - - Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load - - If Not Page.IsPostBack Then - CveMoneda = 1 - ViewState("CvePrePoliza") = 0 - - Dim dt As DataTable = Nothing - Dim Conta As New ClsContabilidad - - If Conta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then - dt = Conta.DtResultados - DtCuentasContables = Conta.DtResultados - Session("DtCuentas") = Conta.DtResultados - End If - Conta.Dispose() - - If Request("CvePrePoliza") IsNot Nothing AndAlso IsNumeric(Request("CvePrePoliza")) AndAlso Request("CvePrePoliza").ToEntero > 0 Then - ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero - CargaPrePoliza() - Exit Sub - End If - - TipoPlantilla = 0 - If IfNull(Request("Tipo"), "").ToString = "Ing" Then - TipoPlantilla = 1 - LblEncabezado.Text = "Otros Ingresos" - Else - - - End If - - CargaPlantillas(TipoPlantilla) - - If UsuarioActual.CveEmpresa = 66 Then trNotificar.Visible = True - - CargaConceptos() - CargaSubProyectos() - CargaCuentasContables() - - 'crea tabla temporal - ArregloMovs = New ArrayList - DtMovimientos = New DataTable("Movimientos") - Dim IDMov As DataColumn = DtMovimientos.Columns.Add("IdMov", Type.GetType("System.Int32")) : IDMov.AutoIncrement = True - With DtMovimientos.Columns - .Add("IdCuenta", Type.GetType("System.Int32")) - .Add("CodigoCuenta", Type.GetType("System.String")) - .Add("Cuenta", Type.GetType("System.String")) - .Add("Referencia", Type.GetType("System.String")) - .Add("Concepto", Type.GetType("System.String")) - .Add("Cargo", Type.GetType("System.Double")) - .Add("Abono", Type.GetType("System.Double")) - .Add("TipoMovto", Type.GetType("System.Int32")) - .Add("EsComodin", Type.GetType("System.Int32")) - .Add("CveConcepto", Type.GetType("System.Int32")) - .Add("CveSubProyecto", Type.GetType("System.Int32")) - .Add("Descripcion", Type.GetType("System.String")) - .Add("CveProveedor", Type.GetType("System.Int32")) - .Add("CvePersonal", Type.GetType("System.Int32")) - End With - - - - End If - - End Sub - - Private Sub CargaPrePoliza() - - LblEncabezado.Text = "Edicion de Póliza" - - Dim ObjContabilidad As New ClsContabilidad - ObjContabilidad.GetContabilizacionDiarioDetalle(CvePrePoliza) - - GvPrePoliza.DataSource = ObjContabilidad.DtResultados.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}") - GvPrePoliza.DataBind() - - DivConceptoPrePoliza.Visible = False - UPMovs.Visible = False - UPMovs.Update() - UPPDocumento.Update() - UpPrePoliza.Update() - - RegistraScript("comparar();") - - If Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero = 1 AndAlso UsuarioActual.CveUsuario <> 100 Then - For Each row As GridViewRow In GvPrePoliza.Rows - row.FCTextBox("TxtCargo").Enabled = False - row.FCTextBox("TxtAbono").Enabled = False - Next - End If - - ObjContabilidad.Dispose() - End Sub - - Private Sub GvPrePoliza_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPrePoliza.RowDataBound - - If e.Row.RowType = DataControlRowType.DataRow Then - - 'Asignamos los Subproyectos - e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - e.Row.FCDropDownList("DdlSubProyecto").DataBind() - e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) - e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto")) - - 'ASignamos las CuentasContables - e.Row.FCDropDownList("DdlCtaContable").DataSource = Session("DtCuentas") - e.Row.FCDropDownList("DdlCtaContable").DataBind() - e.Row.FCDropDownList("DdlCtaContable").Items.Insert(0, New ListItem("Sin Asignar", "0")) - e.Row.FCDropDownList("DdlCtaContable").SelectedValueExist(e.Row.DataKey("IdCtaContable")) - - TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble) - TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCTextBox("TxtAbono").Text.ToDouble) - - End If - - End Sub - - Private Sub CargaPlantillas(TipoPlantilla As Integer) - - 'GvPlantillas.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla) - 'GvPlantillas.DataBind() - - DdlPlantilla.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla) - DdlPlantilla.DataBind() - DdlPlantilla.Items.Insert(0, New ListItem("Plantilla Personalizada", "53")) - End Sub - - Private Sub CargaConceptos() - DdlConceptosContables.DataSource = GlobalDTContaConceptosContables(-1) - DdlConceptosContables.DataBind() - End Sub - - Private Sub CargaSubProyectos() - DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - DdlSubProyecto.DataBind() - DdlSubProyecto.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - - Private Sub CargaCuentasContables() - DdlCtaContable.DataSource = Session("DtCuentas") - DdlCtaContable.DataBind() - DdlCtaContable.Items.Insert(0, New ListItem("Sin Asignar", "0")) - End Sub - - Protected Sub DdlPlantilla_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPlantilla.SelectedIndexChanged - - TxtTotalAbonos.Text = "" - TxtTotalCargos.Text = "" - - If DdlPlantilla.SelectedValue.ToEntero <= 0 Then - Alert("Seleccione un Movimiento Válido", TipoMensaje.MsgAdvertencia) - DdlPlantilla.SelectedValue = "-1" - Exit Sub - End If - - If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada - DivAgregarConceptos.Visible = True - Else - DivAgregarConceptos.Visible = False - End If - - - - Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero - - Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden") - Dim Cuenta As String = "" - Dim IdCuenta As Integer = 0 - Dim CodigoCuenta As String = "" - Dim NombreCuenta As String = "" - Dim EsComodin As Integer = 0 - DtMovimientos.Clear() - - For Each drt As DataRow In Dt.Rows - - Cuenta = drt("ConceptoContable").ToString - IdCuenta = 0 - CodigoCuenta = "" - NombreCuenta = "" - If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables - Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString)) - If drr IsNot Nothing Then - IdCuenta = drt("IdCtaContable").ToString.ToEntero - CodigoCuenta = drr("CuentaFormato").ToString() - NombreCuenta = drr("Nombre").ToString() - 'Cuenta = drr("Nombre").ToString() - End If - EsComodin = 0 - End If - - Dim dr As DataRow = DtMovimientos.NewRow - dr("IdCuenta") = IdCuenta - dr("CodigoCuenta") = CodigoCuenta & "
    " & NombreCuenta - dr("Cuenta") = Cuenta 'TxtCuentaContable.Text - dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) - dr("Concepto") = TxtObservaciones.Text - dr("TipoMovto") = If(drt("TipoMovto").ToString = "False", 0, 1) - dr("EsComodin") = EsComodin - dr("CveConcepto") = drt("CveConcepto") - dr("CveSubProyecto") = drt("CveSubProyectoNegativo") - dr("Cargo") = TxtCargo.Text.ToDouble - dr("Abono") = TxtAbono.Text.ToDouble - dr("CveProveedor") = drt("CveProveedor") - dr("CvePersonal") = drt("CvePersonal") - DtMovimientos.Rows.Add(dr) - Next - - - GvMov.DataSource = DtMovimientos - GvMov.DataBind() - UPMovs.Update() - - End Sub - - Protected Sub GvMov_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvMov.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - e.Row.Height = Unit.Pixel(1) - e.Row.Cells(0).ToolTip = e.Row.DBCampo("IdCuenta") - If e.Row.DBCampo("TipoMovto") = "1" Then - e.Row.FCTextBox("TxtAbono").Visible = True - Else - e.Row.FCTextBox("TxtCargo").Visible = True - End If - - e.Row.FCTextBox("TxtAbono").Text = If(e.Row.DBCampo("Abono") = 0, "", e.Row.DBCampo("Abono")) - e.Row.FCTextBox("TxtCargo").Text = If(e.Row.DBCampo("Cargo") = 0, "", e.Row.DBCampo("Cargo")) - e.Row.FCTextBox("TxtConcepto").Text = e.Row.DBCampo("Descripcion") - - e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - e.Row.FCDropDownList("DdlSubProyecto").DataBind() - e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) - e.Row.FCDropDownList("DdlSubProyecto").SelectedValue = e.Row.DBCampo("CveSubProyecto") - - If DdlPlantilla.SelectedValue.ToEntero = 53 Then - e.Row.FCDropDownList("DdlSubProyecto").Enabled = True - Else - e.Row.FCDropDownList("DdlSubProyecto").Enabled = False - End If - - 'Agregamos la opcion para vincular los movimientos bancarios - If e.Row.DataKey("CveConcepto").ToEntero.Contiene(41) Then - Dim ObjMovimientos As New ClsMovimientos - Dim DdlSaldos As DropDownList = e.Row.FCDropDownList("DdlSaldos") - - Select Case e.Row.DataKey("CveConcepto").ToEntero - - 'Acreedores - Case 41 - If (ObjMovimientos.GetAcreedoresSaldosDetalles(-1,-1, UsuarioActual.CveEmpresa)) Then - DdlSaldos.Visible = True - DdlSaldos.DataSource = ObjMovimientos.DtResultados.FiltraParametros($"CveIE > 0 AND CveProveedor = {e.Row.DataKey("CveProveedor").ToEntero}") - DdlSaldos.DataBind() - DdlSaldos.Items.Insert(0, New ListItem("Seleccione", "-1")) - End If - - End Select - - ObjMovimientos.Dispose() - End If - - End If - End Sub - - Protected Sub BtnIEGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click - - Dim TotalCargos, TotalAbonos As Decimal - - If CvePrePoliza > 0 Then - TotalCargos = TxtTotalCargos.Text.ToDouble - TotalAbonos = TxtTotalAbonos.Text.ToDouble - Else - For Each Gvr As GridViewRow In GvMov.Rows - TotalCargos += Gvr.FCTextBox("TxtCargo").Text.ToDecimal - TotalAbonos += Gvr.FCTextBox("TxtAbono").Text.ToDecimal - Next - End If - - If TotalCargos = TotalAbonos AndAlso TotalCargos <> 0 Then - - If CvePrePoliza > 0 Then - - 'Nuevo Modulo Charlie - ActualizarPrePoliza() - - Else - Dim MensajeAlert = New StringBuilder - Dim ObjIE As New ClsBancos() - Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) - 'Dim Conta As ClsContPAQi = Nothing - Dim IDPoliza As Integer = 0 - Dim MsgError As String = "" - - - If MsgError = "" Then - - - Try - Dim CvePrePoliza As Integer - Dim ConceptoPoliza As String = TxtObservaciones.Text - CvePrePoliza = ObjMov.AddPrePolizas("Contabilidad/RegPrePoliza", DdlPlantilla.SelectedValue.ToEntero, TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - - If CvePrePoliza > 0 Then - Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

    " - Dim idCuentaContabilizacion As Long = 1 - Dim Importe As Double = 0 - Dim TipoMovto As Boolean = False - Dim IdCtaContable As Integer = 0 - 'inserto las compras que voy a pagar - For Each gvr As GridViewRow In GvMov.Rows - - If gvr.DataKey("IDCuenta").ToEntero > 0 Then - IdCtaContable = gvr.DataKey("IDCuenta") - End If - - If gvr.DataKey("TipoMovto").ToDouble > 0 Then - Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble - TipoMovto = True - Else - Importe = gvr.FCTextBox("TxtCargo").Text.ToDouble - TipoMovto = False - End If - - - If MsgError = "" Then - - If idCuentaContabilizacion = 1 AndAlso (IdCtaContable = 0) Then - idCuentaContabilizacion = 0 - End If - If Importe > 0 Then - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero, gvr.FCTextBox("TxtConcepto").Text, TxtFecha.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CveIE:=gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero, CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, ImporteMX:=Importe) Then - - Else - MsgError = "No se pudo insertar el detalle de la póliza2" - End If - End If - End If - - - Next - - 'El movimiento 2 es el de Pago - If ChkAutoConta.Checked AndAlso UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then - If idCuentaContabilizacion > 0 Then - If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - - 'MENSAJE PRINCIPAL - MensajeAlert.AppendFormat("

    Folio de Salida: {1}", ObjMov.ContaIdPoliza, ObjMov.ContaFolio) - Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion) - Else - Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico") - End If - Else - Alert("No se puede contabilizar la Prepoliza debido a que una o mas cuentas son inválidas") - End If - End If - - - Else - MsgError = "No se pudo insertar la póliza" - End If - - - - Catch ex As Exception - MsgError = "Error" - End Try - - If MsgError = "" Then - ObjIE.Commit() - - - Alert("El movimiento se guardó correctamente.") - - 'If Conta IsNot Nothing Then Conta.Commit() - - UPPDocumento.Update() - - - TxtObservaciones.Text = "" - GvMov.DataBind() - TxtFecha.Text = "" - TxtObservaciones.Text = "" - - RegistraScript("window.location.reload()") - Else - ObjIE.RollBack() - 'If Conta IsNot Nothing Then Conta.RollBack() - End If - - - Else - 'If Conta IsNot Nothing Then Conta.RollBack() - End If - - ObjIE.Dispose() - ObjMov.Dispose() - 'If Conta IsNot Nothing Then Conta.Dispose() - End If - Else - Alert("La suma de los movimientos no son iguales", TipoMensaje.MsgAdvertencia) - End If - - End Sub - - Private Sub ActualizarPrePoliza() - - Dim OcurrioError As Boolean = False - Dim ObjContabilidad As New ClsContabilidad - ObjContabilidad.IniciaTransacSQL() - - For Each row As GridViewRow In GvPrePoliza.Rows - If Not ObjContabilidad.UpdatePrepolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCTextBox("TxtConcepto").Text, row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, - row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero, If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, - row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - OcurrioError = True - End If - Next - - If Not OcurrioError Then - ObjContabilidad.Commit() - Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion) - Else - ObjContabilidad.RollBack() - Alert("Ocurrio un error al actualizar la PrePoliza.", TipoMensaje.MsgError) - End If - - ObjContabilidad.Dispose() - End Sub - - Protected Sub GvMov_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvMov.RowDeleting - - Dim idMov As Integer = GvMov.DataKeys(e.RowIndex).Value.ToString.ToEntero - - Dim Rows As DataRow() = DtMovimientos.Select("IDMov = " & idMov) - If Rows.Count > 0 Then - DtMovimientos.Rows.Remove(Rows(0)) - DtMovimientos.AcceptChanges() - End If - GvMov.DataSource = DtMovimientos - GvMov.DataBind() - - TxtTotalAbonos.Text = DtMovimientos.SUM("Abono").FormatoNumero - TxtTotalCargos.Text = DtMovimientos.SUM("Cargo").FormatoNumero - - 'saco de la póliza el importe del cheque, que coincida la cuenta contable con la bancaria - - End Sub - - Private Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click - - Dim dr As DataRow = DtMovimientos.NewRow - Dim CodigoCuenta As String = "" - Dim NombreCuenta As String = "" - - dr("IdCuenta") = DdlCtaContable.SelectedValue - - If DdlCtaContable.SelectedValue.ToEntero > 0 Then - Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue)) - If drr IsNot Nothing Then - CodigoCuenta = drr("CuentaFormato").ToString() - NombreCuenta = drr("Nombre").ToString() - End If - End If - - dr("CodigoCuenta") = CodigoCuenta & "
    " & NombreCuenta - dr("Cuenta") = DdlConceptosContables.SelectedItem - dr("Referencia") = TxtReferencia.Text - dr("Concepto") = TxtObservaciones.Text - dr("TipoMovto") = If(TxtCargo.Text.ToDouble > 0, 0, 1) - dr("EsComodin") = 0 - dr("CveConcepto") = DdlConceptosContables.SelectedValue - dr("Cargo") = TxtCargo.Text.ToDouble - dr("Abono") = TxtAbono.Text.ToDouble - dr("Descripcion") = TxtDescripcion.Text - dr("CveSubProyecto") = DdlSubProyecto.SelectedValue - - TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero - TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero - - DtMovimientos.Rows.Add(dr) - GvMov.DataSource = DtMovimientos - GvMov.DataBind() - UPMovs.Update() - - TxtCargo.Text = "" - TxtAbono.Text = "" - TxtReferencia.Text = "" - TxtDescripcion.Text = "" - - End Sub - -End Class - diff --git a/PyME/Contabilidad/TiposPoliza.aspx b/PyME/Contabilidad/TiposPoliza.aspx deleted file mode 100644 index ce3c4dc03..000000000 --- a/PyME/Contabilidad/TiposPoliza.aspx +++ /dev/null @@ -1,115 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="TiposPoliza.aspx.vb" Inherits="Contabilidad_TiposPoliza" %> - -<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> - - - - - - - - Catálogo de Tipos de Póliza - - - - - - - - - - - - - - - - - - - - - - - -
    - - Tipo de Póliza - - - - Estatus - - - - Fecha Ing - - - - Usuario - - Comandos
    - - - -     -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -   -
    -
    - - - -
    - - - - - -
    - - -
    -
    -
    -
    - - diff --git a/PyME/Contabilidad/TiposPoliza.aspx.vb b/PyME/Contabilidad/TiposPoliza.aspx.vb deleted file mode 100644 index 9a0bbdca1..000000000 --- a/PyME/Contabilidad/TiposPoliza.aspx.vb +++ /dev/null @@ -1,175 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports System.Linq -Imports Extensiones - -Partial Class Contabilidad_TiposPoliza - Inherits ClsPaginas - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - ViewState("Orden") = "" - CargaDatos() - End If - End Sub - - Public Sub CargaDatos() - Dim ObjTipoPoliza As New ClsContabilidad - If ObjTipoPoliza.GetConta_TiposPoliza(UsuarioActual.CveEmpresa) Then - ViewState("DTTipoPoliza") = ObjTipoPoliza.DtResultados - 'GlobalDTTipoPoliza = ObjTipoPoliza.DtResultados - Else - Me.GvDatos.DataSource = Nothing - End If - - ObjTipoPoliza.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub - - Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click - Dim ObjTipoPoliza As New ClsContabilidad - If ObjTipoPoliza.AddConta_TiposPoliza(TxtTipoPoliza.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - TxtTipoPoliza.Text = "" - Alert("El Tipo de Póliza se guardó correctamente.", TipoMensaje.MsgInformacion) - UpTitulos.Update() - ViewState("DTTipoPoliza") = ObjTipoPoliza.DtResultados - 'GlobalDTTipoPoliza = ObjTipoPoliza.DtResultados - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End If - ObjTipoPoliza.Dispose() - End Sub - -#Region "G V D A T O S" - Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(256) - e.Row.Cells(1).Width = Unit.Pixel(100) - e.Row.Cells(2).Width = Unit.Pixel(100) - e.Row.Cells(3).Width = Unit.Pixel(100) - e.Row.Cells(4).Width = Unit.Pixel(100) - e.Row.Cells(5).Width = Unit.Pixel(61) - End If - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - End If - End Sub - - Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - Dim ObjTipoPoliza As New ClsContabilidad - Dim CveTipoPoliza As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero - Dim CveEmpresa As Integer = GvDatos.Rows(e.RowIndex).DataKey("CveEmpresa").ToEntero - - If CveEmpresa = UsuarioActual.CveEmpresa Then - If ObjTipoPoliza.RemoveConta_TipoPoliza(CveTipoPoliza) Then - TxtTipoPoliza.Text = "" - GvDatos.EditIndex = -1 - ViewState("DTTipoPoliza") = ObjTipoPoliza.DtResultados - 'GlobalDTTipoPoliza = ObjTipoPoliza.DtResultados - Alert("El Tipo de Póliza se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - Else - Alert("Los Tipos de Póliza principales no pueden ser eliminados.", TipoMensaje.MsgAdvertencia) - End If - - ObjTipoPoliza.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub - - Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit - GvDatos.EditIndex = -1 - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub - - Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating - - Dim ObjTipoPoliza As New ClsContabilidad - - Dim TipoPoliza As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtTipoPoliza"), TextBox).Text.Trim - Dim Estatus As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked - Dim CveTipoPoliza As Integer = GvDatos.Rows(e.RowIndex).DataKey("CveTipoPoliza").ToEntero - - If ObjTipoPoliza.UpdateConta_TiposPoliza(TipoPoliza, Estatus, CveTipoPoliza) Then - GvDatos.EditIndex = -1 - ViewState("DTTipoPoliza") = ObjTipoPoliza.DtResultados - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - End If - - ObjTipoPoliza.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - - End Sub - - Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatos.RowEditing - GvDatos.EditIndex = e.NewEditIndex - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString()) - Else - CargaGrid("") - End If - End Sub -#End Region - -#Region "O R D E N A M I E N T O" - Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) - Dim Orden As String = "" - Dim Campo As String = "" - Dim Literal As Literal = Nothing - Const OrdenInicial As String = "" - Dim Arg(2) As String - - Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) - Campo = Arg(0) - Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal) - - If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) - Literal.Text = String.Format("") - Else - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) - Literal.Text = String.Format("") - End If - Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString - ViewState("Orden") = Orden - CargaGrid(Orden) - End Sub - - Private Sub CargaGrid(Orden As String) - If Orden <> String.Empty Then - Dim DV As New DataView(CType(ViewState("DTTipoPoliza"), DataTable), "", Orden, DataViewRowState.CurrentRows) - GvDatos.DataSource = DV.ToTable() - DV.Dispose() - Else - GvDatos.DataSource = CType(ViewState("DTTipoPoliza"), DataTable) - End If - GvDatos.DataBind() - UpDatos.Update() - End Sub -#End Region -End Class diff --git a/PyME/Contabilidad/vssver2.scc b/PyME/Contabilidad/vssver2.scc deleted file mode 100644 index f7e68392f198b5bf6610bfaaf0303a0884abd4f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 690 zcmXpJVq}mqTDqL8)7fqJ6IEsZ=Gkla)-yH|>e**cdR!Q6}3H*Kv#Qz24 z-|KsFGWO$y8YUqBH;}KwY;~LO_VryL`9DB@<Kd&L^Fy3ZiK0FZAKCBCmX#H0ko z7Xt_79d;MGVA`o8~$d`LkUDB^O=PHP=qMwtWoS2i5UtFRe zP??*m@0_1kl9-g4lbMp3!r+`(;#`^v6e!k9EH0=(=j)XvF@$6m - -<%@ Import Namespace="System.Web.Optimization" %> - - - - - - SIG | Sistema de Información Gerencial - - - - - - <%: Scripts.Render("~/bundles/modernizr") %> - <%: Styles.Render("~/Content/AjaxControlToolkit/Styles/Bundle") %> - - - <%: Styles.Render("~/Metronic/assets/global/css/css") %> - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - <%--Site Scripts--%> - - - - <%: Scripts.Render("~/bundles/scripts") %> - <%: Scripts.Render("~/Metronic/assets/global/scripts/JS") %> - - -
    -
    - -
    -
    -

    Registra tu empresa

    -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -

    Tenga el control de su empresa con una sola herramienta

    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    -
    -
    - -
    - - - - -
    - Nombre o Razón Social de la empresa -
    -
    -
    -
    -
    -
    - - - - - - - RFC de la empresa -
    -
    -
    -
    -
    -
    - -
    - - - - - - - El correo que ingresó es inválido -
    -
    -
    -
    -
    -
    -
    - -
    - - - - -
    -
    -
    -
    -
    -
    -
    - - - - - - -
    - - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    - - - -
    -
    - - - -
    - - - diff --git a/PyME/Sistemas/RegistroEmpresa.aspx.vb b/PyME/Sistemas/RegistroEmpresa.aspx.vb deleted file mode 100644 index 30b5da7cb..000000000 --- a/PyME/Sistemas/RegistroEmpresa.aspx.vb +++ /dev/null @@ -1,180 +0,0 @@ -Option Strict On -Option Explicit On - -Imports Extensiones - -Partial Class Sistemas_RegistroEmpresa - Inherits ClsPaginas - -#Region "PROPIEDADES" - Private Property Nombre As String - Get - Nombre = ViewState("Nombre").ToString - End Get - Set(value As String) - ViewState("Nombre") = value - End Set - End Property - Private Property RFC As String - Get - RFC = ViewState("RFC").ToString - End Get - Set(value As String) - ViewState("RFC") = value - End Set - End Property - - Private Property Email As String - Get - Email = ViewState("Email").ToString - End Get - Set(value As String) - ViewState("Email") = value - End Set - End Property - - Private Property MetodoPago As String - Get - MetodoPago = ViewState("MetodoPago").ToString - End Get - Set(value As String) - ViewState("MetodoPago") = value - End Set - End Property - - - Private Property Liga As String - Get - Liga = ViewState("Liga").ToString - End Get - Set(value As String) - ViewState("Liga") = 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 - - End If - End Sub - -#Region " GUARDAR " - - Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) - Nombre = txtNombre.Text.ToUpper() - RFC = TxtRFC.Text.ToUpper() - Email = TxtEmail.Text - MetodoPago = DdlMetodoPago.SelectedValue - - Dim objEmpresa As New ClsSisEmpresas() - Try - If objEmpresa.AddEmpresa(-1, Nombre, "", "", "", "", "", "", RFC, 0, "", "", Email, "CFDi", "", "", "", "", "", "", "", 100, False, False, False, "", False, "", "", "", 0, False, False, False, False, False, False, False, False, False, False, - "", "", "", "", "", "", 0, False, "", "", "", "", "", 0, False, "", "", "", 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, "", "", -1, 0.0D, "", 2, False, 0.0D, "", "", 0, False, 0, 0, False, 0, 0, False, 0, - CveMetodoPago:=MetodoPago.ToEntero, CvePAC:=1) Then - Alert("Su solicitud ha sido procesada correctamente, en breve recibira un correo para completar el registro.", TipoMensaje.MsgInformacion) - Liga = String.Format("sig.adsistemas.mx/PyME/Sistemas/WizardRegistro.aspx?P={0}", Encripta(String.Format("CveEmpresa={0}", objEmpresa.CveEmpresa))) - EnviaCorreo() - RegistraScript("$('#C_DivRegistro').css('display', 'none');$('#C_DvFinalizado').css('display', '');") - UpRegistro.Update() - RecargaGlobal() - - - Else - Alert("OCurrió un error al guardar la empresa", TipoMensaje.MsgError) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar la emrpresa desde registro basico.", ex) - Finally - objEmpresa.Dispose() - End Try - - End Sub -#End Region - - Private Sub RecargaGlobal() - Dim ObjEmpresa As New ClsSisEmpresas - If ObjEmpresa.GetEmpresas(-1, "-1", "-1", "-1", "-1") Then - GlobalDTEmpresas(-1) = ObjEmpresa.DtResultados - End If - ObjEmpresa.Dispose() - End Sub - -#Region " ENVIAR CORREO " - Protected Sub REVContactoEmail_Load(sender As Object, e As EventArgs) - RegistraScript("$('#FirstEmail').addClass('has-error');$('#helpMail').css('color', 'red')") - End Sub - Protected Sub EnviaCorreo() - Dim objMail As New ClsSisMail() - Dim body = GeneraCorreo(Nombre) - objMail.SendMail(ClsPaginas.EmpresaNotificaciones, Email, "Activación de empresa", body, "") - End Sub - Private Function GeneraCorreo(Nombre As String) As String - Dim strBody As New StringBuilder - strBody.Append("") - strBody.Append(" ") - strBody.Append("") - strBody.Append("") - strBody.Append("
    ") - strBody.Append("

    AD Sistemas Soluciones en TI

    ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append(" Completar Registro") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat(" ", Nombre) - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append("", Liga) - strBody.Append("") - strBody.Append("") - strBody.Append("
    Fecha: ") - strBody.Append(DateTime.Now.ToString("dd/MM/yy")) - strBody.Append(" ") - strBody.Append("
    {0}

    ") - strBody.Append("
    Para continuar con el proceso de registro y activación, por favor haga click en la siguiente liga:
    ") - strBody.AppendFormat("Continuar

    Le recomendamos tener la siguiente información a la mano:
    ") - strBody.Append("
      ") - strBody.Append("
    • Datos Fiscales (Direccion, Contacto, Regimen, Certificados digitales, etc. )
    • ") - strBody.Append("
    • Roles/Puestos, Permisos y Usuarios que usaran el SIG )
    • ") - strBody.Append("
    • Correos para envío de notificaciones y Para recepción de facturas (si no cuenta con un correo, se le proporcionará uno)
    • ") - strBody.Append("
    • Formatos de factura, plantillas de correo y logo
    • ") - strBody.Append("
    • Clasificaciones contables, Productos / Servicios y las unidades de medida de éstos
    • ") - strBody.Append("
    • Almacenes que se utilizand, y el método de salida de inventario
    • ") - strBody.Append("
    • Proveedores, clientes y proyectos de la empresa
    • ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append("
    ") - strBody.Append(" ") - strBody.Append("") - strBody.Append("") - Return strBody.ToString - End Function -#End Region - -End Class diff --git a/PyME/Sistemas/WizardRegistro.aspx b/PyME/Sistemas/WizardRegistro.aspx deleted file mode 100644 index e928e0f0e..000000000 --- a/PyME/Sistemas/WizardRegistro.aspx +++ /dev/null @@ -1,3658 +0,0 @@ -<%@ Page EnableEventValidation="false" ValidateRequest="false" Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="WizardRegistro.aspx.vb" Inherits="Sistemas_WizardRegistro" %> - -<%@ Register - Assembly="AjaxControlToolkit" - Namespace="AjaxControlToolkit.HTMLEditor" - TagPrefix="HTMLEditor" %> - - - - - - - - - - - - - - - - - - -
    -
    - - <%--TITULO WIZARD--%> -
    - - Asistente de registro. - Paso 1 de 6 - -
    - -
    -
    -
    -
    - <%--PASOS GENERALES--%> - - - <%--BARRA DE PROGESO--%> -
    -
    -
    - - <%--PASOS GENERALES CONTENIDO--%> -
    - - <%--PASO 1: DATOS FISCALES--%> -
    - - - - <%--PASOS INTERNOS--%> - - - <%--BOTONES--%> -
    -
    -
    - - - -
    -
    -
    - -
    - - <%--PASO 1.1: DATOS FISCALES--%> -
    - -
    - - <%--PASO 1.2 ESTA ESCONDIDO--%> -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    IVA por Acreditar: - - -
    IVA Acreditable: - - -
    IVA por Trasladar: - - -
    IVA Trasladado - - -
    IVA Retenciones: - - -
    ISR Circulación: - - -
    -
    - - <%--PASO 1.3: CERTIFICADOS--%> -
    - - -
    -
    - -
    -
    -
    - -
    - - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - - <%--PASO 2: USUARIOS--%> -
    - - - - <%--PASOS INTERNOS--%> - - - <%--BOTONES--%> -
    -
    -
    - - - - -
    -
    -
    - -
    - - <%--PASO 2.1: PERFILES--%> -
    - - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - - Agregar Perfiles -
    -
    -
    -
    -
    -
    -
    -
    -
    - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - <%--PASO 2.2: USUARIOS--%> -
    - -
    -
    - - - - - -
    -
    - -
    - -
    -
    -
    -
    -
    - - Agregar Usuarios -
    -
    -
    -
    -
    -
    -
    -
    -
    - - -
    - - - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - - <%--PASO 3: CONFIGURACION--%> -
    - - -
    - - <%--PASOS INTERNOS--%> - - - <%--BOTONES--%> -
    -
    -
    - - - - -
    -
    -
    - -
    - - <%--PASO 3.1: LOGO--%> -
    -
    -
    -

    Logo de su empresa

    -
    -
    -
    -
    - - -
    -
    - -
    - - <%--PASO 3.2: CORREOS--%> -
    -
    - - <%--COLUMNA 1--%> -
    -
    -

    Envío de Correos

    -
    -
    - - - - -
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    -
    - - - - -
    -
    - -
    -
    - - -
    -
    -
    -
    - - <%--COLUMNA 2--%> -
    -
    -

    Recepción de facturas

    -
    -
    - - - - -
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    -
    - - - - -
    -
    -
    -
    - - - - - -
    -
    -
    -
    - - -
    -
    - - -
    -
    - -
    -
    - - <%--3.3: PLANTILLAS CORREO--%> -
    -
    -
    -
    -

    Plantilla para el envío de correo:

    -
    -
    -
    Asunto:
    -
    - -
    -
    - - - - - - Etiquetas - - - - - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - - <%--
    -
    -

    Etiquetas

    - -

    {NOMBRECLIENTE} Nombre del Cliente.

    -

    {SERIEFOLIO} Folio de la Factura Generada.

    -

    {FECHA} Fecha de la Factura Generada.

    -

    {SUCURSAL} Sucursal de la Factura Generada.

    -

    {IMPORTETOTAL} Importe Total de la Factura Generada.

    - -

    Ejemplo

    -

    -

    Plantilla:
    Estimado Cliente {NOMBRECLIENTE} le hago entrega del documento {SERIEFOLIO} generado en la Sucursal {SUCURSAL} con fecha de {FECHA} e Importe de {IMPORTETOTAL}.

    Correo:
    Estimado Cliente Juan Pérez le hago entrega del documento FAC-123 generado en la Sucursal Matriz Hermosillo con fecha de 30/04/2018 e Importe de $1000.00.
    -

    - -
    -
    --%> -
    -
    - - <%--3.4: FORMATO FACTURA--%> -
    -
    - - - -
    -
    -
    - - Formato Factura -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - - <%-- --%> - <%----%> - - - -
    -
    -
    -
    -

    Arraste o haga click para subir el formato de factura

    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - -
    -
    -
    - - - <%--3.5: CENTRO COSTOS--%> -
    - - -
    -
    - Tipo de Centro de Costos: -
    -
    - - - - - - - - -
    -
    - - - - - -
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - -
    - - <%--3.6: FOLIOS--%> -
    - -
    -
    - - - - - -
    -
    - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - -
    - - <%--3.7: INVENTARIOS--%> -
    -
    -
    -

    Método de costeo

    -
    -
    - -
    -
    -
    - Seleccione el Método de costeo de su empresa: -
    -
    - -
    -
    - -
    - -
    - - - - - -
    -
    -
    - - -
    -
    - - -
    - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - -   - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -
    - <%--REQUISICIONES--%> -
    - - - -
    -
    -

    Asignación de Estatus de Requisiciones

    -
    -
    - -
    - -
    - Centro de Costo: -
    - -
    - -
    - -
    -
    - - - - - USUARIO - - - - - - - - - - - - <%-- --%> -
    - - - - - -
    -
    -
    - - - - - - - <%-- --%> - -
    - - - - - -
    -
    -
    - - - - - - - - <%----%> - -
    - - - - - -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - - -
    - - <%--PASO 4: CATALOGOS--%> -
    - - - - - - - -
    - -
    -
    -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - Agregar Clasificaciones -
    -
    -
    - - - Descargar Excel - - - - Subir Excel - -
    -
    -
    -
    -
    -
    -
    -
    - - - - - -
    -
    -
    -
    - - -
    - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - Agregar Unidades de Medida -
    -
    -
    - - - Descargar Excel - - - - Subir Excel - -
    -
    -
    -
    -
    -
    -
    -
    - - - - - -
    -
    -
    -
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - <%-- - --%> -
    -
    -
    - - Agregar Producto Servicio -
    -
    -
    - - - Descargar Excel - - - - Subir Excel - -
    -
    -
    -
    - <%--
    -
    - - - -
    -
    - - - -
    -
    -
    - - - - - -
    -
    - - - - - -
    -
    - - - - - - - - - -
    -
    - - - - - - - -
    -
    - - - - - - - -
    -
    - - -
    -
    - -
    --%> -
    -
    - - - - - -
    -
    -
    -
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -
    - <%--
    -
    --%> -
    -
    -
    -
    -
    -
    -
    -
    - - <%--PASO ????: INVENTARIOS--%> -
    -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    - método de costeo -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - <%--PASO 5: CARGA INICIAL--%> -
    - - - - - - - -
    - -
    -
    -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - Agregar Proveedores -
    -
    -
    - - - Descargar Excel - - - - Subir Excel - -
    -
    -
    -
    -
    -
    -
    -
    - - - - - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - Agregar Clientes -
    -
    -
    - - - Descargar Excel - - - - Subir Excel - -
    -
    -
    -
    -
    -
    -
    -
    - - - - - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    - -
    -
    -

    Agregar Factura Proveedor Cliente

    -
    - -
    - Seleccione el tipo de factura: -
    - -
    - - - - - -
    - -
    -
    -

    Arraste o haga click para subir el archivo Excel

    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    - <%--PASO 7: Finalizar--%> -
    - - -
    - -
    -
    -
    - - <%-- --%> - <%----%> - <%-- --%> -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - <%--SABE--%> -
    - -
    - - -
    -
    - - - - <%--BOTONES PARA GUARDADO GENERAL - ES EL QUE MANEJA TODO--%> - - - - - <%--EMPIEZAN MODALES DE UPLOAD--%> - - <%--FIEL--%> - - - - <%--CSD--%> - - - <%-- PLANTILLA DE CORREO - MUESTRA ETIQUETAS --%> - - - - <%--AGREGAR PERFIL--%> - - - <%--AGREGAR USUARIO--%> - - - - <%--AGREGAR SUCURSAL--%> - - - - - - - - - - - - - - - <%-- --%> - - - - - - - - - - - - - - - - - - - - <%-- MODALES UPLOAD--%> - - - - -
    - - - - - - - - - - - diff --git a/PyME/Sistemas/WizardRegistro.aspx.vb b/PyME/Sistemas/WizardRegistro.aspx.vb deleted file mode 100644 index ca9193bc0..000000000 --- a/PyME/Sistemas/WizardRegistro.aspx.vb +++ /dev/null @@ -1,3464 +0,0 @@ -Option Strict On -Option Explicit On - -Imports Extensiones -Imports System.Data -Imports System.IO - - -Partial Class Sistemas_WizardRegistro - Inherits Page - -#Region " PROPIEDADES " - Private Property CveEmpresaTemp As Integer - Get - CveEmpresaTemp = ViewState("CveEmpresaTemp").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveEmpresaTemp") = value - End Set - End Property - Private Property CveEmpresa As Integer - Get - CveEmpresa = ViewState("CveEmpresa").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveEmpresa") = value - End Set - End Property - Private Property CveRol As Integer - Get - CveRol = ViewState("CveRol").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveRol") = value - End Set - End Property - Private Property DtRoles As DataTable - Get - Return CType(ViewState("DtRoles"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtRoles") = value - End Set - End Property - Private Property DtProyectos As DataTable - Get - Return CType(ViewState("DtProyectos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtProyectos") = value - End Set - End Property - Private Property DtUsuarios As DataTable - Get - Return CType(ViewState("DtUsuarios"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtUsuarios") = value - End Set - End Property - Private Property DtClasificaciones As DataTable - Get - Return CType(ViewState("DtClasificaciones"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtClasificaciones") = value - End Set - End Property - Private Property DtModulos As DataTable - Get - Return CType(ViewState("DtModulos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtModulos") = value - End Set - End Property - Private Property DtPS As DataTable - Get - Return CType(ViewState("DtPS"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtPS") = value - End Set - End Property - Private Property DTEstatusUsuarios As DataTable - Get - Return CType(ViewState("DTEstatusUsuarios"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTEstatusUsuarios") = value - End Set - End Property - Private Property DtUM As DataTable - Get - Return CType(ViewState("DtUM"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtUM") = value - End Set - End Property - Private Property DtProcesos As DataTable - Get - Return CType(ViewState("DtProcesos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtProcesos") = value - End Set - End Property - Private Property FIEL As String - Get - FIEL = ViewState("FIEL").ToString - End Get - Set(value As String) - ViewState("FIEL") = value - End Set - End Property - Private Property CSD As String - Get - CSD = ViewState("CSD").ToString - End Get - Set(value As String) - ViewState("CSD") = value - End Set - End Property - Private Property NombreEmpresaPropiedad As String - Get - NombreEmpresaPropiedad = ViewState("NombreEmpresaPropiedad").ToString - End Get - Set(value As String) - ViewState("NombreEmpresaPropiedad") = value - End Set - End Property - Private Property RFCPropiedad As String - Get - RFCPropiedad = ViewState("RFCPropiedad").ToString - End Get - Set(value As String) - ViewState("RFCPropiedad") = value - End Set - End Property - Private Property Correo As String - Get - Correo = ViewState("Correo").ToString - End Get - Set(value As String) - ViewState("Correo") = value - End Set - End Property - - Private Property MetodoPAgo As Integer - Get - MetodoPAgo = ViewState("MetodoPAgo").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("MetodoPAgo") = value - End Set - End Property - - - -#End Region - -#Region " PROPIEDADES PARA MODAL DE CATALOGOS " - Private Property ModalidadModal As String - Get - ModalidadModal = ViewState("ModalidadModal").ToString - End Get - Set(value As String) - ViewState("ModalidadModal") = value - End Set - End Property - Private Property CveModal As Integer - Get - CveModal = ViewState("CveModal").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveModal") = value - End Set - End Property -#End Region - - Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load - If Not IsPostBack Then - RegistraScript("$('#mBody').addClass('page-sidebar-closed');$('#divMenu').css('display','none');QuitarBarras();") - If Request("P") IsNot Nothing AndAlso Decripta((Request("P").ToString)) <> "" Then - Dim UrlParametros As Hashtable = Parametros(Decripta((Request("P").ToString))) - CveRol = 0 - If UrlParametros("CVEEMPRESA") IsNot Nothing AndAlso UrlParametros("CVEEMPRESA").ToString.ToEntero > 0 Then - CveEmpresa = UrlParametros("CVEEMPRESA").ToString.ToEntero - CargaDatos() - Else - DivEsconder.Style.Add("display", "none") - Alert("No se seleccionó ninguna empresa", TipoMensaje.MsgAdvertencia) - End If - Else - DivEsconder.Style.Add("display", "none") - Alert("No se seleccionó ninguna empresa", TipoMensaje.MsgAdvertencia) - End If - End If - End Sub - - -#Region " FUNCIONES - POSIBLE LLEVARSE PARA TODO EL SITIO " - Private Function Parametros(Cadena As String) As Hashtable - Dim P1() As String = Cadena.Split("&"c) - Dim Tmp As String - Dim P2() As String - - Dim URLParametros As New Hashtable - - For Each Tmp In P1 - P2 = Tmp.Replace("%26%", "&").Split("="c) - URLParametros.Add(P2(0).ToString.ToUpper, P2(1)) - Next - Return URLParametros - End Function - Private Function EsDuplicado(Dt As DataTable, Filtro As String) As Boolean - Dim Tabla As New DataTable() - Tabla = Dt.FiltraParametros(Filtro) - If Tabla.Rows.Count > 0 Then - Return True - Else - Return False - End If - End Function - Public Function FormatearNombreArchivo(nombreArchivoOriginal As String) As String - Dim nombreArchivoFormateado As String - nombreArchivoFormateado = nombreArchivoOriginal.Replace(" ", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("'", "") - nombreArchivoFormateado = nombreArchivoFormateado.Replace(Chr(34), "") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("$", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("#", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("%", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("!", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("&", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("?", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("¿", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("¡", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("*", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("~", "_") - nombreArchivoFormateado = nombreArchivoFormateado.Replace("^", "_") - Return nombreArchivoFormateado - End Function -#End Region - -#Region " CARGA DATOS " - Protected Sub CargaDatos() - Dim ObjEmpresa As New ClsSisEmpresas - If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") AndAlso ObjEmpresa.DtResultados.Rows.Count > 0 Then - - Dim DrEmpresa = ObjEmpresa.DtResultados.Rows(0) - 'PROPIEDADES - NombreEmpresaPropiedad = DrEmpresa("Empresa").ToString - RFCPropiedad = DrEmpresa("RFC").ToString - 'TITULO - ltlEmpresa.Text = $"Registro de {NombreEmpresaPropiedad} ({RFCPropiedad})" - - 'CARGA PASO 1.1 - DATOS FISCALES - TxtNomEmpresa.Text = DrEmpresa("Empresa").ToString - TxtRFC.Text = DrEmpresa("RFC").ToString - TxtEmail.Text = DrEmpresa("Mail").ToString - DdlRegimen.SelectedValueExist(DrEmpresa("Regimen").ToString) - TxtContacto.Text = DrEmpresa("Contacto").ToString - TxtTelefono.Text = DrEmpresa("Telefono").ToString - TxtExtension.Text = DrEmpresa("Extension").ToString - TxtDireccion.Text = DrEmpresa("Direccion").ToString - TxtNoExt.Text = DrEmpresa("NoExt").ToString - TxtNoInt.Text = DrEmpresa("NoInt").ToString - TxtColonia.Text = DrEmpresa("Colonia").ToString - TxtCiudad.Text = DrEmpresa("Ciudad").ToString - TxtLocalidad.Text = DrEmpresa("Localidad").ToString - TxtEstado.Text = DrEmpresa("Estado").ToString - TxtCP.Text = DrEmpresa("CP").ToString - - 'CARGA PASO 1.3 - DATOS FISCALES - TxtContraKey.Text = DrEmpresa("ContraseñaKey").ToString - TxtCIEC.Text = DrEmpresa("CIEC").ToString - - DtClasificaciones.FiltraParametros("", "", {"CveProyecto", "Proyecto"}) - - Correo = DrEmpresa("Mail").ToString - MetodoPAgo = DrEmpresa("CveMetodoPago").ToString.ToEntero - - 'CARGA PASO 3.2 - CORREOS - txtEnvioCorreo.Text = DrEmpresa("SendMail").ToString - TxtEnvioContraseña.Text = DrEmpresa("SendMailPassword").ToString - TxtEnvioServidor.Text = DrEmpresa("SendMailServer").ToString - TxtEnvioPuerto.Text = DrEmpresa("SendMailPuerto").ToString - ChkEnvioSSL.Checked = CBool(DrEmpresa("SendMailSSL").ToString) - txtRecepCorreo.Text = DrEmpresa("Buzon_Mail").ToString - TxtRecepContraseña.Text = DrEmpresa("Buzon_PWD").ToString - TxtRecepServidor.Text = DrEmpresa("Buzon_Server").ToString - TxtRecepPuerto.Text = DrEmpresa("Buzon_Puerto").ToString - DdlRecepProtocolo.SelectedValueExist(DrEmpresa("Buzon_Tipo").ToString) - ChkRecepSSL.Checked = CBool(DrEmpresa("Buzon_SSL").ToString) - - - DdlTipoCentroCostos.SelectedValueExist(DrEmpresa("Tipo_CentroCosto")) - CargaSubProyectos() - CargaGvFolio() - - Dim ObjRoles As New ClsSisRoles - Dim objUsuarios As New ClsSisUsuarios - Dim objunidadesMedida As New ClsUnidadesMedida - Dim objClasi As New ClsClasificaciones - Dim objPS As New ClsProductosServicios - Dim objInv As New ClsInventarios - - DivRegistroInicial.Style.Add("display", "") - RFVNombre.ValidationGroup = "GrpGuardar" - REVRFC.ValidationGroup = "GrpGuardar" - RFVRFC.ValidationGroup = "GrpGuardar" - REVContactoEmail.ValidationGroup = "GrpGuardar" - RequiredFieldValidator1.ValidationGroup = "GrpGuardar" - 'cvEmail.ValidationGroup = "GrpGuardar" - - - If objUsuarios.GetUsuarios(-1) Then - GvUsuarios.DataSource = objUsuarios.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) - ' - GvUsuarios.DataBind() - End If - If objClasi.GetClasificaciones(CveEmpresa) AndAlso objClasi.DtResultados.Rows.Count > 0 Then - DtClasificaciones = objClasi.DtResultados - CargaDdlClasificaciones() - End If - CargaGVClasificacion() - - If objunidadesMedida.GetUnidadesMedida(CveEmpresa) Then - DtUM = objunidadesMedida.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) - GvUM.DataSource = DtUM - GvUM.DataBind() - CargaDdlUM() - End If - - If objPS.GetPS(-1, -1, CveEmpresa) Then - GVPS.DataSource = objPS.DtResultados - GVPS.DataBind() - Else - GVPS.DataSource = Nothing - End If - - If objPS.GetMetodosInv() Then - DdlMetodos.DataSource = objPS.DtResultados.FiltraParametros("CveMetodoInventario <> 0") - DdlMetodos.DataBind() - Else - DdlMetodos.DataSource = Nothing - End If - - If objInv.GetTiposAlmacenes Then - DdlTipoAlmacen.DataSource = objInv.DtResultados - DdlTipoAlmacen.DataBind() - Else - DdlTipoAlmacen.DataSource = Nothing - End If - - CargaGvInventario() - CargaSubProyectosInventario() - - CargaGVProveedor() - - - ObjRoles.Dispose() - ObjEmpresa.Dispose() - objClasi.Dispose() - objUsuarios.Dispose() - objunidadesMedida.Dispose() - objPS.Dispose() - objInv.Dispose() - - Dim DirFactura = ModExtensiones.DirectorioBaseEmpresas + String.Format("Empresas\{0}\Formatos\Factura.mrt", CveEmpresa) - Dim Factura As New FileInfo(DirFactura) - RblFormatoFactura.Items.Item(1).Enabled = Factura.Exists - RblFormatoFactura.Items.Item(1).Selected = Factura.Exists - - - CargaGVRoles() - CargaGVUsuarios() - CargaGVCC() - CargaGvCliente() - CargaDdlUsuario() - CargaDdlRegimen() - CreaGrid() - 'CargaGridEstatusUsuarios() - - - Else - Alert("No se encontraron datos con la empresa seleccionada.", TipoMensaje.MsgAdvertencia) - DivEsconder.Style.Add("display", "none") - End If - End Sub -#End Region - -#Region " GUARDAR PASO " - Protected Sub BtnGuardarPaso_Click(sender As Object, e As EventArgs) - Dim paso = HdnPaso.Value.ToEntero - Dim subpaso = HdnSubPaso.Value.ToEntero - Pasos(paso, subpaso) - End Sub - Protected Sub Pasos(Paso As Integer, subpaso As Integer) - Dim ObjEmpresa As New ClsSisEmpresas - - - Dim HuboError = False - - 'PASO 1.1: DATOS FISCALES - Dim NombreEmpresa, RFC, CorreoElectronico, Regimen, Contacto, Telefono, Extension, Calle, NoExt, NoInt, Colonia, Ciudad, Localidad, Estado, CP As String - NombreEmpresa = TxtNomEmpresa.Text.Trim - RFC = TxtRFC.Text.Trim - CorreoElectronico = TxtEmail.Text.Trim - Regimen = DdlRegimen.SelectedValue - Contacto = TxtContacto.Text.Trim - Telefono = TxtTelefono.Text.Trim.Replace("("c, "").Replace(")"c, "").Replace("-"c, "").Replace(" ", "") - Extension = TxtExtension.Text.Trim - Calle = TxtDireccion.Text.Trim - NoExt = TxtNoExt.Text.Trim - NoInt = TxtNoInt.Text.Trim - Colonia = TxtColonia.Text.Trim - Ciudad = TxtCiudad.Text.Trim - Localidad = TxtLocalidad.Text.Trim - Estado = TxtEstado.Text.Trim - CP = TxtCP.Text.Trim - - 'PASO 1.3: CERTIFICADOS - Dim CSD, CIEC As String - CSD = TxtContraKey.Text.Trim - CIEC = TxtCIEC.Text.Trim - - 'PASO 3.2: CORREOS - Dim EnvioCorreo, EnvioContraseña, EnvioServidor, RecepCorreo, RecepContraseña, RecepServidor, RecepProtocolo As String - Dim EnvioSSL, RecepSSL As Boolean - Dim EnvioPuerto, RecepPuerto As Integer - EnvioCorreo = txtEnvioCorreo.Text.Trim - EnvioContraseña = TxtEnvioContraseña.Text.Trim - EnvioServidor = TxtEnvioServidor.Text.Trim - EnvioPuerto = TxtEnvioPuerto.Text.Trim.ToEntero - EnvioSSL = ChkEnvioSSL.Checked - RecepCorreo = txtRecepCorreo.Text.Trim - RecepContraseña = TxtRecepContraseña.Text.Trim - RecepServidor = TxtRecepServidor.Text.Trim - RecepPuerto = TxtRecepPuerto.Text.Trim.ToEntero - RecepProtocolo = DdlRecepProtocolo.SelectedValue - RecepSSL = ChkRecepSSL.Checked - - Select Case Paso - Case 1 - Select Case subpaso - Case 1 - 'DATOS FISCALES - If ObjEmpresa.RegistroEmpresasDatosFiscales(NombreEmpresa, RFC, CorreoElectronico, Regimen, Contacto, Telefono, Extension, Calle, NoExt, NoInt, Colonia, Ciudad, Localidad, Estado, CP, CveEmpresa) Then - NombreEmpresaPropiedad = NombreEmpresa - RFCPropiedad = RFC - ltlEmpresa.Text = $"Registro de {NombreEmpresaPropiedad} ({RFCPropiedad})" - Else - RegistraScript("$('a.antfiscal').click()") - End If - - 'ESTATUS DE REQUISICIONES PREDEFINIDAS - Dim ObjOC As New ClsOC - If ObjOC.GetEstatus() Then - If Not ObjOC.DtResultados.FiltraParametros($"CveEmpresa={CveEmpresa}").Rows.Count > 0 Then - ObjOC.AddEstatusRequisicionesPredefinidas(CveEmpresa) - ObjOC.Dispose() - End If - End If - - - Case 2 - 'ESTA ESCONDIDO - Case 3 - 'CERTIFICADOS - If Not ObjEmpresa.RegistroEmpresasCertificados(CSD, CIEC, CveEmpresa) Then - RegistraScript("$('#globalprevious').click()") - End If - End Select - Case 3 - Select Case subpaso - Case 1 - 'LOGO - GuardaLogo() - Case 2 - 'CORREO - If Not ObjEmpresa.RegistroEmpresasCorreos(EnvioCorreo, EnvioContraseña, EnvioServidor, EnvioPuerto, EnvioSSL, RecepCorreo, RecepContraseña, RecepServidor, RecepPuerto, RecepProtocolo, RecepSSL, CveEmpresa) Then - RegistraScript("$('a.antfiscal').click()") - End If - Case 3 - If TxtPlantillaVenta.Text <> String.Empty Then - If Not ObjEmpresa.UpdatePlantillaMail("AsuntoPlantillaMailVenta", TxtAsunto.Text.Trim, "PlantillaMailVenta", TxtPlantillaVenta.Text.Trim, CveEmpresa) Then - Alert("La plantilla de mail de ventas se guardó correctamente.", TipoMensaje.MsgInformacion) - HuboError = True - End If - End If - Case 4 - If TxtFormatoFactura.getfiles().Archivos().Count > 0 Then - Dim FormatoFactura As Archivo = TxtFormatoFactura.getfiles().Archivos(0) - Dim PathFormato = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\Formatos\" - Dim dirFormato As String = String.Format("{0}\Factura.{1}", PathFormato, FormatoFactura.Extension) - If File.Exists(dirFormato) Then - My.Computer.FileSystem.DeleteFile(dirFormato) - End If - My.Computer.FileSystem.MoveFile(FormatoFactura.FileUrl, dirFormato) - ObjEmpresa.UpdateFormatoImpresion(CveEmpresa, 2) - Else - ObjEmpresa.UpdateFormatoImpresion(CveEmpresa, 1) - End If - End Select - Case 5 - If Not True Then - RegistraScript("$('#globalprevious').click()") - End If - End Select - - ObjEmpresa.Dispose() - - End Sub - - -#End Region - -#Region " PASO 1: DATOS FISCALES" - -#Region " 1.1 DATOS FISCALES " - Private Sub CargaDdlRegimen() - Dim ObjEmpresa As New ClsSisEmpresas - If ObjEmpresa.GetRegimenFiscal(-1) Then - DdlRegimen.DataSource = ObjEmpresa.DtResultados() - Else - DdlRegimen.DataSource = Nothing - End If - ObjEmpresa.Dispose() - DdlRegimen.DataBind() - End Sub -#End Region - -#Region " 1.2: CERTIFICADOS " - Protected Sub BtnModalFiel_Click(sender As Object, e As EventArgs) - If Not TxtModalFielArchivo.getfiles().Archivos.Count > 0 Then - Alert("No se ha cargado ningun archivo. Por favor seleccione uno o espere se termine de cargar el archivo y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim ArchivoFiel As Archivo = TxtModalFielArchivo.getfiles().Archivos(0) - - If ArchivoFiel.filenameO.Length > 114 Then - Alert("El nombre del archivo excede los 115 caracteres permitidos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim ObjEmpresas As New ClsSisEmpresas - ObjEmpresas.IniciaTransacSQL() - Try - Dim Path As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\Certificados" - DirectoryExistsCreate(Path) - Dim ArchivoDestino As String = String.Format("{0}\{1}", Path, ArchivoFiel.filename) - If File.Exists(ArchivoDestino) Then - My.Computer.FileSystem.DeleteFile(ArchivoDestino) - End If - If ObjEmpresas.RegistroEmpresasCertificadosFIEL($"{ArchivoFiel.filenameO}", CveEmpresa) Then - My.Computer.FileSystem.MoveFile(ArchivoFiel.FileUrl, ArchivoDestino) - TxtFiel.Text = ArchivoFiel.filenameO - ObjEmpresas.Commit() - - Else - ObjEmpresas.RollBack() - End If - Catch ex As Exception - ObjEmpresas.RollBack() - Alert("Ocurrió un error al guardar el archivo FIEL. Por favor vuelva a intentar.", TipoMensaje.MsgError) - Finally - ObjEmpresas.Dispose() - End Try - UPSat.Update() - RegistraScript("$('#ModalFiel').modal('hide');") - End Sub - - Protected Sub BtnCSD_Click(sender As Object, e As EventArgs) - If Not TxtModalCSDArchivo.getfiles().Archivos.Count > 0 Then - Alert("No hay seleccionado ningun archivo. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim ArchivoCSD As Archivo = TxtModalCSDArchivo.getfiles().Archivos(0) - - If ArchivoCSD.filenameO.Length > 114 Then - Alert("El nombre del archivo excede los 115 caracteres permitidos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim ObjEmpresas As New ClsSisEmpresas - ObjEmpresas.IniciaTransacSQL() - Try - Dim Path As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\Certificados" - DirectoryExistsCreate(Path) - Dim ArchivoDestino As String = String.Format("{0}\{1}", Path, ArchivoCSD.filenameO) - If File.Exists(ArchivoDestino) Then - My.Computer.FileSystem.DeleteFile(ArchivoDestino) - End If - If ObjEmpresas.RegistroEmpresasCertificadosCSD($"{ArchivoCSD.filenameO}", CveEmpresa) Then - My.Computer.FileSystem.MoveFile(ArchivoCSD.FileUrl, ArchivoDestino) - TxtCSD.Text = ArchivoCSD.filenameO - ObjEmpresas.Commit() - Else - ObjEmpresas.RollBack() - End If - Catch ex As Exception - ObjEmpresas.RollBack() - Alert("Ocurrió un error al guardar el archivo CSD. Por favor vuelva a intentar.", TipoMensaje.MsgError) - Finally - ObjEmpresas.Dispose() - End Try - UPSat.Update() - RegistraScript("$('#ModalCSD').modal('hide');") - End Sub -#End Region - -#End Region - -#Region " PASO 2: USUARIOS " - -#Region " 2.1: ROLES - PERFILES " - Protected Sub LBAgregarPerfil_Click(sender As Object, e As EventArgs) - TxtPerfil.Text = "" - BtnPerfil.Text = "Agregar Perfil" - ModalidadModal = "Insertar" - CveModal = -1 - UpPerfil.Update() - RegistraScript(" $('#ModalPerfil').modal('show');") - End Sub - Private Sub CargaGVRoles() - - Dim ObjRoles As New ClsSisRoles - If ObjRoles.GetRoles(-1, CveEmpresa) Then - DtRoles = ObjRoles.DtResultados - End If - ObjRoles.Dispose() - - GVRoles.DataSource = ObjRoles.DtResultados - GVRoles.DataBind() - - CargaDdlRoles() - - UPRoles.Update() - End Sub - - Protected Sub LBAgregarPerfilesSugeridos_Click(sender As Object, e As EventArgs) Handles LBAgregarPerfilesSugeridos.Click - Dim ObjRoles As New ClsSisRoles - If ObjRoles.AddRolesPredefinidos(CveEmpresa) Then - Alert("Los perfiles predefinidos se agregaron correctamente.", TipoMensaje.MsgInformacion) - End If - ObjRoles.Dispose() - CargaGVRoles() - End Sub - - Protected Sub BtnAddUpdatePerfil_Click(sender As Object, e As EventArgs) Handles BtnPerfil.Click - - 'INSERTAR DE NUEVO PERFIL - If ModalidadModal = "Insertar" Then - Dim ObjRoles As New ClsSisRoles - If ObjRoles.AddRol(1, TxtPerfil.Text, 100, CveEmpresa) Then - Alert("El nuevo perfil se guardó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjRoles.Dispose() - End If - - 'ACTUALIZACION DE PERFIL - If ModalidadModal = "Actualizar" Then - If CveModal > 0 Then - Dim ObjRoles As New ClsSisRoles - Dim CveRol = CveModal - If ObjRoles.UpdateRol(1, TxtPerfil.Text, 100, CveRol) Then - Alert("El perfil se actualizó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjRoles.Dispose() - End If - End If - - CargaGVRoles() - RegistraScript(" $('#ModalPerfil').modal('hide');") - End Sub - Protected Sub GVRoles_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GVRoles.RowCommand - If e.CommandName = "Permisos" Then - Dim Array = e.CommandArgument.ToString.Split("|"c) - If Array.Length = 2 Then - Dim ObjPermisos As New ClsSisRoles() - ViewState("CveRol") = Array(0).ToEntero - If ObjPermisos.GetRolesModulos(Array(0).ToEntero, -1, CvePlataforma:=1, CveEmpresa:=CveEmpresa) Then - GvPermisos.DataSource = ObjPermisos.DtResultados.FiltraParametros("AGRUPACION ='N'") - Else - GvPermisos.DataSource = Nothing - End If - ObjPermisos.Dispose() - GvPermisos.DataBind() - LbPermisos.Text = String.Format("Asignación de Permisos: {0}", Array(1).ToString) - - UPPAltaRep.Update() - UPAlta.Update() - RegistraScript("$('#DivPermisos').modal();") - End If - End If - If e.CommandName = "Procesos" Then - Dim Array = e.CommandArgument.ToString.Split("|"c) - If Array.Length = 2 Then - Dim ObjPermisos As New ClsSisRoles() - ViewState("CveProceso") = Array(0).ToEntero - If ObjPermisos.GetRolesProcesos(Array(0).ToEntero, -1) Then - GvProcesos.DataSource = ObjPermisos.DtResultados - Else - GvProcesos.DataSource = Nothing - End If - ObjPermisos.Dispose() - GvProcesos.DataBind() - LbProcesos.Text = String.Format("Asignación de Procesos: {0}", Array(1).ToString) - - UPPAltaProcesos.Update() - UpAltaP.Update() - RegistraScript("$('#DivProcesos').modal();") - End If - End If - If e.CommandName = "Editar" Then - Dim GvRow As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).NamingContainer, GridViewRow) - TxtPerfil.Text = GvRow.DataKey("Rol") - BtnPerfil.Text = "Actualizar Perfil" - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CveRol").ToEntero - UpPerfil.Update() - RegistraScript(" $('#ModalPerfil').modal('show');") - End If - End Sub - - Protected Sub GVRoles_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GVRoles.RowDeleting - Dim ObjRoles As New ClsSisRoles - If ObjRoles.RemoveRol(GVRoles.Rows(e.RowIndex).DataKey("CveRol").ToEntero) Then - Alert("El perfil se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjRoles.Dispose() - - CargaGVRoles() - End Sub - -#End Region - -#Region " 2.2: USUARIOS " - - Private Sub RecargaGlobal() - Dim ObjUsuarios As New ClsSisUsuarios - If ObjUsuarios.GetUsuariosEmpresas(-1) Then - Application("GlobalDTUsuarios") = ObjUsuarios.DtResultados - ' GlobalDTUsuarios() = ObjUsuario.DtResultados - - End If - ObjUsuarios.Dispose() - End Sub - - Private Sub CargaGVUsuarios() - Dim ObjUsuarios As New ClsSisUsuarios - If ObjUsuarios.GetUsuarios(-1) Then - GvUsuarios.DataSource = ObjUsuarios.DtResultados.FiltraParametros($"CveEmpresa={CveEmpresa}") - End If - ObjUsuarios.Dispose() - GvUsuarios.DataBind() - UpGVUsuarios.Update() - End Sub - Private Sub CargaDdlRoles() - DdlRoles.Items.Clear() - DdlRoles.DataSource = DtRoles - DdlRoles.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlRoles.DataBind() - End Sub - Protected Sub LBAgregarUsuario_Click(sender As Object, e As EventArgs) - TxtNombre.Text = "" - TxtCorreo.Text = "" - DdlRoles.SelectedValueExist("-1") - BtnUsuario.Text = "Agregar Usuario" - ModalidadModal = "Insertar" - CveModal = -1 - UpUsuario.Update() - RegistraScript(" $('#ModalUsuario').modal('show');") - End Sub - Protected Sub BtnAddUpdateUsuario_Click(sender As Object, e As EventArgs) Handles BtnUsuario.Click - Dim Usuario As New ClsSisUsuarios - Dim Rol As String = "" - Dim CveUsuario As Integer = 0 - If DdlRoles.SelectedItem.ToString = "Compras" Then Rol = DdlRoles.SelectedItem.ToString - If DdlRoles.SelectedItem.ToString = "Director General" Then Rol = DdlRoles.SelectedItem.ToString - If DdlRoles.SelectedItem.ToString = "Ventas" Then Rol = DdlRoles.SelectedItem.ToString - If DdlRoles.SelectedItem.ToString = "Almacen" Then Rol = DdlRoles.SelectedItem.ToString - If DdlRoles.SelectedItem.ToString = "Bancos" Then Rol = DdlRoles.SelectedItem.ToString - 'INGRESA UN NUEVO USUARIO - If ModalidadModal = "Insertar" Then - CveUsuario = Usuario.AddUsuario(TxtCorreo.Text, ClsPaginas.ContraseñaPredeterminadaEncriptada, TxtNombre.Text, DdlRoles.SelectedValue.ToEntero, TxtCorreo.Text, -1, -1, True, 100, CveEmpresa, -1, DdlRoles.SelectedValue) - If CveUsuario > 0 Then - Alert("El nuevo Usuario se guardó correctamente con la contraseña temporal -acceso-.", TipoMensaje.MsgInformacion) - If Rol <> "" Then - Usuario.AddUsuariosModulosPyMe(CveUsuario, Rol) - End If - Usuario.AddUsuariosEmpresas(CveUsuario, CveEmpresa) - End If - End If - - 'ACTUALIZA USUARIO - If ModalidadModal = "Actualizar" Then - If CveModal > 0 Then - Dim CveUsuarioUpdate = CveModal - If Usuario.UpdateUsuario(TxtCorreo.Text, TxtNombre.Text, DdlRoles.SelectedValue.ToEntero, TxtCorreo.Text, -1, -1, True, True, CveEmpresa, CveUsuarioUpdate, -1, -1) Then - Alert("El Usuario se actualizó correctamente", TipoMensaje.MsgInformacion) - If Rol <> "" Then - Usuario.UpdateUsuariosModulosPyMe(CveUsuarioUpdate, Rol) - End If - End If - End If - End If - - Usuario.Dispose() - RegistraScript(" $('#ModalUsuario').modal('hide');") - CargaGVUsuarios() - CargaDdlUsuario() - RecargaGlobal() - CargaGridEstatusUsuarios() - End Sub - Protected Sub GVUsuarios_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvUsuarios.RowCommand - If e.CommandName = "Editar" Then - Dim GvRow As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).NamingContainer, GridViewRow) - TxtNombre.Text = GvRow.DataKey("Nombre") - TxtCorreo.Text = GvRow.DataKey("Correo") - DdlRoles.SelectedValueExist(GvRow.DataKey("CveRol")) - BtnUsuario.Text = "Actualizar Usuario" - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CveUsuario").ToEntero - UpUsuario.Update() - RegistraScript(" $('#ModalUsuario').modal('show');") - End If - End Sub - Protected Sub GVUsuarios_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvUsuarios.RowDeleting - Dim Usuario As New ClsSisUsuarios - If Usuario.RemoveUsuario(GvUsuarios.Rows(e.RowIndex).DataKey("CveUsuario").ToEntero) Then - Alert("El usuario se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - Usuario.Dispose() - CargaGVUsuarios() - CargaGridEstatusUsuarios() - End Sub -#End Region - - Protected Sub CmdGuardar_Click(sender As Object, e As EventArgs) Handles CmdGuardar.Click - Dim Roles As New ClsSisRoles - For Each Row As GridViewRow In GvPermisos.Rows - Roles.UpdateRolesModulos(Row.DataKey("CveRol").ToEntero, Row.DataKey("CveModulo").ToEntero, If(Row.FCCheckBox("ChkP").Checked, 1, 0), 100) - Next - Roles.Dispose() - UPPAltaRep.Update() - RegistraScript("$('#DivPermisos').modal('hide');") - End Sub - Protected Sub BtnGuardaProcesos_Click(sender As Object, e As EventArgs) Handles BtnGuardaProcesos.Click - Dim Roles As New ClsSisRoles - For Each Row As GridViewRow In GvProcesos.Rows - Roles.UpdateRolesProcesos(Row.DataKey("CveRol").ToEntero, Row.DataKey("CveProceso").ToEntero, If(Row.FCCheckBox("ChkP").Checked, 1, 0), 100) - Next - Roles.Dispose() - RegistraScript("$('#DivProcesos').modal('hide');") - UPPAltaProcesos.Update() - End Sub - - Protected Sub GvPermisos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPermisos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If CveEmpresa > 0 Then - If (e.Row.DBCampo("CveModuloAcceso")) <> "" Then e.Row.FCCheckBox("ChkP").Checked = True - End If - End If - End Sub - - Protected Sub GvProcesos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvProcesos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If CveEmpresa > 0 Then - If (e.Row.DBCampo("CveModuloAcceso")) <> "" Then - e.Row.Cells(0).CssClass = "bg-yellow" - End If - If (e.Row.DBCampo("CveProcesoAcceso")) <> "" Then e.Row.FCCheckBox("ChkP").Checked = True - End If - End If - End Sub - -#End Region - -#Region " PASO 3: CONFIGURACION " - -#Region " 3.1: LOGO " - Protected Sub GuardaLogo() - If TextLogo.getfiles().Archivos().Count = 1 Then - Dim ArchivoLogo As Archivo = TextLogo.getfiles().Archivos(0) - If ArchivoLogo.filenameO.Length <= 114 Then - Try - Dim Path As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}" - DirectoryExistsCreate(Path) - Dim ArchivoDestino As String = String.Format("{0}\Logo.{1}", Path, ArchivoLogo.Extencion) - If File.Exists(ArchivoDestino) Then - My.Computer.FileSystem.DeleteFile(ArchivoDestino) - End If - My.Computer.FileSystem.CopyFile(ArchivoLogo.FileUrl, ArchivoDestino) - Catch ex As Exception - Alert("Ocurrió un error al guardar el Logo de la empresa. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End Try - Else - Alert("El nombre del archivo excede los 115 caracteres permitidos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - End If - End If - End Sub -#End Region - -#Region " 3.2: CORREOS " - -#End Region - -#Region " 3.3: PLANTILLA PARA ENVIO DE CORREOS" - Protected Sub LnkBtnMuestraEtiquetas_Click(sender As Object, e As EventArgs) - RegistraScript("$('#ModalEtiquetas').modal();") - End Sub -#End Region - -#Region " 3.4: FORMATO FACTURA" - - Protected Sub linkActualizar_Click(sender As Object, e As EventArgs) - VerEditarFactura() - End Sub - Protected Sub RblFormatoFactura_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblFormatoFactura.SelectedIndexChanged - Dim StrParams As New StringBuilder - Dim Directorio = ModExtensiones.DirectorioBaseEmpresas + String.Format("Empresas\{0}\Formatos\Factura.mrt", CveEmpresa) - Dim Archivo As New FileInfo(Directorio) - RblFormatoFactura.Items.Item(1).Enabled = Archivo.Exists - DivSubirFactura.Visible = (RblFormatoFactura.SelectedValue = "2") - HlFormatoFactura.Visible = (RblFormatoFactura.SelectedValue.Contiene("3", "4")) - HlFormatoFactura.Text = If(RblFormatoFactura.SelectedValue = "3", "Agregar", "Editar") - StrParams.Append("TIPO=Ing") - StrParams.Append($"&CVEEMPRESA={CveEmpresa}") - StrParams.Append($"&EMPRESA={NombreEmpresaPropiedad}") - StrParams.Append($"&RFC={RFCPropiedad}") - StrParams.Append($"&DOMICILIO={TxtDireccion.Text}") - - If RblFormatoFactura.SelectedValue = "4" AndAlso Archivo.Exists Then - HlFormatoFactura.NavigateUrl = $"/Ventas/ReporteDetalle.aspx?Op={Encripta(StrParams.ToString)}&Mod=Editar" - Else - HlFormatoFactura.NavigateUrl = $"/Ventas/ReporteDetalle.aspx?Op={Encripta(StrParams.ToString)}" - End If - UpFormatoFactura.Update() - End Sub - Private Sub VerEditarFactura() - Dim Directorio = ModExtensiones.DirectorioBaseEmpresas + String.Format("Empresas\{0}\Formatos\Factura.mrt", CveEmpresa) - Dim Archivo As New FileInfo(Directorio) - RblFormatoFactura.Items.Item(1).Enabled = Archivo.Exists - If Archivo.Exists Then - Alert("Formato de factura guardado correctamente", TipoMensaje.MsgInformacion) - Else - Alert("Hubo un error al guardar el formato de factura. Favor de llamar a soporte tecnico", TipoMensaje.MsgInformacion) - End If - UpFormatoFactura.Update() - End Sub - -#End Region - -#Region " 3.5: CENTRO COSTOS " - - Private Sub CargaRequired() - If ChkEsSucursal.Checked = True Then - RFVSerie.Enabled = True - RFVIVA.Enabled = True - RFVCalle.Enabled = True - RFVNoExtCC.Enabled = True - RFVColoniaCC.Enabled = True - RFVLocalidadCC.Enabled = True - RFVMunicipio.Enabled = True - RFVEstadoCC.Enabled = True - RFVPais.Enabled = True - RFVCPCC.Enabled = True - - RFVSerie.Visible = True - RFVIVA.Visible = True - RFVCalle.Visible = True - RFVNoExtCC.Visible = True - RFVColoniaCC.Visible = True - RFVLocalidadCC.Visible = True - RFVMunicipio.Visible = True - RFVEstadoCC.Visible = True - RFVPais.Visible = True - RFVCPCC.Visible = True - - Else - - RFVSerie.Enabled = False - RFVIVA.Enabled = False - RFVCalle.Enabled = False - RFVNoExtCC.Enabled = False - RFVColoniaCC.Enabled = False - RFVLocalidadCC.Enabled = False - RFVMunicipio.Enabled = False - RFVEstadoCC.Enabled = False - RFVPais.Enabled = False - RFVCPCC.Enabled = False - - RFVSerie.Visible = False - RFVIVA.Visible = False - RFVCalle.Visible = False - RFVNoExtCC.Visible = False - RFVColoniaCC.Visible = False - RFVLocalidadCC.Visible = False - RFVMunicipio.Visible = False - RFVEstadoCC.Visible = False - RFVPais.Visible = False - RFVCPCC.Visible = False - - End If - End Sub - - Private Sub ChkEsSucursal_CheckedChanged(sender As Object, e As EventArgs) Handles ChkEsSucursal.CheckedChanged - CargaRequired() - - End Sub - - Private Sub CargaGVCC() - Dim ObjSubProyectos As New ClsSubProyectos - If ObjSubProyectos.GetSubProyectos() Then - GvCC.DataSource = ObjSubProyectos.DtResultados.FiltraParametros($"CveEmpresa = {CveEmpresa}") - End If - ObjSubProyectos.Dispose() - GvCC.DataBind() - - CargaDdlProyectos() - - UpGVCC.Update() - End Sub - Private Sub CargaDdlProyectos() - DdlProyecto.Items.Clear() - Dim ObjProyectos As New ClsProyectos - If ObjProyectos.GetProyectos() Then - DdlProyecto.DataSource = ObjProyectos.DtResultados.FiltraParametros($"CveEmpresa = {CveEmpresa}") - End If - ObjProyectos.Dispose() - DdlProyecto.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlProyecto.DataBind() - End Sub - Protected Sub LBAgregarCC_Click(sender As Object, e As EventArgs) - - TxtCentroCosto.Text = "" - DdlProyecto.SelectedValueExist("-1") - - TxtSerie.Text = "" - TxtIVA.Text = "" - TxtCalle.Text = "" - TxtNoExtCC.Text = "" - TxtNoIntCC.Text = "" - TxtColoniaCC.Text = "" - TxtLocalidadCC.Text = "" - TxtMunicipio.Text = "" - TxtEstadoCC.Text = "" - TxtPais.Text = "" - TxtCPCC.Text = "" - If DdlProyecto.SelectedValue.ToEntero.Contiene(1, 2) Then - DivProyecto.Style.Add("display", "none") - Else - DivProyecto.Style.Add("display", "") - End If - ChkEsMatriz.Checked = False - ChkEsSucursal.Checked = False - - BtnCC.Text = "Agregar Centro Costo" - ModalidadModal = "Insertar" - CveModal = -1 - UpCC.Update() - RegistraScript(" $('#ModalCC').modal('show');") - End Sub - Protected Sub BtnCC_Click(sender As Object, e As EventArgs) Handles BtnCC.Click - If DdlProyecto.SelectedValue = "-1" And ModalidadModal = "Actualizar" Then - Alert("Tiene que seleccionar un proyecto", TipoMensaje.MsgAdvertencia) - Else - Dim TieneError As Boolean = False - Dim ObjSubproyectos As New ClsSubProyectos - Dim ObjProyecto As New ClsProyectos(ObjSubproyectos.IniciaTransacSQL()) - Dim TipoSucursal As Integer - Dim EsSucursal As Integer - Dim CveProyecto As Integer - If ChkEsMatriz.Checked = True Then TipoSucursal = 1 Else TipoSucursal = 0 - If ChkEsSucursal.Checked = True Then EsSucursal = 1 Else EsSucursal = 0 - - 'INGRESA UN NUEVO CC - If ModalidadModal = "Insertar" Then - If DdlProyecto.SelectedValue = "-1" Then - If Not ObjProyecto.AddProyecto(TxtCentroCosto.Text, 100, CveEmpresa) Then - TieneError = True - End If - End If - If TieneError = False Then - If DdlProyecto.SelectedValue = "-1" Then CveProyecto = ObjProyecto.CveProyecto Else CveProyecto = DdlProyecto.SelectedValue.ToEntero - If ObjSubproyectos.AddCentroCosto(TxtCentroCosto.Text.Trim, 0, 100, CveEmpresa, CveProyecto, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExtCC.Text.Trim, - NoInt:=TxtNoIntCC.Text.Trim, Colonia:=TxtColoniaCC.Text.Trim, Localidad:=TxtLocalidadCC.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstadoCC.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCPCC.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal) Then - Alert("El nuevo Centro Costo se guardó correctamente", TipoMensaje.MsgInformacion) - Else - TieneError = True - End If - End If - End If - - 'ACTUALIZA CC - If ModalidadModal = "Actualizar" Then - If CveModal > 0 Then - Dim CveCentroCosto = CveModal - If ObjSubproyectos.UpdateCentroCosto(CveCentroCosto, TxtCentroCosto.Text.Trim, 0, 1, 100, CveEmpresa, DdlProyecto.SelectedValue.ToEntero, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExtCC.Text.Trim, - NoInt:=TxtNoIntCC.Text.Trim, Colonia:=TxtColoniaCC.Text.Trim, Localidad:=TxtLocalidadCC.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstadoCC.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCPCC.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal) Then - Alert("El Centro Costo se actualizó correctamente", TipoMensaje.MsgInformacion) - Else - TieneError = True - End If - End If - End If - - If TieneError = True Then - ObjProyecto.RollBack() - Else - ObjProyecto.Commit() - End If - ObjProyecto.Dispose() - ObjSubproyectos.Dispose() - - RegistraScript(" $('#ModalCC').modal('hide');") - CargaGVCC() - CargaSubProyectos() - UpRequisiciones.Update() - End If - End Sub - Protected Sub GVCC_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvCC.RowCommand - If e.CommandName = "Editar" Then - Dim GvRow As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).NamingContainer, GridViewRow) - TxtCentroCosto.Text = GvRow.DataKey("SubProyecto") - DdlProyecto.SelectedValueExist(GvRow.DataKey("CveProyecto")) - - TxtSerie.Text = GvRow.DataKey("Serie") - TxtIVA.Text = GvRow.DataKey("IVA") - TxtCalle.Text = GvRow.DataKey("Calle") - TxtNoExtCC.Text = GvRow.DataKey("NoExt") - TxtNoIntCC.Text = GvRow.DataKey("NoInt") - TxtColoniaCC.Text = GvRow.DataKey("Colonia") - TxtLocalidadCC.Text = GvRow.DataKey("Localidad") - TxtMunicipio.Text = GvRow.DataKey("Municipio") - TxtEstadoCC.Text = GvRow.DataKey("Estado") - TxtPais.Text = GvRow.DataKey("Pais") - TxtCPCC.Text = GvRow.DataKey("CP") - ChkEsMatriz.Checked = If(GvRow.DataKey("Estatus") = "Activo", True, False) - ChkEsMatriz.Checked = If(GvRow.DataKey("TipoSucursal").ToString.ToEntero = 1, True, False) - ChkEsSucursal.Checked = If(GvRow.DataKey("EsSucursal").ToString.ToEntero = 1, True, False) - - BtnCC.Text = "Actualizar Centro Costo" - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CveSubProyecto").ToEntero - CargaRequired() - UpCC.Update() - RegistraScript(" $('#ModalCC').modal('show');") - End If - End Sub - Protected Sub GVCC_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvCC.RowDeleting - Dim ObjSubproyectos As New ClsSubProyectos - If ObjSubproyectos.RemoveSubProyecto(GvCC.Rows(e.RowIndex).DataKey("CveSubProyecto").ToEntero) Then - Alert("El Centro Costo se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjSubproyectos.Dispose() - - CargaGVCC() - End Sub - - Private Sub DdlTipoCentroCostos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoCentroCostos.SelectedIndexChanged - If DdlTipoCentroCostos.SelectedValue <> "-1" Then - Dim ObjEmpresas As New ClsSisEmpresas - ObjEmpresas.UpdateTipoCentroCosto(DdlTipoCentroCostos.SelectedValue.ToEntero, CveEmpresa) - ObjEmpresas.Dispose() - End If - - End Sub -#End Region - -#Region " 3.6: FOLIOS" - Private Sub CargaSubProyectos() - DdlSubProyecto.Items.Clear() - DdlSubProyectoClientes.Items.Clear() - DdlEstatusSubProyecto.Items.Clear() - DdlSubProyectoInventario.Items.Clear() - Dim ObjSubProyectos As New ClsSubProyectos - If ObjSubProyectos.GetSubProyectos() Then - DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlSubProyecto.DataSource = ObjSubProyectos.DtResultados.FiltraParametros("CveEmpresa = " & CveEmpresa) - DdlSubProyecto.DataBind() - DdlSubProyectoClientes.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlSubProyectoClientes.DataSource = ObjSubProyectos.DtResultados.FiltraParametros("CveEmpresa = " & CveEmpresa) - DdlSubProyectoClientes.DataBind() - DdlEstatusSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlEstatusSubProyecto.DataSource = ObjSubProyectos.DtResultados.FiltraParametros("CveEmpresa = " & CveEmpresa) - DdlEstatusSubProyecto.DataBind() - DdlSubProyectoInventario.DataSource = ObjSubProyectos.DtResultados.FiltraParametros("CveEmpresa = " & CveEmpresa) - DdlSubProyectoInventario.DataBind() - End If - ObjSubProyectos.Dispose() - UpRequisiciones.Update() - End Sub - - Private Sub CargaGvFolio() - Dim ObjFolio As New ClsGralFolios - If ObjFolio.GetFolios(CveEmpresa:=CveEmpresa) Then - GvFolios.DataSource = ObjFolio.DtResultados - GvFolios.DataBind() - End If - UpFolio.Update() - ObjFolio.Dispose() - End Sub - - Protected Sub LnkAgregarFolio_Click(sender As Object, e As EventArgs) Handles LnkAgregarFolio.Click - - DdlSubProyecto.SelectedValueExist("-1") - DdlTipoDocto.SelectedValueExist("-1") - TxtFolioInicial.Text = "" - TxtFolioFinal.Text = "" - TxtFolioActual.Text = "" - BtnGuardarFolio.Text = "Agregar Folio" - ModalidadModal = "Insertar" - ChkEstatus.Checked = True - CveModal = -1 - UpAddFolio.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAgregarFolio")) - End Sub - - - Protected Sub GVFolios_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvFolios.RowCommand - If e.CommandName = "Editar" Then - Dim GvRow As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).NamingContainer, GridViewRow) - TxtFolioActual.Text = GvRow.DataKey("FActual") - TxtFolioFinal.Text = GvRow.DataKey("FFinal") - TxtFolioInicial.Text = GvRow.DataKey("FInicial") - DdlSubProyecto.SelectedValueExist(GvRow.DataKey("CveSubProyecto")) - DdlTipoDocto.SelectedValueExist(GvRow.DataKey("TipoDocto")) - ChkEstatus.Checked = If(GvRow.DataKey("Estado").ToString = "Activo", True, False) - DivFactual.Visible = True - BtnGuardarFolio.Text = "Actualizar Folio" - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CveFolio").ToEntero - UpAddFolio.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAgregarFolio")) - End If - End Sub - - Protected Sub GvFolios_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvFolios.RowDeleting - Dim ObjFolio As New ClsGralFolios - If ObjFolio.RemoveFolios(GvFolios.Rows(e.RowIndex).DataKey("CveFolio").ToEntero) Then - Alert("El Folio se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjFolio.Dispose() - - CargaGvFolio() - End Sub - - Protected Sub BtnGuardarFolio_Click(sender As Object, e As EventArgs) Handles BtnGuardarFolio.Click - If DdlSubProyecto.SelectedValue = "-1" Then - Alert("Tiene que seleccionar un centro de costos.", TipoMensaje.MsgAdvertencia) - ElseIf DdlTipoDocto.SelectedValue = "-1" Then - Alert("Tiene que seleccionar un tipo docto.", TipoMensaje.MsgAdvertencia) - Else - Dim ObjFolio As New ClsGralFolios - If ModalidadModal = "Insertar" Then - If ObjFolio.AddFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, "", TxtFolioInicial.Text.ToEntero, TxtFolioInicial.Text.ToEntero, TxtFolioFinal.Text.ToEntero, "", 100, CveEmpresa) Then - Alert("El Folio se agrego correctamente.", TipoMensaje.MsgInformacion) - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolio")) - End If - End If - If ModalidadModal = "Actualizar" Then - If CveModal > 0 Then - Dim CveFolio = CveModal - If ObjFolio.UpdateFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, "", TxtFolioInicial.Text.ToEntero, TxtFolioActual.Text.ToEntero, TxtFolioFinal.Text.ToEntero, "", If(ChkEstatus.Checked, True, False), 100, CveFolio) Then - Alert("El Folio se actualizo correctamente.", TipoMensaje.MsgInformacion) - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolio")) - End If - End If - End If - ObjFolio.Dispose() - CargaGvFolio() - End If - End Sub - - - -#End Region - -#Region " 3.7: ALMACEN" - - Private Sub CargaSubProyectosInventario() - Dim ObjSubProyectos As New ClsSubProyectos - If ObjSubProyectos.GetSubProyectos() Then - DdlSubProyectoInventario.DataSource = ObjSubProyectos.DtResultados.FiltraParametros("CveEmpresa = " & CveEmpresa) - DdlSubProyectoInventario.DataBind() - - End If - ObjSubProyectos.Dispose() - End Sub - - Private Sub CargaGvInventario() - Dim ObjInventario As New ClsInventarios - If ObjInventario.GetAlmacenes(-1, -1, CveEmpresa, -1) Then - GvInventario.DataSource = ObjInventario.DtResultados - GvInventario.DataBind() - End If - UpInventario.Update() - ObjInventario.Dispose() - End Sub - - Protected Sub LnkAgregarInventario_Click(sender As Object, e As EventArgs) Handles LnkAgregarInventario.Click - - DdlSubProyectoInventario.SelectedValueExist("-1") - TxtAlmacen.Text = "" - DdlTipoAlmacen.SelectedValueExist("-1") - DdlModalidad.SelectedValueExist("0") - DdlInventariable.SelectedValueExist("1") - BtnAgregarAlmacen.Text = "Agregar Almacen" - ModalidadModal = "Insertar" - ChkEstatusInventario.Checked = True - CveModal = -1 - UpAddAlmacen.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "divAddAlmacen")) - End Sub - - - Protected Sub GvInventario_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvInventario.RowCommand - If e.CommandName = "Editar" Then - Dim GvRow As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).NamingContainer, GridViewRow) - TxtAlmacen.Text = GvRow.DataKey("Almacen") - DdlSubProyectoInventario.SelectedValueExist(GvRow.DataKey("CveSubProyecto")) - DdlTipoAlmacen.SelectedValueExist(GvRow.DataKey("CveTipoAlmacen")) - DdlModalidad.SelectedValueExist(GvRow.DataKey("CveModalidad")) - DdlInventariable.SelectedValueExist(GvRow.DataKey("Inventariable")) - ChkEstatusInventario.Checked = If(GvRow.DataKey("Estatus").ToString = "Activo", True, False) - BtnAgregarAlmacen.Text = "Actualizar Almacen" - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CveAlmacen").ToEntero - UpAddAlmacen.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "divAddAlmacen")) - End If - End Sub - - Protected Sub GvInventario_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvInventario.RowDeleting - Dim ObjInventario As New ClsInventarios - If ObjInventario.RemoveAlmacen(GvInventario.Rows(e.RowIndex).DataKey("CveAlmacen").ToEntero) Then - Alert("El Almacen se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjInventario.Dispose() - - CargaGvInventario() - End Sub - - Protected Sub BtnAgregarAlmacen_Click(sender As Object, e As EventArgs) Handles BtnAgregarAlmacen.Click - If DdlSubProyectoInventario.SelectedValue = "-1" Then - Alert("Tiene que seleccionar un centro de costos.", TipoMensaje.MsgAdvertencia) - Else - Dim ObjInventario As New ClsInventarios - If ModalidadModal = "Insertar" Then - If ObjInventario.AddAlmacen(TxtAlmacen.Text, DdlTipoAlmacen.SelectedValue.ToEntero, Nothing, DdlModalidad.SelectedValue.ToEntero, 100, CveEmpresa, CByte(DdlInventariable.SelectedValue), DdlSubProyectoInventario.SelectedValue.ToEntero) Then - Alert("El Almacen se agrego correctamente.", TipoMensaje.MsgInformacion) - RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddAlmacen")) - End If - End If - If ModalidadModal = "Actualizar" Then - If CveModal > 0 Then - Dim CveAlmacen = CveModal - If ObjInventario.UpdateAlmacen(TxtAlmacen.Text, DdlTipoAlmacen.SelectedValue.ToEntero, Nothing, DdlModalidad.SelectedValue.ToEntero, If(ChkEstatusInventario.Checked, True, False), CveAlmacen, CByte(DdlInventariable.SelectedValue), DdlSubProyectoInventario.SelectedValue.ToEntero) Then - Alert("El Almacen se actualizo correctamente.", TipoMensaje.MsgInformacion) - RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddAlmacen")) - End If - End If - End If - ObjInventario.Dispose() - CargaGvInventario() - End If - End Sub - - Private Sub GvInventario_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvInventario.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.FCLiteral("LtlInventariable").Text = "True" Then - e.Row.FCLiteral("LtlInventariable").Text = "Si" - Else - e.Row.FCLiteral("LtlInventariable").Text = "No" - End If - End If - End Sub - - - -#End Region - -#Region " 3.8: REQUISICIONES" - - - Private Sub DdlEstatusSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEstatusSubProyecto.SelectedIndexChanged - If DdlEstatusSubProyecto.SelectedValue = "-1" Then - GvEstatusUsuariosREQ.Enabled = False - GvEstatusUsuariosREQ.Visible = False - btnGuardarEstatusUsuariosREQ.Visible = False - Else - GvEstatusUsuariosREQ.Enabled = True - GvEstatusUsuariosREQ.Visible = True - btnGuardarEstatusUsuariosREQ.Visible = True - End If - - CargaGridEstatusUsuarios() - - End Sub - - Private Sub CreaGrid() - Dim i As Integer = 1 - Dim ObjOC As New ClsOC - If ObjOC.GetEstatus() Then - For Each Row As DataRow In ObjOC.DtResultados.FiltraParametros(String.Format(" CveEmpresa = '{0}' And Tipo = '{1}' ", CveEmpresa, "Req"), "Orden").Rows - GvEstatusUsuariosREQ.Columns(i).HeaderText = Row("Estatus").ToString.ToUpper - GvEstatusUsuariosREQ.Columns(i).FooterText = Row("CveEstatus").ToString - i += 1 - Next - End If - ObjOC.Dispose() - End Sub - - Protected Sub btnGuardarEstatusUsuariosREQ_Click(sender As Object, e As EventArgs) Handles btnGuardarEstatusUsuariosREQ.Click - If DdlEstatusSubProyecto.SelectedValue = "-1" Then - Alert("Tiene que seleccionar un centro de costo", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - Dim objEstatusOC As New ClsOC - objEstatusOC.IniciaTransacSQL() - Dim HuboErrores As Boolean = False - - For Each Row As GridViewRow In GvEstatusUsuariosREQ.Rows - - Dim r As Integer = 1 - For i = 0 To Row.Cells.Count - 1 - - Dim CveEstatus As Integer = If(IsNumeric(GvEstatusUsuariosREQ.Columns(i).FooterText), GvEstatusUsuariosREQ.Columns(i).FooterText.ToEntero, 0) - If CveEstatus > 0 Then - - If Row.FCCheckBox("chkEstatus" + r.ToString).Checked = False And Row.FCHiddenField("hdnCveEstatusUsuarios" + r.ToString).Value.ToEntero > 0 Then - 'Eliminar el registro existente - If Not objEstatusOC.RemoveEstatusUsuarios(Row.FCHiddenField("hdnCveEstatusUsuarios" + r.ToString).Value.ToEntero, -1) Then - HuboErrores = True - Exit For - End If - ElseIf Row.FCCheckBox("chkEstatus" + r.ToString).Checked = True And Row.FCHiddenField("hdnCveEstatusUsuarios" + r.ToString).Value.ToEntero = -1 Then - If Not objEstatusOC.AddEstatusUsuarios(CveEstatus, DdlEstatusSubProyecto.SelectedValue.ToEntero, Row.DataKey("CveUsuario").ToString.ToEntero, True) Then - HuboErrores = True - Exit For - End If - If HuboErrores Then - Exit For - End If - End If - r += 1 - End If - Next - - 'Si tubo algun error terminamos el proceso (FOR) - If HuboErrores Then - Exit For - End If - Next - - If Not HuboErrores Then - objEstatusOC.Commit() - Alert("Se guardaron los Cambios exitosamente", TipoMensaje.MsgInformacion) - Else - objEstatusOC.RollBack() - Alert("Ocurrió un error al guardar los cambios. Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - - objEstatusOC.Dispose() - CargaGridEstatusUsuarios() - End Sub - - Protected Sub CargaGridEstatusUsuarios() - - 'If Tipo = "OC" Then TmpDTOC.Rows.Clear() Else TmpDTReq.Rows.Clear() - If DdlEstatusSubProyecto.SelectedValue = "-1" Then - GvEstatusUsuariosREQ.DataSource = Nothing - GvEstatusUsuariosREQ.DataBind() - - Exit Sub - End If - - Dim objEstatusOC As New ClsOC - - If objEstatusOC.GetEstatusUsuariosPyME(-1, -1, DdlEstatusSubProyecto.SelectedValue.ToEntero, -1, CveEmpresa) Then - DTEstatusUsuarios = objEstatusOC.DtResultados - GvEstatusUsuariosREQ.DataSource = DTEstatusUsuarios.FiltraParametros("", "Nombre", {"CveUsuario", "Nombre"}) - GvEstatusUsuariosREQ.DataBind() - End If - objEstatusOC.Dispose() - UpRequisiciones.Update() - End Sub - - Private Sub CreaGrid(Tipo As String) - Dim i As Integer = 1 - Dim ObjOC As ClsOC = New ClsOC - - If ObjOC.GetEstatus() Then - For Each Row As DataRow In ObjOC.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0} AND Tipo = '{1}' ", CveEmpresa, Tipo), "Orden").Rows - GvEstatusUsuariosREQ.Columns(i).HeaderText = Row("Estatus").ToString.ToUpper - GvEstatusUsuariosREQ.Columns(i).FooterText = Row("CveEstatus").ToString - i += 1 - Next - End If - - ObjOC.Dispose() - - While i <= 10 - GvEstatusUsuariosREQ.Columns(i).Visible = False - i += 1 - End While - End Sub - - Protected Sub GvEstatusUsuariosREQ_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEstatusUsuariosREQ.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - Dim tmpT As DataTable = DTEstatusUsuarios.FiltraParametros(String.Format("CveUsuario = {0}", e.Row.DBCampo("CveUsuario").ToString)) - - For i As Integer = 1 To 3 - Dim CveEstatus As Integer = GvEstatusUsuariosREQ.Columns(i).FooterText.ToEntero - - If CveEstatus > 0 Then - Dim chkEstatus As CheckBox = e.Row.FCCheckBox(String.Format("chkEstatus{0}", i)) - 'Dim ibOpciones As ImageButton = e.Row.FCImageButton(String.Format("ibOpciones{0}", i)) - Dim hdnCveEstatusUsuarios As HiddenField = e.Row.FCHiddenField(String.Format("hdnCveEstatusUsuarios{0}", i)) - 'Dim lblSuperior As Label = e.Row.FCLabel(String.Format("lblSuperior{0}", i)) - 'Dim lblLimites As Label = e.Row.FCLabel(String.Format("lblLimites{0}", i)) - - - - 'ibOpciones.CommandArgument = GlobalDTOCEstatus(CveEmpresa).FiltraParametros(String.Format("CveEstatus = {0}", CveEstatus)).Rows(0)("CveEstatusSiguiente").ToString - - Dim RowEU As DataRowCollection = tmpT.FiltraParametros(String.Format("CveEstatus = {0}", CveEstatus)).Rows - Dim CveEstatusUsuarios As Integer = If(RowEU.Count > 0 AndAlso Not IsDBNull(RowEU(0)("CveEstatusUsuarios")), RowEU(0)("CveEstatusUsuarios").ToString.ToEntero, -1) - 'Dim LimiteInferior As Decimal = If(RowEU.Count > 0 AndAlso Not IsDBNull(RowEU(0)("LimiteInferior")), RowEU(0)("LimiteInferior").ToString.ToDecimal, -1) - 'Dim LimiteSuperior As Decimal = If(RowEU.Count > 0 AndAlso Not IsDBNull(RowEU(0)("LimiteSuperior")), RowEU(0)("LimiteSuperior").ToString.ToDecimal, -1) - Dim CveSuperior As Integer = If(RowEU.Count > 0 AndAlso Not IsDBNull(RowEU(0)("CveSuperior")), RowEU(0)("CveSuperior").ToString.ToEntero, -1) - Dim CveUsuario As Integer = If(RowEU.Count > 0 AndAlso Not IsDBNull(RowEU(0)("CveUsuario")), RowEU(0)("CveUsuario").ToString.ToEntero, -1) - Dim TipoTermino As Integer = If(RowEU.Count > 0 AndAlso Not IsDBNull(RowEU(0)("TipoTermino")), RowEU(0)("TipoTermino").ToString.ToEntero, -1) ' 0. supervisada, 1. autorizada, 2. rechazada - - If RowEU.Count > 0 Then - chkEstatus.Checked = True - 'chkEstatus.Attributes.Add("onclick", String.Format("javascript:chk1Change(this, '{0}');", ibOpciones.ClientID)) - hdnCveEstatusUsuarios.Value = RowEU(0)("CveEstatusUsuarios").ToString - - 'ibOpciones.Style.Add("display", "inline") - - Dim script As New StringBuilder - script.AppendFormat("javascript:hdnCveEstatusUsuarios.value='{0}'; ", CveEstatusUsuarios) - script.AppendFormat("IDhdnCveEstatusUsuarios.value='{0}'; ", hdnCveEstatusUsuarios.ClientID) - script.Append("hdnCveEstatus.value = '-1';") - script.Append("hdnCveUsuario.value = '-1';") - script.AppendFormat("hdnCveSuperior.value = '{0}'; ", CveSuperior) - 'script.AppendFormat("chkMostrarLimites.checked = {0};chkMostrarLimitesCambio();", If(LimiteInferior > 0 Or LimiteSuperior > 0 Or TipoTermino.Contiene(0, 1, 2), "true", "false")) - 'script.AppendFormat("$get('DivLimites').style.display = '{0}';", If(LimiteInferior > 0 Or LimiteSuperior > 0, "inline", "none")) - 'script.AppendFormat("txtLimiteInferior.value = '{0}'; ", If(LimiteInferior > 0, LimiteInferior.FormatoNumero, "")) - 'script.AppendFormat("txtLimiteSuperior.value = '{0}'; ", If(LimiteSuperior > 0, LimiteSuperior.FormatoNumero, "")) - 'ibOpciones.Attributes.Add("onclick", script.ToString) - - 'lblSuperior.Text = RowEU(0)("Superior").ToString - - 'If LimiteSuperior = -1 And LimiteInferior = -1 Then - ' 'Sin Limite - 'ElseIf LimiteSuperior > 0 And LimiteInferior = -1 Then - ' 'Solo Limite Superior - ' lblLimites.Text = String.Format("Hasta {0}", LimiteSuperior.ToString("N")) - 'ElseIf LimiteInferior > 0 And LimiteSuperior = -1 Then - ' 'Solo limite Inferior - ' lblLimites.Text = String.Format("Desde {0}", LimiteInferior.ToString("N")) - 'Else - ' 'Con Limites - ' lblLimites.Text = String.Format("{0} - {1}", LimiteInferior.ToString("N"), LimiteSuperior.ToString("N")) - 'End If - - e.Row.Cells(i).BackColor = Drawing.Color.Yellow - - If DTEstatusUsuarios.FiltraParametros(String.Format("CveEstatusSiguiente = {0} AND CveSuperior = {1}", CveEstatus, CveUsuario)).Rows.Count > 0 Then - chkEstatus.Attributes.Add("onclick", "javascript:var retorno = true; if (this.checked == false) retorno = confirm('Estas seguro????'); return retorno;") - End If - Else - chkEstatus.Checked = False - hdnCveEstatusUsuarios.Value = "-1" - 'ibOpciones.Style.Add("display", "none") - Dim script As New StringBuilder - script.AppendFormat("javascript:hdnCveEstatusUsuarios.value='{0}'; ", CveEstatusUsuarios) - script.AppendFormat("IDhdnCveEstatusUsuarios.value='{0}'; ", hdnCveEstatusUsuarios.ClientID) - script.AppendFormat("hdnCveEstatus.value = '{0}';", CveEstatus) - script.AppendFormat("hdnCveUsuario.value = '{0}';", e.Row.DBCampo("CveUsuario").ToString) - script.AppendFormat("hdnCveSuperior.value = '-1'; ") - 'script.AppendFormat("chkMostrarLimites.checked = {0};chkMostrarLimitesCambio();", If(LimiteInferior > 0 Or LimiteSuperior > 0, "true", "false")) - 'script.AppendFormat("txtLimiteInferior.value = '0.00'; ") - 'script.AppendFormat("txtLimiteSuperior.value = '0.00'; ") - 'ibOpciones.Attributes.Add("onclick", script.ToString) - End If - End If - Next - End If - End Sub - - - -#End Region - -#End Region - -#Region " PASO 4: CATALOGOS " - -#Region " 4.1: CLASIFICACIONES " - Private Sub CargaDdlClasificaciones() - DdlClasificacion.Items.Clear() - Dim ObjClasi As New ClsClasificaciones - If ObjClasi.GetClasificaciones(CveEmpresa) Then - DdlClasificacion.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlClasificacion.DataSource = ObjClasi.DtResultados - DdlClasificacion.DataBind() - End If - UpEditPS.Update() - UpAddPS.Update() - End Sub - Protected Sub BtnClasificacion_Click(sender As Object, e As EventArgs) Handles btnClasificacion.Click - If TxtAddClasificacion.getfiles().Archivos.Count > 0 Then - Dim file As Archivo = TxtAddClasificacion.getfiles().Archivos(0) - Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch - Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") - CargarExcelClasificaciones(Directorio, file.filename, Tipo) - Else - Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError) - End If - - 'If TxtAddClasificacion.getfiles().Archivos.Count > 0 Then - 'Dim file As Archivo = TxtAddClasificacion.getfiles().Archivos(0) - 'Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch & file.filename - 'CargarExcelClasificaciones(Directorio) - ' Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") - ' ' CargarArchivoClasificaciones(ModExtensiones.DirectorioBaseEmpresas & file.patch, file.filename, Tipo) - 'Else - ' Alert("No existe el archivo.Favor de subir un archivo de excel a la plataforma", TipoMensaje.MsgError) - 'End If - End Sub - Private Sub CargarExcelClasificaciones(Ruta As String, FileName As String, Tipo As String) - Dim dtClasificacion As New DataTable - Dim ErrorExcel = False - - 'Verificamos que el archivo tenga el formato correcto - If Tipo <> "EXCEL" Then - Alert("El archivo no tiene el formato correcto.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim strConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Ruta + FileName + ";Extended Properties=Excel 8.0;" - Dim objDbFactory As Common.DbProviderFactory = Common.DbProviderFactories.GetFactory("System.Data.OleDb") - - Using objDbConnection = objDbFactory.CreateConnection(), objDbAdapter = objDbFactory.CreateDataAdapter(), Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") - - objDbConnection.ConnectionString = strConnString - objDbConnection.Open() - Dim objSheetNames As DataTable = objDbConnection.GetSchema("Tables") - Dim HojaExcel As String = objSheetNames.FiltroPrimeroValor("TABLE_NAME") - Try - Conexion.Open() - Dim cmd = Conexion.CreateCommand() - cmd.CommandType = CommandType.Text - cmd.CommandText = $"SELECT * FROM [{HojaExcel}]" - Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) - DataAdapter.Fill(dtClasificacion) - Conexion.Close() - - Catch ex As Exception - ErrorExcel = True - OnError("Ocurrio un error al leer el archivo Excel
    " & ex.Message, ex) - End Try - Conexion.Close() - - End Using - - - If Not ErrorExcel Then - Dim NumRows As Integer = 0 - If Not dtClasificacion.Columns(0).ColumnName = "Clasificacion" Then - Alert("El nombre de la primera columna debe ser 'Clasificacion'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim ObjClasificaciones As New ClsClasificaciones - - For Each Row As DataRow In dtClasificacion.Rows - Dim Clasificacion As String = Row("Clasificacion").ToString - If ObjClasificaciones.AddClasificaciones(Clasificacion, "", 0, "", 0, "", 0, "", 0, 100, CveEmpresa, UsoClasificacion:=0) Then - NumRows = NumRows + 1 - End If - Next - Alert(String.Format("Se agregaron: {0} Clasificaciones correctamente.", NumRows), TipoMensaje.MsgInformacion) - If ObjClasificaciones.GetClasificaciones(CveEmpresa) Then - GvClasificaciones.DataSource = ObjClasificaciones.DtResultados - GvClasificaciones.DataBind() - End If - ObjClasificaciones.Dispose() - UpClasificaciones.Update() - RegistraScript("$('#DivAddClasificaciones').modal('hide');") - End If - End Sub - - Protected Sub GVClasificaciones_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvClasificaciones.RowDeleting - If CveEmpresa = 0 Then - DtClasificaciones.Rows.RemoveAt(e.RowIndex) - DtClasificaciones.AcceptChanges() - GvClasificaciones.DataSource = DtClasificaciones - GvClasificaciones.DataBind() - 'UPGVClasi.Update() - ElseIf CveEmpresa > 0 Then - Dim ObjClasificaciones As New ClsClasificaciones - If ObjClasificaciones.RemoveClasificacion(GvClasificaciones.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - GvClasificaciones.EditIndex = -1 - GvClasificaciones.DataSource = ObjClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " & CveEmpresa) - GvClasificaciones.DataBind() - 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() - End If - End Sub - - Private Sub LnkAgregarClasificacion_Click(sender As Object, e As EventArgs) Handles LnkAgregarClasificacion.Click - TxtClasificacion.Text = "" - BtnAgregarClasificacion.Text = "Agregar Clasificacion" - ModalidadModal = "Insertar" - CveModal = -1 - UpAddClasificacion.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddClasificacion")) - End Sub - - Private Sub BtnAgregarClasificacion_Click(sender As Object, e As EventArgs) Handles BtnAgregarClasificacion.Click - Dim ObjClasificacion As New ClsClasificaciones - - - If ModalidadModal = "Insertar" Then - If ObjClasificacion.AddClasificaciones(TxtClasificacion.Text, "", 0, "", 0, "", 0, "", 0, 100, CveEmpresa, UsoClasificacion:=0) Then - Alert("La clasificacion se agrego correctamente", TipoMensaje.MsgInformacion) - End If - End If - - - If ModalidadModal = "Actualizar" Then - If CveModal > 0 Then - Dim CveClasificacion = CveModal - If ObjClasificacion.UpdateClasificacion(TxtClasificacion.Text, "", 0, "", 0, "", 0, "", True, False, 0, 100, CveClasificacion) Then - Alert("La clasificacion se actualizo correctamente", TipoMensaje.MsgInformacion) - End If - End If - End If - - ObjClasificacion.Dispose() - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddClasificacion")) - CargaGVClasificacion() - End Sub - - Private Sub CargaGVClasificacion() - Dim ObjClasificacion As New ClsClasificaciones - If ObjClasificacion.GetClasificaciones(CveEmpresa) Then - GvClasificaciones.DataSource = ObjClasificacion.DtResultados - GvClasificaciones.DataBind() - End If - ObjClasificacion.Dispose() - UpClasificaciones.Update() - End Sub - - Public Sub EditClasificacion_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CveClasificacion").ToEntero - TxtClasificacion.Text = GvRow.DataKey("Clasificacion") - BtnAgregarClasificacion.Text = "Actualizar Clasificacion" - UpAddClasificacion.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddClasificacion")) - End Sub - -#End Region - -#Region " 4.2: UNIDADES DE MEDIDA " - Private Sub CargaDdlUM() - DdlUM.Items.Clear() - Dim ObjUM As New ClsUnidadesMedida - If ObjUM.GetUnidadesMedida(CveEmpresa) Then - DdlUM.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlUM.DataSource = ObjUM.DtResultados.FiltraParametros("CveEmpresa = " & CveEmpresa) - DdlUM.DataBind() - End If - UpEditPS.Update() - UpAddPS.DataBind() - End Sub - - Private Sub CargarExcelUnidadesMedida(Ruta As String, FileName As String, Tipo As String) - Dim dtUM As New DataTable - Dim ErrorExcel = False - - 'Verificamos que el archivo tenga el formato correcto - If Tipo <> "EXCEL" Then - Alert("El archivo no tiene el formato correcto.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim strConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Ruta + FileName + ";Extended Properties=Excel 8.0;" - Dim objDbFactory As Common.DbProviderFactory = Common.DbProviderFactories.GetFactory("System.Data.OleDb") - - Using objDbConnection = objDbFactory.CreateConnection(), objDbAdapter = objDbFactory.CreateDataAdapter(), Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") - - objDbConnection.ConnectionString = strConnString - objDbConnection.Open() - Dim objSheetNames As DataTable = objDbConnection.GetSchema("Tables") - Dim HojaExcel As String = objSheetNames.FiltroPrimeroValor("TABLE_NAME") - Try - - Conexion.Open() - Dim cmd = Conexion.CreateCommand() - cmd.CommandType = CommandType.Text - cmd.CommandText = $"SELECT * FROM [{HojaExcel}]" - Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) - DataAdapter.Fill(dtUM) - Conexion.Close() - - Catch ex As Exception - ErrorExcel = True - OnError("Ocurrio un error al leer el archivo Excel
    " & ex.Message, ex) - End Try - Conexion.Close() - - End Using - - If Not ErrorExcel AndAlso dtUM.Rows.Count > 0 Then - Dim NumRows As Integer = 0 - - ' Verificamos que el archivo tenga la estructura de la plantilla - If Not dtUM.Columns(0).ColumnName = "UnidadMedida" Then - Alert("El nombre de la primera columna debe ser 'UnidadMedida'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtUM.Columns(1).ColumnName = "Abreviatura" Then - Alert("El nombre de la segunda columna debe ser 'Abreviatura'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim ObjUnidadesMedida As New ClsUnidadesMedida - - For Each Row As DataRow In dtUM.Rows - Dim UnidadMedida As String = Row("UnidadMedida").ToString - Dim Abreviatura As String = Row("Abreviatura").ToString - If ObjUnidadesMedida.AddUnidadMedida(UnidadMedida, Abreviatura, "", "", "", 100, CveEmpresa, -1) > -1 Then - NumRows = NumRows + 1 - End If - Next - - Alert(String.Format("Se agregaron: {0} Unidades de Medida correctamente.", NumRows), TipoMensaje.MsgInformacion) - - If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then - GvUM.DataSource = ObjUnidadesMedida.DtResultados.FiltraParametros($"CveEmpresa = {CveEmpresa}") - GvUM.DataBind() - End If - ObjUnidadesMedida.Dispose() - End If - UpGVUM.Update() - RegistraScript("$('#DivAddUnidadesMedida').modal('hide');") - End Sub - Protected Sub GvUM_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvUM.RowDeleting - If CveEmpresa = 0 Then - DtUM.Rows.RemoveAt(e.RowIndex) - DtUM.AcceptChanges() - GvUM.DataSource = DtUM - GvUM.DataBind() - UpGVUM.Update() - Else - Dim ObjUnidadesMedida As New ClsUnidadesMedida - If ObjUnidadesMedida.RemoveUnidadMedida(GvUM.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - GvUM.EditIndex = -1 - GvUM.DataSource = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & CveEmpresa) - GvUM.DataBind() - Alert("La Unidad de Medida se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjUnidadesMedida.Dispose() - End If - End Sub - - Public Sub EditUM_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CveUnidadMedida").ToEntero - TxtUM.Text = GvRow.DataKey("UnidadMedida") - TxtAbreviatura.Text = GvRow.DataKey("Abreviatura") - BtnAddUM.Text = "Actualizar Unidad de Medida" - UpAddUM.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddUM")) - End Sub - - Private Sub CargaGVUM() - Dim ObjUM As New ClsUnidadesMedida - If ObjUM.GetUnidadesMedida(CveEmpresa) Then - GvUM.DataSource = ObjUM.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) - GvUM.DataBind() - End If - ObjUM.Dispose() - UpGVUM.Update() - End Sub - - Private Sub LnkAddUM_Click(sender As Object, e As EventArgs) Handles LnkAddUM.Click - TxtUM.Text = "" - TxtAbreviatura.Text = "" - BtnAddUM.Text = "Agregar Unidad de Medida" - ModalidadModal = "Insertar" - CveModal = -1 - UpAddUM.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddUM")) - End Sub - - Private Sub BtnAddUM_Click(sender As Object, e As EventArgs) Handles BtnAddUM.Click - Dim ObjUM As New ClsUnidadesMedida - - - If ModalidadModal = "Insertar" Then - If ObjUM.AddUnidadMedida(TxtUM.Text, TxtAbreviatura.Text, "", "", "", 100, CveEmpresa, -1) <> -1 Then - Alert("La clasificacion se agrego correctamente", TipoMensaje.MsgInformacion) - End If - End If - - - If ModalidadModal = "Actualizar" Then - If CveModal > 0 Then - Dim CveUM = CveModal - If ObjUM.UpdateUnidadMedida(TxtUM.Text, TxtAbreviatura.Text, "", "", "", True, 100, CveUM, -1) Then - Alert("La clasificacion se actualizo correctamente", TipoMensaje.MsgInformacion) - End If - End If - End If - - ObjUM.Dispose() - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddUM")) - CargaGVUM() - End Sub - - Protected Sub BtnDivAddUnidadesMedida_Click(sender As Object, e As EventArgs) Handles BtnDivAddUnidadesMedida.Click - If TxtAddUnidadesMedida.getfiles().Archivos.Count > 0 Then - Dim file As Archivo = TxtAddUnidadesMedida.getfiles().Archivos(0) - Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch - Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") - CargarExcelUnidadesMedida(Directorio, file.filename, Tipo) - Else - Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError) - End If - End Sub - -#End Region - -#Region " 4.3: PRODUCTOS / SERVICIOS " - - Private Sub GVPS_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVPS.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.Cells(3).Text = "$" + FormatNumber(e.Row.DBCampo("Precio").ToString, 2, , , TriState.True) - End If - End Sub - - Private Sub CargarExcelPS(rutaExcel As String, Tipo As String) - Dim DtExcel As New DataTable - Dim ErrorExcel = False - - If Tipo <> "EXCEL" Then - Alert("El archivo no tiene el formato correcto.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim strConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + rutaExcel + ";Extended Properties=Excel 8.0;" - Dim objDbFactory As Common.DbProviderFactory = Common.DbProviderFactories.GetFactory("System.Data.OleDb") - - Using objDbConnection = objDbFactory.CreateConnection, - objDbAdapter = objDbFactory.CreateDataAdapter(), - Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + rutaExcel + ";") - - objDbConnection.ConnectionString = strConnString - objDbConnection.Open() - Dim objSheetNames As DataTable = objDbConnection.GetSchema("Tables") - Dim HojaExcel As String = objSheetNames.FiltroPrimeroValor("TABLE_NAME") - Try - - Conexion.Open() - Dim cmd = Conexion.CreateCommand() - cmd.CommandType = CommandType.Text - cmd.CommandText = $"SELECT * FROM [{HojaExcel}]" - Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) - DataAdapter.Fill(DtExcel) - Conexion.Close() - Catch ex As Exception - ErrorExcel = True - OnError("Ocurrio un error al leer el Excel
    " & ex.Message, ex) - End Try - - End Using - - If Not ErrorExcel Then - 'Verificamos que la estructura del archivo coincida con la plantilla - - If Not DtExcel.Columns(0).ColumnName = "Codigo" Then - Alert("El nombre de la primera columna debe ser 'Codigo'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not DtExcel.Columns(1).ColumnName = "Descripcion" Then - Alert("El nombre de la segunda columna debe ser 'Descripcion'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not DtExcel.Columns(2).ColumnName = "Tipo" Then - Alert("El nombre de la primera columna debe ser 'Tipo'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not DtExcel.Columns(3).ColumnName = "Código Barras" Then - Alert("El nombre de la segunda columna debe ser 'Código Barras'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not DtExcel.Columns(4).ColumnName = "Unidad Medida" Then - Alert("El nombre de la primera columna debe ser 'Unidad Medida'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not DtExcel.Columns(5).ColumnName = "Clasificacion" Then - Alert("El nombre de la segunda columna debe ser 'Clasificacion'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not DtExcel.Columns(6).ColumnName = "Marca" Then - Alert("El nombre de la segunda columna debe ser 'Marca'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not DtExcel.Columns(7).ColumnName = "AplicaSerie" Then - Alert("El nombre de la primera columna debe ser 'AplicaSerie'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not DtExcel.Columns(8).ColumnName = "Precio" Then - Alert("El nombre de la segunda columna debe ser 'Precio'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not DtExcel.Columns(9).ColumnName = "IEPS" Then - Alert("El nombre de la segunda columna debe ser 'IEPS'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - - - - Dim NumRows As Integer = DtExcel.Rows.Count - - Dim ErrorPS As Boolean = False - Dim ExistePS As Boolean = False - Dim Contador As Integer = 0 - - 'Obtengo Productos - Dim ObjPS As New ClsProductosServicios - Dim DTPS As New DataTable - ObjPS.IniciaTransacSQL() - If ObjPS.GetPS(-1, -1, CveEmpresa) Then - DTPS = ObjPS.DtResultados - End If - 'Obtengo Clasificaciones - Dim ObjClasificaciones As New ClsClasificaciones - Dim DTClasificaciones As New DataTable - If ObjClasificaciones.GetClasificaciones(CveEmpresa) Then - DTClasificaciones = ObjClasificaciones.DtResultados - End If - ObjClasificaciones.Dispose() - - 'Obtengo Unidades de medida - Dim ObjUM As New ClsUnidadesMedida - Dim DTUM As New DataTable - If ObjUM.GetUnidadesMedida(CveEmpresa) Then - DTUM = ObjUM.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) - End If - ObjUM.Dispose() - - For Each Row As DataRow In DtExcel.Rows - Dim Codigo As String = Row("Codigo").ToString - Dim Descripcion As String = Row("Descripcion").ToString - Dim TipoPS As String = Row("Tipo").ToString.Trim - Dim CodigoBarras As String = Row("Código Barras").ToString - Dim UnidadMedida As String = Row("Unidad Medida").ToString - Dim Clasificacion As String = Row("Clasificacion").ToString - Dim Marca As Decimal = Row("Marca").ToString.ToDecimal - Dim AplicaSerie As String = Row("AplicaSerie").ToString - Dim Precio As String = Row("Precio").ToString - Dim IEPS As String = Row("IEPS").ToString - - Dim CvePS As Integer - If DTPS.FiltraParametros($"Codigo = '{Codigo}'").Rows.Count > 0 Then - CvePS = DTPS.FiltraParametros($"Codigo = '{Codigo}'").Rows(0)("CvePS").ToString.ToEntero - Else - CvePS = 0 - End If - - Dim CveUnidadMedida As Integer - If DTUM.FiltraParametros($"UnidadMedida = '{UnidadMedida}'").Rows.Count > 0 Then - CveUnidadMedida = DTUM.FiltraParametros($"UnidadMedida = '{UnidadMedida}'").Rows(0)("CveUnidadMedida").ToString.ToEntero - Else - CveUnidadMedida = 0 - End If - - Dim CveClasificacion As Integer - If DTClasificaciones.FiltraParametros($"Clasificacion = '{Clasificacion}'").Rows.Count > 0 Then - CveClasificacion = DTClasificaciones.FiltraParametros($"Clasificacion = '{Clasificacion}'").Rows(0)("CveClasificacion").ToString.ToEntero - Else - CveClasificacion = 0 - End If - - If Not CveClasificacion > 0 Then Alert("No se encontró la Clasificación: " + Clasificacion, TipoMensaje.MsgAdvertencia) : ErrorPS = True : Exit For - If Not CveUnidadMedida > 0 Then Alert("No se encontró la Unidad de Medida: " + UnidadMedida, TipoMensaje.MsgAdvertencia) : ErrorPS = True : Exit For - - If CveClasificacion < 0 Then CveClasificacion = 1 - - If CvePS > 0 Then - ExistePS = True - Contador = Contador + 1 - If Not ObjPS.UpdatePS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", CodigoBarras, Descripcion, Precio.ToDouble, 1, 1, False, 0, True, True, True, 100, CvePS, -1, -1, -1) Then - ErrorPS = True - Codigo.GuardaLog - Exit For - End If - Else - If Not ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", "", Descripcion, Precio.ToDouble, 0, 0, False, 0, False, True, 100, CveEmpresa, 1, 1) <> -1 Then - ErrorPS = True - Codigo.GuardaLog - Exit For - End If - End If - Next - - If Not ErrorPS Then - ObjPS.Commit() - If Contador > 0 Then - Alert(String.Format("Se agregaron: {0} Productos/Servicios correctamente.
    Se Actualizaron: {1} Productos/Servicios ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) - Else - Alert(String.Format("Se agregaron: {0} Productos/Servicios correctamente.", NumRows), TipoMensaje.MsgInformacion) - End If - TxtAddPS.Text = "" - Else - ObjPS.RollBack() - End If - End If - - RegistraScript("$('#DivAddPS').modal('hide');") - - CargaGVPS() - UPGvPS.Update() - End Sub - Protected Sub GvPS_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GVPS.RowDeleting - Dim objPS As New ClsProductosServicios() - If objPS.RemovePS(GVPS.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - If objPS.GetPS(-1, -1, CveEmpresa) Then - GVPS.DataSource = objPS.DtResultados - GVPS.DataBind() - Else - GVPS.DataSource = Nothing - End If - Else - Alert("Ocurrió un Error al elimiar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - UPGvPS.Update() - objPS.Dispose() - End Sub - - Public Sub EditPS_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - CargaDdlClasificaciones() - CargaDdlUM() - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CvePS").ToEntero - TxtPS.Text = GvRow.DataKey("PS") - TxtCodigo.Text = GvRow.DataKey("Codigo") - TxtCodigoBarras.Text = GvRow.DataKey("CodigoBarras") - TxtPrecio.Text = GvRow.DataKey("Precio") - DdlUM.SelectedValueExist(GvRow.DataKey("CveUnidadMedida")) - DdlTipoPS.SelectedValueExist(GvRow.DataKey("CveTipoPS")) - DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion")) - BtnDivUpdatePS.Text = "Actualizar Producto/Servicio" - ChkAplicaParaVenta.Checked = CBool(GvRow.DataKey("AplicaParaVenta")) - UpEditPS.Update() - RegistraScript("$('#DivUpdatePS').modal('show');") - End Sub - - Private Sub CargaGVPS() - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPS(-1, -1, CveEmpresa) Then - GVPS.DataSource = ObjPS.DtResultados - GVPS.DataBind() - End If - ObjPS.Dispose() - UPGvPS.Update() - End Sub - - Private Sub LnkAgregarPS_Click(sender As Object, e As EventArgs) Handles LnkAgregarPS.Click - CargaDdlClasificaciones() - CargaDdlUM() - ModalidadModal = "Insertar" - TxtPS.Text = "" - TxtCodigo.Text = "" - TxtCodigoBarras.Text = "" - TxtPrecio.Text = "" - DdlUM.SelectedValue = "-1" - DdlTipoPS.SelectedValue = "-1" - DdlClasificacion.SelectedValue = "-1" - ChkAplicaParaVenta.Checked = False - BtnDivUpdatePS.Text = "Agregar Producto/Servicio" - ModalidadModal = "Insertar" - CveModal = -1 - UpEditPS.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivUpdatePS")) - End Sub - - Protected Sub BtnDivUpdatePS_Click(sender As Object, e As EventArgs) Handles BtnDivUpdatePS.Click - If DdlClasificacion.SelectedValue = "-1" Then - Alert("Tiene que seleccionar una clasificacion", TipoMensaje.MsgAdvertencia) - ElseIf DdlUM.SelectedValue = "-1" Then - Alert("Tiene que seleccionar una unidad de medida", TipoMensaje.MsgAdvertencia) - Else - - Dim ObjPS As New ClsProductosServicios - If ModalidadModal = "Insertar" Then - If ObjPS.AddPS(DdlClasificacion.SelectedValue.ToEntero, 1, DdlUM.SelectedValue.ToEntero, TxtCodigo.Text, "", TxtCodigoBarras.Text, TxtPS.Text, TxtPrecio.Text.ToDouble, 0, 0, False, 0, False, True, 100, CveEmpresa, 1, 1) <> -1 Then - Alert("El prodtco/servicio se agrego correctamente", TipoMensaje.MsgInformacion) - End If - End If - - If ModalidadModal = "Actualizar" Then - Dim CvePS As Integer - CvePS = CveModal.ToEntero - If ObjPS.UpdatePS(DdlClasificacion.SelectedValue.ToEntero, 1, DdlUM.SelectedValue.ToEntero, TxtCodigo.Text, "", TxtCodigoBarras.Text, TxtPS.Text, TxtPrecio.Text.ToDouble, 0, 0, False, 0, False, True, True, 100, CvePS, 1, 1, -1) Then - Alert("El prodtco/servicio se actualizo correctamente", TipoMensaje.MsgInformacion) - End If - End If - - - ObjPS.Dispose() - UPGvPS.Update() - UpEditPS.Update() - CargaGVPS() - RegistraScript("$('#DivUpdatePS').modal('hide');") - - End If - End Sub - - Protected Sub BtnDivAddPS_Click(sender As Object, e As EventArgs) Handles BtnDivAddPS.Click - If TxtAddPS.getfiles().Archivos.Count > 0 Then - Dim ArchivoExcel As Archivo = TxtAddPS.getfiles().Archivos(0) - Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & ArchivoExcel.patch & ArchivoExcel.filename - Dim Tipo As String = If(ArchivoExcel.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "OTRO") - CargarExcelPS(Directorio, Tipo) - Else - Alert("No existe el archivo.Favor de subir un archivo de excel a la plataforma", TipoMensaje.MsgError) - End If - End Sub - -#End Region - -#End Region - -#Region " PASO 5: CARGA INICIAL" - -#Region " 5.1: PROVEEDORES" - Private Sub GvProvedoores_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvProvedoores.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.Cells(7).Text = "$" + FormatNumber(e.Row.DBCampo("LimiteCredito").ToString, 2, , , TriState.True) - e.Row.Cells(8).Text = FormatNumber(e.Row.DBCampo("PlazoPago").ToString, 0, , , TriState.True) - End If - End Sub - - Private Sub CargarArchivoProveedor(Ruta As String, FileName As String, Tipo As String) - Dim dtProveedor As New DataTable - Dim ErrorExcel = False - - 'Verificamos que el archivo tenga el formato correcto - If Tipo <> "EXCEL" Then - Alert("El archivo no tiene el formato correcto.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim strConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Ruta + FileName + ";Extended Properties=Excel 8.0;" - Dim objDbFactory As Common.DbProviderFactory = Common.DbProviderFactories.GetFactory("System.Data.OleDb") - - Using objDbConnection = objDbFactory.CreateConnection(), objDbAdapter = objDbFactory.CreateDataAdapter(), Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") - - objDbConnection.ConnectionString = strConnString - objDbConnection.Open() - Dim objSheetNames As DataTable = objDbConnection.GetSchema("Tables") - Dim HojaExcel As String = objSheetNames.FiltroPrimeroValor("TABLE_NAME") - Try - Conexion.Open() - Dim cmd = Conexion.CreateCommand() - cmd.CommandType = CommandType.Text - cmd.CommandText = $"SELECT * FROM [{HojaExcel}]" - Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) - DataAdapter.Fill(dtProveedor) - Conexion.Close() - - Catch ex As Exception - ErrorExcel = True - OnError("Ocurrio un error al leer el archivo Excel
    " & ex.Message, ex) - End Try - Conexion.Close() - - End Using - - If Not ErrorExcel Then - - If Not dtProveedor.Columns(0).ColumnName = "Codigo" Then - Alert("El nombre de la primera columna debe ser 'Codigo'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(1).ColumnName = "RazonSocial" Then - Alert("El nombre de la segunda columna debe ser 'Fecha'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(2).ColumnName = "RFC" Then - Alert("El nombre de la tercera columna debe ser 'RFC'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(3).ColumnName = "Calle" Then - Alert("El nombre de la cuarta columna debe ser 'Calle'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(4).ColumnName = "Número exterior" Then - Alert("El nombre de la quinta columna debe ser 'Número exterior'.Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(5).ColumnName = "Colonia" Then - Alert("El nombre de la sexta columna debe ser 'Colonia'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(6).ColumnName = "Código postal" Then - Alert("El nombre de la séptima columna debe ser 'Código postal'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(7).ColumnName = "Población" Then - Alert("El nombre de la octava columna debe ser 'Población'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(8).ColumnName = "Estado" Then - Alert("El nombre de la novena columna debe ser 'Estado'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(9).ColumnName = "Teléfono" Then - Alert("El nombre de la décima columna debe ser 'Teléfono'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(10).ColumnName = "Contacto" Then - Alert("El nombre de la onceava columna debe ser 'Contacto'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(11).ColumnName = "Celular Contacto" Then - Alert("El nombre de la doceava columna debe ser 'Celular Contacto'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(12).ColumnName = "Limite Credito" Then - Alert("El nombre de la treceava columna debe ser 'Limite Credito'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtProveedor.Columns(13).ColumnName = "Plazo Cobranza" Then - Alert("El nombre de la treceava columna debe ser 'Plazo Cobranza'. Favor de verificar el archivo.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim NumRows As Integer = dtProveedor.Rows.Count - Dim ObjProv As New ClsCompProveedores - Dim ErrorProv As Boolean = False - Dim Contador As Integer = 0 - Dim ExisteProveedor As Boolean = False - - ObjProv.IniciaTransacSQL() - - For Each Row As DataRow In dtProveedor.Rows - Dim Codigo As String = Row("Codigo").ToString - Dim RazonSocial As String = Row("RazonSocial").ToString - Dim RFC As String = Row("RFC").ToString.Trim - Dim Calle As String = Row("Calle").ToString - Dim NumExt As Decimal = Row("Número exterior").ToString.ToDecimal - Dim Colonia As String = Row("Colonia").ToString - Dim CodigoPostal As Decimal = Row("Código Postal").ToString.ToDecimal - Dim Poblacion As String = Row("Población").ToString - Dim Estado As String = Row("Estado").ToString - Dim Telefono As String = Row("Teléfono").ToString - Dim Contacto As String = Row("Contacto").ToString - Dim CelularContacto As String = Row("Celular Contacto").ToString - Dim LimiteCredito As Integer = Row("Limite Credito").ToString.ToEntero - Dim PlazoCobranza As Integer = Row("Plazo Cobranza").ToString.ToEntero - Dim CveProveedor As Integer = 0 - Dim CveProveedor2 As Integer = 0 - - Dim ObjProveedor As New ClsCompProveedores - If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then - CveProveedor = ObjProveedor.DtResultados.FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString.ToEntero - CveProveedor2 = ObjProveedor.DtResultados.FiltroPrimeroValor("CveProveedor", $"RazonSocial = '{RazonSocial}'").ToString.ToEntero - End If - 'ObjProveedor.Dispose() - - If CveProveedor > 0 Or CveProveedor2 > 0 Then - 'ExisteProveedor = True - Contador = Contador + 1 - If Not ObjProv.UpdateProveedor(Codigo, RazonSocial, RazonSocial, "", RFC, Calle, Telefono, - Contacto, "", Telefono, LimiteCredito, PlazoCobranza, "", 0, 0, 0, -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", - -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", 1, "", -1, -1, True, "", "", False, CveProveedor) Then - ErrorProv = True - Exit For - End If - Else - If Not ObjProv.AddProveedor(Codigo, RazonSocial, RazonSocial, "", RFC, Calle, Telefono, - Contacto, "", Telefono, LimiteCredito, PlazoCobranza, "", 0, 0, 0, -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", - -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", 1, "", -1, -1, "", "", False, 100, CveEmpresa) Then - ErrorProv = True - Exit For - End If - End If - Next - - If Not ErrorProv Then - ObjProv.Commit() - If ObjProv.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", 1, -1) Then Application("GlobalDTCompProveedores") = ObjProv.DtResultados - If Contador > 0 Then - Alert(String.Format("Se agregaron: {0} Proveedores correctamente.
    Se Omitieron: {1} Clientes ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) - Else - Alert(String.Format("Se agregaron: {0} Proveedores correctamente.", NumRows), TipoMensaje.MsgInformacion) - End If - TxtAddProveedor.Text = "" - CargaGVProveedor() - RegistraScript("$('#DivExcelProveedor').modal('hide');") - Else - ObjProv.RollBack() - End If - ObjProv.Dispose() - - End If - End Sub - - - Protected Sub BtnCargaExcelProveedor_Click(sender As Object, e As EventArgs) Handles BtnCargaExcelProveedor.Click - If TxtAddProveedor.getfiles().Archivos.Count > 0 Then - Dim file As Archivo = TxtAddProveedor.getfiles().Archivos(0) - Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch - Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") - CargarArchivoProveedor(Directorio, file.filename, Tipo) - Else - Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError) - End If - End Sub - - Public Sub EditProveedor_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CveProveedor").ToEntero - TxtCodigoProveedor.Text = GvRow.DataKey("Codigo") - TxtRazonSocial.Text = GvRow.DataKey("RazonSocial") - TxtNombreCorto.Text = GvRow.DataKey("NombreCorto") - TxtRFCProv.Text = GvRow.DataKey("RFC") - TxtCalleProveedor.Text = GvRow.DataKey("Direccion") - TxtLimiteCredito.Text = GvRow.DataKey("LimiteCredito") - TxtTelefonoProveedor.Text = GvRow.DataKey("Telefono") - TxtPlazoCobranza.Text = GvRow.DataKey("PlazoPago") - TxtContactoNombre.Text = GvRow.DataKey("ContactoNombre") - BtnAddProveedor.Text = "Actualizar Proveedor" - UpAddProveedor.Update() - RegistraScript("$('#DivAddProveedor').modal('show');") - End Sub - - Private Sub LnkAddProveedor_Click(sender As Object, e As EventArgs) Handles LnkAddProveedor.Click - ModalidadModal = "Insertar" - TxtCodigoProveedor.Text = "" - TxtRazonSocial.Text = "" - TxtNombreCorto.Text = "" - TxtRFCProv.Text = "" - TxtCalleProveedor.Text = "" - TxtLimiteCredito.Text = "" - TxtTelefonoProveedor.Text = "" - TxtPlazoCobranza.Text = "" - TxtContactoNombre.Text = "" - BtnAddProveedor.Text = "Agregar Proveedor" - ModalidadModal = "Insertar" - CveModal = -1 - UpAddProveedor.Update() - RegistraScript("$('#DivAddProveedor').modal('show');") - End Sub - - Private Sub CargaGVProveedor() - Dim ObjProveedor As New ClsCompProveedores - If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then - GvProvedoores.DataSource = ObjProveedor.DtResultados - GvProvedoores.DataBind() - End If - ObjProveedor.Dispose() - UpGvProveedor.Update() - End Sub - - Protected Sub BtnAddProveedor_Click(sender As Object, e As EventArgs) Handles BtnAddProveedor.Click - Dim ObjProveedor As New ClsCompProveedores - If ModalidadModal = "Insertar" Then - If ObjProveedor.AddProveedor(TxtCodigoProveedor.Text, TxtRazonSocial.Text, TxtRazonSocial.Text, TxtNombreCorto.Text, TxtRFCProv.Text, TxtCalleProveedor.Text, TxtTelefonoProveedor.Text, - TxtContactoNombre.Text, "", TxtTelefonoProveedor.Text, TxtLimiteCredito.Text.ToDouble, TxtPlazoCobranza.Text.ToEntero, "", 0, 0, 0, -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", - -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", 1, "", -1, -1, "", "", False, 100, CveEmpresa) Then - Alert("El proveedor se agrego correctamente", TipoMensaje.MsgInformacion) - End If - End If - - If ModalidadModal = "Actualizar" Then - Dim CveProveedor As Integer - CveProveedor = CveModal.ToEntero - If ObjProveedor.UpdateProveedor(TxtCodigoProveedor.Text, TxtRazonSocial.Text, TxtRazonSocial.Text, TxtNombreCorto.Text, TxtRFCProv.Text, TxtCalleProveedor.Text, TxtTelefonoProveedor.Text, - TxtContactoNombre.Text, "", TxtTelefonoProveedor.Text, TxtLimiteCredito.Text.ToDouble, TxtPlazoCobranza.Text.ToEntero, "", 0, 0, 0, -1, "", -1, "", -1, "", - -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, -1, True, "", "", - False, CveProveedor) Then - - Alert("El proveedor se actualizo correctamente", TipoMensaje.MsgInformacion) - End If - End If - - - ObjProveedor.Dispose() - CargaGVProveedor() - RegistraScript("$('#DivAddProveedor').modal('hide');") - End Sub - - Protected Sub GvProvedoores_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvProvedoores.RowDeleting - Dim ObjProveedor As New ClsCompProveedores - If ObjProveedor.RemoveProveedor(GvProvedoores.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - Alert("El Proveedor se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjProveedor.Dispose() - CargaGVProveedor() - End Sub - -#End Region - -#Region " 5.2: CLIENTES" - - Protected Sub GvCliente_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvCliente.RowDeleting - Dim ObjCliente As New ClsClientes - If ObjCliente.RemoveCliente(GvCliente.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - Alert("El Cliente se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - ObjCliente.Dispose() - CargaGvCliente() - End Sub - - Protected Sub BtnAddCliente_Click(sender As Object, e As EventArgs) Handles BtnAddCliente.Click - If DdlSubProyectoClientes.SelectedValue <> "-1" Then - - Dim ObjCliente As New ClsClientes - If ModalidadModal = "Insertar" Then - If ObjCliente.AddCliente(TxtRazonSocialCliente.Text, TxtRazonSocialCliente.Text, TxtDireccionCliente.Text, "", "", TxtColoniaCliente.Text, "", "", TxtEstadoCliente.Text, "", TxtRFCCliente.Text, TxtCPCliente.Text, "", TxtContactoCliente.Text, "", "", "", "", "", -1, False, 1, -1, False, 100, CveEmpresa, "", -1, -1, -1, - "-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", "", 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, DdlSubProyectoClientes.SelectedValue.ToEntero, -1) Then - Alert("El cliente se agrego correctamente", TipoMensaje.MsgInformacion) - End If - End If - - If ModalidadModal = "Actualizar" Then - Dim CveCliente As Integer - CveCliente = CveModal.ToEntero - If ObjCliente.UpdateCliente(TxtRazonSocialCliente.Text, TxtRazonSocialCliente.Text, TxtDireccionCliente.Text, "", "", TxtColoniaCliente.Text, "", "", TxtEstadoCliente.Text, "", TxtRFCCliente.Text, TxtCPCliente.Text, "", TxtContactoCliente.Text, "", "", "", "", "", -1, False, 0.0, 0.0, False, True, "", -1, -1, -1, - "-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", -1, "", -1, "", "", "", "", 0.0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", 100, CveCliente, 100, CveEmpresa, "", "", False, DdlSubProyectoClientes.SelectedValue.ToEntero, -1) Then - Alert("El cliente se actualizo correctamente", TipoMensaje.MsgInformacion) - End If - End If - - - ObjCliente.Dispose() - CargaGvCliente() - RegistraScript("$('#DivAddCliente').modal('hide');") - Else - Alert("Tiene que seleccionar un a sucursal", TipoMensaje.MsgAdvertencia) - End If - End Sub - - Public Sub EditCliente_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - CargaSubProyectos() - ModalidadModal = "Actualizar" - CveModal = GvRow.DataKey("CveCliente").ToEntero - TxtRazonSocialCliente.Text = GvRow.DataKey("Nombre") - DdlSubProyectoClientes.SelectedValueExist(GvRow.DataKey("CveSubProyecto")) - TxtRFCCliente.Text = GvRow.DataKey("RFC") - TxtDireccionCliente.Text = GvRow.DataKey("Direccion") - TxtColoniaCliente.Text = GvRow.DataKey("Colonia") - TxtEstadoCliente.Text = GvRow.DataKey("Estado") - TxtCPCliente.Text = GvRow.DataKey("CP") - TxtContactoCliente.Text = GvRow.DataKey("Contacto") - BtnAddCliente.Text = "Actualizar Cliente" - UpAddCliente.Update() - RegistraScript("$('#DivAddCliente').modal('show');") - End Sub - - Private Sub LnkAddCliente_Click(sender As Object, e As EventArgs) Handles LnkAddCliente.Click - CargaSubProyectos() - ModalidadModal = "Insertar" - TxtRazonSocialCliente.Text = "" - DdlSubProyectoClientes.SelectedValue = "-1" - TxtRFCCliente.Text = "" - TxtDireccionCliente.Text = "" - TxtColoniaCliente.Text = "" - TxtEstadoCliente.Text = "" - TxtCPCliente.Text = "" - TxtContactoCliente.Text = "" - BtnAddCliente.Text = "Agregar Cliente" - ModalidadModal = "Insertar" - CveModal = -1 - UpAddCliente.Update() - RegistraScript("$('#DivAddCliente').modal('show');") - End Sub - - Private Sub CargaGvCliente() - Dim ObjCliente As New ClsClientes - If ObjCliente.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then - GvCliente.DataSource = ObjCliente.DtResultados - GvCliente.DataBind() - End If - ObjCliente.Dispose() - UpGvCliente.Update() - End Sub - - Protected Sub BtnCargaExcelCliente_Click(sender As Object, e As EventArgs) Handles BtnCargaExcelCliente.Click - If TxtAddClientes.getfiles().Archivos.Count > 0 Then - Dim file As Archivo = TxtAddClientes.getfiles().Archivos(0) - Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch - Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") - CargarArchivoCliente(Directorio, file.filename, Tipo) - Else - Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError) - End If - End Sub - - Private Sub CargarArchivoCliente(Ruta As String, FileName As String, Tipo As String) - Dim dtCliente As New DataTable - Dim ErrorExcel = False - - - 'Verificamos que el archivo tenga el formato correcto - If Tipo <> "EXCEL" Then - Alert("El archivo no tiene el formato correcto.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim strConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Ruta + FileName + ";Extended Properties=Excel 8.0;" - Dim objDbFactory As Common.DbProviderFactory = Common.DbProviderFactories.GetFactory("System.Data.OleDb") - - Using objDbConnection = objDbFactory.CreateConnection(), objDbAdapter = objDbFactory.CreateDataAdapter(), Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") - - objDbConnection.ConnectionString = strConnString - objDbConnection.Open() - Dim objSheetNames As DataTable = objDbConnection.GetSchema("Tables") - Dim HojaExcel As String = objSheetNames.FiltroPrimeroValor("TABLE_NAME") - Try - Conexion.Open() - Dim cmd = Conexion.CreateCommand() - cmd.CommandType = CommandType.Text - cmd.CommandText = $"SELECT * FROM [{HojaExcel}]" - Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) - DataAdapter.Fill(dtCliente) - Conexion.Close() - - Catch ex As Exception - ErrorExcel = True - OnError("Ocurrio un error al leer el archivo Excel
    " & ex.Message, ex) - End Try - Conexion.Close() - - End Using - - If Not ErrorExcel Then - - If Not dtCliente.Columns(0).ColumnName = "Codigo" Then - Alert("El nombre de la primera columna debe ser 'Codigo'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(1).ColumnName = "RazonSocial" Then - Alert("El nombre de la segunda columna debe ser 'Fecha'.Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(2).ColumnName = "RFC" Then - Alert("El nombre de la tercera columna debe ser 'RFC'.Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(3).ColumnName = "Calle" Then - Alert("El nombre de la cuarta columna debe ser 'Calle'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(4).ColumnName = "Número exterior" Then - Alert("El nombre de la quinta columna debe ser 'Número exterior' .Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(5).ColumnName = "Colonia" Then - Alert("El nombre de la sexta columna debe ser 'Colonia'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(6).ColumnName = "Código postal" Then - Alert("El nombre de la séptima columna debe ser 'Código postal'.Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(7).ColumnName = "Población" Then - Alert("El nombre de la octava columna debe ser 'Población'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(8).ColumnName = "Estado" Then - Alert("El nombre de la novena columna debe ser 'Estado'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(9).ColumnName = "Teléfono" Then - Alert("El nombre de la décima columna debe ser 'Teléfono'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(10).ColumnName = "Contacto" Then - Alert("El nombre de la onceava columna debe ser 'Contacto'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(11).ColumnName = "Celular Contacto" Then - Alert("El nombre de la doceava columna debe ser 'Celular Contacto'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(12).ColumnName = "Limite Credito" Then - Alert("El nombre de la treceava columna debe ser 'Limite Credito'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtCliente.Columns(13).ColumnName = "Plazo Cobranza" Then - Alert("El nombre de la treceava columna debe ser 'Plazo Cobranza'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - Dim NumRows As Integer = dtCliente.Rows.Count - Dim ObjClientes As New ClsClientes - Dim ErrorClientes As Boolean = False - Dim ExisteCliente As Boolean = False - Dim Contador As Integer = 0 - Dim NumRow As Integer = 0 - - Try - ObjClientes.IniciaTransacSQL() - For Each Row As DataRow In dtCliente.FiltraParametros("RFC <> ''").Rows - NumRow = NumRow + 1 - Dim Codigo As String = Row("Codigo").ToString - Dim RazonSocial As String = Row("RazonSocial").ToString - Dim RFC As String = Row("RFC").ToString.Trim - Dim Calle As String = Row("Calle").ToString - Dim NumExt As Decimal = Row("Número exterior").ToString.ToDecimal - Dim Colonia As String = Row("Colonia").ToString - Dim CodigoPostal As String = Row("Código Postal").ToString - Dim Poblacion As String = Row("Población").ToString - Dim Estado As String = Row("Estado").ToString - Dim Pais As String = Row("Pais").ToString - Dim Telefono As String = Row("Teléfono").ToString - Dim Contacto As String = Row("Contacto").ToString - Dim CelularContacto As String = Row("Celular Contacto").ToString - Dim CveCliente As Integer = 0 - Dim ObjCliente As New ClsClientes - If ObjCliente.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then - CveCliente = ObjCliente.DtResultados.FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero - End If - ObjCliente.Dispose() - - If CveCliente > 0 Then - ExisteCliente = True - Contador = Contador + 1 - If Not ObjClientes.UpdateCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, Pais, RFC, CodigoPostal, "", Contacto, "", "", "", "", "", -1, False, 0.0, 0.0, False, True, "", -1, -1, -1, - "-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", -1, "", -1, "", "", "", "", 0.0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", 100, CveCliente, 100, CveEmpresa, "", "", False, -1, -1) Then - ErrorClientes = True - RFC.GuardaLog - Exit For - End If - Else - If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, Pais, RFC, CodigoPostal, "", Contacto, "", "", "", "", "", -1, False, 1, -1, False, 100, CveEmpresa, "", -1, -1, -1, - "-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", "", 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, -1, -1) Then - ErrorClientes = True - RFC.GuardaLog - Exit For - End If - End If - Next - - - - Catch ex As Exception - GuardaLog($"Ocurrio un error al agregar el Cliente: {ex}, {NumRow}") - ObjClientes.RollBack() - - Finally - 'ObjClientes.Dispose() - End Try - - If Not ErrorClientes Then - ObjClientes.Commit() - 'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then Application("GlobalDTCliente") = ObjClientes.DtResultados - - If Contador > 0 Then - Alert(String.Format("Se agregaron: {0} Clientes correctamente.
    Se Omitieron: {1} Clientes ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) - Else - Alert(String.Format("Se agregaron: {0} Clientes correctamente.", NumRows), TipoMensaje.MsgInformacion) - End If - TxtAddClientes.Text = "" - CargaGvCliente() - Else - ObjClientes.RollBack() - End If - ObjClientes.Dispose() - - - End If - End Sub - - - -#End Region - -#Region " 5.3: FACTURAS" - Private Sub BtnCargaExcelFacturas_Click(sender As Object, e As EventArgs) Handles BtnCargaExcelFacturas.Click - If TxtAddFactura.getfiles().Archivos.Count > 0 Then - Dim file As Archivo = TxtAddFactura.getfiles().Archivos(0) - Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch - Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") - CargarArchivoFactura(Directorio, file.filename, Tipo) - Else - Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError) - End If - End Sub - - Private Sub BtnDescargarFacturas_Click(sender As Object, e As EventArgs) Handles BtnDescargarFacturas.Click - DescargarExcel("Fact") - End Sub - - Private Sub CargarArchivoFactura(Ruta As String, FileName As String, Tipo As String) - Dim dtFactura As New DataTable - Dim ErrorExcel = False - If Tipo <> "EXCEL" Then - Alert("El archivo no tiene el formato correcto.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim strConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Ruta + FileName + ";Extended Properties=Excel 8.0;" - Dim objDbFactory As Common.DbProviderFactory = Common.DbProviderFactories.GetFactory("System.Data.OleDb") - - Using objDbConnection = objDbFactory.CreateConnection(), objDbAdapter = objDbFactory.CreateDataAdapter(), Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") - - objDbConnection.ConnectionString = strConnString - objDbConnection.Open() - Dim objSheetNames As DataTable = objDbConnection.GetSchema("Tables") - Dim HojaExcel As String = objSheetNames.FiltroPrimeroValor("TABLE_NAME") - Try - Conexion.Open() - Dim cmd = Conexion.CreateCommand() - cmd.CommandType = CommandType.Text - cmd.CommandText = $"SELECT * FROM [{HojaExcel}]" - Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) - DataAdapter.Fill(dtFactura) - Conexion.Close() - - Catch ex As Exception - ErrorExcel = True - OnError("Ocurrio un error al leer el archivo Excel
    " & ex.Message, ex) - End Try - Conexion.Close() - - End Using - - If Not ErrorExcel Then - - If Not dtFactura.Columns(0).ColumnName = "Sucursal" Then - Alert("El nombre de la primera columna debe ser 'Sucursal'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dtFactura.Columns(1).ColumnName = "RFC" Then - Alert("El nombre de la segunda columna debe ser 'RFC'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dtFactura.Columns(2).ColumnName = "Serie" Then - Alert("El nombre de la tercera columna debe ser 'Serie'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dtFactura.Columns(3).ColumnName = "Folio" Then - Alert("El nombre de la cuarta columna debe ser 'Folio'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dtFactura.Columns(4).ColumnName = "Fecha" Then - Alert("El nombre de la quinta columna debe ser 'Fecha'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtFactura.Columns(5).ColumnName = "SubTotal" Then - Alert("El nombre de la sexta columna debe ser 'SubTotal'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtFactura.Columns(6).ColumnName = "IVA" Then - Alert("El nombre de la séptima columna debe ser 'IVA'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtFactura.Columns(7).ColumnName = "Total" Then - Alert("El nombre de la octava columna debe ser 'Total'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtFactura.Columns(8).ColumnName = "Saldo" Then - Alert("El nombre de la novena columna debe ser 'Saldo'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtFactura.Columns(9).ColumnName = "Tipo Documento" Then - Alert("El nombre de la décima columna debe ser 'Tipo Documento'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtFactura.Columns(10).ColumnName = "Ret IVA" Then - Alert("El nombre de la onceava columna debe ser 'Ret IVA'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtFactura.Columns(11).ColumnName = "Ret ISR" Then - Alert("El nombre de la doceava columna debe ser 'Ret ISR'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dtFactura.Columns(12).ColumnName = "Moneda" Then - Alert("El nombre de la treceava columna debe ser 'Moneda'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - - If Not dtFactura.Columns(13).ColumnName = "Tipo Cambio" Then - Alert("El nombre de la catorceava columna debe ser 'Tipo Cambio'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dtFactura.Columns(14).ColumnName = "Fecha Vencimiento" Then - Alert("El nombre de la quinceava columna debe ser 'Fecha Vencimiento'. Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If RblFormato.SelectedValue = "1" Then - Dim NumRows As Integer = dtFactura.Rows.Count - Dim ObjCompras As New ClsCompras - Dim ErrorCompras As Boolean = False - Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL()) - Dim CveCompra As Integer - Dim Contador As Integer = 0 - Dim ExisteCompra As Boolean = False - Dim DtProveedores = New DataTable - Dim ObjProve As New ClsCompProveedores - - If ObjProve.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then - DtProveedores = ObjProve.DtResultados - End If - ObjProve.Dispose() - - For Each Row As DataRow In dtFactura.FiltraParametros("RFC <> '' AND Folio <> '' ").Rows - Dim Sucursal As String = Row("Sucursal").ToString - Dim RFC As String = Row("RFC").ToString.Trim - Dim Serie As String = Row("Serie").ToString - Dim Folio As String = Row("Folio").ToString - Dim Fecha As Date = Row("Fecha").ToString.ToDate - Dim SubTotal As Decimal = Row("SubTotal").ToString.ToDecimal - Dim IVA As Decimal = Row("IVA").ToString.ToDecimal - Dim Total As Decimal = Row("Total").ToString.ToDecimal - Dim Saldo As Decimal = Row("Saldo").ToString.ToDecimal - Dim TipoDocto As String = Row("Tipo Documento").ToString - Dim CveProveedor As Integer = DtProveedores.FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString.ToEntero - Dim CvePS As Integer = 0 - Dim CveUnidadMedida As Integer = 0 - - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPS(-1, -1, CveEmpresa) Then - CvePS = ObjPS.DtResultados.FiltroPrimeroValor("CvePS").ToString.ToEntero - End If - ObjPS.Dispose() - - Dim ObjUM As New ClsUnidadesMedida - If ObjUM.GetUnidadesMedida(CveEmpresa) Then - CveUnidadMedida = ObjUM.DtResultados.FiltraParametros($"CveEmpresa={CveEmpresa}").FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero - End If - ObjUM.Dispose() - - Dim RetIVA As Double = Row("Ret IVA").ToString.ToDouble - Dim RetISR As Double = Row("Ret ISR").ToString.ToDouble - Dim Moneda As String = Row("Moneda").ToString - Dim TipoCambio As String = Row("Tipo Cambio").ToString - Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString.ToDate - Dim CveMoneda As Integer = 1 - - If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorCompras = True - If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorCompras = True - If Not CveProveedor > 0 Then Alert(String.Format("No se encontró el Proveedor con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorCompras = True : Exit For - TipoDocto = IIf(TipoDocto = "Ingresos", "Fac", "NC").ToString - - 'Moneda - If Moneda = "Pesos" Then - CveMoneda = 1 - ElseIf Moneda = "Dólares" Then - CveMoneda = 2 - End If - - 'Si no se especifica TC, se manda como pesos. - If TipoCambio = "" Then TipoCambio = "1" - - 'PrePóliza - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Compras/SaldoInicial", 1, Total, Total, CveMoneda, Fecha, "", 100, CveEmpresa) - If Not CvePrePoliza > 0 Then - ErrorCompras = True - Exit For - End If - - 'Compra - If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, "", CveProveedor.ToEntero, SubTotal, 0, 0, IVA, RetIVA, RetISR, 0, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDouble, FechaVencimiento, - True, "", 1, CvePrePoliza, 100, CveEmpresa) Then - ErrorCompras = True - Exit For - End If - CveCompra = ObjCompras.CveCompra - - 'Compra Detalle - If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, -1, -1, 0, 1, SubTotal, 0.16, SubTotal, 0, "Carga Inicial", -1) Then - ErrorCompras = True - Exit For - End If - - 'PrePólizaDetalle - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio, IIf(TipoDocto = "Fac", 5, 18).ToString.ToEntero, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, Folio, 6, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IVA, Folio, 14, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For - - 'Saldo - If Saldo < Total Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Folio, 17, Folio, Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Folio, 95, Folio, Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For - End If - - - Next - If Not ErrorCompras Then - If Contador > 0 Then - Alert(String.Format("Se agregaron: {0} Compras correctamente.
    Se Omitieron: {1} Compras ya que ya se encuentran registradas.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion) - Else - Alert(String.Format("Se agregaron: {0} Compras correctamente.", NumRows), TipoMensaje.MsgInformacion) - End If - Alert(String.Format("Se agregaron: {0} Compras correctamente.", NumRows), TipoMensaje.MsgInformacion) - ObjCompras.Commit() - TxtAddFactura.Text = "" - UpCarga.Update() - Else - ObjCompras.RollBack() - End If - ObjCompras.Dispose() - - End If - - Else - - - Dim ObjVentas As New ClsVentas - Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) - Dim ErrorVentas As Boolean = False - Dim CveVenta As Integer - Dim NumRows As Integer = 0 - Dim DtClientes = New DataTable - Dim CvePS As Integer = 0 - Dim CveUnidadMedida As Integer = 0 - ' Dim ExisteVenta As Boolean = False - 'Dim Contador As Integer = 0 - Dim ObjCliente As New ClsClientes - If ObjCliente.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then - DtClientes = ObjCliente.DtResultados - End If - ObjCliente.Dispose() - - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPS(-1, -1, CveEmpresa) Then - CvePS = ObjPS.DtResultados.FiltroPrimeroValor("CvePS").ToString.ToEntero - End If - ObjPS.Dispose() - - Dim ObjUM As New ClsUnidadesMedida - If ObjUM.GetUnidadesMedida(CveEmpresa) Then - CveUnidadMedida = ObjUM.DtResultados.FiltraParametros($"CveEmpresa={CveEmpresa}").FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero - End If - ObjUM.Dispose() - - - If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorVentas = True - ' If Not CveSucursal > 0 Then Alert("No se encontró la sucursal.", TipoMensaje.MsgError) : ErrorVentas = True - If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorVentas = True - - For Each Row As DataRow In dtFactura.Rows - Dim Sucursal As String = Row("Sucursal").ToString - Dim TipoDocto As String = Row("Tipo Documento").ToString - Dim RFC As String = Row("RFC").ToString.Trim - Dim Serie As String = Row("Serie").ToString - Dim Folio As Integer = Row("Folio").ToString.ToEntero - Dim Fecha As Date = Row("Fecha").ToString.ToDate - Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString.ToDate - Dim SubTotal As Decimal = Row("SubTotal").ToString.ToDecimal - Dim IVA As Decimal = Row("IVA").ToString.ToDecimal - Dim Total As Decimal = Row("Total").ToString.ToDecimal - Dim Saldo As Decimal = Row("Saldo").ToString.ToDecimal - Dim CveCliente As Integer = DtClientes.FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero - Dim RetIVA As Double = Row("Ret IVA").ToString.ToDouble - Dim RetISR As Double = Row("Ret ISR").ToString.ToDouble - Dim Moneda As String = Row("Moneda").ToString - Dim TipoCambio As String = Row("Tipo Cambio").ToString - Dim CveMoneda As Integer = 1 - - If Not CveCliente > 0 Then Alert(String.Format("No se encontró el cliente con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorVentas = True : RFC.GuardaLog : Exit For - TipoDocto = IIf(TipoDocto = "Ingresos", "Ing", IIf(TipoDocto = "Egresos", "Egs", "Rem")).ToString - 'PrePóliza - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Venta/SaldoIncial", 1, Total, Total, 1, Fecha, "", 100, CveEmpresa) - - 'Moneda - If Moneda = "Pesos" Then - CveMoneda = 1 - ElseIf Moneda = "Dólares" Then - CveMoneda = 2 - End If - - 'Si no se especifica TC, se manda como pesos. - If TipoCambio = "" Then TipoCambio = "1" - - - 'Venta - If Not ObjVentas.AddVenta(TipoDocto, Folio, CveCliente.ToEntero, -1, SubTotal, 0, 0, IVA, RetIVA, RetISR, Total, CveMoneda, TipoCambio.ToDouble, - 0, 0, 0, FechaVencimiento, Fecha, "", "", Fecha, 0, "", "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, -1, 0, CvePrePoliza, - 100, CveEmpresa, Serie:=Serie, CveSubProyecto:=Sucursal.ToEntero, CveSubProyectoEjecucion:=Sucursal.ToEntero, CveSubProyectoCobranza:=Sucursal.ToEntero) Then - ErrorVentas = True - Exit For - End If - CveVenta = ObjVentas.CveVenta - - If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, 0.16, SubTotal, "Saldo Inicial", 0, 0, -1, 0) Then - ErrorVentas = True - Exit For - End If - - - 'PrePólizaDetalle - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, Folio.ToString, 4, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=1) Then ErrorVentas = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio.ToString, 1, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente) Then ErrorVentas = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, Folio.ToString, 13, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente) Then ErrorVentas = True : Exit For - - 'Saldo - If Saldo < Total Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Folio.ToString, 2, Folio.ToString, Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente) Then ErrorVentas = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Folio.ToString, 95, Folio.ToString, Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente) Then ErrorVentas = True : Exit For - End If - - Next - If Not ErrorVentas Then - Alert(String.Format("Se agregaron: {0} Ventas correctamente.", NumRows), TipoMensaje.MsgInformacion) - ObjVentas.Commit() - TxtAddFactura.Text = "" - UpCarga.Update() - Else - ObjVentas.RollBack() - End If - ObjVentas.Dispose() - End If - End Sub - - -#End Region - -#End Region - -#Region " PASO 6: FINALIZAR" - - Private Sub CargaDdlUsuario() - DdlUsuario.Items.Clear() - Dim ObjUsuario As New ClsSisUsuarios - If ObjUsuario.GetUsuarios(-1) Then - DdlUsuario.DataSource = ObjUsuario.DtResultados.FiltraParametros($"CveEmpresa={CveEmpresa}") - DdlUsuario.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlUsuario.DataBind() - End If - ObjUsuario.Dispose() - UpFinalizar.Update() - End Sub - - Private Sub BtnIniciarSesion_Click(sender As Object, e As EventArgs) Handles BtnIniciarSesion.Click - If DdlUsuario.SelectedValue = "-1" Then - Alert("Tiene que seleccionar un usuario.", TipoMensaje.MsgAdvertencia) - Else - Dim Liga As String = "/LogIn.aspx" - Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & DdlUsuario.SelectedValue.ToEntero & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & CveEmpresa) - Response.Redirect(LigaActivar, True) - End If - End Sub - -#End Region - -#Region " DESCARGA FORMATOS EXCEL " - Private Sub DescargarExcel(Tipo As String) - Dim Directorio As String = "" - Select Case Tipo - Case "Clasi" - Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\FormatoClasificaciones.xlsx" - Case "UM" - Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\FormatoUnidadesMedida.xlsx" - Case "PS" - Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoPS.xlsx" - Case "Prove" - Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoProveedores.xlsx" - Case "Cli" - Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoClientes.xlsx" - Case "Fact" - If RblFormato.SelectedValue = "1" Then - Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoProveedores-Facturas.xlsx" - End If - If RblFormato.SelectedValue = "2" Then - Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\SaldosIniciales\FormatoClientes-Facturas.xlsx" - End If - - - End Select - Dim Archivo As New IO.FileInfo(Directorio) - If Archivo.Exists Then - Response.Clear() - Response.ClearHeaders() - Response.ClearContent() - Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name) - Response.AddHeader("Content-Length", Archivo.Length.ToString()) - Response.ContentType = "text/plain" - Response.Flush() - Response.TransmitFile(Archivo.FullName) - Response.End() - End If - End Sub - Protected Sub LnkDescargarExcelClasi_Click(sender As Object, e As EventArgs) Handles LnkDescargarExcelClasi.Click - DescargarExcel("Clasi") - End Sub - Protected Sub LnkDescargarExcelUM_Click(sender As Object, e As EventArgs) Handles LnkDescargarExcelUM.Click - DescargarExcel("UM") - End Sub - Protected Sub LnkDescargarExcelPS_Click(sender As Object, e As EventArgs) Handles LnkDescargarExcelPS.Click - DescargarExcel("PS") - End Sub - Protected Sub LnkDescargaProveedor(sender As Object, e As EventArgs) Handles LnkDescargaExcelProveedor.Click - DescargarExcel("Prove") - End Sub - - Protected Sub LnkDescargarExcelCliente(sender As Object, e As EventArgs) Handles LnkDescargarExcelClientes.Click - DescargarExcel("Cli") - End Sub - - - -#End Region - - - -#Region " GUARDAR - NO SE DEBERIA USAR UN GUARDAR GENERAL, PORQUE SE GUARDA PESTAÑA POR PESTAÑA " - 'Protected Sub LBGuardar_Click(sender As Object, e As EventArgs) Handles LBGuardar.Click - ' Alert("Metodo guardar raro", TipoMensaje.MsgAdvertencia) - ' Exit Sub - - ' Dim ObjEmpresa As New ClsSisEmpresas - ' Dim ObjRoles As New ClsSisRoles(ObjEmpresa.IniciaTransacSQL) - ' Dim ObjUsuarios As New ClsSisUsuarios(ObjEmpresa.IniciaTransacSQL) - ' Dim objClasi As New ClsClasificaciones(ObjEmpresa.IniciaTransacSQL) - ' Dim objGenerales As New ClsGenerales(ObjEmpresa.IniciaTransacSQL) - ' Dim Mensaje As New StringBuilder - - ' 'DatosFiscales - ' Dim Direccion, NoExt, NoInt, Colonia, Ciudad, Estado, CP, Regimen, Contacto, Telefono, Ciec, Localidad, Extension As String - - ' 'Envio de correos - ' Dim MailEnvio, ContraseñaEnvio, ServidorEnvio, PuertoEnvio, Protocolo As String - ' Dim UsaSSLEnvio As Boolean - - ' 'RecepcionDeCorreos - ' Dim MailRecep, ServidorRecep, PuertoRecep, UsuarioRecep, ContraseñaRecep As String - ' Dim UsaSSLRecep As Boolean - - ' Dim CorrectoEmpresa = False - ' Dim HuboError = False - - ' Direccion = TxtDireccion.Text.Trim - ' NoExt = TxtNoExt.Text.Trim - ' NoInt = TxtNoInt.Text.Trim - ' Colonia = TxtColonia.Text.Trim - ' Ciudad = TxtCiudad.Text.Trim - ' Estado = TxtEstado.Text.Trim - ' CP = TxtCP.Text.Trim - ' Localidad = TxtLocalidad.Text - ' Extension = TxtExtension.Text - - ' Regimen = DdlRegimen.SelectedValue - ' Contacto = TxtContacto.Text.Trim - ' Telefono = TxtTelefono.Text.Trim - ' Ciec = TxtCIEC.Text.Trim - ' MailEnvio = txtEnvioMail.Text.Trim - ' ContraseñaEnvio = TxtContraseñaSend.Text.Trim - ' ServidorEnvio = TxtServidor.Text.Trim - ' PuertoEnvio = TxtSendMailPort.Text.Trim - ' Protocolo = DDLProtocolo.SelectedValue.Trim - ' UsaSSLEnvio = chkSSL.Checked - ' MailRecep = txtRecepMail.Text.Trim - ' ServidorRecep = TxtServidorRecep.Text.Trim - ' PuertoRecep = TxtRecepMailPort.Text.Trim - ' UsuarioRecep = TxtUsuarioRecep.Text.Trim - ' ContraseñaRecep = TxtUsuarioRecep.Text.Trim - ' UsaSSLRecep = chkSSLRecep.Checked - - - ' If CveEmpresa = 0 Then - ' If ObjEmpresa.AddEmpresa(-1, Empresa, Direccion, NoExt, NoInt, Colonia, Ciudad, Estado, RFC, CP.ToEntero, Telefono, Contacto, Correo, "CFDi", "", "", TxtContraKey.Text, TxtFiel.Text, TxtCSD.Text, "", "", 100, False, False, False, Regimen, False, MailEnvio, ContraseñaEnvio, ServidorEnvio, PuertoEnvio.ToEntero, UsaSSLEnvio, False, False, False, False, False, False, False, False, False, - ' "", "", "", "", MailRecep, ServidorRecep, PuertoRecep.ToEntero, UsaSSLRecep, UsuarioRecep, ContraseñaRecep, Protocolo, "", "", 0, False, "", "", "", 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, "", "", -1, 0.0D, "", 0, False, 0.0D, "", "", 0, False, 0, 0, False, 0, 0, False, 0, CveMetodoPago:=MetodoPAgo, CvePAC:=1) Then - ' CveEmpresa = ObjEmpresa.CveEmpresa - ' If CveEmpresa > 0 Then - ' CorrectoEmpresa = True - ' Mensaje.Append("Agregar Empresa: Correcto ") - ' Else - ' HuboError = True - ' Mensaje.Append("Agregar Empresa: Incorrecto") - ' End If - ' End If - ' If CorrectoEmpresa Then - ' For Each row As DataRow In DtRoles.Rows - ' Try - ' If Not ObjRoles.AddRol(1, row("Rol").ToString, 100, CveEmpresa) Then - ' HuboError = True - ' Mensaje.Append("Agregar Roles: Incorrecto") - ' End If - ' If Not HuboError Then - ' For Each ModRow As DataRow In DtModulos.FiltraParametros(String.Format("CveRol = {0} ", row("CveRol").ToString)).Rows - ' If Not ObjRoles.UpdateRolesModulos(ObjRoles.CveRol, ModRow("CveModulo").ToString.ToEntero, ModRow("Valor").ToString.ToEntero, 100) Then - ' HuboError = True - ' End If - ' Next - ' End If - ' If Not HuboError Then - ' For Each ProcRow As DataRow In DtProcesos.FiltraParametros(String.Format("CveRol = {0} ", row("CveRol").ToString)).Rows - ' If Not ObjRoles.UpdateRolesProcesos(ObjRoles.CveRol, ProcRow("CveProceso").ToString.ToEntero, ProcRow("Valor").ToString.ToEntero, 100) Then - ' HuboError = True - ' End If - ' Next - ' End If - ' Catch ex As Exception - ' HuboError = True - ' Mensaje.Append("Agregar Roles: Incorrecto") - ' OnError(ex.Message, ex) - ' End Try - ' Next - ' End If - ' If CorrectoEmpresa AndAlso TxtPlantillaVenta.Text <> String.Empty Then - ' If Not ObjEmpresa.UpdatePlantillaMail("AsuntoPlantillaMailVenta", TxtAsunto.Text.Trim, "PlantillaMailVenta", TxtPlantillaVenta.Text.Trim, CveEmpresa) Then - ' Alert("La plantilla de mail de ventas se guardó correctamente.", TipoMensaje.MsgInformacion) - ' HuboError = True - ' End If - ' End If - ' If CorrectoEmpresa AndAlso Not HuboError Then - ' Mensaje.Append("Agregar Roles: Correcto") - ' For Each row As DataRow In DtUsuarios.Rows - ' Try - ' If ObjUsuarios.AddUsuario(row("Usuario").ToString, ContraseñaPredeterminadaEncriptada, row("Nombre").ToString, -2, row("Correo").ToString, 0, 0, 0, True, 100, CveEmpresa, -1, row("rol").ToString) = -1 Then - ' HuboError = True - ' Mensaje.Append("Agregar Usuarios: Incorrecto") - ' End If - ' Catch ex As Exception - ' HuboError = True - ' Mensaje.Append("Agregar Usuarios: Incorrecto") - ' OnError(ex.Message, ex) - ' End Try - ' Next - ' End If - ' If CorrectoEmpresa AndAlso Not HuboError Then - ' Mensaje.Append("Agregar Usuarios: Correcto") - ' If DtClasificaciones.Rows.Count > 0 Then - ' objGenerales.AddCategorias("Categoria General", 100, CveEmpresa) - ' For Each row As DataRow In DtClasificaciones.Rows - ' If Not objClasi.AddClasificaciones(row("Clasificacion").ToString, "", 0, "", 0, "", 0, "", 0, 100, CveEmpresa) Then - ' HuboError = True - ' Mensaje.Append("Agregar Clasificaciones: Incorrecto") - ' End If - ' Next - ' End If - ' End If - ' If CorrectoEmpresa AndAlso Not HuboError Then - ' Try - ' If TxtModalFielArchivo.getfiles().Archivos.Count > 0 Then - ' Dim ArchivoFiel As Archivo = TxtModalFielArchivo.getfiles().Archivos(0) - ' Dim Path As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\Certificados" - ' If Not Directory.Exists(Path) Then - ' Directory.CreateDirectory(Path) - ' End If - ' Dim directorioNew As String = String.Format("{0}\{1}.{2}", Path, FIEL, ArchivoFiel.Extencion) - ' If File.Exists(directorioNew) Then - ' My.Computer.FileSystem.DeleteFile(directorioNew) - ' End If - ' My.Computer.FileSystem.MoveFile(ArchivoFiel.FileUrl, directorioNew) - ' End If - - ' If TxtCSD.getfiles().Archivos.Count > 0 Then - ' Dim ArchivoCSD As Archivo = TxtCSD.getfiles().Archivos(0) - ' Dim PathCSD As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\Certificados" - ' Dim dirCSD As String = String.Format("{0}\{1}.{2}", PathCSD, CSD, ArchivoCSD.Extencion) - ' If File.Exists(dirCSD) Then - ' My.Computer.FileSystem.DeleteFile(dirCSD) - ' End If - ' My.Computer.FileSystem.MoveFile(ArchivoCSD.FileUrl, dirCSD) - ' End If - - ' If TextLogo.getfiles().Archivos().Count > 0 Then - ' Dim Logo As Archivo = TextLogo.getfiles().Archivos(0) - ' Dim PathLogo As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\" - ' Dim dirLogo As String = String.Format("{0}\logo.{1}", PathLogo, Logo.Extencion) - ' If File.Exists(dirLogo) Then - ' My.Computer.FileSystem.DeleteFile(dirLogo) - ' End If - ' My.Computer.FileSystem.MoveFile(Logo.FileUrl, dirLogo) - ' End If - - ' If TxtFormatoFactura.getfiles().Archivos().Count > 0 Then - ' Dim FormatoFactura As Archivo = TxtFormatoFactura.getfiles().Archivos(0) - ' Dim PathFormato = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\Formatos\" - ' Dim dirFormato As String = String.Format("{0}\Factura.{1}", PathFormato, FormatoFactura.Extencion) - ' If File.Exists(dirFormato) Then - ' My.Computer.FileSystem.DeleteFile(dirFormato) - ' End If - ' My.Computer.FileSystem.MoveFile(FormatoFactura.FileUrl, dirFormato) - ' End If - ' Catch ex As Exception - ' HuboError = True - ' OnError(ex.Message, ex) - ' End Try - ' End If - - ' If Not HuboError AndAlso CorrectoEmpresa Then - ' ObjEmpresa.Commit() - ' Alert("La información de la nueva empresa de guardó correctamente", TipoMensaje.MsgInformacion) - ' Else - ' ObjEmpresa.RollBack() - ' Alert("Ocurrió un error al guardar los datos de la empresa", TipoMensaje.MsgError) - ' End If - ' ObjEmpresa.Dispose() - ' ElseIf CveEmpresa > 0 Then - ' If ObjEmpresa.UpdateEmpresaXWizard(TxtNomEmpresa.Text, Direccion, NoExt, NoInt, Colonia, Ciudad, Estado, TxtRFC.Text, CP.ToEntero, Telefono, Contacto, TxtEmail.Text, Regimen, MailEnvio, ContraseñaEnvio, ServidorEnvio, PuertoEnvio.ToEntero, UsaSSLEnvio, MailRecep, ServidorRecep, PuertoRecep.ToEntero, - ' UsaSSLRecep, UsuarioRecep, ContraseñaRecep, CveEmpresa, Protocolo, Localidad, Extension, Ciec, TxtFiel.Text, TxtCSD.Text, TxtContraKey.Text) Then - ' CorrectoEmpresa = True - ' End If - ' If CorrectoEmpresa Then - ' If Not ObjEmpresa.UpdatePlantillaMail("AsuntoPlantillaMailVenta", TxtAsunto.Text.Trim, "PlantillaMailVenta", TxtPlantillaVenta.Text.Trim, CveEmpresa) Then - ' CorrectoEmpresa = False - ' End If - ' End If - - ' If DtModulos IsNot Nothing Then - ' For Each ModRow As DataRow In DtModulos.Rows - ' If Not ObjRoles.UpdateRolesModulos(ModRow("CveRol").ToString.ToEntero, ModRow("CveModulo").ToString.ToEntero, ModRow("Valor").ToString.ToEntero, 100) Then - ' CorrectoEmpresa = False - ' End If - ' Next - ' End If - - ' If DtProcesos IsNot Nothing Then - ' For Each ProcRow As DataRow In DtProcesos.Rows - ' If Not ObjRoles.UpdateRolesProcesos(ProcRow("CveRol").ToString.ToEntero, ProcRow("CveProceso").ToString.ToEntero, ProcRow("Valor").ToString.ToEntero, 100) Then - ' HuboError = True - ' End If - ' Next - ' End If - - ' If CorrectoEmpresa Then - ' ObjEmpresa.Commit() - ' Alert("Se actualizaron los datos de la empresa", TipoMensaje.MsgInformacion) - ' Else - ' ObjEmpresa.RollBack() - ' Alert("Ocurrió un error al acualizar los datos de la empresa", TipoMensaje.MsgError) - ' End If - ' ObjEmpresa.Dispose() - ' End If - 'End Sub -#End Region - -End Class diff --git a/PyME/Sistemas/vssver2.scc b/PyME/Sistemas/vssver2.scc deleted file mode 100644 index 773e4fcfc3da90542fd4d8420e53a6f9ae75dedd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmXpJVq}mqTDqL8)7fqJ6IEskZRNHXz>#$WJ;k)B0MV<18*9UqwGBKRGccBfq#r zKcLdrRX;ehxFj_ Date: Tue, 14 Feb 2023 18:52:45 -0700 Subject: [PATCH 25/26] =?UTF-8?q?OI=20Circular=20implementaci=C3=B3n=20com?= =?UTF-8?q?pleta=20de=20todos=20los=20dropdowns=20con=20filtrado=20javascr?= =?UTF-8?q?ipt=20-Se=20modifica=20FiltrarTablaStrMulti=20para=20soportar?= =?UTF-8?q?=20datos=20tipo=20valor=20-1=20-La=20funci=C3=B3n=20FBColumn=20?= =?UTF-8?q?se=20mejora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/modExtensiones.vb | 39 ++++++++++++++++++++++++------------- OI/CircularDetalleB.aspx | 29 ++++++++++++--------------- OI/CircularDetalleB.aspx.cs | 24 +++++++++++------------ Scripts/custom.js | 4 ++-- 4 files changed, 50 insertions(+), 46 deletions(-) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 9f9cd4c4e..38efe79a1 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -24,8 +24,7 @@ Imports iText.Layout Imports iText.Html2pdf Imports iText.Html2pdf.Resolver.Font Imports iText.Layout.Properties -Imports Newtonsoft.Json - +Imports Newtonsoft.Json Namespace Extensiones #Region "E X T E N S I O N E S" @@ -1647,20 +1646,32 @@ Namespace Extensiones Public Function FBColumn(gv As GridView, name As String) As DataControlField - name = name.ToLower - For Each col As DataControlField In gv.Columns - If TypeOf col Is BoundField Then - Dim field As BoundField = CType(col, BoundField) - If field.DataField.ToLower = name OrElse field.SortExpression.ToLower = name OrElse field.HeaderText.Trim.ToLower = name Then - Return col + name = name.ToLower() + Dim headerCells As TableCellCollection = Nothing + If gv.Columns.Count > 0 Then + For i = 0 To gv.Columns.Count - 1 'Si las columnas son autogeneradas, el número de columnas siempre es 0 + Dim col = gv.Columns(i) + If TypeOf col Is BoundField Then + Dim field As BoundField = CType(col, BoundField) + If field.DataField.ToLower() = name OrElse field.SortExpression.ToLower() = name OrElse field.HeaderText.Trim().ToLower() = name Then + Return col + End If + Continue For + ElseIf TypeOf col Is HyperLinkField Then + Dim field As HyperLinkField = CType(col, HyperLinkField) + If field.DataTextField.ToLower() = name OrElse field.SortExpression.ToLower() = name OrElse field.HeaderText.Trim().ToLower() = name Then + Return col + End If + Continue For End If - ElseIf TypeOf col Is HyperLinkField Then - Dim field As HyperLinkField = CType(col, HyperLinkField) - If field.DataTextField.ToLower = name OrElse field.SortExpression.ToLower = name OrElse field.HeaderText.Trim.ToLower = name Then - Return col + If headerCells Is Nothing Then headerCells = gv.HeaderRow?.Cells + If headerCells IsNot Nothing Then + If headerCells(i).Text.Trim().ToLower() = name Then + Return col + End If End If - End If - Next + Next + End If Return Nothing End Function diff --git a/OI/CircularDetalleB.aspx b/OI/CircularDetalleB.aspx index cd5e17ab2..54b74f02c 100644 --- a/OI/CircularDetalleB.aspx +++ b/OI/CircularDetalleB.aspx @@ -234,7 +234,7 @@
    - @@ -247,18 +247,11 @@ - - - - - - - - Rol - - - - + + + + + @@ -348,13 +341,15 @@ //} function filtrarx() { //console.log('Entre 3') - //var filtro = sotext($("div[id^='C_DVModalFiltros'] select:first").attr("id")); - //console.log(filtro) - FiltrarTablaStrMulti('<%=GVUsuarios.ClientID %>', null, sotext('<%=DdlRoles.ClientID %>'), $('#TxtBusquedaCorreos').val()); + var filtros = $("div[id^='C_DVModalFiltros'] select").map(function () { + return soval(this.id); + }).get(); + //console.log(filtros) + FiltrarTablaStrMulti('<%=GVUsuarios.ClientID %>', null, $('#TxtBusquedaCorreos').val(), ...filtros); } function ADSBegin() { // loadeventos(); - // showhideUser() + // showhideUser(); } //inicializa tablas select2me etc etc..... function ADSReady() { diff --git a/OI/CircularDetalleB.aspx.cs b/OI/CircularDetalleB.aspx.cs index 9a363615b..4f8fb0736 100644 --- a/OI/CircularDetalleB.aspx.cs +++ b/OI/CircularDetalleB.aspx.cs @@ -157,39 +157,37 @@ public partial class OI_CircularDetalleB : ClsPaginas DVModalFiltrosProveedores.Visible = false; DVModalFiltrosPersonal.Visible = false; DVModalFiltrosCliente.Visible = false; + GVUsuarios.FBColumn("Rol").Visible = false; - switch (RLBTipoEnvioTipo.SelectedValue.ToEntero()) + + switch (RLBTipoEnvioTipo.SelectedValue.ToEntero()) { case 1: DVModalFiltrosUsuarios.Visible = true; - GVUsuarios.Columns[2].Visible = true; + GVUsuarios.FBColumn("Rol").Visible = true; intTipoConsulta = 1; break; case 2: DVModalFiltrosProveedores.Visible = true; - GVUsuarios.Columns[2].Visible = false; intTipoConsulta = 2; break; case 3: DVModalFiltrosPersonal.Visible = true; - GVUsuarios.Columns[2].Visible = false; intTipoConsulta = 3; break; case 4: DVModalFiltrosCliente.Visible = true; - GVUsuarios.Columns[2].Visible = false; intTipoConsulta = 4; break; default: DVModalFiltrosUsuarios.Visible = true; - GVUsuarios.Columns[2].Visible = true; + GVUsuarios.FBColumn("Rol").Visible = true; intTipoConsulta = 1; break; } ClsOIEventos ObjOI = new ClsOIEventos(); - - if (ObjOI.GetCircularCorreos(intTipoConsulta, UsuarioActual.CveEmpresa, -1, DdlSubProyecto.SelectedValue.ToEntero(), DdlCveClasificacionProveedor.SelectedValue.ToEntero(), DdlSubProyectoPersonal.SelectedValue.ToEntero(), DdlClasificacion.SelectedValue.ToEntero())) + if (ObjOI.GetCircularCorreos(intTipoConsulta, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1)) { if (ObjOI.DtResultados.Rows.Count >= 1000) @@ -220,7 +218,7 @@ public partial class OI_CircularDetalleB : ClsPaginas ObjOI.Dispose(); GVUsuarios.DataBind(); - UpModalSeleccionCorreos.Update(); + UpModalSeleccionCorreos.Update(); } protected void GVUsuarios_RowDataBound(object sender, GridViewRowEventArgs e) @@ -527,22 +525,22 @@ public partial class OI_CircularDetalleB : ClsPaginas protected void DdlSubProyecto_SelectedIndexChanged(object sender, EventArgs e) { - ConsultaCorreos(); + //ConsultaCorreos(); } protected void DdlCveClasificacionProveedor_SelectedIndexChanged(object sender, EventArgs e) { - ConsultaCorreos(); + //ConsultaCorreos(); } protected void DdlSubProyectoPersonal_SelectedIndexChanged(object sender, EventArgs e) { - ConsultaCorreos(); + //ConsultaCorreos(); } protected void DdlClasificacion_SelectedIndexChanged(object sender, EventArgs e) { - ConsultaCorreos(); + //ConsultaCorreos(); } protected void LnlActualizarCorreos_Click(object sender, EventArgs e) diff --git a/Scripts/custom.js b/Scripts/custom.js index c630cc62c..5790d58f4 100644 --- a/Scripts/custom.js +++ b/Scripts/custom.js @@ -90,7 +90,7 @@ function FiltrarTabla(idtxt, idtable, idcontador) { } function FiltrarTablaStr(str, idtable, idcontador) { - if (str == '' || str == 'Todos') { $('table#' + idtable + ' tr').css('display', ''); } + if (str == '' || str == "-1" || str == 'Todos') { $('table#' + idtable + ' tr').css('display', ''); } else { $('table#' + idtable + ' tr:not(.ADtr)').css('display', 'none'); $('table#' + idtable + ' tr:contains("' + str + '")').css('display', ''); @@ -106,7 +106,7 @@ function FiltrarTablaStrMulti(idtable, idcontador /*, str1, str2, str3...*/ ) { let strc = ''; for (let i = 2 /*a partir del 3er argumento obtiene los str*/; i < arguments.length; i++) { let str = arguments[i]; - if (str != '' && str != 'Todos') { + if (str != '' && str != "-1" && str != 'Todos') { strc += ':contains("' + str + '")'; } } From 209415285aa1103ae916bfa2e3ab29e39c28e10f Mon Sep 17 00:00:00 2001 From: MLopez Date: Tue, 14 Feb 2023 18:55:10 -0700 Subject: [PATCH 26/26] Corregir formato de fecha --- OI/Circular.aspx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OI/Circular.aspx b/OI/Circular.aspx index fc7c6ac03..485974134 100644 --- a/OI/Circular.aspx +++ b/OI/Circular.aspx @@ -73,7 +73,7 @@ - +