diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 8d328c4bb..eb4b801f9 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -7,41 +7,41 @@ Imports System.Data.SqlClient Imports Extensiones Public Class ClsMovimientos - Implements IDisposable - + Implements IDisposable + #Region "Campos" - - 'SQL + + 'SQL Private SqlConexion As SqlConnection Private SqlAdapter As SqlDataAdapter Private SqlTransacc As SqlTransaction Private SqlCommand As SqlCommand - Private Data As DataTable + Private Data As DataTable Private DS As DataSet 'Atributos de la clase Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS - Private CveConexion As Integer = 0 - + Private CveConexion As Integer = 0 + #End Region - + #Region "Propiedades" Public ReadOnly Property DtResultados() As DataTable Get DtResultados = Data End Get - End Property - - Public ReadOnly Property DSResultados() As DataSet - Get - DSResultados = DS - End Get End Property - Public Property AlertaMensaje As New StringBuilder + Public ReadOnly Property DSResultados() As DataSet + Get + DSResultados = DS + End Get + End Property + + Public Property AlertaMensaje As New StringBuilder #End Region - + Sub New() SqlConexion = New SqlConnection SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString @@ -62,9 +62,9 @@ Public Class ClsMovimientos End With If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc Data = New DataTable - End Sub + End Sub #Region "Conexiones" - + Private Sub ConexionAdd() If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try @@ -97,9 +97,9 @@ Public Class ClsMovimientos CveConexion = 0 End If - End Sub + End Sub #End Region - + Public Sub IniciaTransacSQL() SqlTransacc = SqlConexion.BeginTransaction() End Sub @@ -110,27 +110,27 @@ Public Class ClsMovimientos Public Sub Commit() SqlTransacc.Commit() - End Sub - + End Sub + #Region "CxC" - 'Public Function GetCxCCliente(CveCliente As Integer) As Boolean - ' Dim Retorno As Boolean = False - ' 'Data = New DataTable - ' 'SqlAdapter = New SqlDataAdapter("PA_ClienteCxC", SqlConexion) - ' 'SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure - ' DataAdapter("PA_ClienteCxC") - ' SqlAdapter.SelectCommand.Parameters.Add("@CveCliente", SqlDbType.Int).Value = CveCliente - - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As SqlException - ' OnError("Ocurrió un error al consultar las CxC del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - - ' Return Retorno - 'End Function - + 'Public Function GetCxCCliente(CveCliente As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' 'Data = New DataTable + ' 'SqlAdapter = New SqlDataAdapter("PA_ClienteCxC", SqlConexion) + ' 'SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure + ' DataAdapter("PA_ClienteCxC") + ' SqlAdapter.SelectCommand.Parameters.Add("@CveCliente", SqlDbType.Int).Value = CveCliente + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As SqlException + ' OnError("Ocurrió un error al consultar las CxC del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + Public Function GetCxCClienteDetalle(CveCliente As Integer, FechaI As String, FechaF As String, CveMoneda As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, CveClienteSucursal As Integer, Optional TipoDocto As String = "-1", Optional FechaCorte As Date = MaxFecha, Optional CveIESustitucion As Integer = -1, Optional FechaVencimientoI As Date = MinFecha, Optional FechaVencimientoF As Date = MaxFecha) As Boolean Dim Retorno As Boolean = False @@ -176,7 +176,7 @@ Public Class ClsMovimientos .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@TipoAgrupador", SqlDbType.Int).Value = TipoAgrupador .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta - .Add("@Cuenta", SqlDbType.NVarChar).Value = Cuenta + .Add("@Cuenta", SqlDbType.NVarChar).Value = Cuenta .Add("@EstatusFactura", SqlDbType.Int).Value = EstatusFactura End With @@ -248,7 +248,8 @@ Public Class ClsMovimientos Gpo As Integer, CveResponsable As Integer, TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional TipoDocto As String = "-1", Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional FechaCorte As Date = Nothing, Optional EstatusCliente As Integer = -1, Optional CveUsuarioConsulta As Integer = -1, - Optional CveCobranzaEstatus As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional TipoCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1, Optional CveMoneda As Integer = -1) As Boolean + Optional CveCobranzaEstatus As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional TipoCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1, Optional CveMoneda As Integer = -1, + Optional TieneLineaAdicional As Integer = -1) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -280,9 +281,10 @@ Public Class ClsMovimientos .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta .Add("@CveCobranzaEstatus", SqlDbType.Int).Value = CveCobranzaEstatus .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion - .Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente - .Add("@AplicaAnticiposPagados", SqlDbType.Int).Value = AplicaAnticiposPagados + .Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente + .Add("@AplicaAnticiposPagados", SqlDbType.Int).Value = AplicaAnticiposPagados .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@TieneLineaAdicional", SqlDbType.Int).Value = TieneLineaAdicional End With Try @@ -333,7 +335,7 @@ Public Class ClsMovimientos CveResponsable As Integer, TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional TipoDocto As String = "-1", Optional FechaVI As String = "-1", Optional FechaVF As String = "1", Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1, Optional CveCobranzaEstatus As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional LimiteCredito As Decimal = -1, - Optional TipoCliente As Integer = -1, Optional CveMoneda As Integer = -1, Optional EstatusCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1) As Boolean + Optional TipoCliente As Integer = -1, Optional CveMoneda As Integer = -1, Optional EstatusCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1, Optional TieneLineaAdicional As Integer = -1) As Boolean Dim Retorno As Boolean = False DS = New DataSet @@ -374,8 +376,9 @@ Public Class ClsMovimientos .Add("@LimiteCredito", SqlDbType.Float).Value = LimiteCredito .Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@EstatusCliente", SqlDbType.Int).Value = EstatusCliente + .Add("@EstatusCliente", SqlDbType.Int).Value = EstatusCliente .Add("@AplicaAnticiposPagados", SqlDbType.Int).Value = AplicaAnticiposPagados + .Add("@TieneLineaAdicional", SqlDbType.Int).Value = TieneLineaAdicional End With Try @@ -386,8 +389,8 @@ Public Class ClsMovimientos End Try Return Retorno - End Function - + End Function + Public Function AddNotificacionEdoCuentaCliente(CveCliente As Integer, Fecha As DateTime) As Boolean Dim Retorno As Boolean = False @@ -406,14 +409,14 @@ Public Class ClsMovimientos End Try Return Retorno - End Function - + End Function + Public Function GetNotificacionEdoCuentaCliente(CveEmpresa As Integer, CveCliente As Integer, Fecha As DateTime) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Sis_NotificacionesEdoCuentaClienteGet") - With SqlAdapter.SelectCommand.Parameters + With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@Fecha", SqlDbType.DateTime).Value = Fecha @@ -427,8 +430,8 @@ Public Class ClsMovimientos End Try Return Retorno - End Function - + End Function + Public Function UpdateNotificacionEdoCuentaCliente(CveNotificacionBitacora As Integer, Notifico As Boolean) As Boolean Dim Retorno As Boolean = False @@ -484,11 +487,11 @@ Public Class ClsMovimientos OnError("Ocurrió un error al descargar los segmentos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - - + End Function + + #End Region - + #Region "Anticipos de Clientes" Public Function GetAnticiposCliente(CveCliente As Integer, Optional SelectTop As Integer = -1, Optional CveMoneda As Integer = 1) As Boolean Dim Retorno As Boolean = False @@ -526,7 +529,7 @@ Public Class ClsMovimientos End Try Return Retorno - End Function + End Function Public Function GetRemisionesNCCliente(CveCliente As Integer, MostarDetalle As Boolean, Optional CveMoneda As Integer = -1, Optional CveClienteSucursal As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_ClienteRemisionesNC") @@ -566,12 +569,12 @@ Public Class ClsMovimientos End Try Return Retorno - End Function - + End Function + #End Region - + #Region "CxP" - + Public Function GetCxPEmpresa(CveProveedor As Integer, FechaVencimientoInicio As String, FechaVencimientoFin As String, CveSubProyecto As Integer, DiasVencidos As Integer, CveUsuarioRegistro As Integer, CveUsuarioProgramo As Integer, CveUsuarioResponsable As Integer, CveClasificacion As Integer, CveMoneda As Integer, CveTipoPagoProgramo As Integer, CveEstatusFactura As Integer, CveAplicaNC As Integer, CveEmpresa As Integer, Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional CodigoProgramacion As String = "-1", Optional CveTipoProveedor As Integer = 0, @@ -733,7 +736,7 @@ Public Class ClsMovimientos Public Function GetCxPPeriodo(CveProveedor As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CveUsuarioResponsable As Integer, CveUsuarioRegistro As Integer, CveEstatus As Integer, CveEmpresa As Integer, Gpo As Integer, CveSucursal As Integer, - TipoCambio As Integer, TCEspecifico As Double, FechaCorte As Date, CveUsuarioConsulta As Integer, CveTipoProveedor As Integer, + TipoCambio As Integer, TCEspecifico As Double, FechaCorte As Date, CveUsuarioConsulta As Integer, CveTipoProveedor As Integer, Optional TipoDocto As String = "-1", Optional CveMoneda As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Comp_RepCxPPeriodo") @@ -751,7 +754,7 @@ Public Class ClsMovimientos .Add("@FechaCorte", SqlDbType.Date).Value = FechaCorte .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta .Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor - .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda End With Try @@ -1325,7 +1328,7 @@ Public Class ClsMovimientos .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta .Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor .Add("@Comprobaciones", SqlDbType.Int).Value = Comprobaciones - .Add("@AplicaNC", SqlDbType.Int).Value = AplicaNC + .Add("@AplicaNC", SqlDbType.Int).Value = AplicaNC .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto End With @@ -1457,9 +1460,9 @@ Public Class ClsMovimientos End Try Return Retorno - End Function + End Function #End Region - + #Region "Anticipos de Proveedores" Public Function GetAnticiposProveedor(CveProveedor As Integer, CveProveedorSucursal As Integer, Optional CveMoneda As Integer = -1, Optional SelectTop As Integer = -1, Optional FechaI As String = "-1", Optional FechaF As String = "-1", Optional TipoDocto As String = "-1") As Boolean Dim Retorno As Boolean = False @@ -1484,30 +1487,30 @@ Public Class ClsMovimientos End Try Return Retorno - End Function - - 'Public Function GetAnticiposClienteAuxiliar(CveCliente As Integer, CveVenta As Integer) As Boolean - ' Dim Retorno As Boolean = False - ' 'Data = New DataTable - ' 'SqlAdapter = New SqlDataAdapter("PA_ClienteAnticiposAuxiliar", SqlConexion) - ' 'SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure - ' DataAdapter("PA_ClienteAnticiposAuxiliar") - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - ' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta - ' End With - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As SqlException - ' OnError("Ocurrió un error al consultar el Auxiliar Contable de Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - - ' Return Retorno - 'End Function - + End Function + + 'Public Function GetAnticiposClienteAuxiliar(CveCliente As Integer, CveVenta As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' 'Data = New DataTable + ' 'SqlAdapter = New SqlDataAdapter("PA_ClienteAnticiposAuxiliar", SqlConexion) + ' 'SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure + ' DataAdapter("PA_ClienteAnticiposAuxiliar") + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + ' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As SqlException + ' OnError("Ocurrió un error al consultar el Auxiliar Contable de Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + #End Region - + #Region "REP RECUPERACION" Public Function GetRepRecuperacion(FechaI As Date, FechaF As Date, CveCliente As Integer, CveSubProyecto As Integer, CveVendedor As Integer, CveUsuario As Integer, CveEstatus As Integer, IVA As String, @@ -1541,13 +1544,13 @@ Public Class ClsMovimientos .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion - .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor - .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - + .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString - .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString - + .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString + .Add("@FechaRegistroIEI", SqlDbType.Date).Value = FechaRegistroIEI.ToShortDateString .Add("@FechaRegistroIEF", SqlDbType.Date).Value = FechaRegistroIEF.ToShortDateString End With @@ -1604,7 +1607,7 @@ Public Class ClsMovimientos Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, Optional CveMoneda As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional Tipo As Integer = -1, Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = Nothing, Optional FechaAplicadoF As Date = Nothing, - Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha, + Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha, Optional CveCondicionesPago As Integer = -1, Optional CveTipoTransaccion As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1634,12 +1637,12 @@ Public Class ClsMovimientos .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion .Add("@Tipo", SqlDbType.Int).Value = Tipo - .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor - .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago - .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion - + .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString - .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString + .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString .Add("@FechaRegistroIEI", SqlDbType.Date).Value = FechaRegistroIEI.ToShortDateString .Add("@FechaRegistroIEF", SqlDbType.Date).Value = FechaRegistroIEF.ToShortDateString @@ -1653,9 +1656,9 @@ Public Class ClsMovimientos End Try Return Retorno - End Function + End Function #End Region - + #Region "REP COBRADO" Public Function GetRepCobrado(FechaI As Date, FechaF As Date, CveProveedor As Integer, CveSubProyecto As Integer, CveUsuario As Integer, IVA As String, CveEmpresa As Integer, Gpo As Integer, CveResponsable As Integer, @@ -1725,11 +1728,11 @@ Public Class ClsMovimientos End Try Return Retorno - End Function + End Function #End Region - + #Region "EDITAR FECHA DE MOVIMIENTO" - + Public Function UpdateMovimientoFecha(Fecha As DateTime, CveMovimiento As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Mov_MovimientoFechaUpdate") @@ -1744,12 +1747,12 @@ Public Class ClsMovimientos OnError("Ocurrió un error al actualizar la fecha del movimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function + End Function #End Region - + #Region "Registros Contables" - - + + Public Function AddMovimiento(CveConcepto As Integer, Tipo As String, Referencia1 As String, Referencia2 As String, CveMoneda As Integer, Cargo As Double, Abono As Double, Fecha As Date, FechaVencimiento As Date, Folio As String, IdCtaContable As Integer, CveUsuario As Integer, CveEmprea As Integer) As Boolean Dim Retorno As Boolean = False @@ -1823,23 +1826,23 @@ Public Class ClsMovimientos End Try Return Retorno - End Function - + End Function + #End Region - + #Region "IDisposable Support" - - - ' IDisposable + + + ' 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() : Data = Nothing - If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing - If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing - If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing - If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() + If disposing Then + ' TODO: dispose managed state (managed objects). + If Not Data Is Nothing Then Data.Dispose() : Data = Nothing + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing + If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing + If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing + If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing End If @@ -1863,9 +1866,9 @@ Public Class ClsMovimientos ConexionClose() Dispose(True) GC.SuppressFinalize(Me) - End Sub + End Sub #End Region - + Public Function GetPersonalCajaChica(CveEmpresa As Integer, CveCompra As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_PersonalCajaChica") diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index e5ad7c6c9..6af729f4c 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -400,7 +400,7 @@ Public Class ClsVentas Optional CveTipoAmortizacionAnticipo As Integer = -1, Optional CveVentaRelacion As Integer = -1, Optional ImporteRelacion As Decimal = -1, Optional CveEmpresaCRM As Integer = -1, Optional EsInterno As Integer = -1, Optional CveAcercamientoCRM As Integer = -1, Optional DiasCredito As Integer = 0, Optional EsDiasCreditoFijo As Boolean = False, Optional AnticipoEspecial As Boolean = False, Optional Kilometraje As Double = 0, Optional EsAmortizacion As Boolean = False, Optional CveTipoRetencion As Integer = 0, Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False, Optional VentaDesglosaIEPS As Boolean = False, Optional ServicioDomicilio As Boolean = False, Optional RFCReceptor As String = "", Optional Adjunto As String = "-1", - Optional DevolucionImportePagado As Decimal = 0, Optional EsGarantia As Boolean = False) As Boolean + Optional DevolucionImportePagado As Decimal = 0, Optional EsGarantia As Boolean = False, Optional CveLineaAdicional As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasAdd") @@ -499,7 +499,7 @@ Public Class ClsVentas .Add("@DevolucionImportePagado", SqlDbType.Money).Value = DevolucionImportePagado .Add("@EsGarantia", SqlDbType.Bit).Value = EsGarantia - + .Add("@CveLineaAdicional", SqlDbType.Int).Value = CveLineaAdicional .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue End With 'SqlTypes.SqlDateTime.Null @@ -5603,6 +5603,50 @@ Public Class ClsVentas End Function + Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional ConSaldo As Integer = -1) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_LineasAdicionalesSaldoGet") + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveLineaAdicional", SqlDbType.Int).Value = CveLineaAdicional + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@ConSaldo", SqlDbType.Int).Value = ConSaldo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error obtener las lineas de adicionales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + + End Function + + Public Function UpdateVentaLineaAdicional(CveLineaAdicional As Integer, CveVenta As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_LineasAdicionalesVentaUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveLineaAdicional", SqlDbType.Int).Value = CveLineaAdicional + .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 actualizar la linea adicional.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + + End Function + Public Function AddLineasAdicionales(LineaAdicional As String, CveCliente As Integer, CveProveedor As Integer, TipoLinea As Integer, Importe As Decimal, CveMoneda As Integer, FechaVencimiento As Date, CveUsuario As Integer, CveClasificacionPS As Integer, CveEstatus As Integer) As Boolean diff --git a/CxC/RepCxC.aspx b/CxC/RepCxC.aspx index 3e639b089..bfe73aab6 100644 --- a/CxC/RepCxC.aspx +++ b/CxC/RepCxC.aspx @@ -351,6 +351,18 @@ +
| Linea Adicional: | +
+ |
+
+ |
+
| Forma de entrega: |
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index b828d9285..e2375e4b3 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -2231,6 +2231,32 @@ Partial Class Ventas
ViewState("ClienteRegimenFiscal") = value
End Set
End Property
+ Private Property CveLineaAdicionalVenta As Integer
+ Get
+ Return IfNull(ViewState("CveLineaAdicionalVenta"), "-1", ViewState("CveLineaAdicionalVenta")).ToString().ToEntero()
+ End Get
+ Set(value As Integer)
+ ViewState("CveLineaAdicionalVenta") = value
+ End Set
+ End Property
+
+ Private Property SaldoLineaAdicional As Decimal
+ Get
+ Return (IfNull(ViewState("ImporteLineaAdicional"), "0", ViewState("ImporteLineaAdicional"))).ToString().ToDecimal()
+ End Get
+ Set(value As Decimal)
+ ViewState("ImporteLineaAdicional") = value
+ End Set
+ End Property
+
+ Private Property CveClasificacionLineaAdicional As Integer
+ Get
+ Return IfNull(ViewState("CveClasificacionLineaAdicional"), "-1", ViewState("CveClasificacionLineaAdicional")).ToString().ToEntero()
+ End Get
+ Set(value As Integer)
+ ViewState("CveClasificacionLineaAdicional") = value
+ End Set
+ End Property
#End Region
@@ -4583,6 +4609,11 @@ Partial Class Ventas
ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero()
Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero()
+
+ If UsuarioActual.Empresa.Funcionalidad(705) = "1" Then
+ Me.CveLineaAdicionalVenta = DbRowVenta("CveLineaAdicional").ToString().ToEntero()
+ End If
+
'CargaEncabezado
If Not (CveRemision > 0 Or CveCotizacion > 0) Then
DdlTipoComprobante.SelectedValue = DbRowVenta("TipoDocto").ToString()
@@ -5637,6 +5668,10 @@ Partial Class Ventas
End If
End If
+ If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso Me.CveLineaAdicionalVenta > 0 Then
+ CalculaLineasAdicionales()
+ End If
+
UpPS.Update()
UpContado.Update()
UpEstatus.Update()
@@ -6645,6 +6680,16 @@ Partial Class Ventas
End If
BloqueaCondiconesPago()
DeshabilitarAplicarNotaDeCredito(LblRFC.Text)
+
+ 'If UsuarioActual.Empresa.Funcionalidad(705) = "1" Then
+ ' Using ObjVentas As New ClsVentas
+ ' If ObjVentas.GetLineasAdicionales(-1, CveCliente, -1, -1, DdlMoneda.SelectedValue.ToEntero(), MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa) Then
+ ' If ObjVentas.DtResultados.Rows.Count > 0 Then
+ ' TrLineaAdicional.Visible = True
+ ' End If
+ ' End If
+ ' End Using
+ 'End If
End Sub
Private Sub CargaRelacionadasPendientes()
@@ -8727,9 +8772,10 @@ Partial Class Ventas
End If
End If
+ 'SI TIENE LINEA ADICIONAL NO VERIFICAR LIMITE DE CREDITO
'SI NO TIENE AUTORIZACION VERIFICAR LIMITE DE CREDITO Y CANDADOS DE VENTA
'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada.
- If Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
+ If DdlLineaAdicional.SelectedValue.ToEntero() <= 0 AndAlso Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then
If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then
@@ -8782,6 +8828,30 @@ Partial Class Ventas
'End If
End If
+ 'VALIDAR LINEAS ADICIONALES
+ If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
+ 'VERIFICA QUE LA CLASIFICACION DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
+ If TmpDT IsNot Nothing AndAlso Me.CveClasificacionLineaAdicional > 0 Then
+ For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows
+ If Me.CveClasificacionLineaAdicional <> Row("CveClasificacion").ToString().ToEntero() Then
+ Alert($"La clasificación '{Row("Clasificacion")}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ Next
+ End If
+
+ If Me.SaldoLineaAdicional <= 0 Then
+ Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+ 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
+ If Me.SaldoLineaAdicional <= TxtTotal.Text.ToDecimal() Then
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+
'VALIDA PRECIO AL AGREGAR A ALMACEN
If Not UsuarioActual.TienePermisoProceso(169) Then
@@ -12559,7 +12629,8 @@ Partial Class Ventas
CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM,
DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False),
Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=factura.CveTipoRetencion, CorreoNotificacion:=TxtCorreoNotificaciones.Text,
- FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible) Then
+ FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible,
+ CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero()) Then
ErrorList.Add("Ocurrió un error al Generar la Venta. Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Else If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then @@ -17963,6 +18034,8 @@ Partial Class Ventas ListaDescuentos.Add(ObjDescuento) End If + CalculaLineasAdicionales() + CalculaTotalesVenta() LimpiaAgregar() @@ -17979,6 +18052,43 @@ Partial Class Ventas End Sub + Private Sub CalculaLineasAdicionales() + If DdlTipoComprobante.SelectedValue = "Ing" AndAlso UsuarioActual.Empresa.Funcionalidad(705) = "1" Then + DdlLineaAdicional.DataSource = Nothing + + Using ObjVentas As New ClsVentas + If CveVenta > 0 Then + If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=-1) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + TrLineaAdicional.Visible = True + DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"Saldo > 0 OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}") + End If + End If + Else + If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=1) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + TrLineaAdicional.Visible = True + DdlLineaAdicional.DataSource = ObjVentas.DtResultados + End If + End If + End If + End Using + + DdlLineaAdicional.DataBind() + DdlLineaAdicional.Items.Insert(0, New ListItem("Seleccione", "-1")) + + If Me.CveLineaAdicionalVenta > 0 Then + DdlLineaAdicional.SelectedValueExist(CveLineaAdicionalVenta.ToString()) + DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) + DdlLineaAdicional.Enabled = False + LnkUpdateLineaAdicional.Visible = True + End If + + End If + + UPCondicionesPago.Update() + End Sub + Private Sub AgregarPSPYME() If Modalidad = "A" Then @@ -18277,8 +18387,12 @@ Partial Class Ventas End If LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero - TrRetIVA.Style.Add("display", "") - DdlTipoRetencion.Visible = True + If LblRetIVA.Text.ToDecimal() > 0 Then + TrRetIVA.Style.Add("display", "") + DdlTipoRetencion.Visible = True + Else + TrRetIVA.Style.Add("display", "none") + End If Row("IVA") = Row("PorcentajeIVA") @@ -33288,13 +33402,15 @@ Partial Class Ventas TxtPedidoContrato.Enabled = True TxtObsAlmacen.Enabled = True RblPaqueteria.Enabled = True - + DdlLineaAdicional.Enabled = True + LnkUpdateLineaAdicional.Visible = True 'Acciones BtnEditar.Text = "Guardar" UpParametros.Update() UPObservaciones.Update() UpFacturar.Update() + UPCondicionesPago.Update() End Sub Private Sub GuardarValoresEditados() @@ -35153,5 +35269,57 @@ Partial Class Ventas End Sub + Protected Sub DdlLineaAdicional_SelectedIndexChanged(sender As Object, e As EventArgs) + If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then + RBLPago.SelectedValue = "1" + RBLPago.Enabled = False + + Using ObjVentas As New ClsVentas + If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") + Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal() + Me.CveClasificacionLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveClasificacionPS").ToString().ToEntero() + End If + End If + End Using + Else + Me.SaldoLineaAdicional = 0 + Me.CveClasificacionLineaAdicional = 0 + End If + + UPCondicionesPago.Update() + End Sub + Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs) + 'VALIDAR LINEAS ADICIONALES + If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then + 'VERIFICA QUE LA CLASIFICACION DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL + If TmpDT IsNot Nothing AndAlso Me.CveClasificacionLineaAdicional > 0 Then + For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows + If Me.CveClasificacionLineaAdicional <> Row("CveClasificacion").ToString().ToEntero() Then + Alert($"La clasificación '{Row("Clasificacion")}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Next + End If + + If Me.SaldoLineaAdicional <= 0 Then + Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE + If Me.SaldoLineaAdicional <= TxtTotal.Text.ToDecimal() Then + Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + + Using ObjVentas As New ClsVentas + If ObjVentas.UpdateVentaLineaAdicional(DdlLineaAdicional.SelectedValue.ToEntero(), Me.CveVenta, UsuarioActual.CveEmpresa) Then + Alert("Se actualizo la linea adicional de crédito de la venta") + End If + End Using + End Sub End Class |