diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 06889de41..ed496d2f9 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -1,247 +1,247 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports System.Data.SqlClient -Imports Extensiones -Imports System -Imports System.Configuration -Imports Microsoft.Reporting.WebForms -Imports System.Xml -Imports System.IO -Imports System.Web - -Public Class ClsBancos - Implements IDisposable - -#Region "Campos" - - 'SQL - Private SqlConexion As SqlConnection - Private SqlAdapter As SqlDataAdapter - Private SqlTransacc As SqlTransaction - Private SqlCommand As SqlCommand - Private Data As DataTable - - 'Atributos de la clase - - Private disposedValue As Boolean = False ' Para detectar llamadas redundantes - -#End Region - -#Region " P R O P I E D A D E S" - - Public ReadOnly Property DtResultados() As DataTable - Get - DtResultados = Data - End Get - End Property - - Public Property Conciliado As Double - Public Property NoConciliado As Double - - 'DATOS CANCELACION - Public Property CveIECancelacion As Integer - Public Property CveIECancelado As Integer - Public Property FolioIECancelacion As String - Public Property FolioIECancelado As String - Public Property CveUsuarioCancelacion As Integer - Public Property UsuarioCancelacion As String - Public Property FechaIngCancelacion As Date +Option Explicit On +Option Strict On + +Imports System.Data +Imports System.Data.SqlClient +Imports Extensiones +Imports System +Imports System.Configuration +Imports Microsoft.Reporting.WebForms +Imports System.Xml +Imports System.IO +Imports System.Web + +Public Class ClsBancos + Implements IDisposable + +#Region "Campos" + + 'SQL + Private SqlConexion As SqlConnection + Private SqlAdapter As SqlDataAdapter + Private SqlTransacc As SqlTransaction + Private SqlCommand As SqlCommand + Private Data As DataTable + + 'Atributos de la clase + + Private disposedValue As Boolean = False ' Para detectar llamadas redundantes + +#End Region + +#Region " P R O P I E D A D E S" + + Public ReadOnly Property DtResultados() As DataTable + Get + DtResultados = Data + End Get + End Property + + Public Property Conciliado As Double + Public Property NoConciliado As Double + + 'DATOS CANCELACION + Public Property CveIECancelacion As Integer + Public Property CveIECancelado As Integer + Public Property FolioIECancelacion As String + Public Property FolioIECancelado As String + Public Property CveUsuarioCancelacion As Integer + Public Property UsuarioCancelacion As String + Public Property FechaIngCancelacion As Date Public Property FechaCancelacion As Date 'CONTROL DE LA CONEXION Private CveConexion As Integer = 0 -#End Region +#End Region -#Region " P R O P I E D A D E S - B A N C O S - I E" - Public Property CveIE As Integer - Public Property CveCuenta As Integer - Public Property CveBanco As Integer - Public Property NumCuenta As String - Public Property CveTipoTransaccion As Integer - Public Property Tipo As String - Public Property TipoTransaccion As String - Public Property FechaDocumento As DateTime - Public Property Folio As String - Public Property PagueseA As String - Public Property Importe As Double - Public Property CveMoneda As Integer - Public Property Moneda As String - Public Property TipoCambio As Double - Public Property ClaveFormaPagoSAT As String - Public Property Observaciones As String - Public Property NotificarA As String - Public Property EsAbonoEnCuenta As Boolean - Public Property FueConciliado As Boolean - Public Property MonedaAbreviatura As String - 'Public Property CvePersonaResponsable As Integer - 'Public Property Año As Integer - 'Public Property CveSubProyecto As Integer - 'Public Property SubProyecto As String - 'Public Property CveProyecto As Integer - 'Public Property Proyecto As String - 'Public Property Cuenta As Integer - - Public Property CveCuentaDeposito As Integer - Public Property DepositoBanco As String - Public Property DepositoCuenta As String - Public Property DepositoCLABE As String - Public Property DepositoCIE As String - Public Property DepositoReferencia As String - Public Property DepositoSucursal As String - Public Property DepositoRefCrediProveedor As String - Public Property CuentaDepositado As String - Public Property CveEstatusIE As Integer - Public Property CveProveedorIntermediario As Integer - Public Property EstatusIE As String - Public Property IDPoliza As Integer - 'Public Property IdCtaContDepreciacion As Integer - Public Property FechaAplicado As DateTime - Public Property FechaIng As Date - Public Property CveUsuario As Integer - Public Property Usuario As String - Public Property UsuarioNombre As String - Public Property UsuarioRegistroAbreviatura As String - Public Property SubProyecto As String - Public Property BancoNumCuentaMoneda As String - Public Property Comprobante As String - Public Property CveEstatusNotificacion As Integer - Public Property FechaEntrega As String - Public Property ObservacionEntrega As String - Public Property CveEmpresa As Integer - Public Property Mensaje As String = "" - Public Property CobranzaCorreo As String = "" -#End Region - -#Region " P R O P I E D A D E S - C U E N T A S - B A N C O S" - Public Property TCveCuenta As Integer 'PARAMETRO OUT del ADD - 'Public Property CveBanco As Integer - Public Property CveTipoCuenta As Integer - Public Property TipoCuenta As String - Public Property Banco As String - 'Public Property NumCuenta As String - Public Property CLABE As String - Public Property DiaCorte As Integer - Public Property FInicial As Integer - Public Property FActual As Integer - Public Property FFinal As Integer - Public Property IdCtaContable As Integer - Public Property IdCtaContableComplementaria As Integer - Public Property CveCuentaConta As Integer - Public Property CveCuentaContaComplementaria As Integer - Public Property FormatoCheque As String - Public Property Estatus As String - Public Property Fecha As DateTime - Public Property LimiteCredito As Double - Public Property ConvenioPagoElectronico As String - Public Property UsaLayout As Boolean - Public Property UsaTarjeta As Boolean -#End Region - - -#Region " P R O P I E D A D E S - C O M P L E M E N T O P A G O" - Public Property ComplementoSerieFolio As String - Public Property CveComplementoPago As Integer -#End Region -#Region "P R O P I E D A D E S - C R E D I T O S" - Public Property CveCredito As Integer - Public Property CveCuentaCredito As Integer - Public Property CveCompra As Integer - Public Property CveAF As Integer - Public Property CveIECredito As Integer - Public Property FechaVencimiento As Date - Public Property Tasa As Double - Public Property SobreTasa As Double - Public Property Referencia As String - Public Property TipoCredito As Integer - Public Property Plazo As Integer - Public Property ImporteCredito As Double - Public Property CreditoValor As Double - Public Property TotalFinanciado As Double - Public Property Proveedor As String - Public Property CveProveedor As Integer - Public Property CveTipoCredito As Integer - Public Property CvePrePoliza As Integer - -#End Region - -#Region "PROPIEDADES CREDITOS COMPRA" - Public Property CveCompraFactura As Integer - Public Property FacturaProveedor As String - Public Property FacturaSerieFolio As String - Public Property FacturaDescripcion As String +#Region " P R O P I E D A D E S - B A N C O S - I E" + Public Property CveIE As Integer + Public Property CveCuenta As Integer + Public Property CveBanco As Integer + Public Property NumCuenta As String + Public Property CveTipoTransaccion As Integer + Public Property Tipo As String + Public Property TipoTransaccion As String + Public Property FechaDocumento As DateTime + Public Property Folio As String + Public Property PagueseA As String + Public Property Importe As Double + Public Property CveMoneda As Integer + Public Property Moneda As String + Public Property TipoCambio As Double + Public Property ClaveFormaPagoSAT As String + Public Property Observaciones As String + Public Property NotificarA As String + Public Property EsAbonoEnCuenta As Boolean + Public Property FueConciliado As Boolean + Public Property MonedaAbreviatura As String + 'Public Property CvePersonaResponsable As Integer + 'Public Property Año As Integer + 'Public Property CveSubProyecto As Integer + 'Public Property SubProyecto As String + 'Public Property CveProyecto As Integer + 'Public Property Proyecto As String + 'Public Property Cuenta As Integer + + Public Property CveCuentaDeposito As Integer + Public Property DepositoBanco As String + Public Property DepositoCuenta As String + Public Property DepositoCLABE As String + Public Property DepositoCIE As String + Public Property DepositoReferencia As String + Public Property DepositoSucursal As String + Public Property DepositoRefCrediProveedor As String + Public Property CuentaDepositado As String + Public Property CveEstatusIE As Integer + Public Property CveProveedorIntermediario As Integer + Public Property EstatusIE As String + Public Property IDPoliza As Integer + 'Public Property IdCtaContDepreciacion As Integer + Public Property FechaAplicado As DateTime + Public Property FechaIng As Date + Public Property CveUsuario As Integer + Public Property Usuario As String + Public Property UsuarioNombre As String + Public Property UsuarioRegistroAbreviatura As String + Public Property SubProyecto As String + Public Property BancoNumCuentaMoneda As String + Public Property Comprobante As String + Public Property CveEstatusNotificacion As Integer + Public Property FechaEntrega As String + Public Property ObservacionEntrega As String + Public Property CveEmpresa As Integer + Public Property Mensaje As String = "" + Public Property CobranzaCorreo As String = "" +#End Region + +#Region " P R O P I E D A D E S - C U E N T A S - B A N C O S" + Public Property TCveCuenta As Integer 'PARAMETRO OUT del ADD + 'Public Property CveBanco As Integer + Public Property CveTipoCuenta As Integer + Public Property TipoCuenta As String + Public Property Banco As String + 'Public Property NumCuenta As String + Public Property CLABE As String + Public Property DiaCorte As Integer + Public Property FInicial As Integer + Public Property FActual As Integer + Public Property FFinal As Integer + Public Property IdCtaContable As Integer + Public Property IdCtaContableComplementaria As Integer + Public Property CveCuentaConta As Integer + Public Property CveCuentaContaComplementaria As Integer + Public Property FormatoCheque As String + Public Property Estatus As String + Public Property Fecha As DateTime + Public Property LimiteCredito As Double + Public Property ConvenioPagoElectronico As String + Public Property UsaLayout As Boolean + Public Property UsaTarjeta As Boolean +#End Region + + +#Region " P R O P I E D A D E S - C O M P L E M E N T O P A G O" + Public Property ComplementoSerieFolio As String + Public Property CveComplementoPago As Integer +#End Region +#Region "P R O P I E D A D E S - C R E D I T O S" + Public Property CveCredito As Integer + Public Property CveCuentaCredito As Integer + Public Property CveCompra As Integer + Public Property CveAF As Integer + Public Property CveIECredito As Integer + Public Property FechaVencimiento As Date + Public Property Tasa As Double + Public Property SobreTasa As Double + Public Property Referencia As String + Public Property TipoCredito As Integer + Public Property Plazo As Integer + Public Property ImporteCredito As Double + Public Property CreditoValor As Double + Public Property TotalFinanciado As Double + Public Property Proveedor As String + Public Property CveProveedor As Integer + Public Property CveTipoCredito As Integer + Public Property CvePrePoliza As Integer + +#End Region + +#Region "PROPIEDADES CREDITOS COMPRA" + Public Property CveCompraFactura As Integer + Public Property FacturaProveedor As String + Public Property FacturaSerieFolio As String + Public Property FacturaDescripcion As String Public Property FacturaFecha As Date -#End Region +#End Region - 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 + 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 + End Try + Else + SqlConexion = TransaccionCompartida.Connection SqlTransacc = TransaccionCompartida - End If - - SqlCommand = New SqlCommand("", SqlConexion) + End If + + SqlCommand = New SqlCommand("", SqlConexion) SqlAdapter = New SqlDataAdapter("", SqlConexion) ConexionAdd() - End Sub - Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) - With SqlAdapter.SelectCommand - .Parameters.Clear() - .CommandText = StrSQL - .CommandType = TipoComando - End With - If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc - Data = New DataTable + End Sub + Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) + With SqlAdapter.SelectCommand + .Parameters.Clear() + .CommandText = StrSQL + .CommandType = TipoComando + End With + If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc + Data = New DataTable End Sub -#Region "Conexiones" +#Region "Conexiones" - Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + Private Sub ConexionAdd() + If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try - DataAdapter("PA_Sis_RegistrarConexion") + 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 - Catch ex As Exception - OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - End If - End Sub - - Private Sub ConexionClose() - If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then - - DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text) - - Try - SqlAdapter.Fill(Data) - - Catch ex As Exception - OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - CveConexion = 0 - End If - + End With + SqlAdapter.Fill(Data) + CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + End If End Sub -#End Region + + Private Sub ConexionClose() + If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + + DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text) + + Try + SqlAdapter.Fill(Data) + + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + CveConexion = 0 + End If + + End Sub +#End Region @@ -255,1384 +255,1384 @@ Public Class ClsBancos End Function - Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) - With SqlCommand - .Parameters.Clear() - .CommandText = pStrSQL - .CommandType = TipoComando - End With - - If Not SqlTransacc Is Nothing Then SqlCommand.Transaction = SqlTransacc - - End Sub - Public Function IniciaTransacSQL() As SqlTransaction - If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() - Return SqlTransacc - End Function - - Public Sub RollBack() - If SqlTransacc IsNot Nothing Then SqlTransacc.Rollback() - SqlTransacc = Nothing - End Sub - Public Sub Commit() - If SqlTransacc IsNot Nothing Then SqlTransacc.Commit() - SqlTransacc = Nothing - End Sub - - - -#Region " B A N C O S " - - Public Function GetBancos() As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_BancosGet") - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As SqlException - OnError("Ocurrió un error al consultar los Bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddBancos(Banco As String, Ejecutivo As String, Telefono As String, CveUsuario As Integer, CveEmpresa As Integer, Optional IdContPaq As Integer = -1, Optional RFC As String = "-1") As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_BancosAdd ") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Banco", SqlDbType.VarChar).Value = Banco - .Add("@Ejecutivo", SqlDbType.VarChar).Value = Ejecutivo - .Add("@Telefono", SqlDbType.VarChar).Value = Telefono - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@IdContPaq", SqlDbType.Int).Value = IdContPaq - .Add("@RFC", SqlDbType.VarChar).Value = RFC - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el Banco", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateBancos(Banco As String, Ejecutivo As String, Telefono As String, Estatus As Boolean, CveBanco As Integer, Optional IdContPaq As Integer = -1, Optional RFC As String = "-1") As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_BancosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Banco", SqlDbType.VarChar).Value = Banco - .Add("@Ejecutivo", SqlDbType.VarChar).Value = Ejecutivo - .Add("@Telefono", SqlDbType.VarChar).Value = Telefono - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveBanco", SqlDbType.Int).Value = CveBanco - .Add("@IdContPaq", SqlDbType.Int).Value = IdContPaq - .Add("@RFC", SqlDbType.VarChar).Value = RFC - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveBancos(CveBanco As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_BancosRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveBanco", SqlDbType.Int).Value = CveBanco - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Banco no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - -#Region " B A N C O S - C U E N T A S " - - Public Function GetBancosCuentas(CveCuenta As Integer, Optional CveEmpresa As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_BancosCuentasGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - - If CveCuenta > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then - Me.CveCuenta = Data.Rows(0)("CveCuenta").ToString.ToEntero - Me.CveBanco = Data.Rows(0)("CveBanco").ToString.ToEntero - Me.CveTipoCuenta = Data.Rows(0)("CveTipoCuenta").ToString.ToEntero - Me.TipoCuenta = Data.Rows(0)("TipoCuenta").ToString - Me.Banco = Data.Rows(0)("Banco").ToString - Me.NumCuenta = Data.Rows(0)("NumCuenta").ToString - Me.CLABE = Data.Rows(0)("CLABE").ToString - Me.CveMoneda = Data.Rows(0)("CveMoneda").ToString.ToEntero - Me.DiaCorte = Data.Rows(0)("DiaCorte").ToString.ToEntero - Me.FInicial = Data.Rows(0)("FInicial").ToString.ToEntero - Me.FActual = Data.Rows(0)("FActual").ToString.ToEntero - Me.FFinal = Data.Rows(0)("FFinal").ToString.ToEntero - Me.IdCtaContable = Data.Rows(0)("IdCtaContable").ToString.ToEntero - Me.IdCtaContableComplementaria = Data.Rows(0)("IdCtaContableComplementaria").ToString.ToEntero - Me.CveCuentaConta = Data.Rows(0)("IdCtaContableSIG").ToString.ToEntero - Me.CveCuentaContaComplementaria = Data.Rows(0)("IdCtaContableComplementariaSIG").ToString.ToEntero - Me.FormatoCheque = Data.Rows(0)("FormatoCheque").ToString - Me.Estatus = Data.Rows(0)("Estatus").ToString - Me.Fecha = Data.Rows(0)("Fecha").ToString.ToDate - Me.Usuario = Data.Rows(0)("Usuario").ToString - Me.LimiteCredito = Data.Rows(0)("LimiteCredito").ToString.ToDouble - Me.ConvenioPagoElectronico = Data.Rows(0)("ConvenioPagoElectronico").ToString - Me.UsaLayout = If(Data.Rows(0)("UsaLayout").ToString = "True", True, False) - Me.UsaTarjeta = If(Data.Rows(0)("UsaTarjeta").ToString = "True", True, False) - - End If - - - Retorno = True - Catch ex As SqlException - OnError("Ocurrió un error al consultar las Cuentas de los Bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - - Public Function GetNextFolio(CveCuenta As Integer, CveTipoTransaccion As Integer) As Long - Dim Retorno As Long = 0 - - DataCommand("PA_Banc_BancosCuentasNextFolioGet") - - With SqlCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - End With - Try - Retorno = SqlCommand.ExecuteScalar.ToString.ToLong - - Catch ex As SqlException - OnError("Ocurrió un error al consultar el siguiente folio de la cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno + 1 - End Function - - Public Function AddBancosCuentas(CveBanco As Integer, CveTipoCuenta As Integer, NumCuenta As String, CLABE As String, CveMoneda As Integer, DiaCorte As Integer, FInicial As Integer, FActual As Integer, FFinal As Integer, LimiteCredito As Double, IdCtaContable As Integer, IdCtaContableComplementaria As Integer, FormatoCheque As String, CveUsuario As Integer, CveEmpresa As Integer, ConvenioPagoElectronico As String, UsaLayout As Boolean, UsaTarjeta As Boolean, Optional SaldoInicial As Double = 0) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_BancosCuentasAdd") - - With SqlAdapter.SelectCommand.Parameters - - .Add("@CveBanco", SqlDbType.Int).Value = CveBanco - .Add("@CveTipoCuenta", SqlDbType.Int).Value = CveTipoCuenta - .Add("@NumCuenta", SqlDbType.VarChar).Value = NumCuenta - .Add("@CLABE", SqlDbType.VarChar).Value = CLABE - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@DiaCorte", SqlDbType.Int).Value = DiaCorte - .Add("@FInicial", SqlDbType.Int).Value = FInicial - .Add("@FActual", SqlDbType.Int).Value = FActual - .Add("@FFinal", SqlDbType.Int).Value = FFinal - .Add("@LimiteCredito", SqlDbType.Money).Value = LimiteCredito - .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable - .Add("@IdCtaContableComplementaria", SqlDbType.Int).Value = IdCtaContableComplementaria - .Add("@FormatoCheque", SqlDbType.VarChar).Value = FormatoCheque - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveCuenta", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@ConvenioPagoElectronico", SqlDbType.VarChar).Value = ConvenioPagoElectronico - .Add("@UsaLayout", SqlDbType.Bit).Value = UsaLayout - .Add("@UsaTarjeta", SqlDbType.Bit).Value = UsaTarjeta - .Add("@SaldoInicial", SqlDbType.Money).Value = SaldoInicial - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Me.TCveCuenta = SqlAdapter.SelectCommand.Parameters("@CveCuenta").Value.ToString.ToEntero - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe el número de cuenta con el mismo Número: " & NumCuenta & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar la Cuenta de Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar la Cuenta de Banco", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateBancosCuentas(CveBanco As Integer, CveTipoCuenta As Integer, NumCuenta As String, CLABE As String, CveMoneda As Integer, DiaCorte As Integer, FInicial As Integer, FActual As Integer, FFinal As Integer, LimiteCredito As Double, IdCtaContable As Integer, IdCtaContableComplementaria As Integer, FormatoCheque As String, Estatus As Boolean, CveCuenta As Integer, ConvenioPagoElectronico As String, UsaLayout As Boolean, UsaTarjeta As Boolean) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_BancosCuentasUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveBanco", SqlDbType.Int).Value = CveBanco - .Add("@CveTipoCuenta", SqlDbType.Int).Value = CveTipoCuenta - .Add("@NumCuenta", SqlDbType.VarChar).Value = NumCuenta - .Add("@CLABE", SqlDbType.VarChar).Value = CLABE - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@DiaCorte", SqlDbType.Int).Value = DiaCorte - .Add("@FInicial", SqlDbType.Int).Value = FInicial - .Add("@FActual", SqlDbType.Int).Value = FActual - .Add("@FFinal", SqlDbType.Int).Value = FFinal - .Add("@LimiteCredito", SqlDbType.Money).Value = LimiteCredito - .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable - .Add("@IdCtaContableComplementaria", SqlDbType.Int).Value = IdCtaContableComplementaria - .Add("@FormatoCheque", SqlDbType.VarChar).Value = FormatoCheque - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@ConvenioPagoElectronico", SqlDbType.VarChar).Value = ConvenioPagoElectronico - .Add("@UsaLayout", SqlDbType.Bit).Value = UsaLayout - .Add("@UsaTarjeta", SqlDbType.Bit).Value = UsaTarjeta - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Número de Cuenta de Banco con el mismo número: " & NumCuenta & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en la Cuenta de Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en la Cuenta de Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveBancosCuentas(CveCuenta As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_BancosCuentasRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("La Cuenta de Banco no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar la Cuenta de Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar la Cuenta deBanco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function VincularCuentasContablesBancarias(IdCtaContable As Integer, IdCtaContableComplementaria As Integer, CveCuenta As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_BancosCuentasContables") - - With SqlAdapter.SelectCommand.Parameters - .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable - .Add("@IdCtaContableComplementaria", SqlDbType.Int).Value = IdCtaContableComplementaria - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Número de Cuenta de Banco con el mismo número: " & NumCuenta & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en la Cuenta de Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en la Cuenta de Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - - End Function -#End Region - -#Region " B A N C O S - C U E N T A S - U S U A R I O S" - - Public Function GetBancosCuentasUsuarios(CveCuenta As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_BancosCuentasUsuariosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - End With - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As SqlException - OnError("Ocurrió un error al consultar las Cuentas de los Bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function GetBancosCuentasUsuariosAcceso(CveCuenta As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_BancosCuentasUsuariosAccesoGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - End With - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As SqlException - OnError("Ocurrió un error al consultar las Cuentas de los Bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - - Public Function AddBancosCuentasUsuarios(CveCuenta As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_BancosCuentasUsuariosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe el número de cuenta con el mismo Número: " & NumCuenta & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar la Cuenta de Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar la Cuenta de Banco", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - - Public Function RemoveBancosCuentasUsuarios(CveCuenta As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_BancosCuentasUsuariosRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("La Cuenta de Banco no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar la Cuenta de Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar la Cuenta de Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - -#Region " B A N C O S - E S T A T U S - C H E Q U E S " - -#End Region - -#Region " B A N C O S - I E " - - Public Function GetBancosIE(CveIE As Integer, CveBanco As Integer, CveCuenta As Integer, TipoMovimiento As String, CveTipoTransaccion As Integer, Folio As String, PagueseA As String, Importe As Double, - CveMoneda As Integer, EsAbonoEnCuenta As Integer, FueConciliado As Integer, CveEstatusIE As Integer, - FechaInicio As Date, FechaFin As Date, FechaAplicacionInicio As Date, FechaAplicacionFin As Date, - FechaConciliadoInicio As Date, FechaConciliadoFin As Date, CveUsuarioConcilio As Integer, TImporte As Double, CveEmpresa As Integer, Optional CveEstatusNotificacion As Integer = -1, Optional CveCuentaTarjeta As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_IEGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveBanco", SqlDbType.Int).Value = CveBanco - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@TipoMovimiento", SqlDbType.VarChar).Value = TipoMovimiento - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - .Add("@Folio", SqlDbType.VarChar).Value = Folio - .Add("@PagueseA", SqlDbType.NVarChar).Value = PagueseA - .Add("@Importe", SqlDbType.Money).Value = Importe - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@EsAbonoEnCuenta", SqlDbType.Int).Value = EsAbonoEnCuenta - .Add("@FueConciliado", SqlDbType.Int).Value = FueConciliado - .Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE - .Add("@FechaI", SqlDbType.Date).Value = IfNull(FechaInicio, DBNull.Value, FechaInicio) - .Add("@FechaF", SqlDbType.Date).Value = IfNull(FechaFin, DBNull.Value, FechaFin) - .Add("@FechaAplicacionI", SqlDbType.Date).Value = IfNull(FechaAplicacionInicio, DBNull.Value, FechaAplicacionInicio) - .Add("@FechaAplicacionF", SqlDbType.Date).Value = IfNull(FechaAplicacionFin, DBNull.Value, FechaAplicacionFin) - .Add("@CveUsuarioConcilio", SqlDbType.Int).Value = CveUsuarioConcilio - .Add("@FechaConciliadoI", SqlDbType.Date).Value = IfNull(FechaConciliadoInicio, DBNull.Value, FechaConciliadoInicio) - .Add("@FechaConciliadoF", SqlDbType.Date).Value = IfNull(FechaConciliadoFin, DBNull.Value, FechaConciliadoFin) - .Add("@TImporte", SqlDbType.Float).Value = TImporte - .Add("@CveEstatusNotificacion", SqlDbType.Int).Value = CveEstatusNotificacion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta - - End With - - Try - SqlAdapter.Fill(Data) - - If CveIE > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then - Me.CveIE = Data.Rows(0)("CveIE").ToString.ToEntero - Me.CveCuenta = Data.Rows(0)("CveCuenta").ToString.ToEntero - Me.CveBanco = Data.Rows(0)("CveBanco").ToString.ToEntero - Me.Banco = Data.Rows(0)("Banco").ToString - Me.NumCuenta = Data.Rows(0)("NumCuenta").ToString - Me.CveTipoTransaccion = Data.Rows(0)("CveTipoTransaccion").ToString.ToEntero - Me.Tipo = Data.Rows(0)("Tipo").ToString - Me.TipoTransaccion = Data.Rows(0)("TipoTransaccion").ToString - Me.ClaveFormaPagoSAT = Data.Rows(0)("ClaveFormaPagoSAT").ToString - Me.FechaDocumento = Data.Rows(0)("FechaDocumento").ToString.ToDate - Me.Folio = Data.Rows(0)("Folio").ToString - Me.PagueseA = Data.Rows(0)("PagueseA").ToString - Me.Importe = Data.Rows(0)("Importe").ToString.ToDouble - Me.CveMoneda = Data.Rows(0)("CveMoneda").ToString.ToEntero - Me.Moneda = Data.Rows(0)("Moneda").ToString - Me.TipoCambio = Data.Rows(0)("TipoCambio").ToString.ToDouble - Me.Observaciones = Data.Rows(0)("Observaciones").ToString - NotificarA = Data.Rows(0)("NotificarA").ToString - Me.EsAbonoEnCuenta = CBool(Data.Rows(0)("EsAbonoEnCuenta").ToString) - Me.FueConciliado = CBool(Data.Rows(0)("FueConciliado").ToString) - Me.FechaAplicado = Data.Rows(0)("FechaAplicado").ToString.ToDate - Me.CveEstatusIE = Data.Rows(0)("CveEstatusIE").ToString.ToEntero - Me.CveProveedorIntermediario = Data.Rows(0)("CveProveedorIntermediario").ToString.ToEntero - BancoNumCuentaMoneda = Data.Rows(0)("BancoNumCuentaMoneda").ToString - IdCtaContable = Data.Rows(0)("IdCtaContable").ToString.ToEntero - IdCtaContableComplementaria = Data.Rows(0)("IdCtaContableComplementaria").ToString.ToEntero - CveCuentaConta = Data.Rows(0)("IdCtaContableSIG").ToString.ToEntero - CveCuentaContaComplementaria = Data.Rows(0)("IdCtaContableComplementariaSIG").ToString.ToEntero - CveCuentaDeposito = Data.Rows(0)("CveCuentaDeposito").ToString.ToEntero - DepositoBanco = Data.Rows(0)("DepositoBanco").ToString - DepositoCuenta = Data.Rows(0)("DepositoCuenta").ToString - DepositoCLABE = Data.Rows(0)("DepositoCLABE").ToString - DepositoCIE = Data.Rows(0)("DepositoCIE").ToString - DepositoReferencia = Data.Rows(0)("DepositoReferencia").ToString - DepositoSucursal = Data.Rows(0)("DepositoSucursal").ToString - DepositoRefCrediProveedor = Data.Rows(0)("RefCrediProveedor").ToString - - CuentaDepositado = Data.Rows(0)("CuentaDepositado").ToString - - Me.EstatusIE = Data.Rows(0)("EstatusIE").ToString - IDPoliza = Data.Rows(0)("IdPoliza").ToString.ToEntero - - Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate - Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero - Me.Usuario = Data.Rows(0)("Usuario").ToString - Me.UsuarioNombre = Data.Rows(0)("Nombre").ToString.ToString - UsuarioRegistroAbreviatura = Data.Rows(0)("NombreAbreviatura").ToString - MonedaAbreviatura = Data.Rows(0)("MonedaAbreviatura").ToString - SubProyecto = Data.Rows(0)("SubProyecto").ToString - Comprobante = Data.Rows(0)("Comprobante").ToString - 'Notificacion - Me.CveEstatusNotificacion = Data.Rows(0)("CveEstatusNotificacion").ToString.ToEntero - Me.FechaEntrega = Data.Rows(0)("FechaEntrega").ToString - Me.ObservacionEntrega = Data.Rows(0)("ObservacionEntrega").ToString - Me.CveProveedor = Data.Rows(0)("CveProveedor").ToString.ToEntero - - 'DATOS DE CANCELACION - Me.CveIECancelacion = Data.Rows(0)("CveIECancelacion").ToString.ToEntero - Me.FolioIECancelacion = Data.Rows(0)("FolioIECancelacion").ToString - Me.CveUsuarioCancelacion = Data.Rows(0)("CveUsuarioCancelacion").ToString.ToEntero - Me.UsuarioCancelacion = Data.Rows(0)("UsuarioCancelacion").ToString - Me.FechaCancelacion = Data.Rows(0)("FechaCancelacion").ToString.ToDate - Me.FechaIngCancelacion = Data.Rows(0)("FechaIngCancelacion").ToString.ToDate - Me.CveIECancelado = Data.Rows(0)("CveIECancelado").ToString.ToEntero - Me.FolioIECancelado = Data.Rows(0)("FolioIECancelado").ToString - End If - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Ingresos y Egresos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetBancosIE(CveIE As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - Retorno = GetBancosIE(CveIE, -1, -1, "-1", -1, "-1", "-1", -1, -1, -1, -1, -1, MinFecha, MaxFecha, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, CveEmpresa) - - Return Retorno - End Function - Public Function GetPrePolizasDetalle(CvePrePoliza As Integer, Optional CveIE As Integer = -1, Optional CveOC As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Conta_PrePolizasDetalleGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveOC", SqlDbType.Int).Value = CveOC - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener Movimientos Prepolizas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetBancosIEMovimientos(CveIE As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_IEMovimientosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .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 movimientos del documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetBancosIEMovimientosPadre(CveIE As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_IEMovimientosRelacionadosPadreGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .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 movimientos del documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetBancosIEMovimientosHijo(CveIE As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_IEMovimientosRelacionadosHijosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .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 movimientos del documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetBancosIEMovimientosDepositos(CveIE As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_IEMovimientosDepositosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .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 movimientos del documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetFoliosCancelados(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_FoliosCanceladosGet") - 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 folios cancelados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#Region "Complemento Pagos" - - Public Function GeneraTimbrePago(CveIE As Integer, CveVenta As Integer, UsuarioActual As Usuario, Optional CveCliente As Integer = -1, Optional CFDIRelacionado As String = "-1", Optional EsCancelacion As Boolean = False, Optional EsRegeneracion As Boolean = False, Optional CvePrePoliza As Integer = -1, Optional FechaTimbrado As DateTime = MinFecha) As Boolean - - If FechaTimbrado = MinFecha Then FechaTimbrado = DateTime.Now - Dim Serie As String = "Pag" - Dim Folio As Integer = -1 - Dim Retorno As Boolean = False - Dim Estatus As Integer = 1 - - Dim dttpagos As DataTable = Nothing - Dim dr As Data.DataRow = Nothing - - If GetComplementoPagosRep(-1, Now.AddYears(-2), Now, If(CvePrePoliza > 0, -1, CveIE), CveVenta, If(EsCancelacion OrElse EsRegeneracion, 2, 1), UsuarioActual.CveEmpresa, CvePrePoliza:=CvePrePoliza) Then - dr = DtResultados.FiltroPrimero("CveVenta IS NULL") - dttpagos = DtResultados.FiltraParametros("CveVenta > 0") - End If - If EsCancelacion Then Estatus = 2 - If EsRegeneracion Then Estatus = 3 - - - Dim tCveComplementoPago As Integer = AddComplementoPago(If(CvePrePoliza > 0, CveIE, dr("CveIE").ToString.ToEntero), -1, Serie, Folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CvePrePoliza:=CvePrePoliza, Estatus:=Estatus) - If tCveComplementoPago > 0 Then - 'Dim drr As Data.DataRow = dtt.Rows(0) - 'ReceptorRFC = drr("RFC").ToString - 'ReceptorNombre = drr("NombreCliente").ToString - - - Folio = FActual - ComplementoSerieFolio = $"{Serie}-{Folio}" - - Dim Cuentapago As String = dr("CuentaOrdenante").ToString - Dim CuentaBeneficiario As String = dr("CuentaBeneficiario").ToString - Dim RFCCliente As String = dr("RFC").ToString - Dim RFCEmpresa As String = UsuarioActual.Empresa.RFC - CobranzaCorreo = dr("CobranzaCorreo").ToString - - Select Case dr("ClaveFormaPagoSAT").ToString - Case "02" - If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(11, 18) Then - Mensaje = "La cuenta ordenante no cumple con el formato esperado." - End If - - If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then - Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." - End If - Case "03" - If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(10, 16, 18) Then - Mensaje = "La cuenta ordenante no cumple con el formato esperado." - End If - If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 18)) Then - Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." - End If - Case "04" - - If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(16) Then - Mensaje = "La cuenta ordenante no cumple con el formato esperado." - End If - - If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then - Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." - End If - - Case "05" - If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(10, 11, 15, 16, 18, 50) Then - Mensaje = "La cuenta ordenante no cumple con el formato esperado." - End If - - If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then - Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." - End If - Case "06" - If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(10) Then - Mensaje = "La cuenta ordenante no cumple con el formato esperado." - End If - - CuentaBeneficiario = "" - Case "28" - If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(16) Then - Mensaje = "La cuenta ordenante no cumple con el formato esperado." - End If - - If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then - Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." - End If - Case "29" - If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(15, 16) Then - Mensaje = "La cuenta ordenante no cumple con el formato esperado." - End If - - If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then - Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." - End If - - Case Else - - CuentaBeneficiario = "" - Cuentapago = "" - 'RFCCliente = "" - 'RFCEmpresa = "" - - End Select - - If EsCancelacion AndAlso (CFDIRelacionado = "-1" OrElse CFDIRelacionado = "") Then - Mensaje += " La cancelación debe de tener documento relacionado" - End If - - If Not Mensaje.Length = 0 Then - GuardaLog(Mensaje) - Return False - End If - - Dim Timbre As CFDITimbre = Nothing - Dim Timbrado As New Timbrado - - - - Timbre = Timbrado.PreparaTimbrePago(RFCEmpresa, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal, - RFCCliente, dr("NombreCliente").ToString, Serie, Folio.ToString, FechaTimbrado, Cuentapago, - dr("FechaDocumento").ToString.ToDate, dr("ClaveFormaPagoSAT").ToString, dr("AbreviaturaSAT").ToString, dr("VentasTotalPagado").ToString.ToDouble, - UsuarioActual.Empresa.CP.ToString, CuentaBeneficiario, dr("TipoCambioPago").ToString.ToDouble, dttpagos, CFDIRelacionado:=CFDIRelacionado, EsCancelacion:=EsCancelacion) - - ''PREPARA PARA CANCELACION POR SUSTITUCION DE COMPLEMENTO DE PAGO - 'If CFDIRelacionado <> "-1" And CFDIRelacionado <> "" Then - ' Timbre.CFDIRelacionados.TipoRelacion = "04" - ' Timbre.CFDIRelacionados.UUID.Add(CFDIRelacionado) - 'End If - - 'Timbre = Timbrado.PreparaTimbrePago(UsuarioActual.Empresa.RFC, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal, - ' dr("RFC").ToString, dr("NombreCliente").ToString, Serie, Folio.ToString, FechaTimbrado, Cuentapago, - ' dr("FechaDocumento").ToString.ToDate, dr("ClaveFormaPagoSAT").ToString, dr("AbreviaturaSAT").ToString, dr("Importe").ToString.ToDouble, - ' UsuarioActual.Empresa.CP.ToString, dr("CuentaBeneficiario").ToString, dr("FolioFiscal").ToString, dr("Serie").ToString, dr("Folio").ToString, dr("VentaAbreviaturaSAT").ToString, - ' dr("MetodoPago").ToString, dr("Importe").ToString.ToDecimal, dr("ImpSaldoInsoluto").ToString.ToDecimal, dr("ImpSaldoAnterior").ToString.ToDouble, dr("TipoCambio").ToString.ToDecimal, - ' dr("NumParcialidad").ToString.ToEntero, dr("PorcentajeIVA").ToString.ToDecimal, dr("PorcentajeIEPS").ToString.ToDecimal) - - If Timbre IsNot Nothing Then - Dim Ventas As New Modelos.Factura - Dim Cliente As New Modelos.ClienteModel - Ventas.Timbre = Timbre - Ventas.Cliente = Cliente - - Dim CvePACEspecial As Integer = -1 - If UsuarioActual.CveEmpresa = 3 Then CvePACEspecial = 4 - - Ventas.TipoDocto = "Pag" - Dim ObjTimbrado As New Timbrado - - Dim SeTimbro As Boolean = ObjTimbrado.TimbrarFactura(UsuarioActual, Ventas, CvePACEspecial) - - ' Dim StrRetorno As String = Modelos.TimbrarFactura(Ventas, UsuarioActual) - If SeTimbro Then - If UpdateComplementoPago(tCveComplementoPago, ObjTimbrado.UUID, UsuarioActual.Empresa.CvePAC, UsuarioActual.CveEmpresa) Then - CveComplementoPago = tCveComplementoPago - Retorno = True - End If - End If - Mensaje = ObjTimbrado.MensajeErrorCFDI - - GuardaLog(ObjTimbrado.MensajeErrorCFDI) - Timbre = Nothing - - Else - GuardaLog(Mensaje) - End If - Timbrado = Nothing - Else - Mensaje = "No se pudo guardar el registro del complemento" - GuardaLog(Mensaje & " - Error en función AddComplementoPago revisar si la empresa cuenta con Folio ""cp"" ") - End If - - Return Retorno - End Function - - 'Public Function CancelaTimbrePago(CveIE As Integer, CveUsuario As Integer, Empresa As Empresa) As Boolean - - ' Dim Resultado As Boolean = False - - ' IniciaTransacSQL() - - ' Dim FechaInicio As Date = New Date(1900, 1, 1) - ' Dim FechaFin As Date = New Date(2999, 12, 31) - - ' If GetComplementoPagosRep(-1, FechaInicio, FechaFin, CveIE, -1, 2, Empresa.CveEmpresa, Estatus:=1) Then - ' If Data.Rows.Count > 0 Then - ' Dim CveComplementoPago As Integer = Data.Rows(0)("CveComplementoPago").ToString.ToEntero - ' If Data.Rows(0)("CveComplementoPago").ToString.ToEntero > 0 Then - - ' Dim Timbrado As New Timbrado - ' Dim PagoFolioFiscal As String = Data.Rows(0)("PagoFolioFiscal").ToString - ' Dim Importe As Decimal = Data.Rows(0)("Importe").ToString.ToDecimal - ' Dim RFCReceptor As String = Data.Rows(0)("RFC").ToString - - ' Resultado = Timbrado.CFDICancelar(Empresa, PagoFolioFiscal, Importe, RFCReceptor, Empresa.RFC) - - ' If Resultado Then - ' Resultado = UpdateComplementoPago(CveComplementoPago, "-1", -1, Empresa.CveEmpresa, 2, Empresa.CvePAC) - ' End If - ' End If - ' Else - ' Resultado = False - ' End If - ' Else - ' Resultado = False - ' End If - - ' If Resultado Then - ' Commit() - ' Else - ' RollBack() - ' End If - - ' Return Resultado - - 'End Function - - Public Function UpdateComplementoPago(CveComplementoPago As Integer, FolioFiscal As String, CvePAC As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CvePACCancelacion As Integer = -1, - Optional FechaCancelacion As Date = MinFecha, Optional SelloCancelacion As String = "") As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_ComplementoPagoUpdate") - - With SqlAdapter.SelectCommand.Parameters - - .Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago - .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal - .Add("@CvePAC", SqlDbType.Int).Value = CvePAC - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion - .Add("@FechaCancelacion", SqlDbType.Date).Value = FechaCancelacion - .Add("@SelloCancelacion", SqlDbType.VarChar).Value = SelloCancelacion - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - If SelloCancelacion.Trim.Length > 0 Then - OnError($"Ocurrió un error al actualizar complemento de pago sello: {SelloCancelacion} ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - Else - OnError("Ocurrió un error al actualizar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End If - - End Try - - Return Retorno - End Function - - - Public Function UpdateComplementoPagoCancelado(CveComplementoPago As Integer, CveEstatus As Integer, CvePACCancelacion As Integer, CveEmpresa As Integer, FechaCancelacion As DateTime) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_ComplementoPagoUpdateCancelado") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@FechaCancelacion", SqlDbType.DateTime).Value = FechaCancelacion - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al cancelar estatus complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddComplementoPago(CveIE As Integer, CveVenta As Integer, Serie As String, Folio As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CvePrePoliza As Integer = -1, Optional Estatus As Integer = 1) As Integer - Dim Retorno As Integer = 0 - DataAdapter("PA_Banc_ComplementoPagoAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveVenta", SqlDbType.Int).Value = CveVenta - .Add("@Serie", SqlDbType.VarChar).Value = Serie - .Add("@Folio", SqlDbType.Int).Value = Folio - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CveComplementoPago", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@FolioInsertado", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - Retorno = SqlAdapter.SelectCommand.Parameters("@CveComplementoPago").Value.ToString.ToEntero - FActual = SqlAdapter.SelectCommand.Parameters("@FolioInsertado").Value.ToString.ToEntero - Catch ex As Exception - OnError("Ocurrió un error al Guardar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function GetComplementoPagosRep(CveCliente As Integer, FechaInicio As Date, FechaFin As Date, CveIE As Integer, CveVenta As Integer, Opcion As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CvePrePoliza As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_ComplementoPagoRepGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveVenta", SqlDbType.Int).Value = CveVenta - .Add("@Opcion", SqlDbType.Int).Value = Opcion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - End With - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener informacion de complementos de pago pendientes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetComplementoPagos(CveComplementoPago As Integer, CveIE As Integer, CveVenta As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_ComplementoPagoGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .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 informacion de complementos de pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetVincularPago(CveProveedor As Integer, CveCompra As Integer, Tipo As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Optional CveIE As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Comp_VincularPagoGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@Tipo", SqlDbType.Int).Value = Tipo - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los pagos a vincular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - Return Retorno - End Function -#End Region - - Public Function GetPagosIntermediarios(CveProveedor As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_PagosIntermediariosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .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 pagos intermediarios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddBancos_IE(CveCuenta As Integer, CveTipoTransaccion As Integer, FechaDocumento As Date, Folio As String, PagueseA As String, Importe As Double, CveMoneda As Integer, TipoCambio As Double, Observaciones As String, - NotificarA As String, EsAbonoEnCuenta As Boolean, AplicaImpuestos As Boolean, IDPoliza As Integer, CvePrePoliza As Integer, Comprobante As String, CveUsuario As Integer, CveEmpresa As Integer, - Optional CveCuentaDeposito As Integer = -1, Optional PagoElectronico As String = "-1", Optional CveEstatusIE As Integer = 1, Optional CveCuentaTarjeta As Integer = -1, - Optional Referencia As String = "-1", Optional CveIESustitucion As Integer = -1, Optional CveCorte As Integer = -1, Optional CveProveedorIntermediario As Integer = -1, Optional FueConciliado As Boolean = False, - Optional MesesSinIntereses As Integer = -1) As Integer - Dim Retorno As Integer = -1 - - DataAdapter("PA_Banc_IEAdd") - - With SqlAdapter.SelectCommand.Parameters - '.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - .Add("@FechaDocumento", SqlDbType.Date).Value = FechaDocumento - .Add("@Folio", SqlDbType.VarChar).Value = Folio - .Add("@PagueseA", SqlDbType.VarChar).Value = PagueseA - .Add("@Importe", SqlDbType.Money).Value = Importe - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@TipoCambio", SqlDbType.Float).Value = TipoCambio - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@NotificarA", SqlDbType.VarChar).Value = NotificarA - .Add("@EsAbonoEnCuenta", SqlDbType.Bit).Value = EsAbonoEnCuenta - '.Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado - .Add("@AplicaImpuestos", SqlDbType.Bit).Value = AplicaImpuestos - .Add("@Comprobante", SqlDbType.VarChar).Value = Comprobante - .Add("@IDPoliza", SqlDbType.Int).Value = IDPoliza - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito - .Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE - .Add("@PagoElectronico", SqlDbType.VarChar).Value = PagoElectronico - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta - .Add("@Referencia", SqlDbType.VarChar).Value = Referencia - .Add("@CveIESustitucion", SqlDbType.Int).Value = CveIESustitucion - .Add("@CveCorte", SqlDbType.Int).Value = CveCorte - .Add("@CveProveedorIntermediario", SqlDbType.Int).Value = CveProveedorIntermediario - .Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado - .Add("@MesesSinIntereses", SqlDbType.Int).Value = MesesSinIntereses - - .Add("@CveIE", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@FolioRegistro", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = SqlAdapter.SelectCommand.Parameters("@CveIE").Value.ToString.ToEntero - _Folio = SqlAdapter.SelectCommand.Parameters("@FolioRegistro").Value.ToString - - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Or Ex1.Message.Contains("Número: 2601;") Then - Alert("Ya existe un movimiento bancario con el mismo Folio: " & Folio & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el Movimiento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el Banco IE", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function + Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) + With SqlCommand + .Parameters.Clear() + .CommandText = pStrSQL + .CommandType = TipoComando + End With + + If Not SqlTransacc Is Nothing Then SqlCommand.Transaction = SqlTransacc + + End Sub + Public Function IniciaTransacSQL() As SqlTransaction + If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() + Return SqlTransacc + End Function + + Public Sub RollBack() + If SqlTransacc IsNot Nothing Then SqlTransacc.Rollback() + SqlTransacc = Nothing + End Sub + Public Sub Commit() + If SqlTransacc IsNot Nothing Then SqlTransacc.Commit() + SqlTransacc = Nothing + End Sub + + + +#Region " B A N C O S " + + Public Function GetBancos() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_BancosGet") + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar los Bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddBancos(Banco As String, Ejecutivo As String, Telefono As String, CveUsuario As Integer, CveEmpresa As Integer, Optional IdContPaq As Integer = -1, Optional RFC As String = "-1") As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_BancosAdd ") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Banco", SqlDbType.VarChar).Value = Banco + .Add("@Ejecutivo", SqlDbType.VarChar).Value = Ejecutivo + .Add("@Telefono", SqlDbType.VarChar).Value = Telefono + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@IdContPaq", SqlDbType.Int).Value = IdContPaq + .Add("@RFC", SqlDbType.VarChar).Value = RFC + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el Banco", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateBancos(Banco As String, Ejecutivo As String, Telefono As String, Estatus As Boolean, CveBanco As Integer, Optional IdContPaq As Integer = -1, Optional RFC As String = "-1") As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_BancosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Banco", SqlDbType.VarChar).Value = Banco + .Add("@Ejecutivo", SqlDbType.VarChar).Value = Ejecutivo + .Add("@Telefono", SqlDbType.VarChar).Value = Telefono + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveBanco", SqlDbType.Int).Value = CveBanco + .Add("@IdContPaq", SqlDbType.Int).Value = IdContPaq + .Add("@RFC", SqlDbType.VarChar).Value = RFC + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveBancos(CveBanco As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_BancosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveBanco", SqlDbType.Int).Value = CveBanco + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Banco no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region " B A N C O S - C U E N T A S " + + Public Function GetBancosCuentas(CveCuenta As Integer, Optional CveEmpresa As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_BancosCuentasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + + If CveCuenta > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then + Me.CveCuenta = Data.Rows(0)("CveCuenta").ToString.ToEntero + Me.CveBanco = Data.Rows(0)("CveBanco").ToString.ToEntero + Me.CveTipoCuenta = Data.Rows(0)("CveTipoCuenta").ToString.ToEntero + Me.TipoCuenta = Data.Rows(0)("TipoCuenta").ToString + Me.Banco = Data.Rows(0)("Banco").ToString + Me.NumCuenta = Data.Rows(0)("NumCuenta").ToString + Me.CLABE = Data.Rows(0)("CLABE").ToString + Me.CveMoneda = Data.Rows(0)("CveMoneda").ToString.ToEntero + Me.DiaCorte = Data.Rows(0)("DiaCorte").ToString.ToEntero + Me.FInicial = Data.Rows(0)("FInicial").ToString.ToEntero + Me.FActual = Data.Rows(0)("FActual").ToString.ToEntero + Me.FFinal = Data.Rows(0)("FFinal").ToString.ToEntero + Me.IdCtaContable = Data.Rows(0)("IdCtaContable").ToString.ToEntero + Me.IdCtaContableComplementaria = Data.Rows(0)("IdCtaContableComplementaria").ToString.ToEntero + Me.CveCuentaConta = Data.Rows(0)("IdCtaContableSIG").ToString.ToEntero + Me.CveCuentaContaComplementaria = Data.Rows(0)("IdCtaContableComplementariaSIG").ToString.ToEntero + Me.FormatoCheque = Data.Rows(0)("FormatoCheque").ToString + Me.Estatus = Data.Rows(0)("Estatus").ToString + Me.Fecha = Data.Rows(0)("Fecha").ToString.ToDate + Me.Usuario = Data.Rows(0)("Usuario").ToString + Me.LimiteCredito = Data.Rows(0)("LimiteCredito").ToString.ToDouble + Me.ConvenioPagoElectronico = Data.Rows(0)("ConvenioPagoElectronico").ToString + Me.UsaLayout = If(Data.Rows(0)("UsaLayout").ToString = "True", True, False) + Me.UsaTarjeta = If(Data.Rows(0)("UsaTarjeta").ToString = "True", True, False) + + End If + + + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar las Cuentas de los Bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function GetNextFolio(CveCuenta As Integer, CveTipoTransaccion As Integer) As Long + Dim Retorno As Long = 0 + + DataCommand("PA_Banc_BancosCuentasNextFolioGet") + + With SqlCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + End With + Try + Retorno = SqlCommand.ExecuteScalar.ToString.ToLong + + Catch ex As SqlException + OnError("Ocurrió un error al consultar el siguiente folio de la cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + 1 + End Function + + Public Function AddBancosCuentas(CveBanco As Integer, CveTipoCuenta As Integer, NumCuenta As String, CLABE As String, CveMoneda As Integer, DiaCorte As Integer, FInicial As Integer, FActual As Integer, FFinal As Integer, LimiteCredito As Double, IdCtaContable As Integer, IdCtaContableComplementaria As Integer, FormatoCheque As String, CveUsuario As Integer, CveEmpresa As Integer, ConvenioPagoElectronico As String, UsaLayout As Boolean, UsaTarjeta As Boolean, Optional SaldoInicial As Double = 0) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_BancosCuentasAdd") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveBanco", SqlDbType.Int).Value = CveBanco + .Add("@CveTipoCuenta", SqlDbType.Int).Value = CveTipoCuenta + .Add("@NumCuenta", SqlDbType.VarChar).Value = NumCuenta + .Add("@CLABE", SqlDbType.VarChar).Value = CLABE + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@DiaCorte", SqlDbType.Int).Value = DiaCorte + .Add("@FInicial", SqlDbType.Int).Value = FInicial + .Add("@FActual", SqlDbType.Int).Value = FActual + .Add("@FFinal", SqlDbType.Int).Value = FFinal + .Add("@LimiteCredito", SqlDbType.Money).Value = LimiteCredito + .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable + .Add("@IdCtaContableComplementaria", SqlDbType.Int).Value = IdCtaContableComplementaria + .Add("@FormatoCheque", SqlDbType.VarChar).Value = FormatoCheque + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCuenta", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@ConvenioPagoElectronico", SqlDbType.VarChar).Value = ConvenioPagoElectronico + .Add("@UsaLayout", SqlDbType.Bit).Value = UsaLayout + .Add("@UsaTarjeta", SqlDbType.Bit).Value = UsaTarjeta + .Add("@SaldoInicial", SqlDbType.Money).Value = SaldoInicial + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Me.TCveCuenta = SqlAdapter.SelectCommand.Parameters("@CveCuenta").Value.ToString.ToEntero + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe el número de cuenta con el mismo Número: " & NumCuenta & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar la Cuenta de Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Cuenta de Banco", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateBancosCuentas(CveBanco As Integer, CveTipoCuenta As Integer, NumCuenta As String, CLABE As String, CveMoneda As Integer, DiaCorte As Integer, FInicial As Integer, FActual As Integer, FFinal As Integer, LimiteCredito As Double, IdCtaContable As Integer, IdCtaContableComplementaria As Integer, FormatoCheque As String, Estatus As Boolean, CveCuenta As Integer, ConvenioPagoElectronico As String, UsaLayout As Boolean, UsaTarjeta As Boolean) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_BancosCuentasUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveBanco", SqlDbType.Int).Value = CveBanco + .Add("@CveTipoCuenta", SqlDbType.Int).Value = CveTipoCuenta + .Add("@NumCuenta", SqlDbType.VarChar).Value = NumCuenta + .Add("@CLABE", SqlDbType.VarChar).Value = CLABE + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@DiaCorte", SqlDbType.Int).Value = DiaCorte + .Add("@FInicial", SqlDbType.Int).Value = FInicial + .Add("@FActual", SqlDbType.Int).Value = FActual + .Add("@FFinal", SqlDbType.Int).Value = FFinal + .Add("@LimiteCredito", SqlDbType.Money).Value = LimiteCredito + .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable + .Add("@IdCtaContableComplementaria", SqlDbType.Int).Value = IdCtaContableComplementaria + .Add("@FormatoCheque", SqlDbType.VarChar).Value = FormatoCheque + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@ConvenioPagoElectronico", SqlDbType.VarChar).Value = ConvenioPagoElectronico + .Add("@UsaLayout", SqlDbType.Bit).Value = UsaLayout + .Add("@UsaTarjeta", SqlDbType.Bit).Value = UsaTarjeta + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Número de Cuenta de Banco con el mismo número: " & NumCuenta & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en la Cuenta de Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Cuenta de Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveBancosCuentas(CveCuenta As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_BancosCuentasRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Cuenta de Banco no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Cuenta de Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Cuenta deBanco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function VincularCuentasContablesBancarias(IdCtaContable As Integer, IdCtaContableComplementaria As Integer, CveCuenta As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_BancosCuentasContables") + + With SqlAdapter.SelectCommand.Parameters + .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable + .Add("@IdCtaContableComplementaria", SqlDbType.Int).Value = IdCtaContableComplementaria + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Número de Cuenta de Banco con el mismo número: " & NumCuenta & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en la Cuenta de Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en la Cuenta de Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function +#End Region + +#Region " B A N C O S - C U E N T A S - U S U A R I O S" + + Public Function GetBancosCuentasUsuarios(CveCuenta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_BancosCuentasUsuariosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + End With + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar las Cuentas de los Bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetBancosCuentasUsuariosAcceso(CveCuenta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_BancosCuentasUsuariosAccesoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + End With + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar las Cuentas de los Bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function AddBancosCuentasUsuarios(CveCuenta As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_BancosCuentasUsuariosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe el número de cuenta con el mismo Número: " & NumCuenta & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar la Cuenta de Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar la Cuenta de Banco", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function RemoveBancosCuentasUsuarios(CveCuenta As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_BancosCuentasUsuariosRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Cuenta de Banco no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar la Cuenta de Banco.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Cuenta de Banco.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region " B A N C O S - E S T A T U S - C H E Q U E S " + +#End Region + +#Region " B A N C O S - I E " + + Public Function GetBancosIE(CveIE As Integer, CveBanco As Integer, CveCuenta As Integer, TipoMovimiento As String, CveTipoTransaccion As Integer, Folio As String, PagueseA As String, Importe As Double, + CveMoneda As Integer, EsAbonoEnCuenta As Integer, FueConciliado As Integer, CveEstatusIE As Integer, + FechaInicio As Date, FechaFin As Date, FechaAplicacionInicio As Date, FechaAplicacionFin As Date, + FechaConciliadoInicio As Date, FechaConciliadoFin As Date, CveUsuarioConcilio As Integer, TImporte As Double, CveEmpresa As Integer, Optional CveEstatusNotificacion As Integer = -1, Optional CveCuentaTarjeta As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IEGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveBanco", SqlDbType.Int).Value = CveBanco + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@TipoMovimiento", SqlDbType.VarChar).Value = TipoMovimiento + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@Folio", SqlDbType.VarChar).Value = Folio + .Add("@PagueseA", SqlDbType.NVarChar).Value = PagueseA + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@EsAbonoEnCuenta", SqlDbType.Int).Value = EsAbonoEnCuenta + .Add("@FueConciliado", SqlDbType.Int).Value = FueConciliado + .Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE + .Add("@FechaI", SqlDbType.Date).Value = IfNull(FechaInicio, DBNull.Value, FechaInicio) + .Add("@FechaF", SqlDbType.Date).Value = IfNull(FechaFin, DBNull.Value, FechaFin) + .Add("@FechaAplicacionI", SqlDbType.Date).Value = IfNull(FechaAplicacionInicio, DBNull.Value, FechaAplicacionInicio) + .Add("@FechaAplicacionF", SqlDbType.Date).Value = IfNull(FechaAplicacionFin, DBNull.Value, FechaAplicacionFin) + .Add("@CveUsuarioConcilio", SqlDbType.Int).Value = CveUsuarioConcilio + .Add("@FechaConciliadoI", SqlDbType.Date).Value = IfNull(FechaConciliadoInicio, DBNull.Value, FechaConciliadoInicio) + .Add("@FechaConciliadoF", SqlDbType.Date).Value = IfNull(FechaConciliadoFin, DBNull.Value, FechaConciliadoFin) + .Add("@TImporte", SqlDbType.Float).Value = TImporte + .Add("@CveEstatusNotificacion", SqlDbType.Int).Value = CveEstatusNotificacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta + + End With + + Try + SqlAdapter.Fill(Data) + + If CveIE > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then + Me.CveIE = Data.Rows(0)("CveIE").ToString.ToEntero + Me.CveCuenta = Data.Rows(0)("CveCuenta").ToString.ToEntero + Me.CveBanco = Data.Rows(0)("CveBanco").ToString.ToEntero + Me.Banco = Data.Rows(0)("Banco").ToString + Me.NumCuenta = Data.Rows(0)("NumCuenta").ToString + Me.CveTipoTransaccion = Data.Rows(0)("CveTipoTransaccion").ToString.ToEntero + Me.Tipo = Data.Rows(0)("Tipo").ToString + Me.TipoTransaccion = Data.Rows(0)("TipoTransaccion").ToString + Me.ClaveFormaPagoSAT = Data.Rows(0)("ClaveFormaPagoSAT").ToString + Me.FechaDocumento = Data.Rows(0)("FechaDocumento").ToString.ToDate + Me.Folio = Data.Rows(0)("Folio").ToString + Me.PagueseA = Data.Rows(0)("PagueseA").ToString + Me.Importe = Data.Rows(0)("Importe").ToString.ToDouble + Me.CveMoneda = Data.Rows(0)("CveMoneda").ToString.ToEntero + Me.Moneda = Data.Rows(0)("Moneda").ToString + Me.TipoCambio = Data.Rows(0)("TipoCambio").ToString.ToDouble + Me.Observaciones = Data.Rows(0)("Observaciones").ToString + NotificarA = Data.Rows(0)("NotificarA").ToString + Me.EsAbonoEnCuenta = CBool(Data.Rows(0)("EsAbonoEnCuenta").ToString) + Me.FueConciliado = CBool(Data.Rows(0)("FueConciliado").ToString) + Me.FechaAplicado = Data.Rows(0)("FechaAplicado").ToString.ToDate + Me.CveEstatusIE = Data.Rows(0)("CveEstatusIE").ToString.ToEntero + Me.CveProveedorIntermediario = Data.Rows(0)("CveProveedorIntermediario").ToString.ToEntero + BancoNumCuentaMoneda = Data.Rows(0)("BancoNumCuentaMoneda").ToString + IdCtaContable = Data.Rows(0)("IdCtaContable").ToString.ToEntero + IdCtaContableComplementaria = Data.Rows(0)("IdCtaContableComplementaria").ToString.ToEntero + CveCuentaConta = Data.Rows(0)("IdCtaContableSIG").ToString.ToEntero + CveCuentaContaComplementaria = Data.Rows(0)("IdCtaContableComplementariaSIG").ToString.ToEntero + CveCuentaDeposito = Data.Rows(0)("CveCuentaDeposito").ToString.ToEntero + DepositoBanco = Data.Rows(0)("DepositoBanco").ToString + DepositoCuenta = Data.Rows(0)("DepositoCuenta").ToString + DepositoCLABE = Data.Rows(0)("DepositoCLABE").ToString + DepositoCIE = Data.Rows(0)("DepositoCIE").ToString + DepositoReferencia = Data.Rows(0)("DepositoReferencia").ToString + DepositoSucursal = Data.Rows(0)("DepositoSucursal").ToString + DepositoRefCrediProveedor = Data.Rows(0)("RefCrediProveedor").ToString + + CuentaDepositado = Data.Rows(0)("CuentaDepositado").ToString + + Me.EstatusIE = Data.Rows(0)("EstatusIE").ToString + IDPoliza = Data.Rows(0)("IdPoliza").ToString.ToEntero + + Me.FechaIng = Data.Rows(0)("FechaIng").ToString.ToDate + Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero + Me.Usuario = Data.Rows(0)("Usuario").ToString + Me.UsuarioNombre = Data.Rows(0)("Nombre").ToString.ToString + UsuarioRegistroAbreviatura = Data.Rows(0)("NombreAbreviatura").ToString + MonedaAbreviatura = Data.Rows(0)("MonedaAbreviatura").ToString + SubProyecto = Data.Rows(0)("SubProyecto").ToString + Comprobante = Data.Rows(0)("Comprobante").ToString + 'Notificacion + Me.CveEstatusNotificacion = Data.Rows(0)("CveEstatusNotificacion").ToString.ToEntero + Me.FechaEntrega = Data.Rows(0)("FechaEntrega").ToString + Me.ObservacionEntrega = Data.Rows(0)("ObservacionEntrega").ToString + Me.CveProveedor = Data.Rows(0)("CveProveedor").ToString.ToEntero + + 'DATOS DE CANCELACION + Me.CveIECancelacion = Data.Rows(0)("CveIECancelacion").ToString.ToEntero + Me.FolioIECancelacion = Data.Rows(0)("FolioIECancelacion").ToString + Me.CveUsuarioCancelacion = Data.Rows(0)("CveUsuarioCancelacion").ToString.ToEntero + Me.UsuarioCancelacion = Data.Rows(0)("UsuarioCancelacion").ToString + Me.FechaCancelacion = Data.Rows(0)("FechaCancelacion").ToString.ToDate + Me.FechaIngCancelacion = Data.Rows(0)("FechaIngCancelacion").ToString.ToDate + Me.CveIECancelado = Data.Rows(0)("CveIECancelado").ToString.ToEntero + Me.FolioIECancelado = Data.Rows(0)("FolioIECancelado").ToString + End If + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Ingresos y Egresos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetBancosIE(CveIE As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + Retorno = GetBancosIE(CveIE, -1, -1, "-1", -1, "-1", "-1", -1, -1, -1, -1, -1, MinFecha, MaxFecha, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, CveEmpresa) + + Return Retorno + End Function + Public Function GetPrePolizasDetalle(CvePrePoliza As Integer, Optional CveIE As Integer = -1, Optional CveOC As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Conta_PrePolizasDetalleGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveOC", SqlDbType.Int).Value = CveOC + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener Movimientos Prepolizas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetBancosIEMovimientos(CveIE As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IEMovimientosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .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 movimientos del documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetBancosIEMovimientosPadre(CveIE As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IEMovimientosRelacionadosPadreGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .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 movimientos del documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetBancosIEMovimientosHijo(CveIE As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IEMovimientosRelacionadosHijosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .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 movimientos del documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetBancosIEMovimientosDepositos(CveIE As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IEMovimientosDepositosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .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 movimientos del documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetFoliosCancelados(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_FoliosCanceladosGet") + 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 folios cancelados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#Region "Complemento Pagos" + + Public Function GeneraTimbrePago(CveIE As Integer, CveVenta As Integer, UsuarioActual As Usuario, Optional CveCliente As Integer = -1, Optional CFDIRelacionado As String = "-1", Optional EsCancelacion As Boolean = False, Optional EsRegeneracion As Boolean = False, Optional CvePrePoliza As Integer = -1, Optional FechaTimbrado As DateTime = MinFecha) As Boolean + + If FechaTimbrado = MinFecha Then FechaTimbrado = DateTime.Now + Dim Serie As String = "Pag" + Dim Folio As Integer = -1 + Dim Retorno As Boolean = False + Dim Estatus As Integer = 1 + + Dim dttpagos As DataTable = Nothing + Dim dr As Data.DataRow = Nothing + + If GetComplementoPagosRep(-1, Now.AddYears(-2), Now, If(CvePrePoliza > 0, -1, CveIE), CveVenta, If(EsCancelacion OrElse EsRegeneracion, 2, 1), UsuarioActual.CveEmpresa, CvePrePoliza:=CvePrePoliza) Then + dr = DtResultados.FiltroPrimero("CveVenta IS NULL") + dttpagos = DtResultados.FiltraParametros("CveVenta > 0") + End If + If EsCancelacion Then Estatus = 2 + If EsRegeneracion Then Estatus = 3 + + + Dim tCveComplementoPago As Integer = AddComplementoPago(If(CvePrePoliza > 0, CveIE, dr("CveIE").ToString.ToEntero), -1, Serie, Folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CvePrePoliza:=CvePrePoliza, Estatus:=Estatus) + If tCveComplementoPago > 0 Then + 'Dim drr As Data.DataRow = dtt.Rows(0) + 'ReceptorRFC = drr("RFC").ToString + 'ReceptorNombre = drr("NombreCliente").ToString + + + Folio = FActual + ComplementoSerieFolio = $"{Serie}-{Folio}" + + Dim Cuentapago As String = dr("CuentaOrdenante").ToString + Dim CuentaBeneficiario As String = dr("CuentaBeneficiario").ToString + Dim RFCCliente As String = dr("RFC").ToString + Dim RFCEmpresa As String = UsuarioActual.Empresa.RFC + CobranzaCorreo = dr("CobranzaCorreo").ToString + + Select Case dr("ClaveFormaPagoSAT").ToString + Case "02" + If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(11, 18) Then + Mensaje = "La cuenta ordenante no cumple con el formato esperado." + End If + + If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then + Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." + End If + Case "03" + If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(10, 16, 18) Then + Mensaje = "La cuenta ordenante no cumple con el formato esperado." + End If + If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 18)) Then + Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." + End If + Case "04" + + If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(16) Then + Mensaje = "La cuenta ordenante no cumple con el formato esperado." + End If + + If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then + Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." + End If + + Case "05" + If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(10, 11, 15, 16, 18, 50) Then + Mensaje = "La cuenta ordenante no cumple con el formato esperado." + End If + + If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then + Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." + End If + Case "06" + If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(10) Then + Mensaje = "La cuenta ordenante no cumple con el formato esperado." + End If + + CuentaBeneficiario = "" + Case "28" + If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(16) Then + Mensaje = "La cuenta ordenante no cumple con el formato esperado." + End If + + If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then + Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." + End If + Case "29" + If Cuentapago <> "" AndAlso Not Cuentapago.Length.Contiene(15, 16) Then + Mensaje = "La cuenta ordenante no cumple con el formato esperado." + End If + + If CuentaBeneficiario <> "" AndAlso Not (CuentaBeneficiario.Length.Contiene(10, 11, 15, 16, 18, 50)) Then + Mensaje = $"{Mensaje} La Cuenta Beneficiario no cumple con el formato esperado." + End If + + Case Else + + CuentaBeneficiario = "" + Cuentapago = "" + 'RFCCliente = "" + 'RFCEmpresa = "" + + End Select + + If EsCancelacion AndAlso (CFDIRelacionado = "-1" OrElse CFDIRelacionado = "") Then + Mensaje += " La cancelación debe de tener documento relacionado" + End If + + If Not Mensaje.Length = 0 Then + GuardaLog(Mensaje) + Return False + End If + + Dim Timbre As CFDITimbre = Nothing + Dim Timbrado As New Timbrado + + + + Timbre = Timbrado.PreparaTimbrePago(RFCEmpresa, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal, + RFCCliente, dr("NombreCliente").ToString, Serie, Folio.ToString, FechaTimbrado, Cuentapago, + dr("FechaDocumento").ToString.ToDate, dr("ClaveFormaPagoSAT").ToString, dr("AbreviaturaSAT").ToString, dr("VentasTotalPagado").ToString.ToDouble, + UsuarioActual.Empresa.CP.ToString, CuentaBeneficiario, dr("TipoCambioPago").ToString.ToDouble, dttpagos, CFDIRelacionado:=CFDIRelacionado, EsCancelacion:=EsCancelacion) + + ''PREPARA PARA CANCELACION POR SUSTITUCION DE COMPLEMENTO DE PAGO + 'If CFDIRelacionado <> "-1" And CFDIRelacionado <> "" Then + ' Timbre.CFDIRelacionados.TipoRelacion = "04" + ' Timbre.CFDIRelacionados.UUID.Add(CFDIRelacionado) + 'End If + + 'Timbre = Timbrado.PreparaTimbrePago(UsuarioActual.Empresa.RFC, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal, + ' dr("RFC").ToString, dr("NombreCliente").ToString, Serie, Folio.ToString, FechaTimbrado, Cuentapago, + ' dr("FechaDocumento").ToString.ToDate, dr("ClaveFormaPagoSAT").ToString, dr("AbreviaturaSAT").ToString, dr("Importe").ToString.ToDouble, + ' UsuarioActual.Empresa.CP.ToString, dr("CuentaBeneficiario").ToString, dr("FolioFiscal").ToString, dr("Serie").ToString, dr("Folio").ToString, dr("VentaAbreviaturaSAT").ToString, + ' dr("MetodoPago").ToString, dr("Importe").ToString.ToDecimal, dr("ImpSaldoInsoluto").ToString.ToDecimal, dr("ImpSaldoAnterior").ToString.ToDouble, dr("TipoCambio").ToString.ToDecimal, + ' dr("NumParcialidad").ToString.ToEntero, dr("PorcentajeIVA").ToString.ToDecimal, dr("PorcentajeIEPS").ToString.ToDecimal) + + If Timbre IsNot Nothing Then + Dim Ventas As New Modelos.Factura + Dim Cliente As New Modelos.ClienteModel + Ventas.Timbre = Timbre + Ventas.Cliente = Cliente + + Dim CvePACEspecial As Integer = -1 + If UsuarioActual.CveEmpresa = 3 Then CvePACEspecial = 4 + + Ventas.TipoDocto = "Pag" + Dim ObjTimbrado As New Timbrado + + Dim SeTimbro As Boolean = ObjTimbrado.TimbrarFactura(UsuarioActual, Ventas, CvePACEspecial) + + ' Dim StrRetorno As String = Modelos.TimbrarFactura(Ventas, UsuarioActual) + If SeTimbro Then + If UpdateComplementoPago(tCveComplementoPago, ObjTimbrado.UUID, UsuarioActual.Empresa.CvePAC, UsuarioActual.CveEmpresa) Then + CveComplementoPago = tCveComplementoPago + Retorno = True + End If + End If + Mensaje = ObjTimbrado.MensajeErrorCFDI + + GuardaLog(ObjTimbrado.MensajeErrorCFDI) + Timbre = Nothing + + Else + GuardaLog(Mensaje) + End If + Timbrado = Nothing + Else + Mensaje = "No se pudo guardar el registro del complemento" + GuardaLog(Mensaje & " - Error en función AddComplementoPago revisar si la empresa cuenta con Folio ""cp"" ") + End If + + Return Retorno + End Function + + 'Public Function CancelaTimbrePago(CveIE As Integer, CveUsuario As Integer, Empresa As Empresa) As Boolean + + ' Dim Resultado As Boolean = False + + ' IniciaTransacSQL() + + ' Dim FechaInicio As Date = New Date(1900, 1, 1) + ' Dim FechaFin As Date = New Date(2999, 12, 31) + + ' If GetComplementoPagosRep(-1, FechaInicio, FechaFin, CveIE, -1, 2, Empresa.CveEmpresa, Estatus:=1) Then + ' If Data.Rows.Count > 0 Then + ' Dim CveComplementoPago As Integer = Data.Rows(0)("CveComplementoPago").ToString.ToEntero + ' If Data.Rows(0)("CveComplementoPago").ToString.ToEntero > 0 Then + + ' Dim Timbrado As New Timbrado + ' Dim PagoFolioFiscal As String = Data.Rows(0)("PagoFolioFiscal").ToString + ' Dim Importe As Decimal = Data.Rows(0)("Importe").ToString.ToDecimal + ' Dim RFCReceptor As String = Data.Rows(0)("RFC").ToString + + ' Resultado = Timbrado.CFDICancelar(Empresa, PagoFolioFiscal, Importe, RFCReceptor, Empresa.RFC) + + ' If Resultado Then + ' Resultado = UpdateComplementoPago(CveComplementoPago, "-1", -1, Empresa.CveEmpresa, 2, Empresa.CvePAC) + ' End If + ' End If + ' Else + ' Resultado = False + ' End If + ' Else + ' Resultado = False + ' End If + + ' If Resultado Then + ' Commit() + ' Else + ' RollBack() + ' End If + + ' Return Resultado + + 'End Function + + Public Function UpdateComplementoPago(CveComplementoPago As Integer, FolioFiscal As String, CvePAC As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CvePACCancelacion As Integer = -1, + Optional FechaCancelacion As Date = MinFecha, Optional SelloCancelacion As String = "") As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_ComplementoPagoUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago + .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal + .Add("@CvePAC", SqlDbType.Int).Value = CvePAC + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion + .Add("@FechaCancelacion", SqlDbType.Date).Value = FechaCancelacion + .Add("@SelloCancelacion", SqlDbType.VarChar).Value = SelloCancelacion + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + If SelloCancelacion.Trim.Length > 0 Then + OnError($"Ocurrió un error al actualizar complemento de pago sello: {SelloCancelacion} ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + Else + OnError("Ocurrió un error al actualizar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End If + + End Try + + Return Retorno + End Function + + + Public Function UpdateComplementoPagoCancelado(CveComplementoPago As Integer, CveEstatus As Integer, CvePACCancelacion As Integer, CveEmpresa As Integer, FechaCancelacion As DateTime) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_ComplementoPagoUpdateCancelado") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaCancelacion", SqlDbType.DateTime).Value = FechaCancelacion + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al cancelar estatus complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddComplementoPago(CveIE As Integer, CveVenta As Integer, Serie As String, Folio As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CvePrePoliza As Integer = -1, Optional Estatus As Integer = 1) As Integer + Dim Retorno As Integer = 0 + DataAdapter("PA_Banc_ComplementoPagoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@Serie", SqlDbType.VarChar).Value = Serie + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveComplementoPago", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@FolioInsertado", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CveComplementoPago").Value.ToString.ToEntero + FActual = SqlAdapter.SelectCommand.Parameters("@FolioInsertado").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error al Guardar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetComplementoPagosRep(CveCliente As Integer, FechaInicio As Date, FechaFin As Date, CveIE As Integer, CveVenta As Integer, Opcion As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CvePrePoliza As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_ComplementoPagoRepGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + End With + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener informacion de complementos de pago pendientes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetComplementoPagos(CveComplementoPago As Integer, CveIE As Integer, CveVenta As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_ComplementoPagoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .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 informacion de complementos de pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetVincularPago(CveProveedor As Integer, CveCompra As Integer, Tipo As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Optional CveIE As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Comp_VincularPagoGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@Tipo", SqlDbType.Int).Value = Tipo + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los pagos a vincular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function +#End Region + + Public Function GetPagosIntermediarios(CveProveedor As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_PagosIntermediariosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .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 pagos intermediarios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddBancos_IE(CveCuenta As Integer, CveTipoTransaccion As Integer, FechaDocumento As Date, Folio As String, PagueseA As String, Importe As Double, CveMoneda As Integer, TipoCambio As Double, Observaciones As String, + NotificarA As String, EsAbonoEnCuenta As Boolean, AplicaImpuestos As Boolean, IDPoliza As Integer, CvePrePoliza As Integer, Comprobante As String, CveUsuario As Integer, CveEmpresa As Integer, + Optional CveCuentaDeposito As Integer = -1, Optional PagoElectronico As String = "-1", Optional CveEstatusIE As Integer = 1, Optional CveCuentaTarjeta As Integer = -1, + Optional Referencia As String = "-1", Optional CveIESustitucion As Integer = -1, Optional CveCorte As Integer = -1, Optional CveProveedorIntermediario As Integer = -1, Optional FueConciliado As Boolean = False, + Optional MesesSinIntereses As Integer = -1, Optional Modulo As String = "") As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_Banc_IEAdd") + + With SqlAdapter.SelectCommand.Parameters + '.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@FechaDocumento", SqlDbType.Date).Value = FechaDocumento + .Add("@Folio", SqlDbType.VarChar).Value = Folio + .Add("@PagueseA", SqlDbType.VarChar).Value = PagueseA + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@TipoCambio", SqlDbType.Float).Value = TipoCambio + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@NotificarA", SqlDbType.VarChar).Value = NotificarA + .Add("@EsAbonoEnCuenta", SqlDbType.Bit).Value = EsAbonoEnCuenta + '.Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado + .Add("@AplicaImpuestos", SqlDbType.Bit).Value = AplicaImpuestos + .Add("@Comprobante", SqlDbType.VarChar).Value = Comprobante + .Add("@IDPoliza", SqlDbType.Int).Value = IDPoliza + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito + .Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE + .Add("@PagoElectronico", SqlDbType.VarChar).Value = PagoElectronico + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta + .Add("@Referencia", SqlDbType.VarChar).Value = Referencia + .Add("@CveIESustitucion", SqlDbType.Int).Value = CveIESustitucion + .Add("@CveCorte", SqlDbType.Int).Value = CveCorte + .Add("@CveProveedorIntermediario", SqlDbType.Int).Value = CveProveedorIntermediario + .Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado + .Add("@MesesSinIntereses", SqlDbType.Int).Value = MesesSinIntereses + + .Add("@CveIE", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@FolioRegistro", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output + .Add("@Modulo", SqlDbType.VarChar).Value = Modulo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CveIE").Value.ToString.ToEntero + _Folio = SqlAdapter.SelectCommand.Parameters("@FolioRegistro").Value.ToString + + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Or Ex1.Message.Contains("Número: 2601;") Then + Alert("Ya existe un movimiento bancario con el mismo Folio: " & Folio & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Movimiento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el Banco IE", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function UpdateBancos_IE(FechaDocumento As DateTime, FechaAplicado As DateTime?, CveIE As Integer, Optional Folio As String = "-1", Optional CveCuentaDeposito As Integer = -1, Optional CveCuenta As Integer = -1, - Optional Observaciones As String = "-1", Optional CveUsuarioModifico As Integer = -1) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaDocumento", SqlDbType.DateTime).Value = FechaDocumento - - If FechaAplicado Is Nothing Then - .Add("@FechaAplicado", SqlDbType.DateTime).Value = DBNull.Value - Else - .Add("@FechaAplicado", SqlDbType.DateTime).Value = FechaAplicado - End If - - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@Folio", SqlDbType.VarChar).Value = Folio - - .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + Optional Observaciones As String = "-1", Optional CveUsuarioModifico As Integer = -1) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaDocumento", SqlDbType.DateTime).Value = FechaDocumento + + If FechaAplicado Is Nothing Then + .Add("@FechaAplicado", SqlDbType.DateTime).Value = DBNull.Value + Else + .Add("@FechaAplicado", SqlDbType.DateTime).Value = FechaAplicado + End If + + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@Folio", SqlDbType.VarChar).Value = Folio + + .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico - - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - 'Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 2627;") Then - ' Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Banco IE Conciliar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateFolioCancelado(CveIE As Integer, Optional Folio As String = "-1") As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEUpdateFolioCancelado") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@Folio", SqlDbType.VarChar).Value = Folio - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Folio cancelado.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateBancos_IECuentaDeposito(CveCuentaDeposito As Integer, CveIE As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IECuentaDepositoUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - 'Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 2627;") Then - ' Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - Catch ex As Exception - OnError("Ocurrió un error al asociar la Cuenta Deposito al IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateBancos_IEConciliado(FueConciliado As Boolean, FechaAplicado As DateTime, OtrosIngresos As Double, CveProveedor As Integer, CveUsuarioConcilio As Integer, CveIE As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEConciliar") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado - .Add("@FechaAplicado", SqlDbType.DateTime).Value = FechaAplicado - .Add("@CveUsuarioConcilio", SqlDbType.Int).Value = CveUsuarioConcilio - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@OtrosIngresos", SqlDbType.Money).Value = OtrosIngresos - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - 'Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 2627;") Then - ' Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Banco IE Conciliar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateBancos_IEPagoElectronico(PagoElectronico As String, CveUsuario As Integer, CveIE As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEPagoElectronico") - - With SqlAdapter.SelectCommand.Parameters - .Add("@PagoElectronico", SqlDbType.VarChar).Value = PagoElectronico - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - 'Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 2627;") Then - ' Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - Catch ex As Exception - OnError("Ocurrió un error al actualizar el pago electronico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateBancos_IETipoCambio(TipoCambio As Double, CveIE As Integer, CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_IETipoCambioUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@TipoCambio", SqlDbType.Float).Value = TipoCambio - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el tipo cambio del IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateBancosTipoCambioValuacion(TipoCambio As Decimal, CveIE As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_IETipoCambioValuacionUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@TipoCambio", SqlDbType.Float).Value = TipoCambio - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el tipo cambio del IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetUsuariosConcilio(CveEmpresa As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEUsuariosConciliaronGet") - - 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 cargar los Usuarios Concilió.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function Bancos_IEImpreso(FueImpreso As Boolean, CveIE As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEImpreso") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FueImpreso", SqlDbType.Bit).Value = FueImpreso - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - - Catch ex As Exception - OnError("Ocurrió un error al imprimir el Documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function CancelarBancos_IE(CveUsuario As Integer, CveIE As Integer, MesAnterior As Boolean, IdPoliza As Integer, FolioPoliza As Integer, Optional FechaCancelacion As Date = MinFecha, Optional TipoMovimiento As Integer = 1) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IECancelar") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@MesAnterior", SqlDbType.Bit).Value = MesAnterior - .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza - .Add("@FolioPoliza", SqlDbType.Int).Value = FolioPoliza - .Add("@FechaCancelacion", SqlDbType.Date).Value = FechaCancelacion - .Add("@TipoMovimiento", SqlDbType.Int).Value = TipoMovimiento - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al cancelar el movimiento en bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function EliminarBancos_IE(CveUsuario As Integer, CveIE As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEEliminar") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + 'Catch Ex1 As SqlException + ' If Ex1.Message.Contains("Número: 2627;") Then + ' Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) + ' Else + ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Banco IE Conciliar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateFolioCancelado(CveIE As Integer, Optional Folio As String = "-1") As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEUpdateFolioCancelado") + + With SqlAdapter.SelectCommand.Parameters .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@TerminoCorrecto", SqlDbType.Bit).Direction = ParameterDirection.Output - End With - - Try + .Add("@Folio", SqlDbType.VarChar).Value = Folio + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Folio cancelado.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateBancos_IECuentaDeposito(CveCuentaDeposito As Integer, CveIE As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IECuentaDepositoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + 'Catch Ex1 As SqlException + ' If Ex1.Message.Contains("Número: 2627;") Then + ' Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) + ' Else + ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + Catch ex As Exception + OnError("Ocurrió un error al asociar la Cuenta Deposito al IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateBancos_IEConciliado(FueConciliado As Boolean, FechaAplicado As DateTime, OtrosIngresos As Double, CveProveedor As Integer, CveUsuarioConcilio As Integer, CveIE As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEConciliar") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado + .Add("@FechaAplicado", SqlDbType.DateTime).Value = FechaAplicado + .Add("@CveUsuarioConcilio", SqlDbType.Int).Value = CveUsuarioConcilio + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@OtrosIngresos", SqlDbType.Money).Value = OtrosIngresos + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + 'Catch Ex1 As SqlException + ' If Ex1.Message.Contains("Número: 2627;") Then + ' Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) + ' Else + ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Banco IE Conciliar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateBancos_IEPagoElectronico(PagoElectronico As String, CveUsuario As Integer, CveIE As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEPagoElectronico") + + With SqlAdapter.SelectCommand.Parameters + .Add("@PagoElectronico", SqlDbType.VarChar).Value = PagoElectronico + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + 'Catch Ex1 As SqlException + ' If Ex1.Message.Contains("Número: 2627;") Then + ' Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) + ' Else + ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + Catch ex As Exception + OnError("Ocurrió un error al actualizar el pago electronico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateBancos_IETipoCambio(TipoCambio As Double, CveIE As Integer, CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IETipoCambioUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoCambio", SqlDbType.Float).Value = TipoCambio + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo cambio del IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateBancosTipoCambioValuacion(TipoCambio As Decimal, CveIE As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IETipoCambioValuacionUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoCambio", SqlDbType.Float).Value = TipoCambio + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo cambio del IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetUsuariosConcilio(CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEUsuariosConciliaronGet") + + 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 cargar los Usuarios Concilió.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function Bancos_IEImpreso(FueImpreso As Boolean, CveIE As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEImpreso") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FueImpreso", SqlDbType.Bit).Value = FueImpreso + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al imprimir el Documento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function CancelarBancos_IE(CveUsuario As Integer, CveIE As Integer, MesAnterior As Boolean, IdPoliza As Integer, FolioPoliza As Integer, Optional FechaCancelacion As Date = MinFecha, Optional TipoMovimiento As Integer = 1) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IECancelar") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@MesAnterior", SqlDbType.Bit).Value = MesAnterior + .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza + .Add("@FolioPoliza", SqlDbType.Int).Value = FolioPoliza + .Add("@FechaCancelacion", SqlDbType.Date).Value = FechaCancelacion + .Add("@TipoMovimiento", SqlDbType.Int).Value = TipoMovimiento + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al cancelar el movimiento en bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function EliminarBancos_IE(CveUsuario As Integer, CveIE As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEEliminar") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@TerminoCorrecto", SqlDbType.Bit).Direction = ParameterDirection.Output + End With + + Try SqlAdapter.Fill(Data) @@ -1643,2667 +1643,2667 @@ Public Class ClsBancos ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Catch ex As Exception - OnError("Ocurrió un error al cancelar el movimiento en bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function GetBancosSaldosPeriodo(CveCuenta As Integer, CveMoneda As Integer, FechaCorte As Date, Opcion As Integer, CveTipoCuenta As String, CveUsuario As Integer, CveEmpresa As Integer, TipoCambio As Integer, TCEspecifico As Double) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_SaldosPeriodoGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@FechaCorte", SqlDbType.Date).Value = FechaCorte - .Add("@Opcion", SqlDbType.Int).Value = Opcion - .Add("@CveTipoCuenta", SqlDbType.VarChar).Value = CveTipoCuenta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio - .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los saldos bancarios por periodo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - Public Function GetBancosSaldos(CveBanco As Integer, CveCuenta As Integer, CveMoneda As Integer, FechaInicio As String, FechaFin As String, Opcion As Integer, CveTipoCuenta As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SaldosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveBanco", SqlDbType.Int).Value = CveBanco - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@FechaI", SqlDbType.VarChar).Value = FechaInicio - .Add("@FechaF", SqlDbType.VarChar).Value = FechaFin - .Add("@Opcion", SqlDbType.Int).Value = Opcion - .Add("@CveTipoCuenta", SqlDbType.VarChar).Value = CveTipoCuenta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .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 saldos bancarios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetBancosSaldosDetalle(pCveBanco As Integer, pCveCuenta As Integer, CveMoneda As Integer, FechaInicio As String, FechaFin As String, Opcion As Integer, CveUsuario As Integer, pCveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SaldosDetalleGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveBanco", SqlDbType.Int).Value = pCveBanco - .Add("@CveCuenta", SqlDbType.Int).Value = pCveCuenta - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@FechaI", SqlDbType.VarChar).Value = FechaInicio - .Add("@FechaF", SqlDbType.VarChar).Value = FechaFin - .Add("@Opcion", SqlDbType.Int).Value = Opcion - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa - End With - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los detalles de saldos bancarios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetConciliacionesReporte(pCveCuenta As Integer, FechaInicio As Date, FechaFin As Date, pCveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Bancos_ConciliacionesReporteGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = pCveCuenta - .Add("@FechaI", SqlDbType.Date).Value = FechaInicio - .Add("@FechaF", SqlDbType.Date).Value = FechaFin - .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa - .Add("@Conciliado", SqlDbType.Money).Direction = ParameterDirection.Output - .Add("@NoConciliado", SqlDbType.Money).Direction = ParameterDirection.Output - End With - Try - SqlAdapter.Fill(Data) - Conciliado = SqlAdapter.SelectCommand.Parameters("@Conciliado").Value.ToString.ToDouble - NoConciliado = SqlAdapter.SelectCommand.Parameters("@NoConciliado").Value.ToString.ToDouble - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de conciliaciones saldos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateComprobanteIE(ExtensionComprobante As String, CveIE As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_UpdateComprobanteIE") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Comprobante", SqlDbType.VarChar).Value = ExtensionComprobante - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el comprobante del IE", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetIngresoEgresosDelDia(Fecha As Date, Tipo As String, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IngresoEgresosDiariosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Fecha", SqlDbType.Date).Value = Fecha - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al cargar los ingresos/egresos diarios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function EliminarBancos_IEComprobacion(CveUsuario As Integer, CveIEDevolucion As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEEliminarComprobacion") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveIEDevolucion", SqlDbType.Int).Value = CveIEDevolucion - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar los Movimientos Bancarios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function CancelarIEVenta(CveIE As Integer, CveVenta As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_CancelarIEVenta") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveVenta", SqlDbType.Int).Value = CveVenta - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al cancelar el ie de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - Return Retorno - End Function -#End Region - -#Region "B A N C O S - I E - N O T I F I C A C I O N E S" - Public Function GetBancosIENotificaciones(FechaInicio As Date, FechaFin As Date, CveTipoTransaccion As Integer, PagueseA As String, Correo As Integer, CveEstatusNotificacion As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_IENotificacionesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - .Add("@PagueseA", SqlDbType.VarChar).Value = PagueseA - .Add("@Correo", SqlDbType.Int).Value = Correo - .Add("@CveEstatusNotificacion", SqlDbType.Int).Value = CveEstatusNotificacion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las Notificaciones para los Ingresos y Egresos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateBancos_IENotificaciones(CveEstatusNotificacion As Integer, FechaEntrega As String, ObservacionEntrega As String, CveIE As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IENotificaciones") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusNotificacion", SqlDbType.Int).Value = CveEstatusNotificacion - .Add("@FechaEntrega", SqlDbType.VarChar).Value = FechaEntrega - .Add("@ObservacionEntrega", SqlDbType.VarChar).Value = ObservacionEntrega - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al guardar el Estatus de Notificacion del IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function -#End Region - -#Region " B A N C O S - E S T A T U S - I E " - - Public Function GetBancos_EstatusIE() As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_EstatusIEGet") - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As SqlException - OnError("Ocurrió un error al consultar los Estatus de Ingresos y Egresos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddBancos_EstatusIE(CveEstatusIE As Integer, EstatusIE As String, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_EstatusIEAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE - .Add("@EstatusIE", SqlDbType.VarChar).Value = EstatusIE - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Banco con el mismo nombre: " & EstatusIE & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el EstatusIE.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el EstatusIE", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateBancos_EstatusIE(EstatusIE As String, Estatus As Boolean, CveEstatusIE As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_EstatusIEUpdate") - - - With SqlAdapter.SelectCommand.Parameters - .Add("@EstatusIE", SqlDbType.VarChar).Value = EstatusIE - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Banco con el mismo nombre: " & EstatusIE & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el EstatusIE", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el EstatusIE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveBancos_EstatusIE(CveEstatusIE As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_EstatusIERemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Estatus de Ingresos y Egresos no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Estatus de Ingresos y Egresos.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Estatus de Ingresos y Egresos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region " B A N C O S - T I P O S - T R A N S A C C I O N E S " - - Public Function GetBancos_TiposTransaccion(Optional Estatus As Integer = 1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_TiposTransaccionGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As SqlException - OnError("Ocurrió un error al consultar los Bancos - Tipos de Transacción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddBancos_TiposTransaccion(CveTipoTransaccion As Integer, TipoTransaccion As String, Tipo As String, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_TiposTransaccionAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - .Add("@TipoTransaccion", SqlDbType.VarChar).Value = TipoTransaccion - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Tipo de Transacción con el mismo nombre: " & TipoTransaccion & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el Tipo de Transacción.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el Tipo de Transacción", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateBancos_TiposTransaccion(TipoTransaccion As String, Tipo As String, Estatus As Boolean, CveTipoTransaccion As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_TiposTransaccionUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@TipoTransaccion", SqlDbType.VarChar).Value = TipoTransaccion - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Tipo de Transacci´ón con el mismo nombre: " & TipoTransaccion & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el Tipo de Transacción", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Tipo de Transacción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveBancos_TiposTransaccion(CveTipoTransaccion As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_TiposTransaccionRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Tipo de Transacción no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Tipo de Transacción.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Tipo de Transacción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateIEPrePoliza(FechaConta As Date, NumeroPoliza As String, IdPoliza As Integer, CvePrePoliza As Integer, CveIE As Integer, CveCompra As Integer) As Boolean - - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_IEPrePolizaUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaConta", SqlDbType.Date).Value = FechaConta - .Add("@NumeroPoliza", SqlDbType.VarChar).Value = NumeroPoliza - .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar poliza del movimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateCompraPrePoliza(FechaConta As Date, NumeroPoliza As String, IdPoliza As Integer, CveCompra As Integer, Optional CvePlantillaPoliza As Integer = 2) As Boolean - - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CompraPrePolizaUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaConta", SqlDbType.Date).Value = FechaConta - .Add("@NumeroPoliza", SqlDbType.VarChar).Value = NumeroPoliza - .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza - .Add("@CvePlantillaPoliza", SqlDbType.Int).Value = CvePlantillaPoliza - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@Retorno", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - Retorno = If(SqlAdapter.SelectCommand.Parameters("@Retorno").Value.ToString.ToEntero = 0, True, False) - - Catch ex As Exception - OnError("Ocurrió un error al actualizar poliza de la compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdatePrePoliza(FechaConta As Date, NumeroPoliza As String, IdPoliza As Integer, CvePrePoliza As Integer) As Boolean - - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_PrePolizaUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaConta", SqlDbType.Date).Value = FechaConta - .Add("@NumeroPoliza", SqlDbType.VarChar).Value = NumeroPoliza - .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar póliza en prepóliza.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - -#End Region - -#Region " B A N C O S - T I P O S - C U E N T A S " - Public Function GetBancos_TiposCuenta() As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_TiposCuentaGet") - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As SqlException - OnError("Ocurrió un error al consultar los Tipos de Cuentas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AddBancos_TiposCuenta(TipoCuenta As String, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_TiposCuentaAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@TipoCuenta", SqlDbType.VarChar).Value = TipoCuenta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Tipo de Cuenta con el mismo nombre: " & TipoCuenta & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el Tipo de Cuenta.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el Tipo de Cuenta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateBancos_TiposCuenta(TipoCuenta As String, Estatus As Boolean, CveTipoCuenta As Integer) As Boolean - - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_TiposCuentaUpdate") - - - With SqlAdapter.SelectCommand.Parameters - .Add("@TipoCuenta", SqlDbType.VarChar).Value = TipoCuenta - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveTipoCuenta", SqlDbType.Int).Value = CveTipoCuenta - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Tipo de Cuenta con el mismo nombre: " & TipoCuenta & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el Tipo de Cuenta ", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Tipo de Cuenta .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveBancos_TiposCuenta(CveTipoCuenta As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_TiposCuentaRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveTipoCuenta", SqlDbType.Int).Value = CveTipoCuenta - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Tipo de Cuenta no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Tipo de Cuenta.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Tipo de Cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - - -#Region "B A N C O S - C R E D I T O S" - Public Function GetCreditos(CveCredito As Integer, CveCompra As Integer, CveCuenta As Integer, CveProveedor As Integer, CveTipoCredito As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_CreditosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveTipoCredito", SqlDbType.Int).Value = CveTipoCredito - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - If Data.Rows.Count > 0 Then - _CveCredito = Data.Rows(0)("CveCredito").ToString.ToEntero - _CveCuentaCredito = Data.Rows(0)("CveCuenta").ToString.ToEntero - _CveCompra = Data.Rows(0)("CveCompra").ToString.ToEntero - _CveAF = Data.Rows(0)("CveAF").ToString.ToEntero - _FechaVencimiento = Data.Rows(0)("FechaVencimiento").ToString.ToDate - _Tasa = Data.Rows(0)("Tasa").ToString.ToDouble - _SobreTasa = Data.Rows(0)("SobreTasa").ToString.ToDouble - _Referencia = Data.Rows(0)("Referencia").ToString - _TipoCredito = Data.Rows(0)("CveTipoCredito").ToString.ToEntero - _Plazo = Data.Rows(0)("Plazo").ToString.ToEntero - ' _ImporteCredito = Data.Rows(0)("Importe").ToString.ToDouble - _CveIECredito = Data.Rows(0)("CveIE").ToString.ToEntero - _Proveedor = Data.Rows(0)("Proveedor").ToString - _CveProveedor = Data.Rows(0)("CveProveedor").ToString.ToEntero - _CveTipoCredito = Data.Rows(0)("CveTipoCredito").ToString.ToEntero - CveCompraFactura = Data.Rows(0)("CveCompraFactura").ToString.ToEntero - FacturaProveedor = Data.Rows(0)("FacturaProveedor").ToString - FacturaSerieFolio = Data.Rows(0)("FacturaSerieFolio").ToString - FacturaDescripcion = Data.Rows(0)("FacturaDescripcion").ToString - FacturaFecha = Data.Rows(0)("FacturaFecha").ToString.ToDate - CreditoValor = Data.Rows(0)("CreditoValor").ToString.ToDouble - TotalFinanciado = Data.Rows(0)("TotalFinanciado").ToString.ToDouble - CvePrePoliza = Data.Rows(0)("CvePrePoliza").ToString.ToEntero - End If - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetCreditosRep(CveTipoCredito As Integer, Opcion As Integer, CveEmpresa As Integer, Optional FechaI As String = "-1", Optional FechaF As String = "-1", Optional Estatus As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_CreditosRep") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveTipoCredito", SqlDbType.Int).Value = CveTipoCredito - .Add("@Opcion", SqlDbType.Int).Value = Opcion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de créditos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetCreditosVencimiento(CveEmpresa As Integer, Optional CveProveedor As Integer = -1, Optional CveUsuario As Integer = -1, Optional Programado As Integer = -1, Optional CveMoneda As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_CreditosVencimientosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@Programado", SqlDbType.Int).Value = Programado - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de créditos vencimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetCreditosVencimientoProveedor(CveEmpresa As Integer, Optional CveProveedor As Integer = -1, Optional Programado As Integer = 1, Optional CveMoneda As Integer = 1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_Creditos_Vw_VencimientosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@Programado", SqlDbType.Int).Value = Programado - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de créditos vencimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - 'Public Function GetCreditosDocumentosDetalle(CveCredito As Integer) As Boolean - ' Dim Retorno As Boolean = False - ' DataAdapter("PA_Banc_CreditosDocumentosDetalleGet") - - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("CveCredito", SqlDbType.Int).Value = CveCredito - ' End With - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al obtener el Catálogo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End Try - - ' Return Retorno - 'End Function - Public Function AddCreditos(CveTipoCredito As Integer, Referencia As String, Observaciones As String, CveCuenta As Integer, CveCompra As Integer, CveAF As Integer, CveMoneda As Integer, FechaInicio As Date, - FechaVencimiento As Date, Tasa As Double, SobreTasa As Double, PorcentajeIVA As Double, Plazo As Integer, CveIE As Integer, CreditoValor As Double, Comision As Double, Seguro As Double, - OtrosGastos As Double, CveProveedor As Integer, ClasificacionContable As Integer, IdCtaContable As Integer, CveUsuario As Integer, CveEmpresa As Integer, - Optional CveCuentaTarjeta As Integer = -1, Optional AplicaAnticipo As Boolean = False, Optional CreditoAnticipo As Double = 0.0, Optional ComisionAnticipo As Double = 0.0, Optional SeguroAnticipo As Double = 0.0, - Optional OtrosGastosAnticipo As Double = 0.0, Optional FondoGarantia As Double = 0.0, Optional SeguroValor As Double = 0.0, Optional TipoInteres As Boolean = False) As Integer - Dim Retorno = -1 - - DataAdapter("PA_Banc_CreditosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@PorIVA", SqlDbType.SmallMoney).Value = PorcentajeIVA - .Add("@Tasa", SqlDbType.Money).Value = Tasa - .Add("@SobreTasa", SqlDbType.Money).Value = SobreTasa - .Add("@Referencia", SqlDbType.VarChar).Value = Referencia - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@CveTipoCredito", SqlDbType.SmallInt).Value = CveTipoCredito - .Add("@Plazo", SqlDbType.SmallInt).Value = Plazo - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CreditoValor", SqlDbType.Money).Value = CreditoValor - .Add("@Comision", SqlDbType.Money).Value = Comision - .Add("@Seguro", SqlDbType.Money).Value = Seguro - .Add("@OtrosGastos", SqlDbType.Money).Value = OtrosGastos - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@ClasificacionContable", SqlDbType.Int).Value = ClasificacionContable - .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta - .Add("@AplicaAnticipo", SqlDbType.Bit).Value = AplicaAnticipo - .Add("@CreditoAnticipo", SqlDbType.Money).Value = CreditoAnticipo - .Add("@ComisionAnticipo", SqlDbType.Money).Value = ComisionAnticipo - .Add("@SeguroAnticipo", SqlDbType.Money).Value = SeguroAnticipo - .Add("@OtrosGastosAnticipo", SqlDbType.Money).Value = OtrosGastosAnticipo - .Add("@FondoGarantia", SqlDbType.Money).Value = FondoGarantia - .Add("@SeguroValor", SqlDbType.Money).Value = SeguroValor - .Add("@TipoInteres", SqlDbType.Bit).Value = TipoInteres - - .Add("@CveCredito", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - Retorno = SqlAdapter.SelectCommand.Parameters("@CveCredito").Value.ToString.ToEntero - CveCredito = Retorno - 'Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 2627;") Then - ' Alert("Ya existe un Registro con el mismo nombre: " & Escolaridad & ".", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al Guardar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el registro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateCreditos(CveCredito As Integer, CveTipoCredito As Integer, Referencia As String, Observaciones As String, CveCuenta As Integer, CveCompra As Integer, CveAF As Integer, CveMoneda As Integer, - FechaInicio As Date, FechaVencimiento As Date, Tasa As Double, SobreTasa As Double, PorcentajeIVA As Double, Plazo As Integer, CveIE As Integer, CreditoValor As Double, Comision As Double, - Seguro As Double, OtrosGastos As Double, CveProveedor As Integer, ClasificacionContable As Integer, IdCtaContable As Integer, CveUsuario As Integer, CveEmpresa As Integer, - Optional CveCuentaTarjeta As Integer = -1, Optional AplicaAnticipo As Boolean = False, Optional CreditoAnticipo As Double = 0.0, Optional ComisionAnticipo As Double = 0.0, Optional SeguroAnticipo As Double = 0.0, - Optional OtrosGastosAnticipo As Double = 0.0, Optional FondoGarantia As Double = 0.0, Optional SeguroValor As Double = 0.0, Optional TipoInteres As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@PorIVA", SqlDbType.SmallMoney).Value = PorcentajeIVA - .Add("@Tasa", SqlDbType.Money).Value = Tasa - .Add("@SobreTasa", SqlDbType.Money).Value = SobreTasa - .Add("@Referencia", SqlDbType.VarChar).Value = Referencia - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@CveTipoCredito", SqlDbType.SmallInt).Value = CveTipoCredito - .Add("@Plazo", SqlDbType.SmallInt).Value = Plazo - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CreditoValor", SqlDbType.Money).Value = CreditoValor - .Add("@Comision", SqlDbType.Money).Value = Comision - .Add("@Seguro", SqlDbType.Money).Value = Seguro - .Add("@OtrosGastos", SqlDbType.Money).Value = OtrosGastos - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@ClasificacionContable", SqlDbType.Int).Value = ClasificacionContable - .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta - .Add("@AplicaAnticipo", SqlDbType.Bit).Value = AplicaAnticipo - .Add("@CreditoAnticipo", SqlDbType.Money).Value = CreditoAnticipo - .Add("@ComisionAnticipo", SqlDbType.Money).Value = ComisionAnticipo - .Add("@SeguroAnticipo", SqlDbType.Money).Value = SeguroAnticipo - .Add("@OtrosGastosAnticipo", SqlDbType.Money).Value = OtrosGastosAnticipo - .Add("@FondoGarantia", SqlDbType.Money).Value = FondoGarantia - .Add("@SeguroValor", SqlDbType.Money).Value = SeguroValor - .Add("@TipoInteres", SqlDbType.Bit).Value = TipoInteres - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al Guardar el registro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateCreditosReferencia(CveCredito As Integer, Referencia As String, Plazo As Integer, FechaInicio As Date, FechaVencimiento As Date) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosReferenciaUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Referencia", SqlDbType.VarChar).Value = Referencia - .Add("@Plazo", SqlDbType.Int).Value = Plazo - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al Actualizar la referencia del Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateCreditosCompra(CveCredito As Integer, CveCompra As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosCompraUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al Actualizar la referencia de la compra del Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - - - Public Function UpdateCreditosPrePoliza(CveCredito As Integer, CvePrePoliza As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosPrePolizaUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al Actualizar la referencia de la PrePoliza del Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function RemoveCreditos(CveCredito As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveCredito", SqlDbType.Int).Value = CveCredito - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El registro no se pudo eliminar porque está siendo usado.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el registro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function CancelarCreditos(CveCredito As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosCancelar") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar/cancelar el Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function AplicarGarantiaCreditos(CveCreditoDetalle As Integer, Importe As Double) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosAplicarGarantia") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCreditoDetalle", SqlDbType.Int).Value = CveCreditoDetalle - .Add("@Importe", SqlDbType.Float).Value = Importe - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al aplicar el fondo de garantía al crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function -#End Region - -#Region "B A N C O S - C R E D I T O S - D E T A L L E S" - Public Function GetCreditosDetalle(CveCredito As Integer, Estatus As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_CreditosDetalleGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetCreditosCompra(CveCompra As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_CreditosCompra") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - - End Function - - Public Function GetCreditosDetalleCompras(CveEmpresa As Integer, CveProveedor As Integer, CveUsuario As Integer, Programado As Integer, CveMoneda As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_CreditosDetalleComprasGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@Programado", SqlDbType.Int).Value = Programado - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los créditos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetTarjetasCreditos(CveCuenta As Integer, Optional CveCuentaTarjeta As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_BancosCuentasTarjetasGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las Tarjetas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddCreditosDetalle(CveCredito As Integer, Fecha As Date, Capital As Double, Intereses As Double, Seguro As Double, IVACapital As Double, IVAIntereses As Double, IVASeguro As Double, Estatus As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosDetalleAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@Fecha", SqlDbType.Date).Value = Fecha - .Add("@Importe", SqlDbType.Money).Value = Importe - .Add("@Capital", SqlDbType.Money).Value = Capital - .Add("@Intereses", SqlDbType.Money).Value = Intereses - .Add("@Seguro", SqlDbType.Money).Value = Seguro - .Add("@IVACapital", SqlDbType.Money).Value = IVACapital - .Add("@IVAIntereses", SqlDbType.Money).Value = IVAIntereses - .Add("@IVASeguro", SqlDbType.Money).Value = IVASeguro - '.Add("@IVA", SqlDbType.Money).Value = Iva - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Registro con el mismo nombre: " & CveCredito & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el registro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateCreditosDetalle(CveCreditoDetalle As Integer, Fecha As Date, Capital As Double, Intereses As Double, Seguro As Double, IVACapital As Double, IVAIntereses As Double, IVASeguro As Double, - Estatus As Integer, Optional CveCompra As Integer = -1, Optional CveCompraInteres As Integer = -1, Optional importeCapital As Decimal = -1, Optional ImporteInteres As Decimal = -1) As Boolean - 'CveCompra:=CveCompraCapital, CveCompraInteres:=CveCompraInteres, importeCapital:=Capital, ImporteInteres:=Interes - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosDetalleUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCreditoDetalle", SqlDbType.Int).Value = CveCreditoDetalle - .Add("@Fecha", SqlDbType.Date).Value = Fecha - .Add("@Importe", SqlDbType.Money).Value = Importe - .Add("@Capital", SqlDbType.Money).Value = Capital - .Add("@Intereses", SqlDbType.Money).Value = Intereses - .Add("@Seguro", SqlDbType.Money).Value = Seguro - .Add("@IVACapital", SqlDbType.Money).Value = IVACapital - .Add("@IVAIntereses", SqlDbType.Money).Value = IVAIntereses - .Add("@IVASeguro", SqlDbType.Money).Value = IVASeguro - '.Add("@IVA", SqlDbType.Money).Value = Iva - .Add("@Estatus", SqlDbType.Int).Value = Estatus - - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveCompraInteres", SqlDbType.Int).Value = CveCompraInteres - - .Add("@ImporteCapital", SqlDbType.Money).Value = importeCapital - .Add("@ImporteInteres", SqlDbType.Money).Value = ImporteInteres - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Registro con el mismo nombre: " & CveCredito & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Actualizar el Detalle del Crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateCreditosDetalle(Estatus As Integer, CveCreditoDetalle As Integer) As Boolean - - Return UpdateCreditosDetalle(CveCreditoDetalle, "01/01/2000".ToDate, -1, -1, -1, -1, -1, -1, Estatus) - - End Function - - Public Function RemoveCreditosDetalle(CveCreditoDetalle As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosDetalleRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveCreditoDetalle", SqlDbType.Int).Value = CveCreditoDetalle - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El registro no se pudo eliminar porque está siendo usado.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el registro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function RemoveCreditosDetalleALL(CveCredito As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosDetalleALLRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveCredito", SqlDbType.Int).Value = CveCredito - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("Uno de los registrso no se pudo eliminar porque está siendo usado.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar un detalle del credito.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar un detalle del credito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - -#End Region - -#Region "B A N C O S - L I N E A S - C R E D I T O S" - Public Function GetLineasCreditos(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LineasCreditosGet") - - 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 el Catálogo de Lineas de Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region + Catch ex As Exception + OnError("Ocurrió un error al cancelar el movimiento en bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try -#Region "B A N C O S - P A G O - E L E C T R O N I C O" - Public Function GetLayoutPagos(CveCuenta As Integer, CveBLE As Integer, Tipo As String, Optional PorGrupos As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutPagos") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveBLE", SqlDbType.Int).Value = CveBLE - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de pagos electronicos (LayoutPagos).", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetLayoutPagosEnviados(CveCuenta As Integer, Estatus As Integer, Tipo As String, FechaI As String, FechaF As String, Optional PorGrupos As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutPagosEnviados") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de pagos electronicos (LayoutPagosEnviados).", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - - Public Function GetLayoutEnvios(CveCuenta As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutEnviosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de envios layout", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddLayoutEnvios(Archivo As String, Fecha As Date, CveCuenta As Integer, Optional PorGrupos As Boolean = False) As Integer - Dim Retorno = -1 - - DataAdapter("PA_Banc_LayoutEnviosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Archivo", SqlDbType.VarChar).Value = Archivo - .Add("@Fecha", SqlDbType.DateTime).Value = Fecha - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos - .Add("@CveLayoutEnvio", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - Retorno = SqlAdapter.SelectCommand.Parameters("@CveLayoutEnvio").Value.ToString.ToEntero - Catch ex As Exception - OnError("Ocurrió un error al agregar el LayoutEnvio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateLayoutEnvios(CveLayoutEnvio As Integer, Fecha As Date) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutEnviosUpdate") - - With SqlAdapter.SelectCommand.Parameters - '.Add("@Archivo", SqlDbType.VarChar).Value = Archivo - .Add("@Fecha", SqlDbType.DateTime).Value = Fecha - '.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveLayoutEnvio", SqlDbType.Int).Value = CveLayoutEnvio - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el LayoutEnvio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetLayoutEnviosDetalle(CveLayoutEnvio As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutEnviosDetalleGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveLayoutEnvio", SqlDbType.Int).Value = CveLayoutEnvio - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de envios detalle del layout", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddLayoutEnviosDetalle(CveLayoutEnvio As Integer, CveIE As Integer, CveProveedor As Integer, CvePersonal As Integer, Estatus As Integer, Observaciones As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutEnviosDetalleAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveLayoutEnvio", SqlDbType.Int).Value = CveLayoutEnvio - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@Estatus", SqlDbType.SmallInt).Value = Estatus - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el Detalle del LayoutEnvio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateLayoutEnviosDetalle(CveLayoutEnvioDetalle As Integer, CveLayoutEnvio As Integer, CveIE As Integer, CveProveedor As Integer, Estatus As Integer, Observaciones As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutEnviosDetalleUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveLayoutEnvio", SqlDbType.Int).Value = CveLayoutEnvio - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@Estatus", SqlDbType.SmallInt).Value = Estatus - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@CveLayoutEnvioDetalle", SqlDbType.Int).Value = CveLayoutEnvioDetalle - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el Detalle del LayoutEnvio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - 'ESTE SE PUEDE ELIMINAR YA NO SE USA - 'Public Function UpdateProveedorPagoElectronico(CveProveedor As Integer, CveEmpresa As Integer) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_Banc_LayoutProveedorUpdate") - - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - ' End With - - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al actualizar el estatus pago electronico del proveedor", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End Try - - ' Return Retorno - 'End Function - Public Function UpdateCuentaDepositoPagoElectronico(CveCuentaDeposito As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutCuentaDepositoUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el estatus pago electronico de la Cuenta Deposito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateIEPagoElectronico(CveIE As Integer, FechaMovto As Date, CveEmpresa As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutIEUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaMovto", SqlDbType.Date).Value = FechaMovto - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el estatus pago electronico del IE", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdatePagoElectronicoCarga(CveIE As Integer, Estatus As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutCargaUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el estatus de Layout Envios Detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdatePagoElectronicoIE() As Boolean - Dim Retorno As Boolean = False - - DataAdapter("Update Banc_IE SET ", CommandType.Text) - - With SqlAdapter.SelectCommand.Parameters - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al cargar el pago electronico", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetLayoutProveedores(CveCuenta As Integer, CveEmpresa As Integer, Optional PorGrupos As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutProveedores") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Proveedores para generar Layout.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetProveedorCuentaDeposito(CveCuentaDeposito As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutProveedorGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Proveedor de la cuenta deposito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetLayoutFyE(CveCuenta As Integer, CveEmpresa As Integer, Optional PorGrupos As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_LayoutFyE") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + Return Retorno + End Function + Public Function GetBancosSaldosPeriodo(CveCuenta As Integer, CveMoneda As Integer, FechaCorte As Date, Opcion As Integer, CveTipoCuenta As String, CveUsuario As Integer, CveEmpresa As Integer, TipoCambio As Integer, TCEspecifico As Double) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_SaldosPeriodoGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@FechaCorte", SqlDbType.Date).Value = FechaCorte + .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@CveTipoCuenta", SqlDbType.VarChar).Value = CveTipoCuenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al generar Layout de Funcionarios y Empleados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno + .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los saldos bancarios por periodo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno End Function -#End Region + Public Function GetBancosSaldos(CveBanco As Integer, CveCuenta As Integer, CveMoneda As Integer, FechaInicio As String, FechaFin As String, Opcion As Integer, CveTipoCuenta As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False -#Region "F L U C T U A C I O N E S" - Public Function GetFluctuacionesBitacora(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_FluctuacionesBitacoraGet") - - 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 la bitacora de Fluctuaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddFluctuacionesBitacora(IdPoliza As Integer, Fecha As Date, TipoFluctuacion As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_FluctuacionesBitacoraAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@IdPoliza", SqlDbType.VarChar).Value = IdPoliza - .Add("@Fecha", SqlDbType.DateTime).Value = Fecha - .Add("@TipoFluctuacion", SqlDbType.SmallInt).Value = TipoFluctuacion - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar a la bitacora de Fluctuaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetFluctuaciones(Fecha As Date, TipoFluctuacion As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Comp_FluctuacionesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Fecha", SqlDbType.Date).Value = Fecha - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@TipoFluctuacion", SqlDbType.SmallInt).Value = TipoFluctuacion - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener las Fluctuaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "B A N C O S - T A R J E T A S C R E D I T O S" - Public Function AddTarjetaCredito(CveCuenta As Integer, NumCuenta As String, Responsable As String, Vencimiento As Date, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CuentasTarjetaAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Numero", SqlDbType.VarChar).Value = NumCuenta - .Add("@Responsable", SqlDbType.VarChar).Value = Responsable - .Add("@Vencimiento", SqlDbType.Date).Value = Vencimiento - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - '.Add("@CveCuentaTarjeta", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un tarjeta con el mismo numero: " & Banco & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar tarjeta de Credito.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar la tarjeta de Credito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function GetTarjetaCredito(CveCuentaTarjeta As Integer, CveCuenta As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CuentasTarjetaGet") - - With SqlAdapter.SelectCommand.Parameters - '.Add("@Numero", SqlDbType.VarChar).Value = NumCuenta - '.Add("@Responsable", SqlDbType.VarChar).Value = Responsable - '.Add("@Vencimiento", SqlDbType.Date).Value = Vencimiento - '.Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - Me.OnError("Ocurrió un error al Obtener el catalogo de tarjetas de credito", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Catch ex As Exception - OnError("Ocurrió un error al Obtener el catalogo de tarjetas de Credito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function UpdateTarjetaCredito(CveCuentaTarjeta As Integer, CveCuenta As Integer, NumCuenta As String, Responsable As String, Vencimiento As Date, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CuentasTarjetaUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Numero", SqlDbType.VarChar).Value = NumCuenta - .Add("@Responsable", SqlDbType.VarChar).Value = Responsable - .Add("@Vencimiento", SqlDbType.Date).Value = Vencimiento - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - OnError("Ocurrió un error al actualizar los datos en la tarjeta de credito", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Catch ex As Exception - OnError("Ocurrió un error al actualizar los datos en la tarjeta de credito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - Public Function RemoveTarjetaCredito(CveCuentaTarjeta As Integer, CveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CuentasTarjetaRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - - Me.OnError("Ocurrió un error al eliminar la Tarjeta de credito.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar la Tarjeta de credito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno + DataAdapter("PA_Banc_SaldosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveBanco", SqlDbType.Int).Value = CveBanco + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@FechaI", SqlDbType.VarChar).Value = FechaInicio + .Add("@FechaF", SqlDbType.VarChar).Value = FechaFin + .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@CveTipoCuenta", SqlDbType.VarChar).Value = CveTipoCuenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .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 saldos bancarios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno End Function -#End Region + Public Function GetBancosSaldosDetalle(pCveBanco As Integer, pCveCuenta As Integer, CveMoneda As Integer, FechaInicio As String, FechaFin As String, Opcion As Integer, CveUsuario As Integer, pCveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False -#Region "PagosCajaChica" - Public Function GetPagosCajaChica(FechaI As String, FechaF As String, CveEmpresa As Integer, CveCuenta As Integer, Optional TipoPago As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_BancosCajaChicaPagosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@TipoChequeEfectivo", SqlDbType.Int).Value = TipoPago - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los pagos de Caja Chica", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno + DataAdapter("PA_Banc_SaldosDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveBanco", SqlDbType.Int).Value = pCveBanco + .Add("@CveCuenta", SqlDbType.Int).Value = pCveCuenta + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@FechaI", SqlDbType.VarChar).Value = FechaInicio + .Add("@FechaF", SqlDbType.VarChar).Value = FechaFin + .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa + End With + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los detalles de saldos bancarios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetConciliacionesReporte(pCveCuenta As Integer, FechaInicio As Date, FechaFin As Date, pCveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Bancos_ConciliacionesReporteGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = pCveCuenta + .Add("@FechaI", SqlDbType.Date).Value = FechaInicio + .Add("@FechaF", SqlDbType.Date).Value = FechaFin + .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa + .Add("@Conciliado", SqlDbType.Money).Direction = ParameterDirection.Output + .Add("@NoConciliado", SqlDbType.Money).Direction = ParameterDirection.Output + End With + Try + SqlAdapter.Fill(Data) + Conciliado = SqlAdapter.SelectCommand.Parameters("@Conciliado").Value.ToString.ToDouble + NoConciliado = SqlAdapter.SelectCommand.Parameters("@NoConciliado").Value.ToString.ToDouble + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de conciliaciones saldos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateComprobanteIE(ExtensionComprobante As String, CveIE As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_UpdateComprobanteIE") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Comprobante", SqlDbType.VarChar).Value = ExtensionComprobante + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el comprobante del IE", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetIngresoEgresosDelDia(Fecha As Date, Tipo As String, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IngresoEgresosDiariosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al cargar los ingresos/egresos diarios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function EliminarBancos_IEComprobacion(CveUsuario As Integer, CveIEDevolucion As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEEliminarComprobacion") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveIEDevolucion", SqlDbType.Int).Value = CveIEDevolucion + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los Movimientos Bancarios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function CancelarIEVenta(CveIE As Integer, CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_CancelarIEVenta") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al cancelar el ie de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function +#End Region + +#Region "B A N C O S - I E - N O T I F I C A C I O N E S" + Public Function GetBancosIENotificaciones(FechaInicio As Date, FechaFin As Date, CveTipoTransaccion As Integer, PagueseA As String, Correo As Integer, CveEstatusNotificacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IENotificacionesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@PagueseA", SqlDbType.VarChar).Value = PagueseA + .Add("@Correo", SqlDbType.Int).Value = Correo + .Add("@CveEstatusNotificacion", SqlDbType.Int).Value = CveEstatusNotificacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Notificaciones para los Ingresos y Egresos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno End Function -#End Region + Public Function UpdateBancos_IENotificaciones(CveEstatusNotificacion As Integer, FechaEntrega As String, ObservacionEntrega As String, CveIE As Integer) As Boolean -#Region "ACTIVOS FIJOS" - Public Function GetActivosFijosCreditos(CveCredito As Integer, CveActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosActivosFijosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los activos fijos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddActivosFijosCreditos(CveCredito As Integer, CveActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosActivosFijosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar los activos fijos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveActivosFijosCreditos(CveCredito As Integer, CveActivoFijo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosActivosFijosRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar los activos fijos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "ANTICIPOS" - Public Function GetAnticiposCreditos(CveCredito As Integer, CveIE As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosAnticiposGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los anticipos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddAnticiposCreditos(CveCredito As Integer, CveIE As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosAnticiposAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar los anticipos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveAnticiposCreditos(CveCredito As Integer, CveIE As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_CreditosAnticiposRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCredito", SqlDbType.Int).Value = CveCredito - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar los anticipos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region " COBRADO PAGADO " - Public Function GetCobradoPagado(Modalidad As Integer, Grupo As Integer, FechaInicio As Date, FechaFin As Date, CveProyecto As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_RepCobradoPagado") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Modalidad", SqlDbType.Int).Value = Modalidad - .Add("@GPO", SqlDbType.Int).Value = Grupo - .Add("@FechaI", SqlDbType.Date).Value = FechaInicio - .Add("@FechaF", SqlDbType.Date).Value = FechaFin - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio - .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de Cobrado Pagado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetCobradoPagadoDetalle(Modalidad As Integer, Grupo As Integer, FechaInicio As Date, FechaFin As Date, CveProyecto As Integer, CveSubProyecto As Integer, GPO As String, CveMoneda As Integer, CveEmpresa As Integer, Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_CobradoPagadoDetalle") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Modalidad", SqlDbType.Int).Value = Modalidad - .Add("@GPO", SqlDbType.Int).Value = Grupo - .Add("@FechaI", SqlDbType.Date).Value = FechaInicio - .Add("@FechaF", SqlDbType.Date).Value = FechaFin - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@Grupo", SqlDbType.VarChar).Value = GPO - .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de Cobrado Pagado Detallado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - -#Region "S A L D O S - - I M P U E S T O S " - Public Function GetSaldosFianzas(CveConceptoContable As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SaldoFianzaGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable - .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 Saldos de fianza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region " CLIENTES ANTICIPOS " - Public Function GetClienteAnticiposRep(CveCliente As Integer, TipoReporte As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Vta_ClienteAnticiposRep") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@TipoReporte", SqlDbType.Int).Value = TipoReporte - .Add("@FechaI", SqlDbType.Date).Value = FechaI - .Add("@FechaF", SqlDbType.Date).Value = FechaF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de Clientes Anticipos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "DEPOSITOS TERMINAL" - Public Function GetVentasTerminal(FechaI As String, FechaF As String, CveEmpresa As Integer, CveCuentaTerminal As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_VentasTerminalGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveCuentaTerminal", SqlDbType.Int).Value = CveCuentaTerminal - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los pagos de Caja Chica", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region " C O M P R O B A C I O N E S - R E P O R T E" - Public Function GetComprobacionesRep(CveCuenta As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_ComprobacionesRepGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de Comprobaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "V I A T I C O S" - Public Function GetConceptosViaticos(CveEmpresa As Integer, Estatus As Integer, Optional CveConceptoViatico As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_ConceptosViaticosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los Conceptos de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddConceptosViaticos(ConceptoViatico As String, Estatus As Boolean, CveUsuarioIng As Integer, FechaIng As DateTime, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_ConceptosViaticosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@ConceptoViatico", SqlDbType.VarChar).Value = ConceptoViatico - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - .Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng - .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el Concepto de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateConceptosViaticos(CveConceptoViatico As Integer, ConceptoViatico As String, Estatus As Boolean) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_ConceptosViaticosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico - .Add("@ConceptoViatico", SqlDbType.VarChar).Value = ConceptoViatico - .Add("@Estatus", SqlDbType.Bit).Value = Estatus - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el Concepto de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveConceptosViaticos(CveConceptoViatico As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_ConceptosViaticosRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el Concepto de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetSolicitudesViaticos(CveSolicitudViatico As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CvePersonal As Integer = -1, Optional Destino As String = "-1", - Optional FechaSalida As String = "-1", Optional FechaRegreso As String = "-1", Optional FechaIngInicio As String = "-1", Optional FechaIngFin As String = "-1", - Optional CveUsuarioIng As Integer = -1, Optional Folio As String = "-1", Optional CveDepartamento As Integer = -1, Optional CveIE As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SolicitudViaticosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CveDepartamento", SqlDbType.Int).Value = CveDepartamento - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@Destino", SqlDbType.VarChar).Value = Destino - - .Add("@FechaSalida", SqlDbType.VarChar).Value = FechaSalida - .Add("@FechaRegreso", SqlDbType.VarChar).Value = FechaRegreso - - .Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng - .Add("@FechaIngInicio", SqlDbType.VarChar).Value = FechaIngInicio - .Add("@FechaIngFin", SqlDbType.VarChar).Value = FechaIngFin - - .Add("@Folio", SqlDbType.VarChar).Value = Folio - .Add("@CveIE", SqlDbType.Int).Value = CveIE - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddSolicitudesViaticos(Folio As String, Estatus As Integer, CvePersonal As Integer, Destino As String, Asunto As String, FechaSalida As String, FechaRegreso As String, FechaIng As DateTime, - CveUsuarioIng As Integer, CveEmpresa As Integer, Optional TipoCarro As String = "-1", Optional KM As String = "-1") As Integer - Dim Retorno As Integer = -1 - - DataAdapter("PA_Banc_SolicitudViaticosAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Folio", SqlDbType.VarChar).Value = Folio - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@Destino", SqlDbType.VarChar).Value = Destino - .Add("@Asunto", SqlDbType.VarChar).Value = Asunto - - .Add("@FechaSalida", SqlDbType.VarChar).Value = FechaSalida - .Add("@FechaRegreso", SqlDbType.VarChar).Value = FechaRegreso - - .Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng - .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@TipoCarro", SqlDbType.VarChar).Value = TipoCarro - .Add("@KM", SqlDbType.VarChar).Value = KM - - .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue - End With - - Try - SqlAdapter.Fill(Data) - Retorno = SqlAdapter.SelectCommand.Parameters("@RETURN_VALUE").Value.ToString.ToEntero - Catch ex As Exception - OnError("Ocurrió un error al agregar la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateSolicitudesViaticos(CveSolicitudViatico As Integer, Estatus As Integer, Destino As String, Asunto As String, FechaSalida As String, FechaRegreso As String, Optional Observaciones As String = "-1", - Optional TipoCarro As String = "-1", Optional KM As String = "-1") As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SolicitudViaticosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico - .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@Destino", SqlDbType.VarChar).Value = Destino - .Add("@Asunto", SqlDbType.VarChar).Value = Asunto - - .Add("@FechaSalida", SqlDbType.VarChar).Value = FechaSalida - .Add("@FechaRegreso", SqlDbType.VarChar).Value = FechaRegreso - - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@TipoCarro", SqlDbType.VarChar).Value = TipoCarro - .Add("@KM", SqlDbType.VarChar).Value = KM - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateSolicitudesViaticosIE(CveSolicitudViatico As Integer, CveIE As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SolicitudViaticosIEUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico - .Add("@CveIE", SqlDbType.Int).Value = CveIE - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el IE en la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveSolicitudesViaticos(CveSolicitudViatico As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SolicitudViaticosRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetNextFolioSolicitudViaticos(CveEmpresa As Integer, Serie As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SolicitudViaticosNextFolioGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Serie", SqlDbType.VarChar).Value = Serie - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al generar el Folio de la Solicitud de Viáticos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetSolicitudesViaticosDetalle(CveSolicitudViaticos As Integer, CveSolicitudViaticosDetalle As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SolicitudViaticosDetalleGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSolicitudViaticos", SqlDbType.Int).Value = CveSolicitudViaticos - .Add("@CveSolicitudViaticosDetalle", SqlDbType.Int).Value = CveSolicitudViaticosDetalle - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los Detalles de la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddSolicitudesViaticosDetalle(CveSolicitudViaticos As Integer, CveConceptoViatico As Integer, Importe As Double) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SolicitudViaticosDetalleAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViaticos - .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico - .Add("@Importe", SqlDbType.Money).Value = Importe - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el Detalle de la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateSolicitudesViaticosDetalle(CveSolicitudViaticosDetalle As Integer, CveConceptoViatico As Integer, Importe As Double) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SolicitudViaticosDetalleUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSolicitudViaticosDetalle", SqlDbType.Int).Value = CveSolicitudViaticosDetalle - .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico - .Add("@Importe", SqlDbType.Money).Value = Importe - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el Detalle de la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveSolicitudesViaticosDetalle(CveSolicitudViaticoDetalle As Integer, CveSolicitudViatico As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_SolicitudViaticosDetalleRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSolicitudViaticoDetalle", SqlDbType.Int).Value = CveSolicitudViaticoDetalle - .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el Detalle de la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "CONCILIACIÓN BANCARIA" - - Public Function UpdateConciliacionBancaria(CveIE As Integer, FechaAplicado As Date) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_ConciliacionBancariaUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@FechaAplicado", SqlDbType.Date).Value = FechaAplicado - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al conciliar los movimientos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function AddIEEstadoCuenta(Referencia As String, FechaDocumento As Date, Importe As Double, CveCuenta As Integer, - CveUsuario As Integer, CveEmpresa As Integer, Tipo As String) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEEstadoCuentaAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@Referencia", SqlDbType.VarChar).Value = Referencia - .Add("@FechaDocumento", SqlDbType.Date).Value = FechaDocumento - .Add("@Importe", SqlDbType.Float).Value = Importe - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - Public Function UpdateIEEstadoCuenta(CveIEEstadoCuenta As Integer, Importe As Double, FueConciliado As Boolean, CveIE As Integer, - Referencia As String, Tipo As String, FechaDocumento As Date, CveCuenta As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEEstadoCuentaUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIEEstadoCuenta", SqlDbType.Int).Value = CveIEEstadoCuenta - .Add("@Importe", SqlDbType.Float).Value = Importe - .Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@Referencia", SqlDbType.VarChar).Value = Referencia - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - .Add("@FechaDocumento", SqlDbType.Date).Value = FechaDocumento - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function GetIEEstadoCuenta(CveIEEstadoCuenta As Integer, FechaI As Date, FechaF As Date, FueConciliado As Integer, - CveCuenta As Integer, CveEmpresa As Integer, Optional VerDuplicados As Boolean = False, - Optional Tipo As Integer = 1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEEstadoCuentaGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIEEstadoCuenta", SqlDbType.Int).Value = CveIEEstadoCuenta - .Add("@FechaI", SqlDbType.Date).Value = FechaI - .Add("@FechaF", SqlDbType.Date).Value = FechaF - .Add("@FueConciliado", SqlDbType.Int).Value = FueConciliado - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@VerDuplicados", SqlDbType.Bit).Value = VerDuplicados - .Add("@Tipo", SqlDbType.Int).Value = Tipo - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function RemoveIEEstadoCuenta(CveIEEstadoCuenta As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEEstadoCuentaRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIEEstadoCuenta", SqlDbType.Int).Value = CveIEEstadoCuenta - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function DesconciliarIE(CveIE As Integer, FechaDesconciliado As Date) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEDesconciliar") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@FechaDesconciliado", SqlDbType.Date).Value = FechaDesconciliado - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al desconciliar el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - Public Function GetIEConciliacion(CveIE As Integer, FechaI As Date, FechaF As Date, FueConciliado As Integer, - CveCuenta As Integer, CveEmpresa As Integer, VerDuplicados As Boolean) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_IEGetConciliacion") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@FechaI", SqlDbType.Date).Value = FechaI - .Add("@FechaF", SqlDbType.Date).Value = FechaF - .Add("@FueConciliado", SqlDbType.Int).Value = FueConciliado - .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@VerDuplicados", SqlDbType.Bit).Value = VerDuplicados - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - - - -#End Region - - -#Region "IDisposable Support" - - - ' IDisposable - Protected Overridable Sub Dispose(disposing As Boolean) - If Not Me.disposedValue Then - If disposing Then - ' TODO: dispose managed state (managed objects). - If Not Data Is Nothing Then Data.Dispose() - If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() - If Not SqlCommand Is Nothing Then SqlCommand.Dispose() - If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() - If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() - If Not SqlConexion Is Nothing Then SqlConexion.Dispose() - End If - - ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below. - ' TODO: set large fields to null. - End If - Me.disposedValue = True - End Sub - - ' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources. - 'Protected Overrides Sub Finalize() - ' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. - ' Dispose(False) - ' MyBase.Finalize() - 'End Sub - - ' This code added by Visual Basic to correctly implement the disposable pattern. + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IENotificaciones") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusNotificacion", SqlDbType.Int).Value = CveEstatusNotificacion + .Add("@FechaEntrega", SqlDbType.VarChar).Value = FechaEntrega + .Add("@ObservacionEntrega", SqlDbType.VarChar).Value = ObservacionEntrega + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar el Estatus de Notificacion del IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + +#Region " B A N C O S - E S T A T U S - I E " + + Public Function GetBancos_EstatusIE() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_EstatusIEGet") + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar los Estatus de Ingresos y Egresos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddBancos_EstatusIE(CveEstatusIE As Integer, EstatusIE As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_EstatusIEAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE + .Add("@EstatusIE", SqlDbType.VarChar).Value = EstatusIE + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Banco con el mismo nombre: " & EstatusIE & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el EstatusIE.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el EstatusIE", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateBancos_EstatusIE(EstatusIE As String, Estatus As Boolean, CveEstatusIE As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_EstatusIEUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@EstatusIE", SqlDbType.VarChar).Value = EstatusIE + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Banco con el mismo nombre: " & EstatusIE & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el EstatusIE", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el EstatusIE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveBancos_EstatusIE(CveEstatusIE As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_EstatusIERemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveEstatusIE", SqlDbType.Int).Value = CveEstatusIE + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Estatus de Ingresos y Egresos no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Estatus de Ingresos y Egresos.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Estatus de Ingresos y Egresos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region " B A N C O S - T I P O S - T R A N S A C C I O N E S " + + Public Function GetBancos_TiposTransaccion(Optional Estatus As Integer = 1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_TiposTransaccionGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar los Bancos - Tipos de Transacción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddBancos_TiposTransaccion(CveTipoTransaccion As Integer, TipoTransaccion As String, Tipo As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_TiposTransaccionAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@TipoTransaccion", SqlDbType.VarChar).Value = TipoTransaccion + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Tipo de Transacción con el mismo nombre: " & TipoTransaccion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Tipo de Transacción.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el Tipo de Transacción", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateBancos_TiposTransaccion(TipoTransaccion As String, Tipo As String, Estatus As Boolean, CveTipoTransaccion As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_TiposTransaccionUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoTransaccion", SqlDbType.VarChar).Value = TipoTransaccion + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Tipo de Transacci´ón con el mismo nombre: " & TipoTransaccion & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Tipo de Transacción", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Tipo de Transacción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveBancos_TiposTransaccion(CveTipoTransaccion As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_TiposTransaccionRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Tipo de Transacción no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Tipo de Transacción.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Tipo de Transacción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateIEPrePoliza(FechaConta As Date, NumeroPoliza As String, IdPoliza As Integer, CvePrePoliza As Integer, CveIE As Integer, CveCompra As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IEPrePolizaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaConta", SqlDbType.Date).Value = FechaConta + .Add("@NumeroPoliza", SqlDbType.VarChar).Value = NumeroPoliza + .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar poliza del movimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCompraPrePoliza(FechaConta As Date, NumeroPoliza As String, IdPoliza As Integer, CveCompra As Integer, Optional CvePlantillaPoliza As Integer = 2) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CompraPrePolizaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaConta", SqlDbType.Date).Value = FechaConta + .Add("@NumeroPoliza", SqlDbType.VarChar).Value = NumeroPoliza + .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza + .Add("@CvePlantillaPoliza", SqlDbType.Int).Value = CvePlantillaPoliza + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@Retorno", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = If(SqlAdapter.SelectCommand.Parameters("@Retorno").Value.ToString.ToEntero = 0, True, False) + + Catch ex As Exception + OnError("Ocurrió un error al actualizar poliza de la compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdatePrePoliza(FechaConta As Date, NumeroPoliza As String, IdPoliza As Integer, CvePrePoliza As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_PrePolizaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaConta", SqlDbType.Date).Value = FechaConta + .Add("@NumeroPoliza", SqlDbType.VarChar).Value = NumeroPoliza + .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar póliza en prepóliza.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + +#End Region + +#Region " B A N C O S - T I P O S - C U E N T A S " + Public Function GetBancos_TiposCuenta() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_TiposCuentaGet") + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al consultar los Tipos de Cuentas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddBancos_TiposCuenta(TipoCuenta As String, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_TiposCuentaAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoCuenta", SqlDbType.VarChar).Value = TipoCuenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Tipo de Cuenta con el mismo nombre: " & TipoCuenta & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Tipo de Cuenta.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el Tipo de Cuenta", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateBancos_TiposCuenta(TipoCuenta As String, Estatus As Boolean, CveTipoCuenta As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_TiposCuentaUpdate") + + + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoCuenta", SqlDbType.VarChar).Value = TipoCuenta + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveTipoCuenta", SqlDbType.Int).Value = CveTipoCuenta + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Tipo de Cuenta con el mismo nombre: " & TipoCuenta & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Tipo de Cuenta ", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Tipo de Cuenta .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveBancos_TiposCuenta(CveTipoCuenta As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_TiposCuentaRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveTipoCuenta", SqlDbType.Int).Value = CveTipoCuenta + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Tipo de Cuenta no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Tipo de Cuenta.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Tipo de Cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + + +#Region "B A N C O S - C R E D I T O S" + Public Function GetCreditos(CveCredito As Integer, CveCompra As Integer, CveCuenta As Integer, CveProveedor As Integer, CveTipoCredito As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_CreditosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveTipoCredito", SqlDbType.Int).Value = CveTipoCredito + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + If Data.Rows.Count > 0 Then + _CveCredito = Data.Rows(0)("CveCredito").ToString.ToEntero + _CveCuentaCredito = Data.Rows(0)("CveCuenta").ToString.ToEntero + _CveCompra = Data.Rows(0)("CveCompra").ToString.ToEntero + _CveAF = Data.Rows(0)("CveAF").ToString.ToEntero + _FechaVencimiento = Data.Rows(0)("FechaVencimiento").ToString.ToDate + _Tasa = Data.Rows(0)("Tasa").ToString.ToDouble + _SobreTasa = Data.Rows(0)("SobreTasa").ToString.ToDouble + _Referencia = Data.Rows(0)("Referencia").ToString + _TipoCredito = Data.Rows(0)("CveTipoCredito").ToString.ToEntero + _Plazo = Data.Rows(0)("Plazo").ToString.ToEntero + ' _ImporteCredito = Data.Rows(0)("Importe").ToString.ToDouble + _CveIECredito = Data.Rows(0)("CveIE").ToString.ToEntero + _Proveedor = Data.Rows(0)("Proveedor").ToString + _CveProveedor = Data.Rows(0)("CveProveedor").ToString.ToEntero + _CveTipoCredito = Data.Rows(0)("CveTipoCredito").ToString.ToEntero + CveCompraFactura = Data.Rows(0)("CveCompraFactura").ToString.ToEntero + FacturaProveedor = Data.Rows(0)("FacturaProveedor").ToString + FacturaSerieFolio = Data.Rows(0)("FacturaSerieFolio").ToString + FacturaDescripcion = Data.Rows(0)("FacturaDescripcion").ToString + FacturaFecha = Data.Rows(0)("FacturaFecha").ToString.ToDate + CreditoValor = Data.Rows(0)("CreditoValor").ToString.ToDouble + TotalFinanciado = Data.Rows(0)("TotalFinanciado").ToString.ToDouble + CvePrePoliza = Data.Rows(0)("CvePrePoliza").ToString.ToEntero + End If + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetCreditosRep(CveTipoCredito As Integer, Opcion As Integer, CveEmpresa As Integer, Optional FechaI As String = "-1", Optional FechaF As String = "-1", Optional Estatus As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_CreditosRep") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoCredito", SqlDbType.Int).Value = CveTipoCredito + .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de créditos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetCreditosVencimiento(CveEmpresa As Integer, Optional CveProveedor As Integer = -1, Optional CveUsuario As Integer = -1, Optional Programado As Integer = -1, Optional CveMoneda As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_CreditosVencimientosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Programado", SqlDbType.Int).Value = Programado + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de créditos vencimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetCreditosVencimientoProveedor(CveEmpresa As Integer, Optional CveProveedor As Integer = -1, Optional Programado As Integer = 1, Optional CveMoneda As Integer = 1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_Creditos_Vw_VencimientosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@Programado", SqlDbType.Int).Value = Programado + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de créditos vencimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + 'Public Function GetCreditosDocumentosDetalle(CveCredito As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter("PA_Banc_CreditosDocumentosDetalleGet") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("CveCredito", SqlDbType.Int).Value = CveCredito + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener el Catálogo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function + Public Function AddCreditos(CveTipoCredito As Integer, Referencia As String, Observaciones As String, CveCuenta As Integer, CveCompra As Integer, CveAF As Integer, CveMoneda As Integer, FechaInicio As Date, + FechaVencimiento As Date, Tasa As Double, SobreTasa As Double, PorcentajeIVA As Double, Plazo As Integer, CveIE As Integer, CreditoValor As Double, Comision As Double, Seguro As Double, + OtrosGastos As Double, CveProveedor As Integer, ClasificacionContable As Integer, IdCtaContable As Integer, CveUsuario As Integer, CveEmpresa As Integer, + Optional CveCuentaTarjeta As Integer = -1, Optional AplicaAnticipo As Boolean = False, Optional CreditoAnticipo As Double = 0.0, Optional ComisionAnticipo As Double = 0.0, Optional SeguroAnticipo As Double = 0.0, + Optional OtrosGastosAnticipo As Double = 0.0, Optional FondoGarantia As Double = 0.0, Optional SeguroValor As Double = 0.0, Optional TipoInteres As Boolean = False) As Integer + Dim Retorno = -1 + + DataAdapter("PA_Banc_CreditosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@PorIVA", SqlDbType.SmallMoney).Value = PorcentajeIVA + .Add("@Tasa", SqlDbType.Money).Value = Tasa + .Add("@SobreTasa", SqlDbType.Money).Value = SobreTasa + .Add("@Referencia", SqlDbType.VarChar).Value = Referencia + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@CveTipoCredito", SqlDbType.SmallInt).Value = CveTipoCredito + .Add("@Plazo", SqlDbType.SmallInt).Value = Plazo + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CreditoValor", SqlDbType.Money).Value = CreditoValor + .Add("@Comision", SqlDbType.Money).Value = Comision + .Add("@Seguro", SqlDbType.Money).Value = Seguro + .Add("@OtrosGastos", SqlDbType.Money).Value = OtrosGastos + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@ClasificacionContable", SqlDbType.Int).Value = ClasificacionContable + .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta + .Add("@AplicaAnticipo", SqlDbType.Bit).Value = AplicaAnticipo + .Add("@CreditoAnticipo", SqlDbType.Money).Value = CreditoAnticipo + .Add("@ComisionAnticipo", SqlDbType.Money).Value = ComisionAnticipo + .Add("@SeguroAnticipo", SqlDbType.Money).Value = SeguroAnticipo + .Add("@OtrosGastosAnticipo", SqlDbType.Money).Value = OtrosGastosAnticipo + .Add("@FondoGarantia", SqlDbType.Money).Value = FondoGarantia + .Add("@SeguroValor", SqlDbType.Money).Value = SeguroValor + .Add("@TipoInteres", SqlDbType.Bit).Value = TipoInteres + + .Add("@CveCredito", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CveCredito").Value.ToString.ToEntero + CveCredito = Retorno + 'Catch Ex1 As SqlException + ' If Ex1.Message.Contains("Número: 2627;") Then + ' Alert("Ya existe un Registro con el mismo nombre: " & Escolaridad & ".", TipoMensaje.MsgAdvertencia) + ' Else + ' Me.OnError("Ocurrió un error al Guardar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el registro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateCreditos(CveCredito As Integer, CveTipoCredito As Integer, Referencia As String, Observaciones As String, CveCuenta As Integer, CveCompra As Integer, CveAF As Integer, CveMoneda As Integer, + FechaInicio As Date, FechaVencimiento As Date, Tasa As Double, SobreTasa As Double, PorcentajeIVA As Double, Plazo As Integer, CveIE As Integer, CreditoValor As Double, Comision As Double, + Seguro As Double, OtrosGastos As Double, CveProveedor As Integer, ClasificacionContable As Integer, IdCtaContable As Integer, CveUsuario As Integer, CveEmpresa As Integer, + Optional CveCuentaTarjeta As Integer = -1, Optional AplicaAnticipo As Boolean = False, Optional CreditoAnticipo As Double = 0.0, Optional ComisionAnticipo As Double = 0.0, Optional SeguroAnticipo As Double = 0.0, + Optional OtrosGastosAnticipo As Double = 0.0, Optional FondoGarantia As Double = 0.0, Optional SeguroValor As Double = 0.0, Optional TipoInteres As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@PorIVA", SqlDbType.SmallMoney).Value = PorcentajeIVA + .Add("@Tasa", SqlDbType.Money).Value = Tasa + .Add("@SobreTasa", SqlDbType.Money).Value = SobreTasa + .Add("@Referencia", SqlDbType.VarChar).Value = Referencia + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@CveTipoCredito", SqlDbType.SmallInt).Value = CveTipoCredito + .Add("@Plazo", SqlDbType.SmallInt).Value = Plazo + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CreditoValor", SqlDbType.Money).Value = CreditoValor + .Add("@Comision", SqlDbType.Money).Value = Comision + .Add("@Seguro", SqlDbType.Money).Value = Seguro + .Add("@OtrosGastos", SqlDbType.Money).Value = OtrosGastos + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@ClasificacionContable", SqlDbType.Int).Value = ClasificacionContable + .Add("@IdCtaContable", SqlDbType.Int).Value = IdCtaContable + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta + .Add("@AplicaAnticipo", SqlDbType.Bit).Value = AplicaAnticipo + .Add("@CreditoAnticipo", SqlDbType.Money).Value = CreditoAnticipo + .Add("@ComisionAnticipo", SqlDbType.Money).Value = ComisionAnticipo + .Add("@SeguroAnticipo", SqlDbType.Money).Value = SeguroAnticipo + .Add("@OtrosGastosAnticipo", SqlDbType.Money).Value = OtrosGastosAnticipo + .Add("@FondoGarantia", SqlDbType.Money).Value = FondoGarantia + .Add("@SeguroValor", SqlDbType.Money).Value = SeguroValor + .Add("@TipoInteres", SqlDbType.Bit).Value = TipoInteres + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Guardar el registro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCreditosReferencia(CveCredito As Integer, Referencia As String, Plazo As Integer, FechaInicio As Date, FechaVencimiento As Date) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosReferenciaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Referencia", SqlDbType.VarChar).Value = Referencia + .Add("@Plazo", SqlDbType.Int).Value = Plazo + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Actualizar la referencia del Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCreditosCompra(CveCredito As Integer, CveCompra As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosCompraUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Actualizar la referencia de la compra del Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + + Public Function UpdateCreditosPrePoliza(CveCredito As Integer, CvePrePoliza As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosPrePolizaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Actualizar la referencia de la PrePoliza del Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function RemoveCreditos(CveCredito As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCredito", SqlDbType.Int).Value = CveCredito + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El registro no se pudo eliminar porque está siendo usado.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el registro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function CancelarCreditos(CveCredito As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosCancelar") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar/cancelar el Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AplicarGarantiaCreditos(CveCreditoDetalle As Integer, Importe As Double) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosAplicarGarantia") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCreditoDetalle", SqlDbType.Int).Value = CveCreditoDetalle + .Add("@Importe", SqlDbType.Float).Value = Importe + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al aplicar el fondo de garantía al crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +#End Region + +#Region "B A N C O S - C R E D I T O S - D E T A L L E S" + Public Function GetCreditosDetalle(CveCredito As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_CreditosDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetCreditosCompra(CveCompra As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_CreditosCompra") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + + End Function + + Public Function GetCreditosDetalleCompras(CveEmpresa As Integer, CveProveedor As Integer, CveUsuario As Integer, Programado As Integer, CveMoneda As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_CreditosDetalleComprasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Programado", SqlDbType.Int).Value = Programado + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los créditos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetTarjetasCreditos(CveCuenta As Integer, Optional CveCuentaTarjeta As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_BancosCuentasTarjetasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Tarjetas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddCreditosDetalle(CveCredito As Integer, Fecha As Date, Capital As Double, Intereses As Double, Seguro As Double, IVACapital As Double, IVAIntereses As Double, IVASeguro As Double, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosDetalleAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@Capital", SqlDbType.Money).Value = Capital + .Add("@Intereses", SqlDbType.Money).Value = Intereses + .Add("@Seguro", SqlDbType.Money).Value = Seguro + .Add("@IVACapital", SqlDbType.Money).Value = IVACapital + .Add("@IVAIntereses", SqlDbType.Money).Value = IVAIntereses + .Add("@IVASeguro", SqlDbType.Money).Value = IVASeguro + '.Add("@IVA", SqlDbType.Money).Value = Iva + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Registro con el mismo nombre: " & CveCredito & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el registro", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateCreditosDetalle(CveCreditoDetalle As Integer, Fecha As Date, Capital As Double, Intereses As Double, Seguro As Double, IVACapital As Double, IVAIntereses As Double, IVASeguro As Double, + Estatus As Integer, Optional CveCompra As Integer = -1, Optional CveCompraInteres As Integer = -1, Optional importeCapital As Decimal = -1, Optional ImporteInteres As Decimal = -1) As Boolean + 'CveCompra:=CveCompraCapital, CveCompraInteres:=CveCompraInteres, importeCapital:=Capital, ImporteInteres:=Interes + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosDetalleUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCreditoDetalle", SqlDbType.Int).Value = CveCreditoDetalle + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@Capital", SqlDbType.Money).Value = Capital + .Add("@Intereses", SqlDbType.Money).Value = Intereses + .Add("@Seguro", SqlDbType.Money).Value = Seguro + .Add("@IVACapital", SqlDbType.Money).Value = IVACapital + .Add("@IVAIntereses", SqlDbType.Money).Value = IVAIntereses + .Add("@IVASeguro", SqlDbType.Money).Value = IVASeguro + '.Add("@IVA", SqlDbType.Money).Value = Iva + .Add("@Estatus", SqlDbType.Int).Value = Estatus + + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveCompraInteres", SqlDbType.Int).Value = CveCompraInteres + + .Add("@ImporteCapital", SqlDbType.Money).Value = importeCapital + .Add("@ImporteInteres", SqlDbType.Money).Value = ImporteInteres + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Registro con el mismo nombre: " & CveCredito & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Actualizar el Detalle del Crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCreditosDetalle(Estatus As Integer, CveCreditoDetalle As Integer) As Boolean + + Return UpdateCreditosDetalle(CveCreditoDetalle, "01/01/2000".ToDate, -1, -1, -1, -1, -1, -1, Estatus) + + End Function + + Public Function RemoveCreditosDetalle(CveCreditoDetalle As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosDetalleRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCreditoDetalle", SqlDbType.Int).Value = CveCreditoDetalle + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El registro no se pudo eliminar porque está siendo usado.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el registro.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el registro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveCreditosDetalleALL(CveCredito As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosDetalleALLRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveCredito", SqlDbType.Int).Value = CveCredito + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("Uno de los registrso no se pudo eliminar porque está siendo usado.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar un detalle del credito.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar un detalle del credito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + +#End Region + +#Region "B A N C O S - L I N E A S - C R E D I T O S" + Public Function GetLineasCreditos(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LineasCreditosGet") + + 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 el Catálogo de Lineas de Crédito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "B A N C O S - P A G O - E L E C T R O N I C O" + Public Function GetLayoutPagos(CveCuenta As Integer, CveBLE As Integer, Tipo As String, Optional PorGrupos As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutPagos") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveBLE", SqlDbType.Int).Value = CveBLE + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de pagos electronicos (LayoutPagos).", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetLayoutPagosEnviados(CveCuenta As Integer, Estatus As Integer, Tipo As String, FechaI As String, FechaF As String, Optional PorGrupos As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutPagosEnviados") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de pagos electronicos (LayoutPagosEnviados).", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + Public Function GetLayoutEnvios(CveCuenta As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutEnviosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de envios layout", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddLayoutEnvios(Archivo As String, Fecha As Date, CveCuenta As Integer, Optional PorGrupos As Boolean = False) As Integer + Dim Retorno = -1 + + DataAdapter("PA_Banc_LayoutEnviosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Archivo", SqlDbType.VarChar).Value = Archivo + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos + .Add("@CveLayoutEnvio", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CveLayoutEnvio").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error al agregar el LayoutEnvio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateLayoutEnvios(CveLayoutEnvio As Integer, Fecha As Date) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutEnviosUpdate") + + With SqlAdapter.SelectCommand.Parameters + '.Add("@Archivo", SqlDbType.VarChar).Value = Archivo + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha + '.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveLayoutEnvio", SqlDbType.Int).Value = CveLayoutEnvio + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el LayoutEnvio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetLayoutEnviosDetalle(CveLayoutEnvio As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutEnviosDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveLayoutEnvio", SqlDbType.Int).Value = CveLayoutEnvio + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de envios detalle del layout", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddLayoutEnviosDetalle(CveLayoutEnvio As Integer, CveIE As Integer, CveProveedor As Integer, CvePersonal As Integer, Estatus As Integer, Observaciones As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutEnviosDetalleAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveLayoutEnvio", SqlDbType.Int).Value = CveLayoutEnvio + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@Estatus", SqlDbType.SmallInt).Value = Estatus + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Detalle del LayoutEnvio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateLayoutEnviosDetalle(CveLayoutEnvioDetalle As Integer, CveLayoutEnvio As Integer, CveIE As Integer, CveProveedor As Integer, Estatus As Integer, Observaciones As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutEnviosDetalleUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveLayoutEnvio", SqlDbType.Int).Value = CveLayoutEnvio + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@Estatus", SqlDbType.SmallInt).Value = Estatus + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@CveLayoutEnvioDetalle", SqlDbType.Int).Value = CveLayoutEnvioDetalle + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Detalle del LayoutEnvio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + 'ESTE SE PUEDE ELIMINAR YA NO SE USA + 'Public Function UpdateProveedorPagoElectronico(CveProveedor As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_Banc_LayoutProveedorUpdate") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al actualizar el estatus pago electronico del proveedor", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function + Public Function UpdateCuentaDepositoPagoElectronico(CveCuentaDeposito As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutCuentaDepositoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estatus pago electronico de la Cuenta Deposito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateIEPagoElectronico(CveIE As Integer, FechaMovto As Date, CveEmpresa As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutIEUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaMovto", SqlDbType.Date).Value = FechaMovto + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estatus pago electronico del IE", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdatePagoElectronicoCarga(CveIE As Integer, Estatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutCargaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estatus de Layout Envios Detalle", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdatePagoElectronicoIE() As Boolean + Dim Retorno As Boolean = False + + DataAdapter("Update Banc_IE SET ", CommandType.Text) + + With SqlAdapter.SelectCommand.Parameters + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al cargar el pago electronico", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetLayoutProveedores(CveCuenta As Integer, CveEmpresa As Integer, Optional PorGrupos As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutProveedores") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Proveedores para generar Layout.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetProveedorCuentaDeposito(CveCuentaDeposito As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutProveedorGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuentaDeposito", SqlDbType.Int).Value = CveCuentaDeposito + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Proveedor de la cuenta deposito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetLayoutFyE(CveCuenta As Integer, CveEmpresa As Integer, Optional PorGrupos As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_LayoutFyE") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al generar Layout de Funcionarios y Empleados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "F L U C T U A C I O N E S" + Public Function GetFluctuacionesBitacora(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_FluctuacionesBitacoraGet") + + 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 la bitacora de Fluctuaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddFluctuacionesBitacora(IdPoliza As Integer, Fecha As Date, TipoFluctuacion As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_FluctuacionesBitacoraAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@IdPoliza", SqlDbType.VarChar).Value = IdPoliza + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha + .Add("@TipoFluctuacion", SqlDbType.SmallInt).Value = TipoFluctuacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar a la bitacora de Fluctuaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetFluctuaciones(Fecha As Date, TipoFluctuacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Comp_FluctuacionesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@TipoFluctuacion", SqlDbType.SmallInt).Value = TipoFluctuacion + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Fluctuaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "B A N C O S - T A R J E T A S C R E D I T O S" + Public Function AddTarjetaCredito(CveCuenta As Integer, NumCuenta As String, Responsable As String, Vencimiento As Date, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CuentasTarjetaAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Numero", SqlDbType.VarChar).Value = NumCuenta + .Add("@Responsable", SqlDbType.VarChar).Value = Responsable + .Add("@Vencimiento", SqlDbType.Date).Value = Vencimiento + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + '.Add("@CveCuentaTarjeta", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un tarjeta con el mismo numero: " & Banco & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar tarjeta de Credito.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar la tarjeta de Credito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetTarjetaCredito(CveCuentaTarjeta As Integer, CveCuenta As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CuentasTarjetaGet") + + With SqlAdapter.SelectCommand.Parameters + '.Add("@Numero", SqlDbType.VarChar).Value = NumCuenta + '.Add("@Responsable", SqlDbType.VarChar).Value = Responsable + '.Add("@Vencimiento", SqlDbType.Date).Value = Vencimiento + '.Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al Obtener el catalogo de tarjetas de credito", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al Obtener el catalogo de tarjetas de Credito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTarjetaCredito(CveCuentaTarjeta As Integer, CveCuenta As Integer, NumCuenta As String, Responsable As String, Vencimiento As Date, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CuentasTarjetaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Numero", SqlDbType.VarChar).Value = NumCuenta + .Add("@Responsable", SqlDbType.VarChar).Value = Responsable + .Add("@Vencimiento", SqlDbType.Date).Value = Vencimiento + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + OnError("Ocurrió un error al actualizar los datos en la tarjeta de credito", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al actualizar los datos en la tarjeta de credito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveTarjetaCredito(CveCuentaTarjeta As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CuentasTarjetaRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuentaTarjeta", SqlDbType.Int).Value = CveCuentaTarjeta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + + Me.OnError("Ocurrió un error al eliminar la Tarjeta de credito.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar la Tarjeta de credito.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "PagosCajaChica" + Public Function GetPagosCajaChica(FechaI As String, FechaF As String, CveEmpresa As Integer, CveCuenta As Integer, Optional TipoPago As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_BancosCajaChicaPagosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@TipoChequeEfectivo", SqlDbType.Int).Value = TipoPago + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los pagos de Caja Chica", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region "ACTIVOS FIJOS" + Public Function GetActivosFijosCreditos(CveCredito As Integer, CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosActivosFijosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los activos fijos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddActivosFijosCreditos(CveCredito As Integer, CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosActivosFijosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar los activos fijos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveActivosFijosCreditos(CveCredito As Integer, CveActivoFijo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosActivosFijosRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los activos fijos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "ANTICIPOS" + Public Function GetAnticiposCreditos(CveCredito As Integer, CveIE As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosAnticiposGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los anticipos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddAnticiposCreditos(CveCredito As Integer, CveIE As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosAnticiposAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar los anticipos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveAnticiposCreditos(CveCredito As Integer, CveIE As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_CreditosAnticiposRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCredito", SqlDbType.Int).Value = CveCredito + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los anticipos del crédito", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region " COBRADO PAGADO " + Public Function GetCobradoPagado(Modalidad As Integer, Grupo As Integer, FechaInicio As Date, FechaFin As Date, CveProyecto As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_RepCobradoPagado") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Modalidad", SqlDbType.Int).Value = Modalidad + .Add("@GPO", SqlDbType.Int).Value = Grupo + .Add("@FechaI", SqlDbType.Date).Value = FechaInicio + .Add("@FechaF", SqlDbType.Date).Value = FechaFin + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de Cobrado Pagado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetCobradoPagadoDetalle(Modalidad As Integer, Grupo As Integer, FechaInicio As Date, FechaFin As Date, CveProyecto As Integer, CveSubProyecto As Integer, GPO As String, CveMoneda As Integer, CveEmpresa As Integer, Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_CobradoPagadoDetalle") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Modalidad", SqlDbType.Int).Value = Modalidad + .Add("@GPO", SqlDbType.Int).Value = Grupo + .Add("@FechaI", SqlDbType.Date).Value = FechaInicio + .Add("@FechaF", SqlDbType.Date).Value = FechaFin + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Grupo", SqlDbType.VarChar).Value = GPO + .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de Cobrado Pagado Detallado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region "S A L D O S - - I M P U E S T O S " + Public Function GetSaldosFianzas(CveConceptoContable As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SaldoFianzaGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable + .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 Saldos de fianza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region " CLIENTES ANTICIPOS " + Public Function GetClienteAnticiposRep(CveCliente As Integer, TipoReporte As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ClienteAnticiposRep") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@TipoReporte", SqlDbType.Int).Value = TipoReporte + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de Clientes Anticipos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "DEPOSITOS TERMINAL" + Public Function GetVentasTerminal(FechaI As String, FechaF As String, CveEmpresa As Integer, CveCuentaTerminal As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_VentasTerminalGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCuentaTerminal", SqlDbType.Int).Value = CveCuentaTerminal + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los pagos de Caja Chica", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region " C O M P R O B A C I O N E S - R E P O R T E" + Public Function GetComprobacionesRep(CveCuenta As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_ComprobacionesRepGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de Comprobaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "V I A T I C O S" + Public Function GetConceptosViaticos(CveEmpresa As Integer, Estatus As Integer, Optional CveConceptoViatico As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_ConceptosViaticosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los Conceptos de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddConceptosViaticos(ConceptoViatico As String, Estatus As Boolean, CveUsuarioIng As Integer, FechaIng As DateTime, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_ConceptosViaticosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@ConceptoViatico", SqlDbType.VarChar).Value = ConceptoViatico + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng + .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Concepto de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateConceptosViaticos(CveConceptoViatico As Integer, ConceptoViatico As String, Estatus As Boolean) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_ConceptosViaticosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico + .Add("@ConceptoViatico", SqlDbType.VarChar).Value = ConceptoViatico + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Concepto de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveConceptosViaticos(CveConceptoViatico As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_ConceptosViaticosRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Concepto de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetSolicitudesViaticos(CveSolicitudViatico As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CvePersonal As Integer = -1, Optional Destino As String = "-1", + Optional FechaSalida As String = "-1", Optional FechaRegreso As String = "-1", Optional FechaIngInicio As String = "-1", Optional FechaIngFin As String = "-1", + Optional CveUsuarioIng As Integer = -1, Optional Folio As String = "-1", Optional CveDepartamento As Integer = -1, Optional CveIE As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SolicitudViaticosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveDepartamento", SqlDbType.Int).Value = CveDepartamento + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@Destino", SqlDbType.VarChar).Value = Destino + + .Add("@FechaSalida", SqlDbType.VarChar).Value = FechaSalida + .Add("@FechaRegreso", SqlDbType.VarChar).Value = FechaRegreso + + .Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng + .Add("@FechaIngInicio", SqlDbType.VarChar).Value = FechaIngInicio + .Add("@FechaIngFin", SqlDbType.VarChar).Value = FechaIngFin + + .Add("@Folio", SqlDbType.VarChar).Value = Folio + .Add("@CveIE", SqlDbType.Int).Value = CveIE + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddSolicitudesViaticos(Folio As String, Estatus As Integer, CvePersonal As Integer, Destino As String, Asunto As String, FechaSalida As String, FechaRegreso As String, FechaIng As DateTime, + CveUsuarioIng As Integer, CveEmpresa As Integer, Optional TipoCarro As String = "-1", Optional KM As String = "-1") As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_Banc_SolicitudViaticosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Folio", SqlDbType.VarChar).Value = Folio + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@Destino", SqlDbType.VarChar).Value = Destino + .Add("@Asunto", SqlDbType.VarChar).Value = Asunto + + .Add("@FechaSalida", SqlDbType.VarChar).Value = FechaSalida + .Add("@FechaRegreso", SqlDbType.VarChar).Value = FechaRegreso + + .Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng + .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@TipoCarro", SqlDbType.VarChar).Value = TipoCarro + .Add("@KM", SqlDbType.VarChar).Value = KM + + .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@RETURN_VALUE").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error al agregar la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateSolicitudesViaticos(CveSolicitudViatico As Integer, Estatus As Integer, Destino As String, Asunto As String, FechaSalida As String, FechaRegreso As String, Optional Observaciones As String = "-1", + Optional TipoCarro As String = "-1", Optional KM As String = "-1") As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SolicitudViaticosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@Destino", SqlDbType.VarChar).Value = Destino + .Add("@Asunto", SqlDbType.VarChar).Value = Asunto + + .Add("@FechaSalida", SqlDbType.VarChar).Value = FechaSalida + .Add("@FechaRegreso", SqlDbType.VarChar).Value = FechaRegreso + + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@TipoCarro", SqlDbType.VarChar).Value = TipoCarro + .Add("@KM", SqlDbType.VarChar).Value = KM + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateSolicitudesViaticosIE(CveSolicitudViatico As Integer, CveIE As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SolicitudViaticosIEUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico + .Add("@CveIE", SqlDbType.Int).Value = CveIE + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el IE en la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveSolicitudesViaticos(CveSolicitudViatico As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SolicitudViaticosRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetNextFolioSolicitudViaticos(CveEmpresa As Integer, Serie As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SolicitudViaticosNextFolioGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Serie", SqlDbType.VarChar).Value = Serie + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al generar el Folio de la Solicitud de Viáticos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetSolicitudesViaticosDetalle(CveSolicitudViaticos As Integer, CveSolicitudViaticosDetalle As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SolicitudViaticosDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSolicitudViaticos", SqlDbType.Int).Value = CveSolicitudViaticos + .Add("@CveSolicitudViaticosDetalle", SqlDbType.Int).Value = CveSolicitudViaticosDetalle + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los Detalles de la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddSolicitudesViaticosDetalle(CveSolicitudViaticos As Integer, CveConceptoViatico As Integer, Importe As Double) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SolicitudViaticosDetalleAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViaticos + .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico + .Add("@Importe", SqlDbType.Money).Value = Importe + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Detalle de la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateSolicitudesViaticosDetalle(CveSolicitudViaticosDetalle As Integer, CveConceptoViatico As Integer, Importe As Double) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SolicitudViaticosDetalleUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSolicitudViaticosDetalle", SqlDbType.Int).Value = CveSolicitudViaticosDetalle + .Add("@CveConceptoViatico", SqlDbType.Int).Value = CveConceptoViatico + .Add("@Importe", SqlDbType.Money).Value = Importe + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Detalle de la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveSolicitudesViaticosDetalle(CveSolicitudViaticoDetalle As Integer, CveSolicitudViatico As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_SolicitudViaticosDetalleRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSolicitudViaticoDetalle", SqlDbType.Int).Value = CveSolicitudViaticoDetalle + .Add("@CveSolicitudViatico", SqlDbType.Int).Value = CveSolicitudViatico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Detalle de la Solicitud de Viáticos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "CONCILIACIÓN BANCARIA" + + Public Function UpdateConciliacionBancaria(CveIE As Integer, FechaAplicado As Date) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_ConciliacionBancariaUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@FechaAplicado", SqlDbType.Date).Value = FechaAplicado + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al conciliar los movimientos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function AddIEEstadoCuenta(Referencia As String, FechaDocumento As Date, Importe As Double, CveCuenta As Integer, + CveUsuario As Integer, CveEmpresa As Integer, Tipo As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEEstadoCuentaAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@Referencia", SqlDbType.VarChar).Value = Referencia + .Add("@FechaDocumento", SqlDbType.Date).Value = FechaDocumento + .Add("@Importe", SqlDbType.Float).Value = Importe + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + Public Function UpdateIEEstadoCuenta(CveIEEstadoCuenta As Integer, Importe As Double, FueConciliado As Boolean, CveIE As Integer, + Referencia As String, Tipo As String, FechaDocumento As Date, CveCuenta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEEstadoCuentaUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIEEstadoCuenta", SqlDbType.Int).Value = CveIEEstadoCuenta + .Add("@Importe", SqlDbType.Float).Value = Importe + .Add("@FueConciliado", SqlDbType.Bit).Value = FueConciliado + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@Referencia", SqlDbType.VarChar).Value = Referencia + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@FechaDocumento", SqlDbType.Date).Value = FechaDocumento + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetIEEstadoCuenta(CveIEEstadoCuenta As Integer, FechaI As Date, FechaF As Date, FueConciliado As Integer, + CveCuenta As Integer, CveEmpresa As Integer, Optional VerDuplicados As Boolean = False, + Optional Tipo As Integer = 1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEEstadoCuentaGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIEEstadoCuenta", SqlDbType.Int).Value = CveIEEstadoCuenta + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@FueConciliado", SqlDbType.Int).Value = FueConciliado + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@VerDuplicados", SqlDbType.Bit).Value = VerDuplicados + .Add("@Tipo", SqlDbType.Int).Value = Tipo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function RemoveIEEstadoCuenta(CveIEEstadoCuenta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEEstadoCuentaRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIEEstadoCuenta", SqlDbType.Int).Value = CveIEEstadoCuenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function DesconciliarIE(CveIE As Integer, FechaDesconciliado As Date) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEDesconciliar") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@FechaDesconciliado", SqlDbType.Date).Value = FechaDesconciliado + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al desconciliar el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + Public Function GetIEConciliacion(CveIE As Integer, FechaI As Date, FechaF As Date, FueConciliado As Integer, + CveCuenta As Integer, CveEmpresa As Integer, VerDuplicados As Boolean) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_IEGetConciliacion") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@FueConciliado", SqlDbType.Int).Value = FueConciliado + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@VerDuplicados", SqlDbType.Bit).Value = VerDuplicados + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el estado de cuenta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + + + +#End Region + + +#Region "IDisposable Support" + + + ' IDisposable + Protected Overridable Sub Dispose(disposing As Boolean) + If Not Me.disposedValue Then + If disposing Then + ' TODO: dispose managed state (managed objects). + If Not Data Is Nothing Then Data.Dispose() + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() + If Not SqlCommand Is Nothing Then SqlCommand.Dispose() + If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() + If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() + If Not SqlConexion Is Nothing Then SqlConexion.Dispose() + End If + + ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below. + ' TODO: set large fields to null. + End If + Me.disposedValue = True + End Sub + + ' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources. + 'Protected Overrides Sub Finalize() + ' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. + ' Dispose(False) + ' MyBase.Finalize() + 'End Sub + + ' 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 -#End Region - -#Region "PAGO ACREEDORES / PAGO DEUDORES" - Public Function GetPersonalPrestamoAuxiliar(CvePersonal As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_PersonalPrestamoAuxiliar") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el auxiliar del personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function GetPersonalPrestamoReporte(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_PersonalPrestamoReporte") - 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 el reporte del personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - Public Function GetAcreedoresAuxiliar(CveProveedor As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_AcreedorAuxiliar") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el auxiliar del acreedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function GetAcreedoresReporte(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_AcreedorReporte") - 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 el reporte del acreedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function GetDeudoresAuxiliar(CveProveedor As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_DeudorAuxiliar") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el auxiliar del acreedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function GetDeudoresReporte(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_DeudorReporte") - 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 el reporte del acreedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function -#End Region - -#Region "Ajustar importe IE Otros Ingresos por Redondeo(78), Otros Gastos(211)" - - - Public Function UpdateAjustarMovimiento(CveIE As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Banc_AjustarMovimientoUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@Importe", SqlDbType.Money).Value = Importe - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el movimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - -#End Region - -#Region "COMPROBACION SIN BANCOS" - - Public Function UpdateComprobacionSinBancos(CveIE As Integer, CvePrePoliza As Integer, CvePersonal As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_ComprobacionSinBancosUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la comprobación sin bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - -#End Region - - - Public Function GetCuentasBancarias(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_CuentasBancariasGet") - 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 las Cuentas Bancarias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - Return Retorno - End Function -End Class + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region + +#Region "PAGO ACREEDORES / PAGO DEUDORES" + Public Function GetPersonalPrestamoAuxiliar(CvePersonal As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_PersonalPrestamoAuxiliar") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el auxiliar del personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetPersonalPrestamoReporte(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_PersonalPrestamoReporte") + 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 el reporte del personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + Public Function GetAcreedoresAuxiliar(CveProveedor As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_AcreedorAuxiliar") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el auxiliar del acreedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetAcreedoresReporte(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_AcreedorReporte") + 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 el reporte del acreedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetDeudoresAuxiliar(CveProveedor As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_DeudorAuxiliar") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el auxiliar del acreedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetDeudoresReporte(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_DeudorReporte") + 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 el reporte del acreedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function +#End Region + +#Region "Ajustar importe IE Otros Ingresos por Redondeo(78), Otros Gastos(211)" + + + Public Function UpdateAjustarMovimiento(CveIE As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_AjustarMovimientoUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el movimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + +#End Region + +#Region "COMPROBACION SIN BANCOS" + + Public Function UpdateComprobacionSinBancos(CveIE As Integer, CvePrePoliza As Integer, CvePersonal As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_ComprobacionSinBancosUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la comprobación sin bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + +#End Region + + + Public Function GetCuentasBancarias(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_CuentasBancariasGet") + 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 las Cuentas Bancarias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function +End Class