diff --git a/App_Code/ClsAF.vb b/App_Code/ClsAF.vb index f08a705e2..ee7e27b43 100644 --- a/App_Code/ClsAF.vb +++ b/App_Code/ClsAF.vb @@ -21,6 +21,7 @@ Public Class ClsAF Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIÓN Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region #Region "Propiedades" @@ -95,6 +96,7 @@ Public Class ClsAF Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -112,7 +114,7 @@ Public Class ClsAF #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index e451e5b44..46ca6341d 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -19,6 +19,7 @@ Public Class ClsAcumuladores Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIÓN Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False Private Sub SqlDataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) With SqlAdapter.SelectCommand @@ -62,6 +63,7 @@ Public Class ClsAcumuladores Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -70,7 +72,7 @@ Public Class ClsAcumuladores #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try SqlDataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index bada31574..64e685e71 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -26,6 +26,9 @@ Public Class ClsBancos 'Atributos de la clase Private disposedValue As Boolean = False ' Para detectar llamadas redundantes + 'CONTROL DE LA CONEXION + Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region @@ -50,8 +53,7 @@ Public Class ClsBancos Public Property FechaIngCancelacion As Date Public Property FechaCancelacion As Date - 'CONTROL DE LA CONEXION - Private CveConexion As Integer = 0 + #End Region #Region " P R O P I E D A D E S - B A N C O S - I E" @@ -189,6 +191,7 @@ Public Class ClsBancos Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlCommand = New SqlCommand("", SqlConexion) @@ -209,7 +212,7 @@ Public Class ClsBancos #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters @@ -4375,4 +4378,24 @@ Public Class ClsBancos End Try Return Retorno End Function + + Public Function GetBancosSAT() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Nom_Sat_BancosGet") + + 'With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + 'End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + + End Class diff --git a/App_Code/ClsCGame.vb b/App_Code/ClsCGame.vb index 80217ec28..417d972e9 100644 --- a/App_Code/ClsCGame.vb +++ b/App_Code/ClsCGame.vb @@ -19,6 +19,7 @@ Public Class ClsCGame Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIÓN Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False Public ReadOnly Property DtResultados() As DataTable Get @@ -54,6 +55,7 @@ Public Class ClsCGame Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -71,7 +73,7 @@ Public Class ClsCGame #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsClaseBase.vb b/App_Code/ClsClaseBase.vb index 47a302402..a51bde5ba 100644 --- a/App_Code/ClsClaseBase.vb +++ b/App_Code/ClsClaseBase.vb @@ -194,6 +194,10 @@ Public Class ClsClaseBase SqlAdapter.Dispose() End If + If DTSet IsNot Nothing Then + DTSet.Dispose() + End If + GC.SuppressFinalize(Me) End Sub diff --git a/App_Code/ClsClasificaciones.vb b/App_Code/ClsClasificaciones.vb index 212594b67..78f93277e 100644 --- a/App_Code/ClsClasificaciones.vb +++ b/App_Code/ClsClasificaciones.vb @@ -174,6 +174,26 @@ Public Class ClsClasificaciones OnError("Ocurrió un error al modificar la clasificación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try + Return Retorno + End Function + + Public Function RemoveClasificacionesComprobaciones(CveClasificacion As Integer, CveEmpresa As Integer, TipoComprobacion As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_ClasificacionesComprobacionesRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@TipoComprobacion", SqlDbType.Int).Value = TipoComprobacion + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al eliminar la clasificación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno End Function diff --git a/App_Code/ClsCompProveedores.vb b/App_Code/ClsCompProveedores.vb index bbbc1b8f1..813a15016 100644 --- a/App_Code/ClsCompProveedores.vb +++ b/App_Code/ClsCompProveedores.vb @@ -21,6 +21,7 @@ Public Class ClsCompProveedores Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIÓN Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region #Region "Propiedades" @@ -170,6 +171,7 @@ Public Class ClsCompProveedores Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -187,7 +189,7 @@ Public Class ClsCompProveedores #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index b7a1e8828..7f1873b42 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -22,6 +22,7 @@ Public Class ClsCompras Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region @@ -62,7 +63,8 @@ Public Class ClsCompras End Try Else SqlConexion = TransaccionCompartida.Connection - SqlTransacc = TransaccionCompartida + SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -83,7 +85,7 @@ Public Class ClsCompras #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index a56a6f108..33c02da87 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -25,6 +25,7 @@ Public Class ClsContabilidad Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False Public Property CvePrePolizaDetalle As Integer #End Region @@ -97,6 +98,7 @@ Public Class ClsContabilidad Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If Mensaje = New StringBuilder SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -115,7 +117,7 @@ Public Class ClsContabilidad #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters @@ -1120,14 +1122,12 @@ Public Class ClsContabilidad If Empresa.TipoContabilizacion = 1 Then ' contabilidad en SIG - Retorno = ContabilizaDesContabilizaPrePoliza(CvePrePoliza, True, Empresa.CveEmpresa) - If Retorno Then - Mensaje.Append(String.Format("{1}
", CvePrePoliza, _ContaFolio)) + If Retorno Then + Mensaje.Append(String.Format("{1}
", CvePrePoliza, _ContaFolio)) End If - Else If CvePrePoliza <= 0 Then Return False diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index 2efbc2f65..8d0ca08f7 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -18,6 +18,7 @@ Public Class ClsContratos Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region #Region "Propiedades" @@ -65,6 +66,7 @@ Public Class ClsContratos Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -85,7 +87,7 @@ Public Class ClsContratos #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsEdocumentacion.vb b/App_Code/ClsEdocumentacion.vb index b850d1078..8ca3b451f 100644 --- a/App_Code/ClsEdocumentacion.vb +++ b/App_Code/ClsEdocumentacion.vb @@ -19,6 +19,7 @@ Public Class ClsEdocumentacion Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False Private Sub SqlDataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) With SqlAdapter.SelectCommand @@ -56,6 +57,7 @@ Public Class ClsEdocumentacion Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -69,11 +71,11 @@ Public Class ClsEdocumentacion End With If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc Data = New DataTable - End Sub + End Sub #Region "Conexiones" - + Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsGPS.vb b/App_Code/ClsGPS.vb index 622a9de14..1488d68ff 100644 --- a/App_Code/ClsGPS.vb +++ b/App_Code/ClsGPS.vb @@ -22,7 +22,8 @@ Public Class ClsGPS Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS - Private CveConexion As Integer = 0 + Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False Public ReadOnly Property DtResultados() As DataTable Get @@ -61,6 +62,7 @@ Public Class ClsGPS Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -78,7 +80,7 @@ Public Class ClsGPS #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index b47b3d317..2db192a9c 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -18,9 +18,10 @@ Public Class ClsGenerales Private Data As DataTable Private disposedValue As Boolean = False 'REGISTRAR CONEXIONES ABIERTAS - Private CveConexion As Integer = 0 + Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region - + #Region "Propiedades" Public Property Colectiva As String Public Property Codigo As String @@ -73,7 +74,8 @@ Public Class ClsGenerales End Try Else SqlConexion = TransaccionCompartida.Connection - SqlTransacc = TransaccionCompartida + SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -91,7 +93,7 @@ Public Class ClsGenerales #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters @@ -1388,7 +1390,7 @@ Public Class ClsGenerales End Function Public Function AddCuentasDepositos(BancoNombre As String, Plaza As String, Sucursal As String, Cuenta As String, CLABE As String, CIE As String, SWIFT As String, Referencia As String, RefCrediProveedor As String, CveUsuario As Integer, CveMoneda As Integer, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveColectiva As Integer = -1, Optional CveUsuarioModifico As Integer = -1, - Optional Correo As String = "", Optional BBVAAlias As String = "-1") As Boolean + Optional Correo As String = "", Optional BBVAAlias As String = "-1", Optional EstatusPagoElectronico As Boolean = False, Optional EstatusPagoElectronicoGrupos As Boolean = False, Optional CveSATBanco As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_CuentasDepositosAdd") @@ -1412,6 +1414,9 @@ Public Class ClsGenerales .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico .Add("@Correo", SqlDbType.VarChar).Value = Correo .Add("@BBVAAlias", SqlDbType.VarChar).Value = BBVAAlias + .Add("@EstatusPagoElectronico", SqlDbType.Bit).Value = EstatusPagoElectronico + .Add("@EstatusPagoElectronicoGrupos", SqlDbType.Bit).Value = EstatusPagoElectronicoGrupos + .Add("@CveSATBanco", SqlDbType.Int).Value = CveSATBanco End With @@ -1454,7 +1459,9 @@ Public Class ClsGenerales Return Retorno End Function - Public Function UpdateCuentasDepositos(CveCuentaDeposito As Integer, BancoNombre As String, Plaza As String, Sucursal As String, Cuenta As String, CLABE As String, CIE As String, SWIFT As String, Referencia As String, RefCrediProveedor As String, Predeterminada As Boolean, Estatus As Boolean, CveMoneda As Integer, Optional CveUsuarioModifico As Integer = -1, Optional Correo As String = "", Optional BBVAAlias As String = "-1") As Boolean + Public Function UpdateCuentasDepositos(CveCuentaDeposito As Integer, BancoNombre As String, Plaza As String, Sucursal As String, Cuenta As String, CLABE As String, CIE As String, SWIFT As String, Referencia As String, + RefCrediProveedor As String, Predeterminada As Boolean, Estatus As Boolean, CveMoneda As Integer, Optional CveUsuarioModifico As Integer = -1, Optional Correo As String = "", + Optional BBVAAlias As String = "-1", Optional EstatusPagoElectronico As Boolean = False, Optional EstatusPagoElectronicoGrupos As Boolean = False, Optional CveSATBanco As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_CuentasDepositosUpdate") @@ -1477,6 +1484,9 @@ Public Class ClsGenerales .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico .Add("@Correo", SqlDbType.VarChar).Value = Correo .Add("@BBVAAlias", SqlDbType.VarChar).Value = BBVAAlias + .Add("@EstatusPagoElectronico", SqlDbType.Bit).Value = EstatusPagoElectronico + .Add("@EstatusPagoElectronicoGrupos", SqlDbType.Bit).Value = EstatusPagoElectronicoGrupos + .Add("@CveSATBanco", SqlDbType.Int).Value = CveSATBanco End With @@ -2659,11 +2669,12 @@ Public Class ClsGenerales End Try Return Retorno - End Function - + End Function + #Region "P A Q U E T E R I A S G U I A S" Public Function AddPaqueteriasGuias(CvePaqueteria As Integer, CvePaqueteriaGuiaTipo As Integer, CveEstatus As Integer, CveSubProyecto As Integer, Fecha As String, Rastreo As String, Guia As String, NumCajas As Integer, - Peso As Double, Dimensiones As String, FechaEstimada As String, Observaciones As String, CveUsuario As Integer, CveEmpresa As Integer, Optional ImplicaCosto As Boolean = True) As Integer + Peso As Double, Dimensiones As String, FechaEstimada As String, Observaciones As String, CveUsuario As Integer, CveEmpresa As Integer, Optional ImplicaCosto As Boolean = True, + Optional EsEntregaInterna As Boolean = False) As Integer Dim Retorno As Integer = -1 @@ -2689,6 +2700,8 @@ Public Class ClsGenerales .Add("@ImplicaCosto", SqlDbType.Bit).Value = IIf(ImplicaCosto = True, 1, 0) .Add("@CvePaqueteriaGuiaTipo", SqlDbType.SmallInt).Value = CvePaqueteriaGuiaTipo + .Add("@EsEntregaInterna", SqlDbType.Bit).Value = EsEntregaInterna + .Add("@CvePaqueteriaGuia", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -2709,7 +2722,9 @@ Public Class ClsGenerales Return Retorno End Function - Public Function GetPaqueteriasGuias(CvePaqueteriaGuia As Integer, CvePaqueteriaGuiaTipo As Integer, CvePaqueteria As Integer, CveEstatus As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Guia As String, FechaInicio As String, FechaFin As String, Optional FechaIngInicio As String = "-1", Optional FechaIngFin As String = "-1", Optional Filtro As Integer = -1) As Boolean + Public Function GetPaqueteriasGuias(CvePaqueteriaGuia As Integer, CvePaqueteriaGuiaTipo As Integer, CvePaqueteria As Integer, CveEstatus As Integer, CveSubProyecto As Integer, + CveEmpresa As Integer, Guia As String, FechaInicio As String, FechaFin As String, Optional FechaIngInicio As String = "-1", + Optional FechaIngFin As String = "-1", Optional Filtro As Integer = -1, Optional CveUsuarioEntrega As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -2728,6 +2743,7 @@ Public Class ClsGenerales .Add("@FechaIngInicio", SqlDbType.VarChar).Value = FechaIngInicio .Add("@FechaIngFin", SqlDbType.VarChar).Value = FechaIngFin .Add("@Filtro", SqlDbType.Int).Value = Filtro + .Add("@CveUsuarioEntrega", SqlDbType.Int).Value = CveUsuarioEntrega End With Try SqlAdapter.Fill(Data) @@ -2794,9 +2810,43 @@ Public Class ClsGenerales End Try Return Retorno - End Function -#End Region + End Function + + Public Function GetEntregasPorRealizar(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Gral_EntregasPorRealizarGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener entregas por realizar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function AsignarEntregasPorRealizar(CvePaqueteriaGuia As Integer, CvePersonal As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Gral_AsignarEntregasPorRealizar") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePaqueteriaGuia", SqlDbType.Int).Value = CvePaqueteriaGuia + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener entregas por realizar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + #Region "P A Q U E T E R I A S G U I A S D E T A L L E S" Public Function AddPaqueteriasGuiasDetalles(CvePaqueteriaGuia As Integer, CveVenta As Integer, CveOC As Integer, CveMovimiento As Integer, Optional CveCompra As Integer = -1) As Boolean diff --git a/App_Code/ClsGralFolios.vb b/App_Code/ClsGralFolios.vb index d65f873ba..2705071c7 100644 --- a/App_Code/ClsGralFolios.vb +++ b/App_Code/ClsGralFolios.vb @@ -34,6 +34,7 @@ Public Class ClsGralFolios Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region @@ -72,6 +73,7 @@ Public Class ClsGralFolios Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -90,7 +92,7 @@ Public Class ClsGralFolios #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index ffbec5e23..480d478ec 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -18,6 +18,7 @@ Public Class ClsInventarios Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region @@ -151,6 +152,7 @@ Public Class ClsInventarios Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -169,7 +171,7 @@ Public Class ClsInventarios #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters @@ -1145,12 +1147,6 @@ Public Class ClsInventarios End With Try SqlAdapter.Fill(Data) - - If Data IsNot Nothing AndAlso Data.Rows.Count >= 1 Then - Dim dr As DataRow = Data.Rows(0) - CveSeccion = dr("CveSeccionAlmacen").ToString.ToEntero - End If - Retorno = True Catch ex As Exception OnError("Ocurrió un error al obtener los movimientos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) @@ -2902,28 +2898,28 @@ Public Class ClsInventarios Return Retorno End Function - Public Function LoteBatchFechaCaducidadGet(CvePS As Integer, Lote As String, Batch As String, CveEmpresa As Integer, Optional CveAlmacen As Integer = -1) As Boolean - Dim Retorno As Boolean = False + 'Public Function LoteBatchFechaCaducidadGet(CvePS As Integer, Lote As String, Batch As String, CveEmpresa As Integer, Optional CveAlmacen As Integer = -1) As Boolean + ' Dim Retorno As Boolean = False - DataAdapter("PA_Inv_LoteBatchFechaCaducidadGet") + ' DataAdapter("PA_Inv_LoteBatchFechaCaducidadGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@Lote", SqlDbType.VarChar).Value = Lote - .Add("@Batch", SqlDbType.VarChar).Value = Batch - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen - End With + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CvePS", SqlDbType.Int).Value = CvePS + ' .Add("@Lote", SqlDbType.VarChar).Value = Lote + ' .Add("@Batch", SqlDbType.VarChar).Value = Batch + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + ' End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener la Fecha Caducidad del Lote-Batch.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener la Fecha Caducidad del Lote-Batch.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try - Return Retorno - End Function + ' Return Retorno + 'End Function Public Function ActualizarEsDevolucionVenta(CveVenta As Integer, Valor As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("Vta_UpdateDevolucionVenta") @@ -2942,6 +2938,24 @@ Public Class ClsInventarios Return Retorno End Function + Public Function UpdateEstatusAlmacen(CveVentaDetalle As Integer, Valor As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("Vta_UpdateDevolucionVentaDetalle") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle + .Add("@Valor", SqlDbType.Int).Value = Valor + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la devolucion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function LimpiaEntregaDirecta(CveMovimiento As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_LimpiaEntregaDirecta") @@ -3062,6 +3076,24 @@ Public Class ClsInventarios Return Retorno End Function + Public Function GetSaldoVentaDetalle(CveVenta As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentaDetalleSaldo") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener datos de almacen por detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function GetMovimientosDevoluciones(CveVenta As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentaDetalleAlmacenDevolucion") diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb index ba3ba2c77..cf460fdab 100644 --- a/App_Code/ClsOC.vb +++ b/App_Code/ClsOC.vb @@ -18,6 +18,7 @@ Public Class ClsOC Private disposedValue As Boolean = False 'PARA REGISTRAR CONEXION Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region @@ -163,6 +164,7 @@ Public Class ClsOC Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlCommand = New SqlCommand("", SqlConexion) @@ -182,7 +184,7 @@ Public Class ClsOC #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index d8084033f..551593b30 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -75,6 +75,8 @@ Public Class ClsOIEventos Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'PARA REGISTRAR CONEXION Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False + #End Region #Region "Propiedades" @@ -164,6 +166,7 @@ Public Class ClsOIEventos Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlCommand = New SqlCommand("", SqlConexion) @@ -183,7 +186,7 @@ Public Class ClsOIEventos #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 01b7122ee..fd1b013bf 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -851,14 +851,7 @@ Public Class ClsPaginas Application("GlobalDTLeyendasFiscales") = value End Set End Property - Property GlobalDTFolios() As DataTable - Get - GlobalDTFolios = DirectCast(Application("GlobalDTFolios"), DataTable) - End Get - Set(value As DataTable) - Application("GlobalDTFolios") = value - End Set - End Property + Property GlobalDTEstatusFactura() As DataTable Get GlobalDTEstatusFactura = DirectCast(Application("GlobalDTEstatusFactura"), DataTable) @@ -4275,6 +4268,7 @@ Public Class ClsPaginas PaginaDict.Add("/General/CatRinTamanios.aspx".ToUpper(), 711) PaginaDict.Add("/General/CatMedidas.aspx".ToUpper(), 712) PaginaDict.Add("/General/CatSatListado69B.aspx".ToUpper, 1038) + PaginaDict.Add("/General/PopUpPaqueteriasGuiasInternas.aspx".ToUpper(), 727) #End Region #Region "GPS" @@ -4404,6 +4398,7 @@ Public Class ClsPaginas PaginaDict.Add("/Inventarios/RepTraspasoEmitido.aspx".ToUpper(), 891) PaginaDict.Add("/Inventarios/AjustesSeccionAlmacen.aspx".ToUpper(), 892) PaginaDict.Add("/Inventarios/RepTraspasoAlmacen.aspx".ToUpper(), 688) + PaginaDict.Add("/Inventarios/EntregasPorRealizar.aspx".ToUpper(), 728) #End Region #Region "MF" diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index 7a8561d47..4160a2279 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -20,7 +20,7 @@ Public Class ClsProductosServicios Private disposedValue As Boolean = False 'PARA REGISTRAR CONEXION Private CveConexion As Integer = 0 - + Private EsTransaccionCompartida As Boolean = False #End Region #Region "Propiedades" @@ -152,6 +152,7 @@ Public Class ClsProductosServicios Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -169,7 +170,7 @@ Public Class ClsProductosServicios #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try @@ -1837,9 +1838,47 @@ Public Class ClsProductosServicios End Try Return Retorno - End Function -#End Region + End Function + Public Function GetPSExistenciasWS(CvePS As Integer, CvePrecioLista As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, + CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional CveTipoAlmacen As Integer = -1, Optional CveSubProyecto As Integer = -1, + Optional FechaMovto As String = "-1", Optional Serie As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, + Optional ExcluyeAdelantado As Integer = -1, Optional PendientePorSurtir As Integer = -1, Optional Lote As String = "-1", Optional Batch As String = "-1", + Optional ExcluyeApartados As Integer = 1, Optional RestringirAlmacenes As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProductosExistenciasWSGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@CveUnidadMedida", SqlDbType.Int).Value = CveUnidadMedida + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen + .Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@FechaMovto", SqlDbType.DateTime).Value = DateTime.ParseExact(FechaMovto, "yyyy/MM/dd HH:mm", Nothing) + .Add("@Serie", SqlDbType.VarChar).Value = Serie + .Add("@Lote", SqlDbType.VarChar).Value = Lote + .Add("@Batch", SqlDbType.VarChar).Value = Batch + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@ExcluyeAdelantado", SqlDbType.Int).Value = ExcluyeAdelantado + .Add("@PendientePorSurtir", SqlDbType.Int).Value = PendientePorSurtir + .Add("@ExcluyeApartados", SqlDbType.Int).Value = ExcluyeApartados + .Add("@RestringirAlmacenes", SqlDbType.Int).Value = RestringirAlmacenes + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las productos y sus existencias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + #Region "Porcentaje Productos" Public Function GetPorcentajeProductos(CveCliente As Integer) As Boolean Dim Retorno As Boolean = False @@ -2042,6 +2081,7 @@ Public Class ClsProductosServicios ' This code added by Visual Basic to correctly implement the disposable pattern. Public Sub Dispose() Implements IDisposable.Dispose ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. + ConexionClose() Dispose(True) GC.SuppressFinalize(Me) End Sub diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index 09d4cb16a..f0223a50f 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -50,20 +50,27 @@ Public Class ClsRH Get DSResultados = DSet End Get - End Property - + End Property + #End Region - Sub New() - SqlConexion = New SqlConnection - SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString - SqlAdapter = New SqlDataAdapter("", SqlConexion) - Try - SqlConexion.Open() - ConexionAdd() - Catch ex As Exception - OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) - End Try - + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) + + If TransaccionCompartida Is Nothing Then + SqlConexion = New SqlConnection + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + Try + SqlConexion.Open() + Catch ex As Exception + OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) + End Try + Else + SqlConexion = TransaccionCompartida.Connection + SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True + End If + + SqlAdapter = New SqlDataAdapter("", SqlConexion) + ConexionAdd() End Sub Private Sub DataAdapter(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) With SqlAdapter.SelectCommand @@ -73,21 +80,23 @@ Public Class ClsRH End With Data = New DataTable End Sub - Private CveConexion As Integer = 0 - + Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False + + #Region "Conexiones" - + Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then - - 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo - - Try - DataAdapter("PA_Sis_RegistrarConexion") - With SqlAdapter.SelectCommand.Parameters - .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name - .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) - .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + + 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo + + Try + DataAdapter("PA_Sis_RegistrarConexion") + With SqlAdapter.SelectCommand.Parameters + .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name + .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) + .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output End With SqlAdapter.Fill(Data) CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero @@ -95,6 +104,7 @@ Public Class ClsRH OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try + End If End Sub diff --git a/App_Code/ClsSAT.vb b/App_Code/ClsSAT.vb index abc93de5a..b5592d9d8 100644 --- a/App_Code/ClsSAT.vb +++ b/App_Code/ClsSAT.vb @@ -32,6 +32,7 @@ Public Class ClsSAT Private ContListado69B As Integer = 0 'PARA REGISTRAR CONEXION Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region #Region "Propiedades" @@ -76,6 +77,7 @@ Public Class ClsSAT Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) @@ -95,7 +97,7 @@ Public Class ClsSAT #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo diff --git a/App_Code/ClsSisNotificaciones.vb b/App_Code/ClsSisNotificaciones.vb index c914aa79e..79b05c132 100644 --- a/App_Code/ClsSisNotificaciones.vb +++ b/App_Code/ClsSisNotificaciones.vb @@ -2041,12 +2041,16 @@ Public Class ClsSisNotificaciones Using wc As New HttpClient() Try - Dim Url = New Uri($"{ClsPaginas.UrlDirecciones}nominatim/reverseMultiple.php") + Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones)) Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array) Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded") Dim response = wc.PostAsync(Url, content).Result Dim result = response.Content.ReadAsStringAsync().Result retorno = JArray.Parse(result) + response.Dispose() + content = Nothing + Url = Nothing + FormStuff = Nothing Catch ex As Exception OnError("Ocurrió un error al obtener las direcciones", ex) End Try diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index efc1d2d3f..109597599 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -22,6 +22,8 @@ Public Class ClsVentas 'Atributos de la clase Private disposedValue As Boolean = False ' Para detectar llamadas redundantes + Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region @@ -75,7 +77,7 @@ Public Class ClsVentas Public Sub RollBack() SqlTransacc.Rollback() End Sub - Private CveConexion As Integer = 0 + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) If TransaccionCompartida Is Nothing Then @@ -89,6 +91,7 @@ Public Class ClsVentas Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlAdapter = New SqlDataAdapter("", SqlConexion) ConexionAdd() @@ -107,7 +110,7 @@ Public Class ClsVentas #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters @@ -740,11 +743,13 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CvePAC", SqlDbType.SmallInt).Value = CvePAC .Add("@CveEstatusRefacturacion", SqlDbType.TinyInt).Value = CveEstatusRefacturacion + .Add("@Cancelada", SqlDbType.SmallInt).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - Retorno = True + Retorno = If(SqlAdapter.SelectCommand.Parameters("@Cancelada").Value.ToString.ToEntero = 1, True, False) + Catch ex As Exception OnError("Ocurrió un error al Guardar el estatus de cancelacion Factura.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try diff --git a/App_Code/ClsVtaVendedores.vb b/App_Code/ClsVtaVendedores.vb index e76734c7f..6949554e1 100644 --- a/App_Code/ClsVtaVendedores.vb +++ b/App_Code/ClsVtaVendedores.vb @@ -15,6 +15,7 @@ Public Class ClsVtaVendedores Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'PARA REGISTRAR CONEXION Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False #End Region #Region "Propiedades" @@ -51,6 +52,7 @@ Public Class ClsVtaVendedores Else SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True End If SqlCommand = New SqlCommand("", SqlConexion) @@ -70,7 +72,7 @@ Public Class ClsVtaVendedores #Region "Conexiones" Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try DataAdapter("PA_Sis_RegistrarConexion") With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index eb2eea490..07f8fecbf 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -3201,12 +3201,12 @@ Namespace Modelos End If 'Factura - If Not ObjEventos.AddEventoBitacora($"Sustituye a: Folio Factura", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then + If Not ObjEventos.AddEventoBitacora($"Remisión facturada: Folio Factura", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then ErrorPrepoliza = True End If 'Remision - If Not ObjEventos.AddEventoBitacora($"Refacturacion en: {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then + If Not ObjEventos.AddEventoBitacora($"Facturación de remisión en: {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then ErrorPrepoliza = True End If @@ -4260,9 +4260,27 @@ Namespace Modelos 'BITACORA, SOLICITUD DE CANCELACION If CveEstatus > 0 AndAlso CveEstatusFacturaAsignado <= 0 Then + + Dim msgBitacora As String = "Solicitud de cancelación de factura" + If EsRefacturacion Then + msgBitacora = "Solicitud de cancelación por refacturación" + End If + Dim ObjE As New ClsOIEventos() - ObjE.AddEventoBitacora("Solicitud de cancelación de factura", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) + ObjE.AddEventoBitacora(msgBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) ObjE.Dispose() + Else + + If CveEstatus = 5 Then + Dim ObjE As New ClsOIEventos() + ObjE.AddEventoBitacora("La cancelación de la factura fue aceptada en el SAT", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) + ObjE.Dispose() + ElseIf CveEstatus = 4 Then + Dim ObjE As New ClsOIEventos() + ObjE.AddEventoBitacora("No se pudo comprobar el estatus de factura ante el SAT, solo sera cancelada en el sistema", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) + ObjE.Dispose() + End If + End If 'SI ES CANCELACION EN PROCESO CANCELA EL PROCESO DE LAS REMISIONES @@ -4553,35 +4571,39 @@ Namespace Modelos Next - 'VERIFICA LOS MOVIMIENTOS DE DEVOLUCION YA GENERADOS QUE TENGAN EXISTENCIA EN (ENTREGA POR ADELANTADO) - If Not ErrorCancelar Then - If ObjInventario.GetMovimientosDevoluciones(CveVenta, UsuarioActual.CveEmpresa) Then - DtDevoluciones = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10") - Else - ErrorCancelar = True - MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar." - End If - End If - 'SI EXISTEN HAY EXISTENCIA EN (ENTREGA POR ADELANTADO) SE TIENE QUE REGRESAR AL ALMACEN GENERAL If Not ErrorCancelar AndAlso ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 Then - For Each CveRemision As Integer In ListaRemisionesCancelar - Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}") - Dim RowDevolucion As DataRow = DtDevRemision.FiltraParametros("", DistinctColumns:={"CveRemision", "CveAlmacen", "CveAlmacenDestino"}).Rows(0) - - CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero() - CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero() - - 'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN GENERAL - If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision, ObjVentas, ObjInventario) Then + 'VERIFICA LOS MOVIMIENTOS DE DEVOLUCION YA GENERADOS QUE TENGAN EXISTENCIA EN (ENTREGA POR ADELANTADO) + If Not ErrorCancelar Then + If ObjInventario.GetMovimientosDevoluciones(CveVenta, UsuarioActual.CveEmpresa) Then + DtDevoluciones = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10") + Else ErrorCancelar = True - MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión." - Exit For + MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar." End If + End If + + 'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN GENERAL + If Not ErrorCancelar AndAlso DtDevoluciones IsNot Nothing Then + For Each CveRemision As Integer In ListaRemisionesCancelar + Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}") + + Dim RowDevolucion As DataRow = DtDevRemision.FiltraParametros("", DistinctColumns:={"CveRemision", "CveAlmacen", "CveAlmacenDestino"}).Rows(0) + + CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero() + CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero() + + If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision, ObjVentas, ObjInventario) Then + ErrorCancelar = True + MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión." + Exit For + End If + Next + Else + ErrorCancelar = True + End If - DtDevRemision.Dispose() - Next End If 'VERIFICAR MOVIMIENTOS DE APARTADOS @@ -6662,14 +6684,6 @@ Namespace Modelos HttpContext.Current.Application("GlobalDTLeyendasFiscales") = value End Set End Property - Property GlobalDTFolios() As DataTable - Get - GlobalDTFolios = DirectCast(HttpContext.Current.Application("GlobalDTFolios"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTFolios") = value - End Set - End Property Property GlobalDTEstatusFactura() As DataTable Get GlobalDTEstatusFactura = DirectCast(HttpContext.Current.Application("GlobalDTEstatusFactura"), DataTable) diff --git a/App_Code/Usuario.vb b/App_Code/Usuario.vb index 55dc738c9..93fc805d2 100644 --- a/App_Code/Usuario.vb +++ b/App_Code/Usuario.vb @@ -247,6 +247,7 @@ Namespace ADSSession Dim resultado As String = "" Try + Dim request As Net.HttpWebRequest = CType(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest) request.Timeout = maxTimeMilliseconds request.Method = "POST" @@ -263,10 +264,15 @@ Namespace ADSSession End Using End Using - Dim response As Net.WebResponse = CType(request.GetResponse(), Net.WebResponse) - Dim sr As IO.StreamReader = New IO.StreamReader(response.GetResponseStream()) - resultado = sr.ReadToEnd() - sr.Close() + Using response As Net.WebResponse = CType(request.GetResponse(), Net.WebResponse) + Using sr As IO.StreamReader = New IO.StreamReader(response.GetResponseStream()) + + resultado = sr.ReadToEnd() + sr.Close() + End Using + + End Using + request = Nothing Catch ex As Exception 'Extenciones.ApplicationParameter.GuardaLogEx(ex, $"SOAPAction : {SOAPAction} XML : {xml}") End Try diff --git a/Ashx/SIGFacturacion.ashx b/Ashx/SIGFacturacion.ashx index 461d85c62..c1e46ead0 100644 --- a/Ashx/SIGFacturacion.ashx +++ b/Ashx/SIGFacturacion.ashx @@ -1,5 +1,5 @@ -<%@ WebHandler Language="VB" Class="SIGFacturacion" %> - +<%@ WebHandler Language="VB" Class="SIGFacturacion" %> + Imports System Imports System.Web Imports System.Net.Http @@ -212,8 +212,8 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState json.Add(New JProperty("Almacen", ObsInv.ToString())) Return json - End Function - + End Function + #Region "V A L I D A - D A T O S" Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario Dim UsuarioActual As Usuario = Nothing @@ -247,8 +247,8 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState UsuarioActual.Empresa = ObjEmpresa.Empresa End If ObjEmpresa.Dispose() - End Sub - + End Sub + #End Region #Region "D E F I N I R - O B J E T O S" Private Function CreaFactura(Resp As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, DTRemisionesPS As DataTable, CveCliente As Integer, CveSubProyecto As Integer, CveMoneda As Integer, DatosRemisiones As JObject, FechaI As DateTime, FechaF As DateTime) As Modelos.Factura @@ -750,7 +750,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState 'RECARGAR GV Return Row - End Function + End Function #End Region #Region "E N V I O - C O R R E O" Private Sub EnviarCorreo(Objfactura As Modelos.Factura, UsuarioActual As Usuario) @@ -894,9 +894,9 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState End If End Try End If - End Sub + End Sub #End Region - + Public Sub GuardaLogFacturacion(Str As String) Dim ArchivoW As StreamWriter Dim strLineaTMP As String @@ -919,8 +919,8 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState ArchivoW.Close() ArchivoW.Dispose() - End Sub - + End Sub + #Region "G L O B A L - D T" Public Property GlobalTipoCambio(Optional Fecha As Date = MinFecha) As Double Get @@ -1105,10 +1105,10 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTPSATPS") = value End Set - End Property - + End Property + #Region "GLOBALES DE SAT COMERCIO EXTERIOR" - + Property GlobalDTClavePedimento() As DataTable Get GlobalDTClavePedimento = DirectCast(HttpContext.Current.Application("GlobalDTClavePedimento"), DataTable) @@ -1218,10 +1218,10 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTColonia") = value End Set - End Property - + End Property + #End Region - + Property GlobalDTPSATUM() As DataTable Get GlobalDTPSATUM = DirectCast(HttpContext.Current.Application("GlobalDTPSATUM"), DataTable) @@ -1605,15 +1605,8 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTLeyendasFiscales") = value End Set - End Property - Property GlobalDTFolios() As DataTable - Get - GlobalDTFolios = DirectCast(HttpContext.Current.Application("GlobalDTFolios"), DataTable) - End Get - Set(value As DataTable) - HttpContext.Current.Application("GlobalDTFolios") = value - End Set - End Property + End Property + Property GlobalDTEstatusFactura() As DataTable Get GlobalDTEstatusFactura = DirectCast(HttpContext.Current.Application("GlobalDTEstatusFactura"), DataTable) @@ -1657,44 +1650,38 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState HttpContext.Current.Application("GlobalDTProyectos") = value End Set End Property - 'Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable - ' Get - - ' If DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable).Rows.Count = 0) Then - ' Dim P As New ClsSubProyectos - ' If P.GetSubProyectos Then - ' HttpContext.Current.Application("GlobalDTSubProyectos") = P.DtResultados - ' End If - ' P.Dispose() - - ' Dim msg As String = "aqui no se carga subproyectos" - - ' End If - - ' If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then - ' Dim StrSQL As New StringBuilder - ' If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - ' If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) - ' If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) - ' If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - - ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - ' GlobalDTSubProyectos = Dv.ToTable - ' Dv.Dispose() - - ' Else - ' GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application("GlobalDTSubProyectos"), DataTable) - ' End If - - ' End Get - ' Set(ByVal value As DataTable) - ' If value Is Nothing OrElse value.Rows.Count = 0 Then - ' Dim msg As String = "aqui no se carga subproyectos" - - ' End If - ' HttpContext.Current.Application("GlobalDTSubProyectos") = value - ' End Set - 'End Property + Public Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Or (DirectCast(HttpContext.Current.Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(HttpContext.Current.Application(AppNombre), DataTable).Rows.Count = 0) Then + Dim P As New ClsSubProyectos + If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then HttpContext.Current.Application(AppNombre) = P.DtResultados + P.Dispose() + + End If + + If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then + Dim StrSQL As New StringBuilder + If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) + If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) + If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) + If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) + + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + GlobalDTSubProyectos = Dv.ToTable + Dv.Dispose() + + Else + GlobalDTSubProyectos = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) + End If + + End Get + Set(ByVal value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value + End Set + End Property Property GlobalDTSubProyectosUsuarios(CveUsuario As Integer, CveProyecto As Integer, CveEmpresa As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEstatus As Integer = -1) As DataTable Get @@ -2360,9 +2347,9 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTVtaCobranzaEstatus") = value End Set - End Property - - + End Property + + #Region "***********************************************************************DT EVENTOS****************************************************************************************" Property GlobalDTTiposEventos() As DataTable Get @@ -2398,9 +2385,9 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTOIEstatusEventos") = value End Set - End Property + End Property #End Region - + #Region " **********************************************************************DT PROSPECTOS*************************************************************************************" Property GlobalDTProspectosCaracteristicasClasificaciones() As DataTable Get @@ -2441,9 +2428,9 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTProspectosCaracteristicasOpciones") = value End Set - End Property + End Property #End Region - + #Region "***********************************************************************DT ACTIVOS FIJOS**********************************************************************************" Property GlobalDTActivoFijos(CveEmpresa As Integer, Optional CveSubTipoActivoFijo As Integer = -1, Optional CveActivoFijo As Integer = -1) As DataTable Get @@ -2536,10 +2523,10 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTTipoActivoFijo") = value End Set - End Property - + End Property + #End Region - + #Region "***********************************************************************DT GENERALES**************************************************************************************" Property GlobalDTGralPaises() As DataTable Get @@ -2627,10 +2614,10 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTGralColectivas") = value End Set - End Property - + End Property + #End Region - + #Region "***********************************************************************DT PROSPECTOS*************************************************************************************" Property GlobalDTProspectosSupervisores(CveEmpresa As Integer) As DataTable Get @@ -2839,8 +2826,8 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTProspectosTipos") = value End Set - End Property - + End Property + #Region " DT PROSPECTOS SOLICITUDES" Property GlobalDTProspectosSolicitudes(CveEmpresa As Integer) As DataTable Get @@ -2907,15 +2894,15 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTProspectosSolicitudesApoyos") = value End Set - End Property - + End Property + #End Region #End Region - + #Region "**********************************************DT AMORTIZACIÓN CONTABLE PLAN DE DESARROLLO********************************************************************************" - + #Region "***********************************************************************DT AMORTIZACIÓN CONTABLE*********************************************************************************************" - + Property GlobalDTAC_RubrosIngreso() As DataTable Get GlobalDTAC_RubrosIngreso = DirectCast(HttpContext.Current.Application("GlobalDTAC_RubrosIngreso"), DataTable) @@ -3171,11 +3158,11 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTAC_MatrizEgresos") = value End Set - End Property - - + End Property + + #End Region - + Property GlobalDTAC_PD_EjeRector(CveEmpresa As Integer) As DataTable Get If CveEmpresa <> -1 Then @@ -3254,9 +3241,9 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTAC_PD_Metas") = value End Set - End Property + End Property #End Region - + #Region "***********************************************************************GLOBAL DT ORDENES DE COMPRA***********************************************************************" Property GlobalDTOCEstatus(CveEmpresa As Integer) As DataTable Get @@ -3293,11 +3280,11 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTOCEstatusUsuarios") = value End Set - End Property - - + End Property + + #End Region - + #Region "F I N A N Z A S " Property GlobalDTFinan_RazonesFinancieras() As DataTable Get @@ -3306,10 +3293,10 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTFinan_RazonesFinancieras") = value End Set - End Property + End Property #End Region - - + + #Region "***********************************************************************GLOBAL DT CONTABILIDAD****************************************************************************" Property GlobalDTContaPlantillasPolizas(CveEmpresa As Integer, Optional TipoPlantilla As Integer = -1) As DataTable Get @@ -3363,9 +3350,9 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTContaConceptosContables") = value End Set - End Property + End Property #End Region - + #Region "**********************************************************************GLOBAL DT RH (RECURSOS HUMANOS)********************************************************************" Property GlobalDTAsistenciaDetalle() As DataTable Get @@ -3517,13 +3504,13 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTTipoBuzon") = value End Set - End Property + End Property #End Region - + #Region "*********** D T - C O M B U S T I B L E S ***********" - - - + + + Property GlobalDTCombustibles(CveEmpresa As Integer) As DataTable Get If CveEmpresa <> -1 Then @@ -3562,11 +3549,11 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(ByVal value As DataTable) HttpContext.Current.Application("GlobalDTCombustiblesTipos") = value End Set - End Property + End Property #End Region - + #Region "*********** D T - M A N T E N I M I E N T O S ***********" - + Property GlobalDTMantenimientosTipos() As DataTable Get GlobalDTMantenimientosTipos = DirectCast(HttpContext.Current.Application("GlobalDTMantenimientosTipos"), DataTable) @@ -3605,13 +3592,13 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState HttpContext.Current.Application("GlobalDTMantenimientosTipos") = value End Set - End Property - + End Property + #End Region - - + + #Region "*********** D T - T A L L E R E S ***********" - + Property GlobalDTTalleresTipos() As DataTable Get GlobalDTTalleresTipos = DirectCast(HttpContext.Current.Application("GlobalDTTalleresTipos"), DataTable) @@ -3628,12 +3615,12 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTTalleres") = value End Set - End Property - + End Property + #End Region - + #Region "*********** D T - D I S T R I B U I D O R E S ***********" - + Property GlobalDTDistribuidoresTipos() As DataTable Get GlobalDTDistribuidoresTipos = DirectCast(HttpContext.Current.Application("GlobalDTDistribuidoresTipos"), DataTable) @@ -3650,11 +3637,11 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTDistribuidores") = value End Set - End Property - + End Property + #End Region - - + + Property GlobalDTOIRevision(CveEmpresa As Integer) As DataTable Get If CveEmpresa <> -1 Then @@ -3745,8 +3732,8 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Set(value As DataTable) HttpContext.Current.Application("GlobalDTPaqueterias") = value End Set - End Property - + End Property + #End Region - + End Class \ No newline at end of file diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index ff6662eda..832d3c44e 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -96,7 +96,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Retorno = 200 End If ObjConta.Dispose() - + Empresa = Nothing 'context.Response.Write(CveUsuario.ToString()) context.Response.StatusCode = Retorno End Sub @@ -114,7 +114,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState context.Response.WriteFile(FileInfo.FullName) context.Response.End() End If - + FileInfo = Nothing + Url = "" End If End Sub @@ -127,6 +128,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState savepath = context.Server.MapPath(tempPath) Dim nombre As String = String.Format("{0}\{1}", savepath, context.Request("nombre")) File.Delete(nombre) + tempPath = "" + savepath = "" context.Response.StatusCode = 200 End Sub @@ -149,16 +152,18 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState If copyFile <> "" Then Dim ext As Integer = copyFile.IndexOf(","c) + 1 - Dim extncion As String = copyFile.Substring(5, ext - 5) - If extncion.Contains("image/") Then extncion = extncion.Replace("image/", "").Replace(";base64,", "") + Dim extension As String = copyFile.Substring(5, ext - 5) + If extension.Contains("image/") Then extension = extension.Replace("image/", "").Replace(";base64,", "") 'Dim extncion As String = - filename = String.Format("{0}-{1}.{2}", tick, Cve, extncion) + filename = String.Format("{0}-{1}.{2}", tick, Cve, extension) Dim msf As New MemoryStream(Convert.FromBase64String(copyFile.Substring(ext))) Dim stem As Stream = New FileStream(String.Format("{0}\{1}", savepath, filename), FileMode.Create) msf.WriteTo(stem) msf.Close() stem.Close() + msf.Dispose() + stem.Dispose() End If Else @@ -166,10 +171,13 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState postedFile = context.Request.Files(0) filename = String.Format("{0}-{1}", tick, postedFile.FileName) - postedFile.SaveAs((savepath & "\") + filename) + postedFile.SaveAs(String.Format("{0}\{1}", savepath, filename)) End If context.Response.Write(tick) context.Response.StatusCode = 200 + savepath = "" + tempPath = "" : filename = "" + postedFile = Nothing End Sub #End Region @@ -206,9 +214,9 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState 'End If 'ObjClientes.Dispose() - Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") + Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - DtRetorno = dt.FiltraParametros($"NombreComercial like '%{Name}%' OR Nombre like '%{Name}%' ") + DtRetorno = dt.FiltraParametros(String.Format("NombreComercial like '%{0}%' OR Nombre like '%{0}%' ", Name)) End If dt.Dispose() End If @@ -254,9 +262,9 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ' DtRetorno = ObjProveedores.DtResultados 'End If 'ObjProveedores.Dispose() - Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") + Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - DtRetorno = dt.FiltraParametros($"NombreCortoProveedor like '%{Name}%'") + DtRetorno = dt.FiltraParametros(String.Format("NombreCortoProveedor like '%{0}%'", Name)) End If dt.Dispose() End If @@ -321,6 +329,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Else context.Response.Write("[]") End If + DtPSRetorno.Dispose() Return retorno End Function @@ -485,9 +494,9 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState If usuario.TienePermisoProceso(300) And usuario.TienePermisoProceso(301) Then DTClasificacionesComprobaciones = ObjClasificaciones.DtResultados - ElseIf usuario.TienePermisoProceso(300) Then 'TipoComprobacion 1 Biaticos + ElseIf usuario.TienePermisoProceso(300) Then 'TipoComprobacion 1 Viaticos DTClasificacionesComprobaciones = ObjClasificaciones.DtResultados.FiltraParametros("TipoComprobacion = 1") - Else 'TipoComprobacion 2 Compreobacines + Else 'TipoComprobacion 2 caja chica DTClasificacionesComprobaciones = ObjClasificaciones.DtResultados.FiltraParametros("TipoComprobacion = 2") End If @@ -515,6 +524,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState 'no regresar datos herror al consultar DtPSRetorno.Clear() End If + DTTmp.Dispose() + ObjClasificaciones.Dispose() End If @@ -556,7 +567,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState #Region "Funciones" Public Function GetJson(ByVal dt As DataTable) As String - + Dim Retorno As String = "" Dim serializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer() Dim rows As New List(Of Dictionary(Of String, Object)) Dim row As Dictionary(Of String, Object) @@ -568,7 +579,11 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Next rows.Add(row) Next - Return serializer.Serialize(rows) + If dt IsNot Nothing Then dt.Dispose() + Retorno = serializer.Serialize(rows) + rows = Nothing + serializer = Nothing + Return Retorno End Function ReadOnly Property UsuarioActual(ByVal context As HttpContext) As Usuario Get @@ -631,6 +646,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState DtPSRetorno.Columns("ClaveNombre").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtPSRetorno).ToString context.Response.Write(retorno) + DtPSRetorno.Dispose() Else context.Response.Write("[]") End If @@ -738,6 +754,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Catch ex As Exception DtPSRetorno = Nothing End Try + DTPS = Nothing + End If End If @@ -745,6 +763,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState DtPSRetorno.Columns("CvePS").ColumnName = "id" DtPSRetorno.Columns("PSCodigo").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtPSRetorno).ToString + DtPSRetorno.Dispose() context.Response.Write(retorno) Else context.Response.Write("[]") @@ -795,6 +814,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState DtRetorno.Columns("CvePersonal").ColumnName = "id" DtRetorno.Columns("NombreCompleto").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtRetorno).ToString + DtRetorno.Dispose() context.Response.Write(retorno) Else context.Response.Write("[]") diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index b27cfb067..c877371bc 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -707,6 +707,7 @@ Partial Class Bancos_IE Dim ObjIE2 As New ClsBancos() If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then If ObjIE.DtResultados.Rows.Count > 0 Then + Dim NumComplementos As Integer Try Tipo = ObjIE.DtResultados.Rows(0)("Tipo").ToString @@ -719,6 +720,7 @@ Partial Class Bancos_IE Cuenta = ObjIE.DtResultados(0)("NumCuenta").ToString CveIEDeposito2 = ObjIE.DtResultados(0)("CveIEDeposito2").ToString.ToEntero + NumComplementos = ObjIE.DtResultados(0)("NumComplementos").ToString.ToEntero If UsuarioActual.TienePermisoProceso(99) Then 'BtnActualizar.Visible = True @@ -887,10 +889,10 @@ Partial Class Bancos_IE If UsuarioActual.TienePermisoProceso(85) Then LnkCancelar.Visible = True 'ELIMINAR IE SIN VALIDACIONES - If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True + If UsuarioActual.TienePermisoProceso(80) AndAlso NumComplementos = 0 Then LnkEliminar.Visible = True 'ELIMINA IE CUANDO ES EL MISMO USUARIO QUE LO CREO Y QUE NO ESTE CONTABILIZADO NI CONCILIADO - If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 Then + If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 AndAlso NumComplementos = 0 Then LnkEliminar.Visible = True End If End If @@ -906,10 +908,10 @@ Partial Class Bancos_IE LblEstatus.ForeColor = Drawing.Color.Red 'ELIMINAR IE SIN VALIDACIONES - If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True + If UsuarioActual.TienePermisoProceso(80) AndAlso NumComplementos = 0 Then LnkEliminar.Visible = True 'ELIMINA IE CUANDO ES EL MISMO USUARIO QUE LO CREO Y QUE NO ESTE CONTABILIZADO NI CONCILIADO - If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 Then + If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 AndAlso NumComplementos = 0 Then LnkEliminar.Visible = True End If @@ -1089,7 +1091,7 @@ Partial Class Bancos_IE '2019-08-28 unificados vista de controles complemento (Cancelado, conciliciado, Con complemento vigente, sin complemento vigente) Dim ExistenComplementosVigentes As Boolean = VerificaComplementos(True) - Dim ExistenComplementos As Boolean = VerificaComplementos(False) + 'Dim ExistenComplementos As Boolean = VerificaComplementos(False) If Not ChkConciliado.Checked And ObjIE.CveEstatusIE <> 2 Then @@ -3121,40 +3123,19 @@ Partial Class Bancos_IE MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" End If End If - - End If - - If Opcion.Contiene("EGSSINFACT") AndAlso CveSolicitudViatico > 0 AndAlso MsgError = "" Then If Not ObjIE.UpdateSolicitudesViaticosIE(CveSolicitudViatico, CveIE) Then MsgError = "Ocurrió un error al vincular el egreso con la solicitud de viatico." End If End If - End Select - - 'El movimiento 1 es el de Venta - 'Conta SIG - If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then - If CveCuentaBeneficiario > 0 And CveCuentaConta > 0 Then - If ObjMov.ContabilizarPrePolizaSIG(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - IDPoliza = ObjMov.ContaIdPoliza - Else - Alert("Ocurrio un error al contabilizar en SIG, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) - End If - Else - If CveCuentaConta < 1 Then - Alert("No se puede contabilizar la Prepoliza en SIG debido a que la cuenta de Bancos es invalida", TipoMensaje.MsgAdvertencia) - End If - If CveCuentaBeneficiario < 1 Then - Alert("No se puede contabilizar la Prepoliza en SIG debido a que las cuenta del Beneficiario es invalida", TipoMensaje.MsgAdvertencia) - End If - End If - End If - - 'Conta ContPAQ + End Select + + 'El movimiento 1 es el de Venta + + 'Conta ContPAQ If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then If IDCtaBeneficiario > 0 And IDCtaContable > 0 Then If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then @@ -3350,17 +3331,25 @@ Partial Class Bancos_IE End Sub #Region " NOTIFICACION PAGO " - Private Sub NotificacionPago(CveIE As Integer, CorreoNotificarA As String) - Dim Param As New List(Of String) - - Param.Add(CorreoNotificarA) 'Para - Param.Add("Notificaciones de pago") 'Asunto - Param.Add(GeneraCorreo2(CveIE)) 'Body - Param.Add(CveIE.ToString) 'CveIE - Param.Add(If(ComprobanteIE <> "", String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ComprobanteIE), "")) 'Archivo Adjunto - - Dim Hilo As New Threading.Thread(AddressOf MandaCorreo) - Hilo.Start(Param) + Private Sub NotificacionPago(CveIE As Integer, CorreoNotificarA As String) + + If Not DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(9, 17) Then + + Dim Param As New List(Of String) + + Param.Add(CorreoNotificarA) 'Para + Param.Add("Notificaciones de pago") 'Asunto + Param.Add(GeneraCorreo2(CveIE)) 'Body + Param.Add(CveIE.ToString) 'CveIE + Param.Add(If(ComprobanteIE <> "", String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ComprobanteIE), "")) 'Archivo Adjunto + + Dim Hilo As New Threading.Thread(AddressOf MandaCorreo) + Hilo.Start(Param) + + End If + + + End Sub Private Sub MandaCorreo(data As Object) Dim Parametros As List(Of String) = DirectCast(data, List(Of String)) @@ -4761,16 +4750,33 @@ Partial Class Bancos_IE Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) Exit Sub End If - Dim ObjGral As New ClsGenerales - If ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, TxtDescripcion.Text, "Banco", TxtFolio.Text + " / " + Cuenta) Then + + + Dim ObjAC As ClsContPAQi = Nothing + Dim Banc As New ClsBancos + Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL()) + Dim ObjGral As New ClsGenerales(Banc.IniciaTransacSQL()) + + Dim DescripcionAus As String = TxtDescripcion.Text + + If DdlTipoTransaccion.SelectedItem.Text <> "Seleccione Tipo Movimiento" Then DescripcionAus = String.Format("{0} {1}", DescripcionAus, $"Movimiento:{DdlTipoTransaccion.SelectedItem.Text}") + If DdlCuenta.SelectedItem.Text <> "Seleccione" Then DescripcionAus = String.Format("{0} {1}", DescripcionAus, $"Cuenta:{DdlCuenta.SelectedItem.Text}") + If TxtFolio.Text <> "" Then DescripcionAus = String.Format("{0} {1}", DescripcionAus, $"Número:{TxtFolio.Text}") + If TxtImporte.Text <> "" AndAlso TxtImporte.Text <> "0" Then DescripcionAus = String.Format("{0} {1}", DescripcionAus, $"Importe:{TxtImporte.Text}") + If DdlCliente.Visible Then + DescripcionAus = String.Format("{0} {1}", DescripcionAus, $"Páguese A:{DdlCliente.SelectedText}") + ElseIf DdlProveedores.Visible Then + DescripcionAus = String.Format("{0} {1}", DescripcionAus, $"Páguese A:{DdlProveedores.SelectedText}") + ElseIf DdlPersonal.Visible Then + DescripcionAus = String.Format("{0} {1}", DescripcionAus, $"Páguese A:{DdlPersonal.SelectedItem.Text}") + End If + DescripcionAus = String.Format("{0} {1}", DescripcionAus, $"Fecha:{TxtFechaDocumento.Text}") + + If ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, DescripcionAus, "Banco", TxtFolio.Text + " / " + Cuenta) Then Borrar = True End If - ObjGral.Dispose() - If Borrar = True Then - Dim ObjAC As ClsContPAQi = Nothing - Dim Banc As New ClsBancos - Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL()) + If Borrar = True Then Dim ErrorCompra = False 'VERIFICA SI EL IES ESTA VINCULADO A UNA SOLICITUD VIATICO @@ -4827,6 +4833,7 @@ Partial Class Bancos_IE If ObjAC IsNot Nothing Then ObjAC.Dispose() Banc.Dispose() ObjConta.Dispose() + ObjGral.Dispose() End If Else Alert("Tiene que decir el motivo de su eliminacion.", TipoMensaje.MsgInformacion) diff --git a/Bancos/PagoElectronico.aspx.vb b/Bancos/PagoElectronico.aspx.vb index 90bbff120..ed0b9df3c 100644 --- a/Bancos/PagoElectronico.aspx.vb +++ b/Bancos/PagoElectronico.aspx.vb @@ -1566,6 +1566,7 @@ Partial Class Bancos_PagoElectronico Param.Add(ArrayCorreos(index)) 'Para Param.Add("Notificación de Pago") 'Asunto + Param.Add(GeneraCorreo2(DtPago.Rows(index), ObjIE, ArrayCveIEs(index).ToEntero)) 'Body Dim Hilo As New Threading.Thread(AddressOf MandaCorreo) @@ -2130,11 +2131,11 @@ Partial Class Bancos_PagoElectronico End If Return strBody.ToString - End Function + End Function #End Region - + #Region " GENERA CORREO 2" - + Private Function GeneraCorreo2(Dr As DataRow, ByRef ObjIE As ClsBancos, CveIE As Integer) As String Dim strBody As New StringBuilder @@ -2456,11 +2457,227 @@ Partial Class Bancos_PagoElectronico End If Return strBody.ToString - End Function + End Function + + + + Private Function GeneraCorreo(CveIE As Integer) As String + + Dim strBody As New StringBuilder + Dim objIE As New ClsBancos + + If objIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" {0}", UsuarioActual.Empresa.Empresa) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Direccion) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Colonia) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.RFC) + strBody.AppendFormat(" ") + strBody.AppendFormat("
{0}
Col. {0}
{0}, {1}, C.P.{2}
RFC {0}
") + strBody.AppendFormat("
") + strBody.AppendFormat("


") + + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + + If objIE.CveTipoTransaccion = 1 Then ' cuando es cheque + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + End If + + If objIE.CveTipoTransaccion = 2 Then ' cuando es transf + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + End If + + strBody.Append(" ") + strBody.AppendFormat(" ") + strBody.Append(" ") + strBody.Append("
Favor de pasar a nuestras oficinas por el cheque con la siguientes instrucciones.
Notificación de transferencia de pago realizada.
 
") + strBody.AppendFormat("
") + strBody.Append("
") + + + strBody.AppendFormat("
") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" Beneficiario:{0} ", objIE.PagueseA) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.TipoTransaccion) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.Banco) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.NumCuenta) + strBody.AppendFormat(" ") + If objIE.CuentaDepositado.ToString <> "" Then + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.CuentaDepositado) + strBody.AppendFormat(" ") + End If + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.FechaDocumento.ToString("dd/MM/yyyy")) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.Importe.FormatoNumero, objIE.Moneda) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.Observaciones) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
Movimiento:{0}
Banco:{0}
Cuenta:{0}
Cuenta Destino:{0}
Fecha:{0}
Importe:$ {0} {1}
Observaciones:{0}
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + + + 'MOVIMIENTOS CHEQUE + If objIE.GetBancosIEMovimientos(CveIE, UsuarioActual.CveEmpresa) Then + Dim Textov33 As String = "" + If UsuarioActual.Empresa.Funcionalidad(520) = "1" Then + Textov33 = "Favor de emitir complemento de pago de los siguientes documentos" + End If + + strBody.AppendFormat("
") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" Documentos abonados o pagados
{0}
", Textov33) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + + + For Each dr As DataRow In objIE.DtResultados.FiltraParametros("CveConceptoContable IN (17) AND CveCompra > 0").Rows + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", dr("Fecha").ToString.ToDate.ToShortDateString()) + strBody.AppendFormat(" ", dr("SerieFolio").ToString) + strBody.AppendFormat(" ", dr("Importe").ToString.FormatoNumero) + strBody.AppendFormat(" ", dr("FolioFiscal")) + strBody.AppendFormat(" ", dr("ImporteNC").ToString.FormatoNumero) + strBody.AppendFormat(" ") + Next + + + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
FechaFacturaImporte ($)Folio FiscalNC Aplicadas
{0}{0}$ {0}{0}{0}
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + End If + + strBody.Append("
Favor de no responder a este correo.
") + + strBody.Append("") + End If + + objIE.Dispose() + Return strBody.ToString + End Function + + #End Region - - - + + + + + #Region " IMPRIMIR " Protected Sub BtnReporteAltaCarga_Click(sender As Object, e As EventArgs) Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta)) diff --git a/Bancos/PagoElectronicoGrupos.aspx.vb b/Bancos/PagoElectronicoGrupos.aspx.vb index acf4a927d..b7dca6fdc 100644 --- a/Bancos/PagoElectronicoGrupos.aspx.vb +++ b/Bancos/PagoElectronicoGrupos.aspx.vb @@ -966,6 +966,16 @@ Partial Class Bancos_PagoElectronicoGrupos RegistrosPago.Append("PSC") End If + + If drow("CLABEDestino").ToString.Trim.Length.Contiene(10, 18) Then + RegistrosPago.Append(drow("CLABEDestino").ToString.PadLeft(18, CeroRelleno)) + Else + ErrorLayout = True + MENSAJEError.AppendLine("ERROR EN CLABE cuenta destino") + Exit For + End If + + If drow("CLABEOrigen").ToString.Trim.Length.Contiene(10, 18) Then RegistrosPago.Append(drow("CLABEOrigen").ToString.PadLeft(18, CeroRelleno)) @@ -976,13 +986,7 @@ Partial Class Bancos_PagoElectronicoGrupos Exit For End If - If drow("CLABEDestino").ToString.Trim.Length.Contiene(10, 18) Then - RegistrosPago.Append(drow("CLABEDestino").ToString.PadLeft(18, CeroRelleno)) - Else - ErrorLayout = True - MENSAJEError.AppendLine("ERROR EN CLABE cuenta destino") - Exit For - End If + RegistrosPago.Append(drow("Abreviatura").ToString) RegistrosPago.Append(drow("Abonado").ToString.ToDecimal.ToString("0000000000000.00")) diff --git a/Bancos/PopIECompras.aspx.vb b/Bancos/PopIECompras.aspx.vb index e1909a2b2..16c6010ad 100644 --- a/Bancos/PopIECompras.aspx.vb +++ b/Bancos/PopIECompras.aspx.vb @@ -3251,21 +3251,9 @@ Partial Class Bancos_PopIECompras MsgError = ObjMov.MensajePolizaDescuadre GuardaLogAD($"Bancos/PopIECompras | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") End If - End If - - If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then - If CveCuentaContabilizacion > 0 Then - If ObjMov.ContabilizarPrePolizaSIG(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - Alert(alertaContabilizacion, ModExtensiones.TipoMensaje.MsgInformacion) - Else - Alert("Ocurrio un error al contabilizar en SIG, pongase en contacto con Soporte Técnico") - End If - Else - Alert(String.Format("No se puede contabilizar la Prepoliza en SIG debido a que las siguientes cuentas son invalidas: {0}", CuentasContablesInvalidasSIG)) - End If - End If - - 'Conta ContPAQ + End If + + 'Conta ContPAQ If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then If idCuentaContabilizacion > 0 Then If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 587e2dafd..17a1b63e6 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -3484,19 +3484,6 @@ Partial Class Bancos_PopIEVentas End If End If - 'Conta SIG - If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then - If CveCuentaContabilizacion > 0 Then - If ObjMov.ContabilizarPrePolizaSIG(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - Alert(alertaContabilizacion, ModExtensiones.TipoMensaje.MsgInformacion) - Else - Alert("Ocurrio un error al contabilizar en SIG, pongase en contacto con Soporte Técnico") - End If - Else - Alert(String.Format("No se puede contabilizar la Prepoliza en SIG debido a que las siguientes cuentas son invalidas: {0}", CuentasContablesInvalidasSIG)) - End If - End If - 'Conta ContPAQ If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" Then If idCuentaContabilizacion > 0 Then diff --git a/Bancos/PopUpBuscarIE.aspx.vb b/Bancos/PopUpBuscarIE.aspx.vb index 494a38e23..28e66b31b 100644 --- a/Bancos/PopUpBuscarIE.aspx.vb +++ b/Bancos/PopUpBuscarIE.aspx.vb @@ -67,23 +67,29 @@ Partial Class Bancos_PopUpBuscarIE Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click - Dim ObjBancosIE As New ClsBancos Dim Folio As String = "-1" If TxtFolio.Text <> "" Then Folio = String.Format("%{0}%", TxtFolio.Text.Trim) - If ObjBancosIE.GetBancosIE(-1, DdlBanco.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, "-1", -1, Folio, "-1", -1, -1, -1, -1, -1, txtFechaI.Text.ToDate, MaxFecha.ToShortDateString.ToDate, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then - DtDatos = ObjBancosIE.DtResultados 'If(TxtFolio.Text <> "", ObjBancosIE.DtResultados.FiltraParametros(String.Format("Folio Like '{0}'", TxtFolio.Text)), ObjBancosIE.DtResultados) + If ValidarFiltrosSeleccionado() Then + + Dim ObjBancosIE As New ClsBancos + If ObjBancosIE.GetBancosIE(-1, DdlBanco.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, "-1", -1, Folio, "-1", -1, -1, -1, -1, -1, txtFechaI.Text.ToDate, + MaxFecha.ToShortDateString.ToDate, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then + DtDatos = ObjBancosIE.DtResultados 'If(TxtFolio.Text <> "", ObjBancosIE.DtResultados.FiltraParametros(String.Format("Folio Like '{0}'", TxtFolio.Text)), ObjBancosIE.DtResultados) + Else + Alert("Ocurrió un error al consultar los Anticipos", TipoMensaje.MsgError) + DtDatos = Nothing + End If + + ObjBancosIE.Dispose() + + If DtDatos IsNot Nothing Then + GvDatos.DataSource = DtDatos + GvDatos.DataBind() + UpDatos.Update() + End If Else - Alert("Ocurrió un error al consultar los Anticipos", TipoMensaje.MsgError) - DtDatos = Nothing - End If - - ObjBancosIE.Dispose() - - If DtDatos IsNot Nothing Then - GvDatos.DataSource = DtDatos - GvDatos.DataBind() - UpDatos.Update() + Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia) End If End Sub @@ -103,4 +109,11 @@ Partial Class Bancos_PopUpBuscarIE End If End Sub + Private Function ValidarFiltrosSeleccionado() As Boolean + If DdlBanco.SelectedValue.ToEntero > 0 Then Return True + If DdlCuenta.SelectedValue.ToEntero > 0 Then Return True + If TxtFolio.Text.Length > 0 Then Return True + Return False + End Function + End Class diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 6ca16c29c..1cc586d2c 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -2518,22 +2518,22 @@ Partial Class Bancos_ProveedoresAbonar Alert("El Beneficiario no tiene una cuenta activa en BBVA, dela de alta o seleccione otro método de pago", TipoMensaje.MsgAdvertencia) End If - ElseIf DdlTipoTransaccion.SelectedValue = "17" Then + 'ElseIf DdlTipoTransaccion.SelectedValue = "17" Then - If Dep.DtResultados.Rows.Count > 0 Then - DdlCuentaDeposito.DataSource = Dep.DtResultados - trCuentaDeposito.Visible = True - BtnIEGuardar.ToolTip = "" - Else + ' If Dep.DtResultados.Rows.Count > 0 Then + ' DdlCuentaDeposito.DataSource = Dep.DtResultados + ' trCuentaDeposito.Visible = True + ' BtnIEGuardar.ToolTip = "" + ' Else - BtnIEGuardar.Enabled = False - BtnIEGuardar.ToolTip = "El proveedor no tiene cuentas deposito" + ' BtnIEGuardar.Enabled = False + ' BtnIEGuardar.ToolTip = "El proveedor no tiene cuentas deposito" - End If + ' End If - UpGuardar.Update() + ' UpGuardar.Update() Else DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("Estatus ='True'") If Dep.DtResultados.Rows.Count > 0 Then @@ -2550,19 +2550,19 @@ Partial Class Bancos_ProveedoresAbonar End If - Else + 'Else - If DdlTipoTransaccion.SelectedValue = "17" Then + ' If DdlTipoTransaccion.SelectedValue = "17" Then - BtnIEGuardar.Enabled = False - BtnIEGuardar.ToolTip = "El proveedor no tiene cuentas deposito" - Else - BtnIEGuardar.Enabled = True - BtnIEGuardar.ToolTip = "" - End If + ' BtnIEGuardar.Enabled = False + ' BtnIEGuardar.ToolTip = "El proveedor no tiene cuentas deposito" + ' Else + ' BtnIEGuardar.Enabled = True + ' BtnIEGuardar.ToolTip = "" + ' End If - UpGuardar.Update() + ' UpGuardar.Update() End If @@ -2680,22 +2680,26 @@ Partial Class Bancos_ProveedoresAbonar #Region " NOTIFICACION PAGO " Private Sub NotificacionPago(CveIE As Integer, CorreoNotificarA As String) - 'Dim Param As New List(Of String) - 'Param.Add(CorreoNotificarA) 'Para - 'Param.Add("Notificaciones de pago") 'Asunto - 'Param.Add(GeneraCorreo(CveIE)) 'Body - 'Param.Add(CveIE.ToString) 'CveIE - Dim Body As String = GeneraCorreo(CveIE) - Dim Comprobante = If(ComprobanteIE <> "", String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ComprobanteIE), "") 'Archivo Adjunto + If Not DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(9, 17) Then + 'Dim Param As New List(Of String) - Dim File As Byte() = Nothing - If UsuarioActual.Empresa.Funcionalidad(545).ToEntero > 0 Then - File = NewGeneraBytesCxP(CveProveedor, UsuarioActual.Nombre) + 'Param.Add(CorreoNotificarA) 'Para + 'Param.Add("Notificaciones de pago") 'Asunto + 'Param.Add(GeneraCorreo(CveIE)) 'Body + 'Param.Add(CveIE.ToString) 'CveIE + Dim Body As String = GeneraCorreo(CveIE) + Dim Comprobante = If(ComprobanteIE <> "", String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ComprobanteIE), "") 'Archivo Adjunto + + Dim File As Byte() = Nothing + If UsuarioActual.Empresa.Funcionalidad(545).ToEntero > 0 Then + File = NewGeneraBytesCxP(CveProveedor, UsuarioActual.Nombre) + End If + + Dim Hilo As New Threading.Thread(Sub() MandaCorreo(CorreoNotificarA, "Notificaciones de pago", Body, CveIE, Comprobante, File)) + Hilo.Start() End If - Dim Hilo As New Threading.Thread(Sub() MandaCorreo(CorreoNotificarA, "Notificaciones de pago", Body, CveIE, Comprobante, File)) - Hilo.Start() End Sub Private Sub MandaCorreo(Para As String, Asunto As String, Body As String, CveIE As Integer, Comprobante As String, File As Byte()) diff --git a/Bancos/Transferencias.aspx.vb b/Bancos/Transferencias.aspx.vb index 7ccdbb882..826813cd0 100644 --- a/Bancos/Transferencias.aspx.vb +++ b/Bancos/Transferencias.aspx.vb @@ -394,23 +394,6 @@ Partial Class Bancos_Transferencias If MsgError = "" Then - 'Conta SIG - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then - If (CveCuentaOrigen > 0 AndAlso CveCuentaDestino > 0) OrElse (CveCuentaDestino > 0 AndAlso Opcion = 1) Then - - If ObjMov.ContabilizarPrePolizaSIG(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, Fecha:=TxtFechaDocumento.Text) Then - If ObjMov.ContaIdPoliza > 0 Then - AlertaGlobal.AppendFormat("

Ver Póliza", ObjMov.ContaIdPoliza) - End If - - Else - MsgError = "Ocurrio un error al contabilizar en SIG, pongase en contacto con Soporte Técnico" - End If - Else - MsgError = String.Format("No se puede contabilizar la Prepoliza en SIG debido a que las siguientes cuentas son invalidas: {0}", CuentasContablesInvalidasSIG) - End If - End If - 'Conta ContPAQ If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" Then If (IdCtaContableOrigen > 0 AndAlso IdCtaContableDestino > 0) OrElse (IdCtaContableDestino > 0 AndAlso Opcion = 1) Then diff --git a/CGame/PopUpBuscarEmpaque.aspx.cs b/CGame/PopUpBuscarEmpaque.aspx.cs index 72d8e2765..ce4a09ed2 100644 --- a/CGame/PopUpBuscarEmpaque.aspx.cs +++ b/CGame/PopUpBuscarEmpaque.aspx.cs @@ -26,27 +26,32 @@ public partial class CGame_PopUpBuscarProduccion :ClsPaginas } protected void Consultar_Click(object sender, EventArgs e) { - String Folio; - if (TxtFolio.Text != "") { Folio = TxtFolio.Text; } else { Folio = "-1"; } - ClsCGame ObjCGame = new ClsCGame(); - if (ObjCGame.GetProduccion(UsuarioActual.CveEmpresa, Folio, -1, DdlHuerta.SelectedValue.ToEntero(), TxtFechaEntregaI.Text.ToDate(), TxtFechaEntregaF.Text.ToDate())) + if (ValidarFiltrosSeleccionados()) { - GvDatos.DataSource = ObjCGame.DtResultados; - GvDatos.DataBind(); - LtlTotalRegistros.Text = ObjCGame.DtResultados.Rows.Count.ToString(); - if (ObjCGame.DtResultados.Rows.Count < 1) + String Folio; + if (TxtFolio.Text != "") { Folio = TxtFolio.Text; } else { Folio = "-1"; } + ClsCGame ObjCGame = new ClsCGame(); + if (ObjCGame.GetProduccion(UsuarioActual.CveEmpresa, Folio, -1, DdlHuerta.SelectedValue.ToEntero(), TxtFechaEntregaI.Text.ToDate(), TxtFechaEntregaF.Text.ToDate())) { - Alert("No se encontraron resultados con los filtros seleccionados", TipoMensaje.MsgAdvertencia); - } - else - { - TblBusqueda.Visible = true; + GvDatos.DataSource = ObjCGame.DtResultados; + GvDatos.DataBind(); + LtlTotalRegistros.Text = ObjCGame.DtResultados.Rows.Count.ToString(); + if (ObjCGame.DtResultados.Rows.Count < 1) + { + Alert("No se encontraron resultados con los filtros seleccionados", TipoMensaje.MsgAdvertencia); + } + else + { + TblBusqueda.Visible = true; + } } + ObjCGame.Dispose(); + UPDatos.Update(); + }else + { + Alert("Seleccione un criterio de busqueda",TipoMensaje.MsgAdvertencia); } - ObjCGame.Dispose(); - UPDatos.Update(); - } #region GridView @@ -60,4 +65,12 @@ public partial class CGame_PopUpBuscarProduccion :ClsPaginas } #endregion + private bool ValidarFiltrosSeleccionados() + { + if(TxtFolio.Text.Length > 0) return true; + if(DdlHuerta.SelectedValue.ToEntero() > 0) return true; + if(TxtFechaEntregaI.Text.Length > 0) return true; + if(TxtFechaEntregaF.Text.Length > 0) return true; + return false; + } } \ No newline at end of file diff --git a/CGame/PopUpBuscarOrdenProduccion.aspx.vb b/CGame/PopUpBuscarOrdenProduccion.aspx.vb index 484e1a0fa..f2bc848fc 100644 --- a/CGame/PopUpBuscarOrdenProduccion.aspx.vb +++ b/CGame/PopUpBuscarOrdenProduccion.aspx.vb @@ -37,19 +37,23 @@ Partial Class CGame_PopUpBuscarOrdenProduccion Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click Dim Folio As String If TxtFolio.Text.Trim <> "" Then Folio = TxtFolio.Text Else Folio = "-1" - Dim ObjOP As New ClsCGame - If ObjOP.GetOrdenProduccion(-1, UsuarioActual.CveEmpresa, DdlEstatus.SelectedValue.ToEntero, Folio, TxtFechaEntregaI.Text.ToDate, TxtFechaEntregaF.Text.ToDate, DdlCliente.SelectedValue.ToEntero) Then - GvOP.DataSource = ObjOP.DtResultados - GvOP.DataBind() - LtlTotalRegistros.Text = ObjOP.DtResultados.Rows.Count.ToString - If Not ObjOP.DtResultados.Rows.Count > 0 Then - Alert("No se encontraron resultados con los filtros seleccionados", TipoMensaje.MsgAdvertencia) - Else - TblBusqueda.Visible = True + If ValidarFiltrosSeleccionado() Then + Dim ObjOP As New ClsCGame + If ObjOP.GetOrdenProduccion(-1, UsuarioActual.CveEmpresa, DdlEstatus.SelectedValue.ToEntero, Folio, TxtFechaEntregaI.Text.ToDate, TxtFechaEntregaF.Text.ToDate, DdlCliente.SelectedValue.ToEntero) Then + GvOP.DataSource = ObjOP.DtResultados + GvOP.DataBind() + LtlTotalRegistros.Text = ObjOP.DtResultados.Rows.Count.ToString + If Not ObjOP.DtResultados.Rows.Count > 0 Then + Alert("No se encontraron resultados con los filtros seleccionados", TipoMensaje.MsgAdvertencia) + Else + TblBusqueda.Visible = True + End If End If + ObjOP.Dispose() + UPDatos.Update() + Else + Alert("Seleccione un criterio de busqueda", TipoMensaje.MsgAdvertencia) End If - ObjOP.Dispose() - UPDatos.Update() End Sub Private Sub GvOP_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvOP.RowDataBound @@ -57,4 +61,13 @@ Partial Class CGame_PopUpBuscarOrdenProduccion e.Row.FCLabel("LblFolio").Text = String.Format("
{0}{1}
", "", e.Row.DBCampo("Folio")) End If End Sub + + Private Function ValidarFiltrosSeleccionado() As Boolean + If DdlEstatus.SelectedValue.ToEntero > 0 Then Return True + If TxtFolio.Text.Length > 0 Then Return True + If TxtFechaEntregaI.Text.Length > 0 Then Return True + If TxtFechaEntregaF.Text.Length > 0 Then Return True + If DdlCliente.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function End Class diff --git a/CRM/Acercamiento.aspx b/CRM/Acercamiento.aspx index 4565c7876..ef2aec956 100644 --- a/CRM/Acercamiento.aspx +++ b/CRM/Acercamiento.aspx @@ -441,7 +441,7 @@
- +
@@ -530,7 +530,7 @@
<%-- max-height: 410px;--%> -
+
@@ -552,7 +552,7 @@
- - -
-
-
-
- - -
- -
<%#Eval("Titulo").ToString() %>
-
<%# Eval("Descripcion").ToString() %>
-
- - -
-
- - @@ -733,7 +759,7 @@
- @@ -786,7 +812,7 @@
- diff --git a/CRM/PopUpBuscarAcercamiento.aspx.cs b/CRM/PopUpBuscarAcercamiento.aspx.cs index 982fd1a6c..958a4cc7c 100644 --- a/CRM/PopUpBuscarAcercamiento.aspx.cs +++ b/CRM/PopUpBuscarAcercamiento.aspx.cs @@ -164,21 +164,41 @@ public partial class CRM_PopUpBuscarAcercamiento : ClsPaginas string FechaCierre = TxtFechaCierre.Text == "" ? "-1" : TxtFechaCierre.Text; string NombreAcercamiento = TxtAcercamiento.Text == "" ? "-1" : TxtAcercamiento.Text; - ClsCRM ObjCRM = new ClsCRM(); - if (ObjCRM.GetAcercamiento(UsuarioActual.CveEmpresa, CveEmpresaCRM, -1, CveTipoProceso, CveVendedor, "-1", "-1", NombreAcercamiento, CveMedioCaptacion, CveRechazoMotivo, CveProbabilidad, FechaApertura, FechaCierre)) + if (ValidarFiltrosSeleccionados()) { - GVDatos.DataSource = ObjCRM.DtResultados; - GVDatos.DataBind(); + ClsCRM ObjCRM = new ClsCRM(); + if (ObjCRM.GetAcercamiento(UsuarioActual.CveEmpresa, CveEmpresaCRM, -1, CveTipoProceso, CveVendedor, "-1", "-1", NombreAcercamiento, CveMedioCaptacion, CveRechazoMotivo, CveProbabilidad, FechaApertura, FechaCierre)) + { + GVDatos.DataSource = ObjCRM.DtResultados; + GVDatos.DataBind(); - LtlTotalRegistros.Text = ObjCRM.DtResultados.Rows.Count.ToString(); - if (ObjCRM.DtResultados.Rows.Count > 0) - DivBusqueda.Visible = true; - else - DivBusqueda.Visible = false; + LtlTotalRegistros.Text = ObjCRM.DtResultados.Rows.Count.ToString(); + if (ObjCRM.DtResultados.Rows.Count > 0) + DivBusqueda.Visible = true; + else + DivBusqueda.Visible = false; + } + + ObjCRM.Dispose(); + UPDatos.Update(); + }else + { + Alert("Seleccione un criterio de busqueda",ModExtensiones.TipoMensaje.MsgAdvertencia); } + } - ObjCRM.Dispose(); - UPDatos.Update(); + private bool ValidarFiltrosSeleccionados() + { + if (DdlTipoProceso.SelectedValue.ToEntero() > 0) return true; + if (DdlEmpresaCRM.SelectedValue.ToEntero() > 0) return true; + if (DdlVendedor.SelectedValue.ToEntero() > 0) return true; + if (DdlMedioCaptacion.SelectedValue.ToEntero() > 0) return true; + if (DdlRechazoMotivo.SelectedValue.ToEntero() > 0) return true; + if (DdlProbabilidad.SelectedValue.ToEntero() > 0) return true; + if (TxtFechaApertura.Text != "") return true; + if (TxtFechaCierre.Text != "") return true; + if (TxtAcercamiento.Text != "") return true; + return false; } #endregion } \ No newline at end of file diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 9ef3bda65..7c5b5214e 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -141,6 +141,11 @@ select.selecthidden { display: none; } + + radioContado { + border: 1px solid black; + width: 85%; + } /*IPP*/ @@ -181,7 +186,7 @@ --%> - Proveedor: + Proveedor: <%--Proveedor:--%> <%-- Proveedor:--%>
@@ -408,6 +413,7 @@
+
@@ -415,6 +421,7 @@
+
@@ -592,8 +599,12 @@ Unidad Clasificación + +     + +
@@ -604,6 +615,8 @@   + +
@@ -612,6 +625,8 @@ Tipo de Gasto + +
@@ -780,6 +795,7 @@       + @@ -806,6 +822,7 @@   + @@ -813,6 +830,7 @@   + @@ -893,6 +911,8 @@     + + @@ -1012,6 +1032,8 @@
TC: + +
@@ -1047,6 +1069,8 @@
  • Aplica consignación: + +

  • @@ -1058,6 +1082,8 @@
  • Consignación: + +
  • <%--
  • Folio Consignación: @@ -1199,9 +1225,9 @@ - + - + @@ -1332,6 +1358,8 @@
    • Tipo Cambio: + + @@ -1732,9 +1760,12 @@ Clasificación + +
      Producto/Servicio +
      @@ -1959,6 +1990,7 @@ + @@ -2051,6 +2083,7 @@ + @@ -2145,6 +2178,8 @@ Personal + +
      @@ -2164,6 +2199,7 @@ +
      @@ -2330,6 +2366,8 @@ Rembolso: + + Personal/Empleado Caja Chica @@ -2516,7 +2554,7 @@ - +

      @@ -2600,6 +2638,7 @@   +
      @@ -2733,12 +2772,14 @@   +   + @@ -2892,6 +2933,8 @@

      Enviar + + a otro Almacén

      @@ -3111,45 +3154,45 @@
@@ -410,14 +422,14 @@
-
- -
+
+ +
<%--GV DATOS--%> - @@ -428,11 +440,11 @@ - + - + @@ -440,8 +452,8 @@ - - + + @@ -450,7 +462,7 @@ - + @@ -459,12 +471,12 @@ - - - - - - + + + + + +
@@ -655,7 +667,7 @@ - + @@ -699,6 +711,7 @@
Cantidad +
@@ -740,6 +753,7 @@ Cant.: +
@@ -760,7 +774,7 @@ - + - +
@@ -824,7 +838,7 @@ $('#TxtCodigoPS').focus() } - + function playsonidito(NomArchivo) { var URL = /Sonidos/ + NomArchivo @@ -833,7 +847,7 @@ snd.currentTime = 0; } - + function CantidadEspecial() { MuestraCantidadEspecial(); //$('#ModalCantidad').modal('show'); diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 6a429e8f0..f5b2187dc 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -596,7 +596,9 @@ Partial Class Inventarios_EntregaAlmacen DdlAlmacen.SelectedValueExist(CveAlmacenTraspasoOrigen) End If - + If Not DtDatos.Columns.Contains("Serie") Then + DtDatos.Columns.Add("Serie", GetType(String)) + End If If Not DtDatos.Columns.Contains("Lote") Then DtDatos.Columns.Add("Lote", GetType(String)) End If @@ -658,8 +660,9 @@ Partial Class Inventarios_EntregaAlmacen Alert("Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar.", TipoMensaje.MsgError) End If End If - - CargaDocumentos(CveVenta) + If UsuarioActual.Empresa.FacturaProduccion Then + CargaDocumentos(CveVenta) + End If Else Alert("No se encontraron productos pendientes por surtir. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) End If @@ -744,6 +747,20 @@ Partial Class Inventarios_EntregaAlmacen DdlAlmacen.SelectedValueExist(CveAlmacenTraspasoOrigen) End If + If Not DtDatos.Columns.Contains("CveSeccion") Then + DtDatos.Columns.Add("CveSeccion", GetType(Integer)) + End If + + If Not DtDatos.Columns.Contains("FechaCaducidad") Then + DtDatos.Columns.Add("FechaCaducidad", GetType(Date)) + End If + If Not DtDatos.Columns.Contains("Seleccionado") Then + DtDatos.Columns.Add("Seleccionado", GetType(Boolean)) + End If + If Not DtDatos.Columns.Contains("CantidadSeleccionada") Then + DtDatos.Columns.Add("CantidadSeleccionada", GetType(Double)) + End If + If UsuarioActual.Empresa.Funcionalidad(132) = "1" Then DivCodigoSeriePS.Visible = True Else @@ -790,7 +807,7 @@ Partial Class Inventarios_EntregaAlmacen 'CARGA LO PRECARGADO CON SERIE Dim Contador = 0 For Each Gvr As GridViewRow In GvDatos.Rows - If Gvr.DataKey("CvePS").ToEntero = CvePSSerie Then + If Gvr.DataKey("CvePS").ToEntero = CvePSSerie AndAlso DtDatosDetalle IsNot Nothing Then Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).Rows.Count Gvr.FCCheckBox("cbInv").Enabled = False Gvr.FCCheckBox("cbInv").Checked = True @@ -809,9 +826,13 @@ Partial Class Inventarios_EntregaAlmacen e.Row.FCButton("BtnSerie").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec"), e.Row.DBCampo("Inv_CveMetodoInventario")) e.Row.FCTextBox("TbCantidadF").Enabled = False e.Row.FCCheckBox("cbInv").Enabled = False - Dim Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DBCampo("Consec"))).Rows.Count - e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString - 'e.Row.FCTextBox("TbCantidadF").Text = "0" + If e.Row.DBCampo("Consec") <> "" AndAlso DtDatosDetalle IsNot Nothing Then + Dim Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DBCampo("Consec"))).Rows.Count + e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString + Else + e.Row.FCTextBox("TbCantidadF").Text = "0" + End If + If TipoDocto = "DPe" Then CveConsecSerie = e.Row.DBCampo("Consec").ToString.ToEntero @@ -864,6 +885,7 @@ Partial Class Inventarios_EntregaAlmacen 'FUNCIONALIDAD PISTOLA DE CODIGOS If UsuarioActual.Empresa.Funcionalidad(132) = "1" And e.Row.DBCampo("CodigoBarras").Trim <> "" Then + e.Row.FCTextBox("TbCantidadF").Text = "0" 'NO BLOQUEA PARA ROL AD If UsuarioActual.CveRol = 1 Then If e.Row.DBCampo("Inv_CveMetodoInventario").Contiene("5", "6") Then @@ -1980,7 +2002,7 @@ Partial Class Inventarios_EntregaAlmacen End If For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1), EsInterno:=EsInterno) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") Exit For @@ -2537,10 +2559,10 @@ Partial Class Inventarios_EntregaAlmacen If CBool(Dr("AplicaSerie")) Then DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) For Each Dr1 As DataRow In DtDetalle.Rows - StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), 1, IfNull(Dr("CveSeccion"), -1), Dr1("Serie"), Lote, FechaCaducidad.ToString("YYYY/MM/DD")) + StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), 1, IfNull(Dr("CveSeccion"), -1), Dr1("Serie"), Lote, FechaCaducidad.ToString("yyyy/MM/dd")) Next Else - StrXML.AppendFormat("", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), IfNull(Dr("CveSeccion"), -1), "-1", Lote, FechaCaducidad.ToString("YYYY/MM/DD")) + StrXML.AppendFormat("", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), IfNull(Dr("CveSeccion"), -1), "-1", Lote, FechaCaducidad.ToString("yyyy/MM/dd")) End If End If Next @@ -3085,6 +3107,18 @@ Partial Class Inventarios_EntregaAlmacen #End Region +#Region "TipoEntrega" + + Protected Sub EntregaRadioGroup_Click(sender As Object, e As EventArgs) + If RbEntregaExterna.Checked Then + RegistraScript("AbrirVentana('/General/PopUpPaqueteriasGuias.aspx',800,547,'N')") + ElseIf RbEntregaInterna.Checked Then + RegistraScript($"AbrirVentana('/General/PopUpPaqueteriasGuiasInternas.aspx?CveVenta={CveVentaSurtir}&CveSubProyecto={CveSubProyecto}',800,547,'N')") + 'CveVentaSurtir + End If + End Sub + +#End Region End Class diff --git a/Inventarios/EntregasPorRealizar.aspx b/Inventarios/EntregasPorRealizar.aspx new file mode 100644 index 000000000..9b5943b7e --- /dev/null +++ b/Inventarios/EntregasPorRealizar.aspx @@ -0,0 +1,102 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="EntregasPorRealizar.aspx.cs" Inherits="Inventarios_EntregasPorRealizar" %> + + + + + + + + + <%--Paqueterías Guías--%>Entrega Interna + + + + + + + + + + +
+
+
+ + +
+
+
+
PERSONAL QUE ENTREGA:
+
+ +
+
+
+
+
+
+
+ + + +
+
+ + ASIGNACIÓN DE ENTREGAS +
+
+ +
+
+
+ + + + +   + + + + +   + + + + + +   + + + + +   + + + + +   + + + + +
+
+
+
+
+ + diff --git a/Inventarios/EntregasPorRealizar.aspx.cs b/Inventarios/EntregasPorRealizar.aspx.cs new file mode 100644 index 000000000..bf831e4e3 --- /dev/null +++ b/Inventarios/EntregasPorRealizar.aspx.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; +using Extensiones; + +public partial class Inventarios_EntregasPorRealizar : ClsPaginas +{ + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargarEntregas(); + CargarPersonal(); + } + } + + protected void BtnAsignar_Click(object sender,EventArgs e) + { + if (DdlUsuario.SelectedValue.ToEntero() > 0) + { + bool TieneError = false; + ClsGenerales ObjGeneral = new ClsGenerales(); + ObjGeneral.IniciaTransacSQL(); + GridViewRowCollection Grid = GvPaqueteriasGuias.Rows; + + foreach (GridViewRow row in Grid) + { + if (row.FCCheckBox("ChkAsigna").Checked) + { + int CvePaqueteriasGuias = row.DataKey("CvePaqueteriaGuia").ToEntero(); + int CvePersonal = DdlUsuario.SelectedValue.ToEntero(); + + if(!ObjGeneral.AsignarEntregasPorRealizar(CvePaqueteriasGuias, CvePersonal)){ + TieneError = true; + } + } + } + + if (!TieneError) + { + ObjGeneral.Commit(); + Alert("Entregas asignadas correctamente"); + CargarEntregas(); + UpDatos.Update(); + } + else + { + ObjGeneral.RollBack(); + } + ObjGeneral.Dispose(); + } + else + { + Alert("Seleccione a alguien del personal",ModExtensiones.TipoMensaje.MsgAdvertencia); + } + } + + private void CargarEntregas() + { + ClsGenerales ObjGeneral = new ClsGenerales(); + if (ObjGeneral.GetEntregasPorRealizar(UsuarioActual.CveEmpresa)) + { + GvPaqueteriasGuias.DataSource = ObjGeneral.DtResultados; + GvPaqueteriasGuias.DataBind(); + } + ObjGeneral.Dispose(); + } + + private void CargarPersonal() + { + DdlUsuario.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa); + DdlUsuario.DataBind(); + DdlUsuario.Items.Insert(0, new ListItem("Seleccione", "-1")); + } +} \ No newline at end of file diff --git a/Inventarios/PopUpBuscarMovto.aspx.vb b/Inventarios/PopUpBuscarMovto.aspx.vb index 92994df68..9f5c1dd38 100644 --- a/Inventarios/PopUpBuscarMovto.aspx.vb +++ b/Inventarios/PopUpBuscarMovto.aspx.vb @@ -49,27 +49,38 @@ Partial Class PopUpBuscarFolio CargaDatos() End Sub Private Sub CargaDatos() - Dim Reporte As New ClsInventarios + If ValidarFiltrosSeleccionados() Then + Dim Reporte As New ClsInventarios - Dim FechaInicial = If(TxtFechaI.Text.Trim <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text.ToDate, MinFecha) - Dim FechaFinal = If(TxtFechaF.Text.Trim <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text.ToDate, MaxFecha) - Dim FechaIngI = If(TxtFechaIngInicio.Text.Trim <> "" AndAlso TxtFechaIngInicio.Text <> "__/__/____", TxtFechaIngInicio.Text.ToDate, MinFecha) - Dim FechaIngF = If(TxtFechaIngFin.Text.Trim <> "" AndAlso TxtFechaIngFin.Text <> "__/__/____", TxtFechaIngFin.Text.ToDate, MaxFecha) + Dim FechaInicial = If(TxtFechaI.Text.Trim <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text.ToDate, MinFecha) + Dim FechaFinal = If(TxtFechaF.Text.Trim <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text.ToDate, MaxFecha) + Dim FechaIngI = If(TxtFechaIngInicio.Text.Trim <> "" AndAlso TxtFechaIngInicio.Text <> "__/__/____", TxtFechaIngInicio.Text.ToDate, MinFecha) + Dim FechaIngF = If(TxtFechaIngFin.Text.Trim <> "" AndAlso TxtFechaIngFin.Text <> "__/__/____", TxtFechaIngFin.Text.ToDate, MaxFecha) - If Reporte.GetMovimientosRep(DdlAlmacen.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, If(TxtFolio.Text = "", "-1", TxtFolio.Text.Trim).ToEntero, FechaIngI, FechaIngF, FechaInicial, FechaFinal, -1, UsuarioActual.CveEmpresa) Then - GvM.DataSource = Reporte.DtResultados - LtlTotalRegistros.Text = Reporte.DtResultados.Rows.Count.ToString.FormatoNumero(0) + If Reporte.GetMovimientosRep(DdlAlmacen.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, If(TxtFolio.Text = "", "-1", TxtFolio.Text.Trim).ToEntero, + FechaIngI, FechaIngF, FechaInicial, FechaFinal, -1, UsuarioActual.CveEmpresa) Then + GvM.DataSource = Reporte.DtResultados + LtlTotalRegistros.Text = Reporte.DtResultados.Rows.Count.ToString.FormatoNumero(0) + Else + GvM.DataSource = Nothing + End If + + GvM.DataBind() + + UPDatos.Update() + TblBusqueda.Visible = True + Reporte.Dispose() Else - GvM.DataSource = Nothing + Alert("Seleccione un criterio de busqueda", TipoMensaje.MsgAdvertencia) End If - - GvM.DataBind() - - UPDatos.Update() - TblBusqueda.Visible = True - Reporte.Dispose() End Sub + + Private Function ValidarFiltrosSeleccionados() As Boolean + If DdlAlmacen.SelectedValue.ToEntero > 0 Then Return True + If DdlTipoMovimiento.SelectedValue.ToEntero > 0 Then Return True + If TxtFolio.Text.Length > 0 Then Return True + Return False + End Function #End Region - End Class diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx.vb b/Inventarios/PopUpExistenciasAlmacen.aspx.vb index 4f988dc7f..c3bc4fc7c 100644 --- a/Inventarios/PopUpExistenciasAlmacen.aspx.vb +++ b/Inventarios/PopUpExistenciasAlmacen.aspx.vb @@ -94,72 +94,77 @@ Partial Class Inventarios_Default End If End Sub Private Sub CargaDatos(CvePS As Integer, Tipo As Integer) - Dim ObjInventarios As New ClsInventarios() - If ObjInventarios.GetExistenciasProducto(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then - Dim dr As Data.DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") - If dr IsNot Nothing Then - LtPs.Text = $"Producto: {dr("PSCodigo").ToString}" - Dim CvePrecioLista As Integer = -1 - If Not UsuarioActual.Empresa.Funcionalidad(404).ToString = "1" Then 'sino manneja precios de lista - CvePrecioLista = -2 - End If + If ValidarFiltrosSeleccionados() Then + Dim ObjInventarios As New ClsInventarios() + If ObjInventarios.GetExistenciasProducto(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then + Dim dr As Data.DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") - Dim ObjVta As New ClsVentas - Dim objPS As New ClsProductosServicios - If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then - If ObjVta.DtResultados.Rows.Count > 0 Then - If CvePrecioLista = -1 Then CvePrecioLista = ObjVta.DtResultados.Rows(0)("CvePrecioLista").ToString.ToEntero - If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, -1, DDlPS.SelectedValue.ToEntero) Then - If objPS.DtResultados.Rows.Count > 0 Then - LtPrecioPS.Text = $"Precio de venta: $: {objPS.DtResultados.Rows(0)("PrecioLista").ToString.FormatoNumero} {dr("Abreviatura").ToString}" + If dr IsNot Nothing Then + LtPs.Text = $"Producto: {dr("PSCodigo").ToString}" + Dim CvePrecioLista As Integer = -1 + If Not UsuarioActual.Empresa.Funcionalidad(404).ToString = "1" Then 'sino manneja precios de lista + CvePrecioLista = -2 + End If + + Dim ObjVta As New ClsVentas + Dim objPS As New ClsProductosServicios + If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then + If ObjVta.DtResultados.Rows.Count > 0 Then + If CvePrecioLista = -1 Then CvePrecioLista = ObjVta.DtResultados.Rows(0)("CvePrecioLista").ToString.ToEntero + If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, -1, DDlPS.SelectedValue.ToEntero) Then + If objPS.DtResultados.Rows.Count > 0 Then + LtPrecioPS.Text = $"Precio de venta: $: {objPS.DtResultados.Rows(0)("PrecioLista").ToString.FormatoNumero} {dr("Abreviatura").ToString}" + End If End If End If End If + ObjVta.Dispose() + objPS.Dispose() + If UsuarioActual.CveEmpresa = 119 Then + If CBool(dr("AplicaIEPS")) Then + LtlIEPS.Visible = True + LtlIEPSPorcentaje.Visible = True + LtlIEPSPorcentaje.Text = $"% {(dr("IEPSPorcentaje").ToString.ToDouble * 100).FormatoNumero}" + Else + LtlIEPS.Visible = False + LtlIEPSPorcentaje.Visible = False + End If + If dr("IVA").ToString = "-1" OrElse dr("IVA").ToString.ToDecimal > 0 Then + LtlIVA.Visible = True + LtlIVAPorcentaje.Visible = True + LtlIVAPorcentaje.Text = $"Si" + Else + LtlIVA.Visible = False + LtlIVAPorcentaje.Visible = False + End If + End If End If - ObjVta.Dispose() - objPS.Dispose() - If UsuarioActual.CveEmpresa = 119 Then - If CBool(dr("AplicaIEPS")) Then - LtlIEPS.Visible = True - LtlIEPSPorcentaje.Visible = True - LtlIEPSPorcentaje.Text = $"% {(dr("IEPSPorcentaje").ToString.ToDouble * 100).FormatoNumero}" - Else - LtlIEPS.Visible = False - LtlIEPSPorcentaje.Visible = False - End If - If dr("IVA").ToString = "-1" OrElse dr("IVA").ToString.ToDecimal > 0 Then - LtlIVA.Visible = True - LtlIVAPorcentaje.Visible = True - LtlIVAPorcentaje.Text = $"Si" - Else - LtlIVA.Visible = False - LtlIVAPorcentaje.Visible = False - End If + + If UsuarioActual.CveUsuario = 100 Then + HlPendiente.Visible = True + HlPendiente.NavigateUrl = String.Format("/Inventarios/RepVentasXSurtir.aspx?CvePS={0}", CvePS) + End If + + If ObjInventarios.DtResultados.Rows.Count > 0 Then + GV.DataSource = ObjInventarios.DtResultados + Else + GV.DataSource = Nothing + Dim Js = If(Tipo = 1, "", "window.setTimeout(Focus,200);") + Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) End If End If - If UsuarioActual.CveUsuario = 100 Then - HlPendiente.Visible = True - HlPendiente.NavigateUrl = String.Format("/Inventarios/RepVentasXSurtir.aspx?CvePS={0}", CvePS) - End If + ObjInventarios.Dispose() + GV.DataBind() - If ObjInventarios.DtResultados.Rows.Count > 0 Then - GV.DataSource = ObjInventarios.DtResultados - Else - GV.DataSource = Nothing - Dim Js = If(Tipo = 1, "", "window.setTimeout(Focus,200);") - Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) - End If + + + UPDatos.Update() + TblBusqueda.Visible = True + Else + Alert("Seleccione un producto o servicio", TipoMensaje.MsgAdvertencia) End If - - ObjInventarios.Dispose() - GV.DataBind() - - - - UPDatos.Update() - TblBusqueda.Visible = True End Sub Private Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -227,6 +232,7 @@ Partial Class Inventarios_Default End Sub Private Sub CargarDatosMedRin() + Dim ObjInventarios As New ClsInventarios If ObjInventarios.GetExistenciasMedRin(DDlPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlRin.SelectedValue.ToEntero, DdlMedidas.SelectedValue.ToEntero) Then GvMedRin.DataSource = ObjInventarios.DtResultados @@ -236,4 +242,9 @@ Partial Class Inventarios_Default UPDatos.Update() End Sub + Private Function ValidarFiltrosSeleccionados() As Boolean + If DDlPS.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function + End Class diff --git a/Inventarios/PrestamosdeProveedor.aspx b/Inventarios/PrestamosdeProveedor.aspx index 7719754cf..2adadb1bd 100644 --- a/Inventarios/PrestamosdeProveedor.aspx +++ b/Inventarios/PrestamosdeProveedor.aspx @@ -1,161 +1,163 @@ <%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PrestamosdeProveedor.aspx.vb" Inherits="Inventarios_PrestamosdeProveedor" %> - + - + - + Préstamos de Proveedores - + - + - + - + - -
-
-
- + +
+
+
+ +
+
+ + +
+ +
+ + +
+ + +
+ +
+
+
+
+ +
+ +
+
+ + + + +
+
+
+ + RECEPCIÓN DE TRASPASO +
+
+
-
- - -
- -
- - -
- - -
- +
+ +
+ +
+
+
+
+ +
+
+ + + + + + + + + + + + + +
+
+
+
+ + +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+
+ + + + +
- - -
- -
-
- - - - -
-
-
- - RECEPCIÓN DE TRASPASO -
-
-
-
-
- -
- -
-
-
-
- -
-
- - - - - - - - - - - - - -
-
-
-
- - -
- - - -
-
-
- -
- -
-
-
- -
- -
-
-
-
- - - - - -
-
-
-
-
-
-
-
+ + +
+
+
- - - - - - - <%-- + + + + + + + <%-- --%> - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - +
+
- + - diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 893e3be4c..f0f919c1a 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -479,7 +479,8 @@ Partial Class Inventarios_RecepcionAlmacen Protected Sub DdlAlmacen_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacen.SelectedIndexChanged If DdlAlmacen.SelectedValue <> "-1" Then - CargaCompra(CveCompraSurtir, CveProveedor) + + CargaGVInv() 'For Each Gvr As GridViewRow In GvInv.Rows ' If Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue = "-1" Then ' Dim Dr As DataRow = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero).FiltroPrimero("") @@ -1263,7 +1264,7 @@ Partial Class Inventarios_RecepcionAlmacen If CBool(e.Row.DBCampo("AplicaSeccion")) Then e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True If DdlAlmacen.SelectedValue.ToEntero > 0 Then - e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero) + e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero) e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) End If @@ -2192,7 +2193,7 @@ Partial Class Inventarios_RecepcionAlmacen 'ENTRADA ALMACÉN CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, If(TipoMovimiento > 1, 13, 2), 1, FechaMovto, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, TipoCambio), - MovimientoFijo:=If(TipoMovimiento = 2, True, False), Remision:=TxtRemision.Text, Modulo:="RA/G") + MovimientoFijo:=If(TipoMovimiento = 2, True, False), Remision:=TxtRemision.Text, Modulo:="RA/G1") If CveMovimiento > 0 Then InvFolio = ObjInventario.Folio.ToString Dim DtDetalle As New DataTable @@ -2311,7 +2312,7 @@ Partial Class Inventarios_RecepcionAlmacen CveMovtoSalidaDirecta = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 3, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, TipoCambio), - MovimientoFijo:=True, CveMovimientoRelacionado:=CveMovimiento, Remision:=TxtRemision.Text, CveVendedor:=CveVendedor, CveCliente:=CveCliente, Modulo:="RA/G") + MovimientoFijo:=True, CveMovimientoRelacionado:=CveMovimiento, Remision:=TxtRemision.Text, CveVendedor:=CveVendedor, CveCliente:=CveCliente, Modulo:="RA/G2") FolioSalidaDirecta = ObjInventario.Folio If Not CveMovtoSalidaDirecta > 0 Then @@ -2365,7 +2366,7 @@ Partial Class Inventarios_RecepcionAlmacen If CveVendedorActual = -1 Or (Dr("CveVendedor").ToString.ToEntero <> CveVendedorActual Or Dr("CveCliente").ToString.ToEntero <> CveClienteActual) Then CveMovtoSalidaActual = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 8, 1, FechaMovto, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, TipoCambio), CveAlmacenDestino:=CveAlmacenDestino, MovimientoFijo:=True, CveVendedor:=Dr("CveVendedor").ToString.ToEntero, - CveCliente:=Dr("CveCliente").ToString.ToEntero, Remision:=TxtRemision.Text, Modulo:="RA/G") + CveCliente:=Dr("CveCliente").ToString.ToEntero, Remision:=TxtRemision.Text, Modulo:="RA/G3") MovtosSalida.Add(CveMovtoSalidaActual) FoliosSalida.Add(ObjInventario.Folio) @@ -2447,7 +2448,7 @@ Partial Class Inventarios_RecepcionAlmacen Dim CveAlmacenVirutal As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacenFiltro).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero() - CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirutal, If(TipoMovimiento > 1, 13, 2), 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="RA/G") + CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirutal, If(TipoMovimiento > 1, 13, 2), 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="RA/G4") FolioVirtual = ObjInventario.Folio For Each RowUsado As DataRow In DtPSVirtual.Rows @@ -2590,7 +2591,7 @@ Partial Class Inventarios_RecepcionAlmacen Dim CveAlmacenVirutal As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 25).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero() - CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirutal, If(TipoMovimiento > 1, 13, 2), 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="RA/G") + CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirutal, If(TipoMovimiento > 1, 13, 2), 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="RA/G5") FolioVirtual = ObjInventario.Folio For Each RowUsado As DataRow In DtPSVirtual.Rows @@ -3048,7 +3049,7 @@ Partial Class Inventarios_RecepcionAlmacen Dim ObjContaAC As ClsContPAQi = Nothing 'ENTRADA ALMACÉN - CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 2, 1, FechaMovto, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveImportacionCompra, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=-1, Remision:=TxtRemision.Text, Modulo:="RA/G") + CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 2, 1, FechaMovto, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveImportacionCompra, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=-1, Remision:=TxtRemision.Text, Modulo:="RA/G6") If CveMovimiento > 0 Then InvFolio = ObjInventario.Folio.ToString Dim DtDetalle As New DataTable diff --git a/Inventarios/RepApartados2.aspx b/Inventarios/RepApartados2.aspx index aecae7b73..f40374908 100644 --- a/Inventarios/RepApartados2.aspx +++ b/Inventarios/RepApartados2.aspx @@ -110,7 +110,7 @@ <%----%> <%-- - %> + --%> diff --git a/Inventarios/ResguardoMaterial.aspx.vb b/Inventarios/ResguardoMaterial.aspx.vb index aad0f3987..9aabeb893 100644 --- a/Inventarios/ResguardoMaterial.aspx.vb +++ b/Inventarios/ResguardoMaterial.aspx.vb @@ -608,7 +608,7 @@ Partial Class Inventarios_ResguardoMaterial Private Sub CargaGvMLiberacion() GvM.Columns(5).Visible = False For Each Dr As DataRow In DtMovimientosLiberacion.Rows - If Dr("SerieLote").ToString <> "" Then + If Dr("Serie").ToString <> "" Then GvM.Columns(5).Visible = True Exit For End If @@ -777,7 +777,7 @@ Partial Class Inventarios_ResguardoMaterial Dim Cont As Integer = 0 For Each Dr As DataRow In DtMovimientos.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, -1, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString) Then MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar." TieneError = True Exit For @@ -796,7 +796,7 @@ Partial Class Inventarios_ResguardoMaterial Else If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString) Then TieneError = True MensajeError = "Ocurrió un error al guardar los movimientos de entrada" Exit For diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 55ee7d78a..752c30d04 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -855,7 +855,7 @@ Partial Class Inventarios_TraspasoAlmacen If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then Dim Cont As Integer = 0 For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacenDestino").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Observaciones:=Dr("Observaciones").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=-1, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Observaciones:=Dr("Observaciones").ToString) Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de entrada" Exit For diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index f070cb6d2..7e6042a87 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -5182,7 +5182,7 @@ Partial Class OC Protected Function ActualizarCotizacion(ByRef ObjVentas As ClsVentas) As Boolean Dim OcurrioError As Boolean = False Try - Dim PorcentajeGanancia As Decimal = 0.1D + Dim PorcentajeGanancia As Decimal = 0.3D For Each Row As DataRow In DtDetalle.Rows Dim CvePS As Integer = Row("CvePS").ToString.ToEntero Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("") diff --git a/OC/PopUpBuscarReq.aspx.vb b/OC/PopUpBuscarReq.aspx.vb index 814797b58..043715c23 100644 --- a/OC/PopUpBuscarReq.aspx.vb +++ b/OC/PopUpBuscarReq.aspx.vb @@ -168,17 +168,23 @@ Partial Class OC_PopUpBuscarReq Dim FI As Date = If(txtFechaI.Text.Trim = "", MinFecha, txtFechaI.Text.Trim.ToDate) Dim guia As String = If(TxtGuia.Text.Trim = "", "-1", TxtGuia.Text) 'Cargar Datos - Dim ObjOC As New ClsOC - ObjOC.GetOrdenesCompraRep(DdlTipo.SelectedValue, CveProyecto, CveSubProyecto, -1, DdlEstatus.SelectedValue.ToEntero, FI, MaxFecha, -1, DdlProveedor.SelectedValue.ToEntero, If(TxtFolio.Text.ToEntero <= 0, -1, TxtFolio.Text.ToEntero), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Guia:=guia, - SoloSubProyectosConPermiso:=If(UsuarioActual.Empresa.Funcionalidad(530) = "1", True, False)) - Dim DtOC = ObjOC.DtResultados ' tipotermino, esattus inicial - ObjOC.Dispose() - GV.DataSource = DtOC - GV.DataBind() - LtlTotalRegistros.Text = GV.Rows.Count.ToString - LblTotalRegistros.Text = "Número de registros: " - UPDatos.Update() + If ValidarFiltrosSeleccionado() Then + Dim ObjOC As New ClsOC + ObjOC.GetOrdenesCompraRep(DdlTipo.SelectedValue, CveProyecto, CveSubProyecto, -1, DdlEstatus.SelectedValue.ToEntero, FI, MaxFecha, -1, DdlProveedor.SelectedValue.ToEntero, + If(TxtFolio.Text.ToEntero <= 0, -1, TxtFolio.Text.ToEntero), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Guia:=guia, + SoloSubProyectosConPermiso:=If(UsuarioActual.Empresa.Funcionalidad(530) = "1", True, False)) + Dim DtOC = ObjOC.DtResultados ' tipotermino, esattus inicial + ObjOC.Dispose() + + GV.DataSource = DtOC + GV.DataBind() + LtlTotalRegistros.Text = GV.Rows.Count.ToString + LblTotalRegistros.Text = "Número de registros: " + UPDatos.Update() + Else + Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia) + End If End Sub Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then @@ -245,6 +251,17 @@ Partial Class OC_PopUpBuscarReq End If End Sub + + Private Function ValidarFiltrosSeleccionado() As Boolean + If DdlTipo.SelectedValue.ToEntero > 0 Then Return True + If DdlEstatus.SelectedValue.ToEntero > 0 Then Return True + If DdlProveedor.SelectedValue.ToEntero > 0 Then Return True + If TxtFolio.Text.ToEntero > 0 Then Return True + If DdlSubProyectos.SelectedValue.ToEntero > 0 Then Return True + If DdlProyectos.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function + #End Region #Region " VINCULA CON COMPRAS " diff --git a/OS/PopUpBuscarOS.aspx.vb b/OS/PopUpBuscarOS.aspx.vb index eca09e56b..3e288a7f4 100644 --- a/OS/PopUpBuscarOS.aspx.vb +++ b/OS/PopUpBuscarOS.aspx.vb @@ -35,16 +35,19 @@ Partial Class OS_PopUpBuscarOS 'If TxtFechaRecibido.Text.Trim <> String.Empty Then FechaRecibido.ToString() If DdlEstatusOrdenServicio.SelectedValue <> String.Empty Then CveEstatusOrdenServicio = DdlEstatusOrdenServicio.SelectedValue.ToEntero - - If ObjOS.GetOrdenesServicios(-1, CveCliente, Folio, CveUsuarioRecibio, CveEstatusOrdenServicio, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then - If ObjOS.DtResultados.Rows.Count > 0 Then - LtlTotalRegistros.Text = ObjOS.DtResultados.Rows.Count.ToString.FormatoNumero(0) - GV.DataSource = ObjOS.DtResultados - Else - LtlTotalRegistros.Text = "0" - GV.DataSource = Nothing - Alert("No se encontraron registros con losparámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + If ValidarUnFiltroSeleccionado() Then + If ObjOS.GetOrdenesServicios(-1, CveCliente, Folio, CveUsuarioRecibio, CveEstatusOrdenServicio, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then + If ObjOS.DtResultados.Rows.Count > 0 Then + LtlTotalRegistros.Text = ObjOS.DtResultados.Rows.Count.ToString.FormatoNumero(0) + GV.DataSource = ObjOS.DtResultados + Else + LtlTotalRegistros.Text = "0" + GV.DataSource = Nothing + Alert("No se encontraron registros con losparámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + End If End If + Else + Alert("Seleccione un criterio de búsqueda", TipoMensaje.MsgAdvertencia) End If ObjOS.Dispose() @@ -108,4 +111,13 @@ Partial Class OS_PopUpBuscarOS DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) End Sub + Private Function ValidarUnFiltroSeleccionado() As Boolean + If TxtFolio.Text.Trim <> String.Empty Then Return True + If DdlCliente.SelectedValue.ToEntero > 0 Then Return True + If DdlUsuarioRecibio.SelectedValue.ToEntero > 0 Then Return True + 'If TxtFechaRecibido.Text.Trim <> String.Empty Then FechaRecibido.ToString() + If DdlEstatusOrdenServicio.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function + End Class diff --git a/Planeacion/CatFolios.aspx.vb b/Planeacion/CatFolios.aspx.vb index 5646a6ec2..5d7011078 100644 --- a/Planeacion/CatFolios.aspx.vb +++ b/Planeacion/CatFolios.aspx.vb @@ -91,7 +91,7 @@ Partial Class CatFolios Dim ObjFolios As New ClsGralFolios If ObjFolios.GetFolios() Then ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTFolios = ObjFolios.DtResultados + GvDatos.DataSource = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) GvDatos.DataBind() Else @@ -153,7 +153,7 @@ Partial Class CatFolios If ObjFolios.RemoveFolios(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then GvDatos.EditIndex = -1 ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTFolios = ObjFolios.DtResultados + Alert("La Aprobación de Folios se eliminó correctamente.", TipoMensaje.MsgInformacion) End If ObjFolios.Dispose() @@ -194,7 +194,7 @@ Partial Class CatFolios Session("FileUpload") = "" Alert("La nueva Aprobación de Folios se guardó/editó correctamente.", TipoMensaje.MsgInformacion) - GlobalDTFolios = ObjFolios.DtResultados + ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) diff --git a/PortalGPS/Penske.aspx.vb b/PortalGPS/Penske.aspx.vb index 5df25f0cd..38e4d8041 100644 --- a/PortalGPS/Penske.aspx.vb +++ b/PortalGPS/Penske.aspx.vb @@ -74,12 +74,16 @@ Partial Class PortalGPS_Penske Using wc As New HttpClient() Try - Dim Url = New Uri($"{ClsPaginas.UrlDirecciones}nominatim/reverseMultiple.php") + Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones)) Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array) Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded") Dim response = wc.PostAsync(Url, content).Result Dim result = response.Content.ReadAsStringAsync().Result retorno = JArray.Parse(result) + response.Dispose() + content = Nothing + Url = Nothing + FormStuff = Nothing Catch ex As Exception OnError("Ocurrió un error al obtener las direcciones", ex) End Try diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index fd7b97de2..ad953a315 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -1242,6 +1242,11 @@ Partial Class RH_Personal Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.png", UsuarioActual.CveEmpresa, CvePersonal) Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica)) + ImgPersonal.ImageUrl = logouri + ElseIf File.Exists(ModExtensiones.DirectorioBaseEmpresas & "Empresas\" & UsuarioActual.CveEmpresa & "\RH\Personal\" & CvePersonal & ".bmp") Then + Dim LogoRutaFisica As String = String.Format("Empresas\{0}\RH\Personal\{1}.bmp", UsuarioActual.CveEmpresa, CvePersonal) + Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica)) + ImgPersonal.ImageUrl = logouri End If 'BtnCargarArchivo_Click(Me, New EventArgs) @@ -4973,10 +4978,14 @@ Partial Class RH_Personal Dim yaExistente As String = String.Format("{0}Empresas\{1}\RH\Personal\{2}.jpg", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CvePersonal) Dim yaExistentePNG As String = String.Format("{0}Empresas\{1}\RH\Personal\{2}.png", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CvePersonal) + Dim yaExistenteBMP As String = String.Format("{0}Empresas\{1}\RH\Personal\{2}.bmp", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, CvePersonal) + If File.Exists(yaExistente) Then File.Delete(yaExistente) ElseIf File.Exists(yaExistentePNG) Then File.Delete(yaExistentePNG) + ElseIf File.Exists(yaExistenteBMP) Then + File.Delete(yaExistenteBMP) End If If filemove <> "" Then diff --git a/RH/PopUpBuscarPersonal.aspx.vb b/RH/PopUpBuscarPersonal.aspx.vb index e9d5cab16..06a779f57 100644 --- a/RH/PopUpBuscarPersonal.aspx.vb +++ b/RH/PopUpBuscarPersonal.aspx.vb @@ -142,7 +142,6 @@ Partial Class RH_PopUpBuscarPersonal End Sub Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click - Dim ObjPersonal As New ClsRH() Dim Codigo As String = "-1" Dim Nombre As String = "-1" @@ -161,26 +160,32 @@ Partial Class RH_PopUpBuscarPersonal Dim StrFiltroCaracteristica As String = GeneraFiltroCaracteristicas() - If ObjPersonal.GetPersonal2(-1, Codigo, Nombre, NSS, RFC, DdlTurnos.SelectedValue.ToEntero, DdlPuestos.SelectedValue.ToEntero, DdlDepartamentos.SelectedValue.ToEntero, + If ValidarFiltrosSeleccionado() Then + + Dim ObjPersonal As New ClsRH() + If ObjPersonal.GetPersonal2(-1, Codigo, Nombre, NSS, RFC, DdlTurnos.SelectedValue.ToEntero, DdlPuestos.SelectedValue.ToEntero, DdlDepartamentos.SelectedValue.ToEntero, DdlRuta.SelectedValue.ToEntero, DdlEscolaridad.SelectedValue.ToEntero, DdlEstadoCivil.SelectedValue.ToEntero, DdlGenero.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlClienteAsignado.SelectedValue.ToEntero, Horario, CveSupervisor, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", StrFiltroCaracteristica, 1, UsuarioActual.CveEmpresa) Then - If ObjPersonal.DtResultados.Rows.Count > 0 Then - LtlTotalRegistros.Text = ObjPersonal.DtResultados.Rows.Count.ToString.FormatoNumero(0) - GV.DataSource = ObjPersonal.DtResultados - Else - LtlTotalRegistros.Text = "0" - GV.DataSource = Nothing - Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + If ObjPersonal.DtResultados.Rows.Count > 0 Then + LtlTotalRegistros.Text = ObjPersonal.DtResultados.Rows.Count.ToString.FormatoNumero(0) + GV.DataSource = ObjPersonal.DtResultados + Else + LtlTotalRegistros.Text = "0" + GV.DataSource = Nothing + Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + End If End If + + ObjPersonal.Dispose() + GV.DataBind() + + UPDatos.Update() + + TblBusqueda.Visible = True + Else + Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia) End If - - ObjPersonal.Dispose() - GV.DataBind() - - UPDatos.Update() - - TblBusqueda.Visible = True End Sub Private Function GeneraFiltroCaracteristicas() As String @@ -383,4 +388,26 @@ Partial Class RH_PopUpBuscarPersonal End If End Sub + + Private Function ValidarFiltrosSeleccionado() As Boolean + If TxtCodigo.Text.Trim <> String.Empty Then Return True + If TxtNombre.Text.Trim <> String.Empty Then Return True + If TxtNSS.Text.Trim <> String.Empty Then Return True + If TxtRFC.Text.Trim <> String.Empty Then Return True + If TxtHorarioDe.Text.Trim <> String.Empty Then Return True + + If DdlTurnos.SelectedValue.ToEntero > 0 Then Return True + If DdlPuestos.SelectedValue.ToEntero > 0 Then Return True + If DdlDepartamentos.SelectedValue.ToEntero > 0 Then Return True + If DdlRuta.SelectedValue.ToEntero > 0 Then Return True + If DdlEscolaridad.SelectedValue.ToEntero > 0 Then Return True + If DdlEstadoCivil.SelectedValue.ToEntero > 0 Then Return True + If DdlGenero.SelectedValue.ToEntero > 0 Then Return True + If DdlEstatus.SelectedValue.ToEntero > 0 Then Return True + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then Return True + If DdlClienteAsignado.SelectedValue.ToEntero > 0 Then Return True + + Return False + End Function + End Class diff --git a/Sistemas/CatSesiones.aspx b/Sistemas/CatSesiones.aspx index a5e1ae906..266a9afff 100644 --- a/Sistemas/CatSesiones.aspx +++ b/Sistemas/CatSesiones.aspx @@ -20,8 +20,7 @@ - - + <%-- --%> diff --git a/Sistemas/CatSesiones.aspx.vb b/Sistemas/CatSesiones.aspx.vb index f363c3e59..943e3b585 100644 --- a/Sistemas/CatSesiones.aspx.vb +++ b/Sistemas/CatSesiones.aspx.vb @@ -24,8 +24,6 @@ Partial Class Sistemas_CatSesiones CargaSubProyectos() ElseIf DdlVariable.SelectedItem.Value = "GlobalDTSubProyectosUsuarios" Then CargaSubProyectos() - ElseIf DdlVariable.SelectedItem.Value = "GlobalDTFolios" Then - CargaFolios() 'ElseIf DdlVariable.SelectedItem.Value = "GlobalDTSucursales" Then ' CargaSucursales() ElseIf DdlVariable.SelectedItem.Value = "GlobalDTCompProveedores" Then @@ -168,7 +166,7 @@ Partial Class Sistemas_CatSesiones Private Sub CargaAlmacen() Dim Objinventarios As New ClsInventarios If Objinventarios.GetAlmacenes(-1, -1, -1, -1) Then Application("GlobalDTAlmacen") = Objinventarios.DtResultados Else Application("GlobalDTAlmacen") = Nothing - If Objinventarios.GetSeccionesAlmacenes(-1) Then Application("GlobalDTSeccionAlmacen") = Objinventarios.DtResultados Else Application("GlobalDTSeccionAlmacen") = Nothing + If Objinventarios.GetSeccionesAlmacenes(-1, -1) Then Application("GlobalDTSeccionAlmacen") = Objinventarios.DtResultados Else Application("GlobalDTSeccionAlmacen") = Nothing If Objinventarios.GetTiposAlmacenes Then Application("GlobalDTTipoAlmacen") = Objinventarios.DtResultados Else Application("GlobalDTTipoAlmacen") = Nothing If Objinventarios.GetConceptos Then Application("GlobalDTInvConceptos") = Objinventarios.DtResultados Else Application("GlobalDTInvConceptos") = Nothing Objinventarios.Dispose() @@ -341,18 +339,6 @@ Partial Class Sistemas_CatSesiones 'Fin Carga Proyectos End Sub - Private Sub CargaFolios() - 'Carga Folios - Dim ObjFolios As New ClsGralFolios() - If ObjFolios.GetFolios() Then - Application("GlobalDTFolios") = ObjFolios.DtResultados - Else - Application("GlobalDTFolios") = Nothing - End If - ObjFolios.Dispose() - 'Fin Carga Folios - End Sub - 'Private Sub CargaSucursales() ' 'Carga Sucursales ' Dim ObjSucursales As New ClsSucursales() diff --git a/Sistemas/SessionesActivas.aspx b/Sistemas/SessionesActivas.aspx index cac53f774..a61a989a3 100644 --- a/Sistemas/SessionesActivas.aspx +++ b/Sistemas/SessionesActivas.aspx @@ -20,6 +20,10 @@ +
  • + +
  • diff --git a/Sistemas/SessionesActivas.aspx.vb b/Sistemas/SessionesActivas.aspx.vb index d75a25113..71db01552 100644 --- a/Sistemas/SessionesActivas.aspx.vb +++ b/Sistemas/SessionesActivas.aspx.vb @@ -196,4 +196,45 @@ Partial Class SessionesActivas Notificaciones.AlertaVentana(TxtMensaje.Text, lista, timeoutseconds:=0) RegistraScript($"$(""#DivMensaje"").modal('hide');console.log('{Decripta(Context.User.Identity.Name)}')") End Sub + + + + Private Sub VerGC() + + Dim myGCCol As MyGCCollectClass = New MyGCCollectClass() + Console.WriteLine("The highest generation is {0}", GC.MaxGeneration) + myGCCol.MakeSomeGarbage() + Console.WriteLine("Generation: {0}", GC.GetGeneration(myGCCol)) + Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(False)) + GC.Collect(0) + Console.WriteLine("Generation: {0}", GC.GetGeneration(myGCCol)) + Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(False)) + GC.Collect(2) + Console.WriteLine("Generation: {0}", GC.GetGeneration(myGCCol)) + Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(False)) + Console.Read() + + GC.Collect() + GC.WaitForPendingFinalizers() + + End Sub + + Private Sub LBGC_Click(sender As Object, e As EventArgs) Handles LBGC.Click + GC.Collect() + GC.WaitForPendingFinalizers() + End Sub + + Class MyGCCollectClass + Public Sub MakeSomeGarbage() + Dim vt As Version + + For i As Integer = 0 To 1000 - 1 + vt = New Version() + Next + End Sub + + End Class + + + End Class diff --git a/Site.master.vb b/Site.master.vb index 71df0dc42..bef60c318 100644 --- a/Site.master.vb +++ b/Site.master.vb @@ -381,7 +381,10 @@ Partial Class Site End If HeaderBar.AppendFormat("{0}", ScriptColorGrupoModulo) BarraNavegacion.Text = HeaderBar.ToString - CargaMenu(MenuHTML) + 'CargaMenu(MenuHTML) + Menu.Text = MenuHTML.ToString + MenuHTML.Clear() + HeaderBar.Clear() End Sub @@ -413,9 +416,9 @@ Partial Class Site End Select End Function - Private Sub CargaMenu(Texto As StringBuilder) - Menu.Text = Texto.ToString - End Sub + 'Private Sub CargaMenu(Texto As StringBuilder) + ' Menu.Text = Texto.ToString + 'End Sub #Region "Notificaciones" @@ -458,6 +461,7 @@ Partial Class Site 'OC.Dispose() LtlMNotificaciones.Text = LtlMNotificaciones.Text & Notificaciones.ToString + Notificaciones.Clear() End Sub @@ -474,7 +478,10 @@ Partial Class Site Dim x509 As New X509Certificate2() x509.Import(Data) - Return x509.NotAfter.ToShortDateString() + Dim Retorno = x509.NotAfter.ToShortDateString() + x509 = Nothing + Data = Nothing + Return Retorno End If Catch ex As Exception diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index 6a75e8dbd..61757410e 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -1499,7 +1499,7 @@
    - +
       @@ -1557,7 +1557,7 @@
    - +
       @@ -5509,7 +5509,7 @@ - Dias + Días
    @@ -5525,7 +5525,7 @@ - Dias Credito + Días Credito
    @@ -5590,7 +5590,7 @@ - + diff --git a/Ventas/PopUpBuscarClientes.aspx.vb b/Ventas/PopUpBuscarClientes.aspx.vb index b1d247a43..96af8f67b 100644 --- a/Ventas/PopUpBuscarClientes.aspx.vb +++ b/Ventas/PopUpBuscarClientes.aspx.vb @@ -54,7 +54,6 @@ Partial Class PopUpBuscarClientes End Sub Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click - Dim ObjClientes As New ClsClientes() Dim Nombre As String = "-1" Dim Codigo As String = "-1" @@ -70,30 +69,37 @@ Partial Class PopUpBuscarClientes If TxtTelefono.Text.Trim <> String.Empty Then Telefono = TxtTelefono.Text.Trim If TxtMail.Text.Trim <> String.Empty Then Mail = TxtMail.Text.Trim - If ObjClientes.GetClientes(-1, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlEstatus.SelectedValue.ToEntero, TipoCliente:=TipoCliente) Then - If ObjClientes.DtResultados.Rows.Count > 0 Then - LtlTotalRegistros.Text = ObjClientes.DtResultados.Rows.Count.ToString.FormatoNumero(0) - GV.DataSource = ObjClientes.DtResultados - If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 Then - GV.DataSource = ObjClientes.DtResultados.FiltraParametros("CveCliente IN (10450, 10460, 10458)") - LtlTotalRegistros.Text = "0" - ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 Then - GV.DataSource = ObjClientes.DtResultados.FiltraParametros("CveCliente IN (27448)") + If ValidarUnFiltroSeleccionado() Then + + Dim ObjClientes As New ClsClientes() + If ObjClientes.GetClientes(-1, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, + DdlEstatus.SelectedValue.ToEntero, TipoCliente:=TipoCliente) Then + If ObjClientes.DtResultados.Rows.Count > 0 Then + LtlTotalRegistros.Text = ObjClientes.DtResultados.Rows.Count.ToString.FormatoNumero(0) + GV.DataSource = ObjClientes.DtResultados + If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 Then + GV.DataSource = ObjClientes.DtResultados.FiltraParametros("CveCliente IN (10450, 10460, 10458)") + LtlTotalRegistros.Text = "0" + ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 Then + GV.DataSource = ObjClientes.DtResultados.FiltraParametros("CveCliente IN (27448)") + LtlTotalRegistros.Text = "0" + End If + Else LtlTotalRegistros.Text = "0" + GV.DataSource = Nothing + Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) End If - Else - LtlTotalRegistros.Text = "0" - GV.DataSource = Nothing - Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) End If + + ObjClientes.Dispose() + GV.DataBind() + + UPDatos.Update() + + TblBusqueda.Visible = True + Else + Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia) End If - - ObjClientes.Dispose() - GV.DataBind() - - UPDatos.Update() - - TblBusqueda.Visible = True End Sub Protected Sub GV_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GV.RowDataBound @@ -127,4 +133,17 @@ Partial Class PopUpBuscarClientes e.Row.FCLiteral("LtlMail").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Mail")) End If End Sub + + Private Function ValidarUnFiltroSeleccionado() As Boolean + If TxtNombre.Text.Trim <> String.Empty Then Return True + If TxtCodigo.Text.Trim <> String.Empty Then Return True + If TxtNombreCorto.Text.Trim <> String.Empty Then Return True + If TxtRFC.Text.Trim <> String.Empty Then Return True + If TxtTelefono.Text.Trim <> String.Empty Then Return True + If TxtMail.Text.Trim <> String.Empty Then Return True + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then Return True + If DdlEstatus.SelectedValue.ToEntero > 0 Then Return True + Return False + End Function + End Class diff --git a/Ventas/PopUpBuscarFolio.aspx.vb b/Ventas/PopUpBuscarFolio.aspx.vb index f5dc1d44e..e2c6711cd 100644 --- a/Ventas/PopUpBuscarFolio.aspx.vb +++ b/Ventas/PopUpBuscarFolio.aspx.vb @@ -88,7 +88,6 @@ Partial Class PopUpBuscarFolio Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click - Dim ObjVentas As New ClsVentas() Dim Serie As String = "-1" Dim Folio As Integer = -1 @@ -123,23 +122,31 @@ Partial Class PopUpBuscarFolio PeidoContrato = If(TxtPedidoContrato.Text.Length = 0, "-1", TxtPedidoContrato.Text.Trim) OrdenCompra = If(TxtOrdenCompra.Text.Length = 0, "-1", TxtOrdenCompra.Text.Trim) - If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, DdlTipoDocto.SelectedValue, Serie, Folio, Codigo, Cliente.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlEstatusFactura.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, FechaI, FechaF, FolioFiscal, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedValue.ToEntero, -1), DdlPS.SelectedValue.ToEntero, PedidoContrato:=PeidoContrato, OrdenCompra:=OrdenCompra, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then - LtlTotalRegistros.Text = ObjVentas.DtResultados.Rows.Count.ToString.FormatoNumero(0) - GV.DataSource = ObjVentas.DtResultados - Else - LtlTotalRegistros.Text = "0" - GV.DataSource = Nothing - Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + If ValidarUnFiltroSeleccionado() Then + + Dim ObjVentas As New ClsVentas() + If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, DdlTipoDocto.SelectedValue, Serie, Folio, Codigo, Cliente.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, + DdlEstatusFactura.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, FechaI, FechaF, FolioFiscal, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedValue.ToEntero, -1), + DdlPS.SelectedValue.ToEntero, PedidoContrato:=PeidoContrato, OrdenCompra:=OrdenCompra, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + LtlTotalRegistros.Text = ObjVentas.DtResultados.Rows.Count.ToString.FormatoNumero(0) + GV.DataSource = ObjVentas.DtResultados + Else + LtlTotalRegistros.Text = "0" + GV.DataSource = Nothing + Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) + End If End If + + ObjVentas.Dispose() + GV.DataBind() + + UPDatos.Update() + + TblBusqueda.Visible = True + Else + Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia) End If - - ObjVentas.Dispose() - GV.DataBind() - - UPDatos.Update() - - TblBusqueda.Visible = True End Sub Protected Sub GV_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GV.RowDataBound @@ -271,4 +278,20 @@ Partial Class PopUpBuscarFolio DdlEstatusFactura.Items.Add(New ListItem("Todos", "-1")) DdlEstatusFactura.DataBind() End Sub + + Private Function ValidarUnFiltroSeleccionado() As Boolean + If DdlTipoDocto.SelectedValue.ToEntero > 0 Then Return True + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then Return True + If DdlEstatusFactura.SelectedValue.ToEntero > 0 Then Return True + If DdlUsuario.SelectedValue.ToEntero > 0 Then Return True + If DdlPS.SelectedValue.ToEntero > 0 Then Return True + + If DdlNombre.SelectedValue.ToEntero > 0 Then Return True + If TxtFolioFiscal.Text.Trim.Length > 0 Then Return True + If TxtPedidoContrato.Text.Length > 0 Then Return True + If TxtOrdenCompra.Text.Length > 0 Then Return True + + Return False + + End Function End Class diff --git a/Ventas/PopUpBuscarPs.aspx.vb b/Ventas/PopUpBuscarPs.aspx.vb index f5baa1e9e..44825d642 100644 --- a/Ventas/PopUpBuscarPs.aspx.vb +++ b/Ventas/PopUpBuscarPs.aspx.vb @@ -64,18 +64,24 @@ Partial Class PopUpBuscarPs If TxtCodigoBarras.Text.Trim = "" Then CodigoBarras = "-1" Else CodigoBarras = TxtCodigoBarras.Text.Trim If TxtNombre.Text = "" Then Nombre = "-1" Else Nombre = TxtNombre.Text.ToUpper - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPS(-1, Ddlclasificacion.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, Codigo:=Codigo, CodigoBarras:=CodigoBarras, PS:=Nombre, pEstado:=DdlEstado.SelectedValue.ToEntero, CveTipoPS:=DdlCveTipoPS.SelectedValue.ToEntero, pAplicaParaVenta:=DdlAplicaVenta.SelectedValue.ToEntero, CveCompuesto:=DdlCompuesto.SelectedValue.ToEntero) Then - GvDatos.DataSource = ObjPS.DtResultados - dvbusqueda.Visible = True - Else - GvDatos.DataSource = Nothing - dvbusqueda.Visible = False - End If - ObjPS.Dispose() + If ValidarUnFiltroSeleccionado() Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPS(-1, Ddlclasificacion.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, Codigo:=Codigo, CodigoBarras:=CodigoBarras, PS:=Nombre, + pEstado:=DdlEstado.SelectedValue.ToEntero, CveTipoPS:=DdlCveTipoPS.SelectedValue.ToEntero, pAplicaParaVenta:=DdlAplicaVenta.SelectedValue.ToEntero, + CveCompuesto:=DdlCompuesto.SelectedValue.ToEntero) Then + GvDatos.DataSource = ObjPS.DtResultados + dvbusqueda.Visible = True + Else + GvDatos.DataSource = Nothing + dvbusqueda.Visible = False + End If + ObjPS.Dispose() - GvDatos.DataBind() - GvDatos.UseAccessibleHeader = True + GvDatos.DataBind() + GvDatos.UseAccessibleHeader = True + Else + Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia) + End If End Sub #End Region @@ -91,6 +97,17 @@ Partial Class PopUpBuscarPs End Sub #End Region + Private Function ValidarUnFiltroSeleccionado() As Boolean + If TxtCodigo.Text.Trim <> String.Empty Then Return True + If TxtCodigoBarras.Text.Trim <> String.Empty Then Return True + If TxtNombre.Text.Trim <> String.Empty Then Return True + + If DdlCveTipoPS.SelectedValue.ToEntero > 0 Then Return True + If DdlAplicaVenta.SelectedValue.ToEntero > 0 Then Return True + If DdlCompuesto.SelectedValue.ToEntero > 0 Then Return True + + Return False + End Function End Class diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index b775018f3..f6f71a957 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5152,7 +5152,9 @@ Partial Class Ventas CargarAlmacenes() - CargaDocumentacionCliente() + If UsuarioActual.Empresa.FacturaProduccion Then + CargaDocumentacionCliente() + End If If UsuarioActual.CveEmpresa.Contiene(72, 80, 1, 119) Then BtnEmitirImprimir.OnClientClick = $"ValidaGuardar({ If(ImprimeNombreSucursal = True, 1, 0)});" @@ -5728,6 +5730,11 @@ Partial Class Ventas End If + If UsuarioActual.TienePermisoProceso(68) Then + e.Row.FCTextBox("TxtPrecio").Enabled = False + e.Row.FCTextBox("TxtDescuento").Enabled = False + End If + 'Si es una devolucion If NuevaFactura = 0 Then e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False @@ -5956,15 +5963,17 @@ Partial Class Ventas If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR Dim CvePS As Integer = DatarowPS("CvePS").ToString().ToEntero() - Dim CveUM As Integer = DatarowPS("CveUM").ToString().ToEntero() + Dim CveUM As Integer = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero() 'DatarowPS("CveUM").ToString().ToEntero() Dim CveTipoPS As Integer = DatarowPS("CveTipoPS").ToString().ToEntero() - CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToString().ToDecimal + CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToDecimal + Dim CveUMInicial As Integer = GvPS.Rows(e.RowIndex).DataKey("CveUM").ToEntero Dim ValidaExistencia As Boolean = True If (CantidadInventario > 0) OrElse (Cantidad <= CantidadOriginal) Then 'si ya hay algo surtido, que no valide existencia ValidaExistencia = False End If + If CveUM <> CveUMInicial Then ValidaExistencia = True 'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then @@ -6067,6 +6076,7 @@ Partial Class Ventas Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() e.Cancel = True Exit Sub End If @@ -6080,6 +6090,7 @@ Partial Class Ventas MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
    ", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) End If Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() e.Cancel = True Exit Sub End If @@ -6128,6 +6139,7 @@ Partial Class Ventas PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0 + DrPS = Nothing End If Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento)) @@ -6700,6 +6712,7 @@ Partial Class Ventas If MensajeCosto.ToString().Length > 1 Then Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() Exit Sub End If @@ -6816,6 +6829,7 @@ Partial Class Ventas Next Alert(str.ToString(), TipoMensaje.MsgAdvertencia) dttsat.Dispose() + str.Clear() Exit Sub End If dttsat.Dispose() @@ -7003,28 +7017,36 @@ Partial Class Ventas Dim ObjNC As List(Of Object) = Nothing If ErrorList.Count = 0 Then If NuevaFactura = 1 Then - 'Si directamente como cancelada sin aceptación, debe de generar la cancelacion aquí - 'If Me.CveEstatusRefacturacion = 0 Then ' cuando es refacturación sin aceptación debe de cancelar y reducir saldo - ' ObjNC = generaNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, ObjEventos) - ' If ObjNC Is Nothing Then - ' ErrorList.Add("No se pudo Cancelar la Factura") - ' End If - 'End If - 'Esquema viejo, evitamos que aparezca por surtir - If ErrorList.Count = 0 Then - 'MARCAR VENTA ANTERIOR - If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then + 'SI YA ESTA MARCADA LA VENTA ANTERIOR + If DevolucionAlmacenNC = 2 Then + If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") End If - - 'MARCAR VENTA ANTERIOR - If VentaSaldoAlmacenNC <> 0 OrElse DevolucionAlmacenNC = 2 Then - If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then - ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") - End If - End If - End If + + 'MARCAR VENTA ANTERIOR + If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then + ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") + End If + + 'MARCA LO PENDIENTE A NIVEL DETALLE + Dim DtMovDetalles As DataTable = Nothing + If ObjInventario.GetSaldoVentaDetalle(CveDevolucion, UsuarioActual.CveEmpresa) Then + DtMovDetalles = ObjInventario.DtResultados.Copy() + End If + + If DtMovDetalles IsNot Nothing Then + For Each Row As DataRow In DtMovDetalles.Rows + Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToEntero() + If SaldoAlmacen < 0 Then + ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 1) + ElseIf SaldoAlmacen = 0 Then + ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 0) + End If + Next + End If + + DtMovDetalles.Dispose() End If End If @@ -7417,6 +7439,7 @@ Partial Class Ventas Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}&Opt=3"";")) Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga) + MensajeAlert.Clear() 'LIMPIA CONDICIONES DE PAGO - CONTADO RBLPago.SelectedValue = "1" @@ -7443,6 +7466,7 @@ Partial Class Ventas ObjContr.Dispose() ObjDocCliente.Dispose() 'ObjFolios.Dispose() + ErrorList.Clear ErrorList = Nothing MensajeAlert = Nothing If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() @@ -7465,13 +7489,17 @@ Partial Class Ventas ObjContr.Dispose() ObjDocCliente.Dispose() 'ObjFolios.Dispose() + ErrorList.Clear() ErrorList = Nothing MensajeAlert = Nothing If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() TmpDT = TmpDTError.Copy End If + ObjFactura = Nothing + Obj2 = Nothing End If + End If End Sub @@ -9473,7 +9501,7 @@ Partial Class Ventas Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=CveTipoRetencion) Then ErrorList.Add("Ocurrió un error al Generar la Venta.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Else - If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Then + If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Or CveEstatusRefacturacion = 1 Then If DtVentasNC IsNot Nothing Then For Each row As DataRow In DtVentasNC.Rows If Not row("CveVenta").ToString().ToEntero() = -1 Then @@ -10160,7 +10188,7 @@ Partial Class Ventas Exit For Else ViewState("SeGuardoPrePoliza") = True - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then ErrorPrepoliza = True Exit For End If @@ -11104,12 +11132,12 @@ Partial Class Ventas End If 'Factura - If Not ObjEventos.AddEventoBitacora($"Sustituye a: Folio Factura", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then + If Not ObjEventos.AddEventoBitacora($"Remisión facturada : {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then ErrorPrepoliza = True End If 'Remision - If Not ObjEventos.AddEventoBitacora($"Refacturacion en: {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then + If Not ObjEventos.AddEventoBitacora($"Facturación de remisión en: {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then ErrorPrepoliza = True End If Next @@ -13714,6 +13742,8 @@ Partial Class Ventas TxtPrecio.Enabled = True End If + If UsuarioActual.TienePermisoProceso(68) Then TxtPrecio.Enabled = False + If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString()) CambiaMoneda() @@ -16731,7 +16761,7 @@ Partial Class Ventas End If End If - + TextoExistencia.Clear() Return TieneError End Function 'Protected Sub LbVerInventario_Click(sender As Object, e As EventArgs) Handles LbVerInventario.Click @@ -18343,6 +18373,10 @@ Partial Class Ventas DtTemporal.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime")) End If + If Not DtTemporal.Columns.Contains("Serie") Then + DtTemporal.Columns.Add("Serie", Type.GetType("System.String")) + End If + GvInv.Columns(4).Visible = DtTemporal.MAX("Serie", "Serie <> ''") <> "" Or CveVenta <= 0 GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> "" GvInv.Columns(6).Visible = DtTemporal.MAX("FechaCaducidad").ToDate > MinFecha @@ -19200,7 +19234,7 @@ Partial Class Ventas Else ResultadoMail = 0 End If - + sb.Clear() End If ObjVentas.Dispose() End Sub @@ -19219,7 +19253,7 @@ Partial Class Ventas End If LbCancelarDescripcion.Text = SbCondiciones.ToString() - + SbCondiciones.Clear() UpCancelarDocumento.Update() End Sub @@ -19276,7 +19310,7 @@ Partial Class Ventas RegistraScript("$('#ModalCancelarDocumento').modal();") UpCancelarDocumento.Update() - + sb.Clear() Else CancelarDocumento() End If @@ -19419,6 +19453,7 @@ Partial Class Ventas Private Sub CancelarDocumento(Optional EsRefacturacion As Boolean = False) + Dim LigaRedirigir As String = "" 'Si es cancelacion de una refactura ignoramos las condiciones If Me.CveEstatus = 13 Then CancelarRefacturada() @@ -19463,11 +19498,9 @@ Partial Class Ventas Else If EsRefacturacion Then If resp.CveEstatus = 20 Then - ObjFacturaCancelacion.Dispose() - Server.Transfer($"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={CveVenta}") + LigaRedirigir = $"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={CveVenta}" ElseIf resp.CveEstatus.Contiene(4, 5) Then - ObjFacturaCancelacion.Dispose() - Server.Transfer($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1") + LigaRedirigir = $"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1" Else Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") End If @@ -19475,8 +19508,6 @@ Partial Class Ventas Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") End If End If - - ObjFacturaCancelacion.CveAlmacen = -1 Else Alert("Ocurrió un error al generar la cancelación", TipoMensaje.MsgError) End If @@ -19488,6 +19519,10 @@ Partial Class Ventas UpEstatus.Update() + If Not String.IsNullOrEmpty(LigaRedirigir) Then + Response.Redirect(LigaRedirigir) + End If + End Sub @@ -20710,7 +20745,7 @@ Partial Class Ventas RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error") Exit Sub End If - + MensajeAlert.Clear() Dim MensajeSinExistencias As New StringBuilder Dim ObjInventarios As New ClsInventarios @@ -20754,7 +20789,7 @@ Partial Class Ventas Else RegistraScript("playsonidito('beep-07.wav')", "Existo") End If - + MensajeSinExistencias.Clear() End Sub Protected Sub GvSerie_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvSerie.RowDeleting @@ -21833,13 +21868,12 @@ Partial Class Ventas Cuerpo.AppendLine("") End If Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()) + Cuerpo.Clear() Exit Select End Select - - End Sub Private Sub GuardarBitacora(CveVenta As Integer, RutaAdjunto As String, Obser As String) Dim ObjEventos As New ClsOIEventos() @@ -23580,6 +23614,7 @@ Partial Class Ventas DtCotizacionesPS = ObjClientes.DtResultados End If ObjClientes.Dispose() + Cves.Clear() If Not AgregaPSCotizacion() Then Alert("Ocurrió un error validar las partidas de las cotizaciones seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -23954,6 +23989,7 @@ Partial Class Ventas sb.Remove(sb.Length - 1, 1) CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1)) + sb.Clear() End Select Dim CveTipoDocto = DdlTipoComprobante.SelectedValue @@ -23999,7 +24035,10 @@ Partial Class Ventas DdlContrato.DataSource = DtContratos.FiltraParametros($"CveContrato = {CveContrato}") DdlContrato.DataBind() End If - + MensajeRemisiones.Clear() + ObsOC.Clear() + ObsPedido.Clear() + ObsInv.Clear() End If End If @@ -24324,6 +24363,7 @@ Partial Class Ventas DtPedidos2PS = ObjVentas.DtResultados End If ObjVentas.Dispose() + Cves.Clear() If Not AgregaPSPedido2() Then Alert("Ocurrió un error validar las partidas de los pedidos seleccionadas. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -24356,6 +24396,10 @@ Partial Class Ventas TxtPedidoContrato.Text = If(ObsPedido.ToString().Length > 0, ObsPedido.ToString().Substring(0, ObsPedido.ToString().Length - 2), "") TxtObsAlmacen.Text = If(ObsInv.ToString().Length > 0, ObsInv.ToString().Substring(0, ObsInv.ToString().Length - 2), "") + MensajePedidos2.Clear() + ObsOC.Clear() + ObsPedido.Clear() + ObsInv.Clear() UpModalPedidos2.Update() UpFacturar.Update() @@ -24727,14 +24771,27 @@ Partial Class Ventas If UsuarioActual.CveEmpresa = 141 Then Dim Total As Decimal = TxtTotal.Text.ToDecimal() - If Not PermiteCredito AndAlso ((DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) AndAlso Total > 0) Then + Dim AmortizacionNC As Decimal = 0 + + Dim TienePagos As Boolean = ((Not (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0)) AndAlso (DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0)) OrElse AmortizacionNC > 0 + + 'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO + If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then + For Each gvr As GridViewRow In GVAnticipos.Rows + If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then + AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal + End If + Next + End If + + If Not PermiteCredito AndAlso Not TienePagos AndAlso Total > 0 Then Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) Retorno = False Return Retorno End If - If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 AndAlso Total > 0 Then - Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + If Not PermiteCredito AndAlso TienePagos AndAlso Total > 0 Then + Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC If TotalPago < Total Then Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) @@ -25394,6 +25451,7 @@ Partial Class Ventas ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.") End If ObjEventos.Dispose() + Msg.Clear() Else Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia) End If diff --git a/asmx/WSApp.asmx b/asmx/WSApp.asmx index 88b6270ad..99eae2355 100644 --- a/asmx/WSApp.asmx +++ b/asmx/WSApp.asmx @@ -633,7 +633,7 @@ Public Class WSApp Dim retorno As String = "[]" Dim CvePS = -1 Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSExistencias(CvePS, CvePrecioLista, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then + If ObjPS.GetPSExistenciasWS(CvePS, CvePrecioLista, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then If CveClasificacion > 0 Then retorno = ObjPS.DtResultados.FiltraParametros($"CveClasificacion = {CveClasificacion}").ToJson() Else @@ -1122,7 +1122,7 @@ Public Class WSApp TmpDT.Columns.Add("NoIdentificacion", GetType(String)) TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) - TmpDT.Columns.Add("SerieLote", GetType(String)) + TmpDT.Columns.Add("Serie", GetType(String)) TmpDT.Columns.Add("CuentaPredial", GetType(String)) TmpDT.Columns.Add("Obs", GetType(String)) TmpDT.Columns.Add("TiempoEntrega", GetType(String)) @@ -1210,7 +1210,7 @@ Public Class WSApp TmpDT.Columns.Add("CveUM", GetType(Integer)) TmpDT.Columns.Add("Cantidad", GetType(Decimal)) TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) - TmpDT.Columns.Add("SerieLote", GetType(String)) + TmpDT.Columns.Add("Serie", GetType(String)) TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer)) For Each Dr As DataRow In DtDetalle.FiltraParametros("CveTipoPS = 2").Rows @@ -1219,7 +1219,7 @@ Public Class WSApp ss("CveUM") = Dr("CveUM") ss("Cantidad") = Dr("Cantidad") ss("CveTipoInvPS") = Dr("CveTipoInvPS") - ss("SerieLote") = Dr("SerieLote") + ss("Serie") = Dr("Serie") ss("CveVentaDetalle") = -1 TmpDT.Rows.Add(ss) @@ -1228,7 +1228,7 @@ Public Class WSApp Return TmpDT End Function Private Function AgregarProductoServicio(ByRef Retorno As Modelos.Factura.MMensajeFactura, TmpDT As DataTable, PS As MVentaProductos, CveEmpresa As Integer, CvePrecioLista As Integer, CveSubProyecto As Integer, - Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, + Optional Serie As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, @@ -1290,7 +1290,7 @@ Public Class WSApp Row("Proyecto") = DrSubProyecto("Proyecto").ToString() Row("CveSubProyecto") = CveSubProyecto Row("SubProyecto") = DrSubProyecto("SubProyecto").ToString() - Row("SerieLote") = SerieLote + Row("Serie") = Serie Row("TiempoEntrega") = TiempoEntrega Row("Orden") = TmpDT.Rows.Count + 1 Row("Cantidad") = PS.Cantidad diff --git a/asmx/WsTSoft.asmx b/asmx/WsTSoft.asmx index 5c10a6d20..541ab2d77 100644 --- a/asmx/WsTSoft.asmx +++ b/asmx/WsTSoft.asmx @@ -19,8 +19,8 @@ Public Class WsTSoft Inherits System.Web.Services.WebService - Public Function AddRemision(FolioRemision As String, NoEconomico As String, CveEstatus As Integer, GeoInicial As String, GeoCarga As String, GeoEntrega As String, Fecha As String) As String - Dim retorno As String = "" + Public Function AddRemision(FolioRemision As String, NoEconomico As String, CveEstatus As Integer, GeoInicial As String, GeoCarga As String, GeoEntrega As String, Fecha As String) As String + Dim retorno As String = "" Dim objTsoft As New ClsTSoft objTsoft.IniciaTransacSQL() Dim Continuar As Boolean = objTsoft.AddRemisiones(FolioRemision, NoEconomico, CveEstatus, GeoInicial, GeoCarga, GeoEntrega, Fecha) @@ -34,9 +34,10 @@ Public Class WsTSoft objRem.CveRemision = 0 objRem.CurrentError = objTsoft.MyCurrentError End If - objTsoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) - Return retorno.ToString + objTsoft.Dispose() + retorno = JsonConvert.SerializeObject(objRem) + objRem = Nothing + Return retorno End Function @@ -53,8 +54,9 @@ Public Class WsTSoft objRem.CurrentError = objTsoft.MyCurrentError End If objTsoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) - Return retorno.ToString + retorno = JsonConvert.SerializeObject(objRem) + objRem = Nothing + Return retorno End Function Public Function GetUltimaPosicion(DevID As String) As String @@ -85,8 +87,9 @@ Public Class WsTSoft ObjPos.CurrentError = "No se pudo obtener la posición." End If ObjGPS.Dispose() - retorno = JsonConvert.SerializeObject(ObjPos) - Return retorno.ToString + retorno = JsonConvert.SerializeObject(ObjPos) + ObjPos = Nothing + Return retorno End Function Public Function TerminoRemision(FolioRemision As String, NoEconomico As String) As String @@ -102,8 +105,9 @@ Public Class WsTSoft objRem.CurrentError = objTsoft.MyCurrentError End If objTsoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) - Return retorno.ToString + retorno = JsonConvert.SerializeObject(objRem) + objRem = Nothing + Return retorno End Function Public Function GetRemisionHistorial(FolioRemision As String, NoEconomico As String) As String @@ -136,8 +140,9 @@ Public Class WsTSoft objRem.CurrentError = objTsoft.MyCurrentError End If objTsoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) - Return retorno.ToString + retorno = JsonConvert.SerializeObject(objRem) + retorno = Nothing + Return retorno End Function Public Function GetInfoEventos(FechaInicio As String, FechaFin As String) As String @@ -167,7 +172,7 @@ Public Class WsTSoft End If objTsoft.Dispose() - Return retorno.ToString + Return retorno End Function Public Function TieneRemisionesActivas(NoEconomico As String) As String @@ -183,7 +188,8 @@ Public Class WsTSoft .CurrentError = ObjTSoft.MyCurrentError } ObjTSoft.Dispose() - retorno = JsonConvert.SerializeObject(objRem) + retorno = JsonConvert.SerializeObject(objRem) + objRem = Nothing Return retorno End Function @@ -203,12 +209,16 @@ Public Class WsTSoft Using wc As New HttpClient() Try - Dim Url = New Uri($"{ClsPaginas.UrlDirecciones}nominatim/reverseMultiple.php") + Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones)) Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array) Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded") Dim response = wc.PostAsync(Url, content).Result Dim result = response.Content.ReadAsStringAsync().Result - retorno = JArray.Parse(result) + retorno = JArray.Parse(result) + response.Dispose() + content = Nothing + Url = Nothing + FormStuff = Nothing Catch ex As Exception OnError("Ocurrió un error al obtener las direcciones", ex) End Try