diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb
index 4e0ef922e..7b7617049 100644
--- a/App_Code/ClsGenerales.vb
+++ b/App_Code/ClsGenerales.vb
@@ -384,10 +384,32 @@ Public Class ClsGenerales
End Try
Return ds
- End Function
-
+ End Function
+
+ Public Function GetDashboardData(CveEmpresa As Integer) As DataSet
+ Dim ds As New DataSet
+ DataAdapter("PA_Gral_DashboardsGet")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Opcion", SqlDbType.Int).Value = 1
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@FechaInicio", SqlDbType.Date).Value = Date.Now.AddYears(-1)
+ .Add("@FechaFin", SqlDbType.Date).Value = Date.Now
+ End With
+
+ Try
+ SqlAdapter.Fill(ds)
+ ds.Tables(0).TableName = "Indicadores"
+ ds.Tables(1).TableName = "DetalleDia"
+ Return ds
+ Catch ex As Exception
+ ' Manejo de errores
+ Return Nothing
+ End Try
+ End Function
+
+
#End Region
-
+
#Region " D I A S I N H A B I L E S "
Public Function DiasInhabiles_Add(CveEmpresa As Integer, CveUsuario As Integer, DiaInhabil As String, Descripcion As String, Estatus As Integer, FechaInhabil As Date) As Boolean
Dim Retorno As Boolean = False
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index b48d0ecb2..a89c07bd9 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -10556,6 +10556,7 @@ Public Class ClsPaginas
PaginaDict.Add("/General/CatMedidaEquivalencia.aspx".ToUpper(), 773)
PaginaDict.Add("/General/RepIndicadorResumen.aspx".ToUpper(), 110)
PaginaDict.Add("/General/SaldosMenores.aspx".ToUpper(), -1)
+ PaginaDict.Add("/General/Dashboard.aspx".ToUpper(), 17)
#End Region
#Region "GPS"
PaginaDict.Add("/GPS/RepTemperatura.aspx".ToUpper(), 681)
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index 3a08f1200..223f40d59 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -7697,7 +7697,7 @@ Public Class ClsVentas
End Function
- Public Function GetSMSIndicadores(Opcion As Integer, FechaInicio As Date, FechaFin As Date, CveUsuario As Integer, CveVendedor As Integer, CveUsuarioTecnico As Integer, CveEmpresa As Integer) As Boolean
+ Public Function GetSMSIndicadores(Opcion As Integer, FechaInicio As Date, FechaFin As Date, CveUsuario As Integer, CveVendedor As Integer, CveGerenteVendedor As Integer, CveUsuarioTecnico As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_SMS_IndicadoresGet")
With SqlAdapter.SelectCommand.Parameters
@@ -7706,6 +7706,7 @@ Public Class ClsVentas
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
+ .Add("@CveGerenteVendedor", SqlDbType.Int).Value = CveGerenteVendedor
.Add("@CveUsuarioTecnico", SqlDbType.Int).Value = CveUsuarioTecnico
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
diff --git a/General/Dashboard.aspx b/General/Dashboard.aspx
new file mode 100644
index 000000000..95553bddd
--- /dev/null
+++ b/General/Dashboard.aspx
@@ -0,0 +1,55 @@
+<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Dashboard.aspx.vb" Inherits="General_Dashboard" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/General/Dashboard.aspx.vb b/General/Dashboard.aspx.vb
new file mode 100644
index 000000000..7384cc14f
--- /dev/null
+++ b/General/Dashboard.aspx.vb
@@ -0,0 +1,101 @@
+
+Imports System.Data
+Imports Extensiones
+Imports System.Web.Services
+Imports Newtonsoft.Json
+Imports ADSNetLibrary.SIGAPI.Models.CRM.Request
+Imports ADSNetLibrary.SIGAPI.Services.CRM
+
+Partial Class General_Dashboard
+ Inherits ClsPaginas
+
+ Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
+ If Not IsPostBack Then
+ CargarIndicadores()
+ End If
+ End Sub
+
+ Private Sub CargarIndicadores()
+ Dim Gral As New ClsGenerales
+ Dim ds As DataSet = Gral.GetDashboardData(UsuarioActual.CveEmpresa)
+
+ If ds IsNot Nothing AndAlso ds.Tables.Count > 0 Then
+ ProcesarDatosIndicadores(ds.Tables(0))
+ End If
+ End Sub
+
+ Private Sub ProcesarDatosIndicadores(dt As DataTable)
+ If dt.Rows.Count > 0 Then
+ Dim dr As DataRow = dt.Rows(0)
+
+ ' Indicador Año
+ MuestraIndicador(DivIndicadores, "blue", "fa fa-calendar", "Año Actual", dr("AcumAño").ToString.FormatoNumero(0), "#", "Acumulado",
+ dr("AcumAñoPromedio").ToString.FormatoNumero(0), "#", "Promedio",
+ dr("AcumAñoContado").ToString.FormatoNumero(0), "#", "Contado",
+ dr("AcumAñoCredito").ToString.FormatoNumero(0), "#", "Crédito")
+
+ ' Indicador Mes
+ MuestraIndicador(DivIndicadores, "green", "fa fa-calendar-check-o", "Mes Actual",
+ dr("AcumMes").ToString.FormatoNumero(0), "#", "Acumulado",
+ dr("AcumMesPromedio").ToString.FormatoNumero(0), "#", "Promedio",
+ dr("AcumMesContado").ToString.FormatoNumero(0), "#", "Contado",
+ dr("AcumMesCredito").ToString.FormatoNumero(0), "#", "Crédito")
+
+ ' Indicador Semana
+ MuestraIndicador(DivIndicadores, "purple", "fa fa-calendar-minus-o", "Semana Actual",
+ dr("AcumSemana").ToString.FormatoNumero(0), "#", "Acumulado",
+ dr("AcumSemanaPromedio").ToString.FormatoNumero(0), "#", "Promedio",
+ dr("AcumSemanaContado").ToString.FormatoNumero(0), "#", "Contado",
+ dr("AcumSemanaCredito").ToString.FormatoNumero(0), "#", "Crédito")
+
+
+ MuestraIndicador(DivIndicadores, "red", "fa fa-sun-o", "Hoy",
+ "0".FormatoNumero(0), "#", "Acumulado",
+ "0".FormatoNumero(0), "#", "Promedio",
+ "0".FormatoNumero(0), "#", "Contado",
+ "0".FormatoNumero(0), "#", "Crédito")
+ End If
+ End Sub
+
+ Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, Comentario As String, Link As String, TitleComentario As String)
+ Dim htmldiv As New StringBuilder
+ htmldiv.AppendFormat("{0}
", Link)
+ DIV.InnerHtml = htmldiv.ToString
+ End Sub
+ Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String)
+ Dim htmldiv As New StringBuilder
+ htmldiv.AppendFormat("{0}
")
+ DIV.InnerHtml = htmldiv.ToString
+ End Sub
+ Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String, C3 As String, CL3 As String, CT3 As String)
+ Dim htmldiv As New StringBuilder
+ htmldiv.AppendFormat("{0}
")
+ DIV.InnerHtml = htmldiv.ToString
+ End Sub
+ Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String, C3 As String, CL3 As String, CT3 As String, C4 As String, CL4 As String, CT4 As String)
+ Dim htmldiv As New StringBuilder
+ htmldiv.AppendFormat("{0}
", CL1)
+ DIV.InnerHtml = htmldiv.ToString
+ End Sub
+
+End Class
diff --git a/Inicio.aspx b/Inicio.aspx
index 140609925..6c15b06db 100644
--- a/Inicio.aspx
+++ b/Inicio.aspx
@@ -553,7 +553,7 @@
Opción:
-
+
diff --git a/Inicio.aspx.vb b/Inicio.aspx.vb
index 018715c5f..142d887d8 100644
--- a/Inicio.aspx.vb
+++ b/Inicio.aspx.vb
@@ -181,19 +181,38 @@ Partial Class Inicio
If UsuarioActual.TienePermisoProceso(343) Then MuestraPsProximosAVencer()
If UsuarioActual.TienePermisoProceso(344) Then MuestraRSCOProximosAVencer()
- If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso UsuarioActual.CveUsuario = 3964 Then 'AndAlso UsuarioActual.CveRol.Contiene(1577, 1639, 1573) Then
- Dim Opcion As Integer = 1
- Dim CveVendedor As Integer = -1
- Dim CveUsuarioTecnico As Integer = -1
+ If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso (UsuarioActual.CveUsuario = 3964 Or UsuarioActual.CveRol = 1639) Then 'AndAlso UsuarioActual.CveRol.Contiene(1577, 1639, 1573) Then
+ 'Dim Opcion As Integer = 1
+ 'Dim CveVendedor As Integer = -1
+ 'Dim CveUsuarioTecnico As Integer = -1
+
+ 'If UsuarioActual.CveRol = 1577 Then 'vendedor
+ ' Opcion = 1
+ ' CveVendedor = UsuarioActual.CveVendedor
+ ' CveUsuarioTecnico = UsuarioActual.CveUsuario 'GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUsuarioTecnico", $"CveVendedor = {CveVendedor}").ToEntero
+ 'ElseIf UsuarioActual.CveRol.Contiene(1639, 1573) Then ' rol admin. 1573
+ ' Opcion = 2 'gerente ventas
+ 'End If
divsms1.Visible = True
- If UsuarioActual.CveRol = 1577 Then 'vendedor
- Opcion = 1
- CveVendedor = UsuarioActual.CveVendedor
- CveUsuarioTecnico = UsuarioActual.CveUsuario 'GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUsuarioTecnico", $"CveVendedor = {CveVendedor}").ToEntero
- ElseIf UsuarioActual.CveRol.Contiene(1639, 1573) Then ' rol admin. 1573
- Opcion = 2 'gerente ventas
+ If UsuarioActual.CveUsuario = 3964 Then
+ DdlSMSOpciones.SelectedValue = "2"
+ DdlSMSVendedores.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveEstatus=1 ")
+ DdlSMSVendedores.DataBind()
End If
- CargaKPICirugias(Opcion, CveVendedor, CveUsuarioTecnico)
+ If UsuarioActual.CveRol.Contiene(1639) Then 'gerente ventas
+ DdlSMSOpciones.SelectedValue = "2"
+ DdlSMSOpciones.Items.RemoveAt(4)
+ DdlSMSOpciones.Items.RemoveAt(3)
+ DdlSMSOpciones.Items.RemoveAt(2)
+ Dim CveGerenteVendedor As Integer = -1
+ If UsuarioActual.CveUsuario = 4419 Then CveGerenteVendedor = 1386 '; --' daniela
+ If UsuarioActual.CveUsuario = 4137 Then CveGerenteVendedor = 1172 '; --'jesus alvarez
+
+ DdlSMSVendedores.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveEstatus=1 and CveSuperior = {CveGerenteVendedor} ")
+ DdlSMSVendedores.DataBind()
+ End If
+ CargaSMSKPI()
+
End If
If (UsuarioActual.CveRol = 1062) Or (UsuarioActual.CveUsuario = 100) Then
@@ -1437,7 +1456,6 @@ Partial Class Inicio
RegistraScript("$('#DvUnoaUno').modal('hide')")
End Sub
-
#Region "DOCUMENTACION"
Private Sub CargaDocumentacion()
@@ -1494,19 +1512,12 @@ Partial Class Inicio
#End Region
-
-
-
Protected Sub LnkInconsistencias_Click1(sender As Object, e As EventArgs)
MuestraInconsistencias()
End Sub
-
-
-
Private Sub IniializaDdlsOpcionesAgenda()
'CLIENTES
-
DdlClientesWS.setEsWebService(True)
'PROVEEDORES
@@ -1523,14 +1534,8 @@ Partial Class Inicio
DdlPersonal.DataBind()
DdlPersonal.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
-
CargaDdlEmpresaCRM()
-
-
RBLAgendaOpcion_SelectedIndexChanged(Nothing, Nothing)
-
-
-
End Sub
Private Sub CargaDdlEmpresaCRM()
@@ -1614,7 +1619,7 @@ Partial Class Inicio
#Region "S M S - I N D I C A D O R E S"
- Private Sub CargaKPICirugias(Opcion As Integer, Optional CveVendedor As Integer = -1, Optional CveUsuarioTecnico As Integer = -1)
+ Private Sub CargaKPICirugias(Opcion As Integer, Optional CveVendedor As Integer = -1, Optional CveUsuarioTecnico As Integer = -1, Optional CveGerenteVendedor As Integer = -1)
DivIndicadores.InnerHtml = ""
Dim dtIndicadores As DataTable = Nothing
@@ -1625,7 +1630,7 @@ Partial Class Inicio
Dim FechaI As Date = Now.FirstDayOfMonth
Dim FechaF As Date = Now.LastDayOfMonth
- If Gral.GetSMSIndicadores(Opcion, FechaI, FechaF, UsuarioActual.CveUsuario, CveVendedor, CveUsuarioTecnico, UsuarioActual.CveEmpresa) Then
+ If Gral.GetSMSIndicadores(Opcion, FechaI, FechaF, UsuarioActual.CveUsuario, CveVendedor, CveGerenteVendedor, CveUsuarioTecnico, UsuarioActual.CveEmpresa) Then
ds = Gral.DataSetResultados
End If
'0-ventas totales, 1-comisiones totales, 2-medicos sin consumo, 3-top10medicos, 4-top5marcas, 5-num pacientes
@@ -2513,14 +2518,22 @@ Partial Class Inicio
#End Region
- Protected Sub DdlSMSOpciones_SelectedIndexChanged(sender As Object, e As EventArgs)
+ Private Sub CargaSMSKPI(Optional CveGerente As Integer = -1)
If DdlSMSOpciones.SelectedValue = "1" Then
- DdlSMSVendedores.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros("CveEstatus=1")
- DdlSMSVendedores.DataBind()
DdlSMSVendedores.Visible = True
DdlSMSTecnico.Visible = False
Dim CveUsuarioTecnico As Integer = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUsuario", $"CveVendedor = {DdlSMSVendedores.SelectedValue}").ToEntero
CargaKPICirugias(DdlSMSOpciones.SelectedValue.ToEntero, DdlSMSVendedores.SelectedValue.ToEntero, CveUsuarioTecnico)
+
+ ElseIf DdlSMSOpciones.SelectedValue = "2" Then ' ROL DE GERENTE DE VENTAS
+ Dim CveGerenteVendedor As Integer = -1
+ If UsuarioActual.CveRol = 1639 Then
+ If UsuarioActual.CveUsuario = 4419 Then CveGerenteVendedor = 1386 ' daniela
+ If UsuarioActual.CveUsuario = 4137 Then CveGerenteVendedor = 1172 'jesus alvarez
+ End If
+ DdlSMSVendedores.Visible = False
+ CargaKPICirugias(DdlSMSOpciones.SelectedValue.ToEntero, CveGerenteVendedor:=CveGerenteVendedor)
+
ElseIf DdlSMSOpciones.SelectedValue = "4" Then
DdlSMSTecnico.DataSource = GlobalDTUsuarios(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveRol = 1582")
DdlSMSTecnico.DataBind()
@@ -2533,9 +2546,14 @@ Partial Class Inicio
DdlSMSTecnico.Visible = False
CargaKPICirugias(DdlSMSOpciones.SelectedValue.ToEntero)
End If
-
End Sub
+ Protected Sub DdlSMSOpciones_SelectedIndexChanged(sender As Object, e As EventArgs)
+ CargaSMSKPI()
+ End Sub
+
+
+
Protected Sub DdlSMSVendedores_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim CveUsuarioTecnico As Integer = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUsuario", $"CveVendedor = {DdlSMSVendedores.SelectedValue}").ToEntero
CargaKPICirugias(DdlSMSOpciones.SelectedValue.ToEntero, DdlSMSVendedores.SelectedValue.ToEntero, CveUsuarioTecnico)
diff --git a/LogIn.aspx.vb b/LogIn.aspx.vb
index 104e4dd54..373b95ad4 100644
--- a/LogIn.aspx.vb
+++ b/LogIn.aspx.vb
@@ -29,16 +29,14 @@ Partial Class LogIn
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
- '"187.158.96.163" es la de mi casa
- 'If (Context.Session("UsuarioSIG") IsNot Nothing) OrElse Not User.Identity.IsAuthenticated Then
- 'Request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJOb21icmUiOiJhZG1pbiIsIkN2ZVVzdWFyaW8iOiIyMDA5IiwiQ3ZlRW1wcmVzYSI6IjIiLCJDdmVQZXJmaWwiOiIyIiwiTWFpbCI6ImFkbWluQGFkbWluLmNvbSIsImV4cCI6MTU5NDY3MzQ2NCwiaXNzIjoiVGVzdC5jb20iLCJhdWQiOiJUZXN0LmNvbSJ9.vmPRxGfxzR10Rf-4Luk2Ej0SVs7w2XGDGJBCyx5VSQI")
- 'Response.AddHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJOb21icmUiOiJhZG1pbiIsIkN2ZVVzdWFyaW8iOiIyMDA5IiwiQ3ZlRW1wcmVzYSI6IjIiLCJDdmVQZXJmaWwiOiIyIiwiTWFpbCI6ImFkbWluQGFkbWluLmNvbSIsImV4cCI6MTU5NDY3MzQ2NCwiaXNzIjoiVGVzdC5jb20iLCJhdWQiOiJUZXN0LmNvbSJ9.vmPRxGfxzR10Rf-4Luk2Ej0SVs7w2XGDGJBCyx5VSQI")
- 'Response.End()
- 'End If
+
Dim iplist As String() = New String() {"", ""}
If HttpContext.Current.Request.ServerVariables("REMOTE_ADDR").ToString().Contiene(iplist) Then
Response.Redirect("http://www.adsistemas.mx/login.aspx") 'si alguien lo ve es correcto la pagina vieja de adsistemas
End If
+
+
+ 'leer un txt para validar una ip
Dim token As String = GetTokenAngular()
If (token.Length > 0) Then
If Not IsNothing(Request("port")) Then
@@ -92,7 +90,22 @@ Partial Class LogIn
PnlLoginB.CssClass = "logincint login-form "
PnlContraB.CssClass = "logincint login-form "
lnkFavicon.Href = "/Imagenes/favicongps.ico"
- Else
+ End If
+
+ Dim clientIp As String = (If(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),
+ Request.ServerVariables("REMOTE_ADDR"))).Split(","c)(0).Trim()
+ ' Ruta del archivo con las IP bloqueadas
+ Dim path As String = Server.MapPath("/Utilerias/IPBloqueadas.txt")
+
+ If System.IO.File.Exists(path) Then
+ ' Leer el contenido del archivo y separarlo por ";"
+ Dim contenido As String = System.IO.File.ReadAllText(path)
+ Dim ipBloqueadas As String() = contenido.Split(";"c)
+ ' Verificar si la IP está en la lista
+ If ipBloqueadas.Any(Function(ip) ip.Trim() = clientIp) Then
+ Alert(" this site can't be reached
refused to connect.
ERR_CONNECTION_REFUSED
", TipoMensaje.MsgError)
+ BtnLogIn.Visible = False
+ End If
End If
HdfImagenes.Value = strimg.ToString()
diff --git a/Ventas/PVCobranza.aspx b/Ventas/PVCobranza.aspx
index 199a92d47..6e138db07 100644
--- a/Ventas/PVCobranza.aspx
+++ b/Ventas/PVCobranza.aspx
@@ -1239,8 +1239,7 @@
" style="display: inline-block; margin-right: -20px; width: 150px;" />
" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
-
-
+
Total:
diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb
index 63bc511e8..cab85a831 100644
--- a/Ventas/PVCobranza.aspx.vb
+++ b/Ventas/PVCobranza.aspx.vb
@@ -520,7 +520,7 @@ Partial Class Ventas_PVCobranza
HdnVentaCondicionesPago.Value = GvRow.DataKey("CondicionesPago")
HdnPlazoCobranza.Value = GvRow.DataKey("PlazoCobranza")
- If UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197) AndAlso GvRow.DataKey("TipoDocto") = "Rem" Then
+ If UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197) AndAlso GvRow.DataKey("TipoDocto").Contiene("Rem", "Ant") Then
DivAnticipo.Visible = True
ImgAntiPend.Visible = True
End If
@@ -2254,43 +2254,32 @@ Partial Class Ventas_PVCobranza
Protected Sub ImgAntiPend_Click(sender As Object, e As EventArgs)
- Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero()
-
- 'If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
- ' If DdlTipoAmortizacionAnticipo.Items.FindByValue("4") Is Nothing Then
- ' DdlTipoAmortizacionAnticipo.Items.Insert(1, New ListItem("Pago con devolución", "4"))
- ' End If
- ' DdlTipoAmortizacionAnticipo.SelectedValueExist("4")
-
- ' DdlTipoRelacionAnticipo.SelectedValueExist("-1")
-
- ' divAmortizacionTipoRelacion.Visible = False
-
- ' DdlTipoAmortizacionAnticipo_SelectedIndexChanged(DdlTipoAmortizacionAnticipo, EventArgs.Empty)
- 'End If
+ VerificaCargaAnticipo()
+ UpAnticipos.Update()
+ RegistraScript("$('#DivAnticipos').modal();", "AE")
+ End Sub
+ Private Sub VerificaCargaAnticipo()
+ Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero()
Dim DbRowVenta As DataRow = Nothing
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
End If
ObjVentas.Dispose()
-
+ Dim tTipoDocto As String
If DbRowVenta IsNot Nothing Then
CveCliente = DbRowVenta("CveCliente").ToString().ToEntero()
CveVendedor = DbRowVenta("CveVendedor").ToString().ToEntero()
+ tTipoDocto = DbRowVenta("TipoDocto").ToString()
End If
If CveCliente > 0 Then
- CargaAnticipos(CveCliente)
+ CargaAnticipos(CveCliente, tTipoDocto)
End If
-
- UpAnticipos.Update()
-
- RegistraScript("$('#DivAnticipos').modal();", "AE")
End Sub
- Private Sub CargaAnticipos(CveCliente As Integer)
+ Private Sub CargaAnticipos(CveCliente As Integer, TipoDocto As String)
If CveCliente > 0 Then
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then
@@ -2298,48 +2287,34 @@ Partial Class Ventas_PVCobranza
End If
ObjMovtos.Dispose()
+ Dim TipoAnticipo As String = "'NC','IxC','Ant'"
+ If TipoDocto = "Ant" Then TipoAnticipo = " 'IxC' "
+
If Me.TmpDTAnticiposNCIxCCliente IsNot Nothing Then
- GVAnticipos.DataSource = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"ISTotal = 0 AND Saldo > 0 AND Tipo IN('NC','IxC','Ant') ")
- Else
- GVAnticipos.DataSource = Nothing
+ GVAnticipos.DataSource = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"ISTotal = 0 AND Saldo > 0 AND Tipo IN ({TipoAnticipo}) ")
+ Else
+ GVAnticipos.DataSource = Nothing
+ End If
+
+ GVAnticipos.Columns(5).Visible = False
+ GVAnticipos.Columns(9).Visible = False
+
+ If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
+ GVAnticipos.Columns(7).Visible = True
+ End If
+
+ GVAnticipos.DataBind()
+
+ If ListaAnticiposAplicados IsNot Nothing Then
+ ListaAnticiposAplicados.Clear()
+ End If
+ TxtNCDev.Text = "0.00"
End If
-
- GVAnticipos.Columns(5).Visible = False
- GVAnticipos.Columns(9).Visible = False
-
- If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
- GVAnticipos.Columns(7).Visible = True
- End If
-
- GVAnticipos.DataBind()
-
- If ListaAnticiposAplicados IsNot Nothing Then
- ListaAnticiposAplicados.Clear()
- End If
- TxtNCDev.Text = "0.00"
- End If
- UpAnticipos.Update()
+ UpAnticipos.Update()
End Sub
Protected Sub LnkRecargaAnticipos_Click(sender As Object, e As EventArgs)
- Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero()
-
- If CveCliente <= 0 Then
- Dim DbRowVenta As DataRow = Nothing
- Dim ObjVentas As New ClsVentas
- If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
- DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
- End If
- ObjVentas.Dispose()
-
- If DbRowVenta IsNot Nothing Then
- CveCliente = DbRowVenta("CveCliente").ToString().ToEntero()
- End If
- End If
-
- If CveCliente > 0 Then
- CargaAnticipos(CveCliente)
- End If
+ VerificaCargaAnticipo()
End Sub
Protected Sub LnkSolicitarActivarAnticipo_Click(sender As Object, e As EventArgs)