Filtro por tipo docto en historial de ventas
This commit is contained in:
@@ -519,13 +519,14 @@ Public Class ClsClientes
|
||||
'SqlAdapter.Dispose()
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function GetHistorialVentas(CveCliente As Integer, Optional SelectTop As Integer = -1, Optional CveClienteSucursal As Integer = -1) As Boolean
|
||||
Public Function GetHistorialVentas(CveCliente As Integer, Optional SelectTop As Integer = -1, Optional CveClienteSucursal As Integer = -1, Optional TipoDocto As String = "-1") As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_ClienteHistorialVentas")
|
||||
SqlAdapter.SelectCommand.Parameters.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
|
||||
SqlAdapter.SelectCommand.Parameters.Add("@SelectTop", SqlDbType.Int).Value = SelectTop
|
||||
SqlAdapter.SelectCommand.Parameters.Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal
|
||||
SqlAdapter.SelectCommand.Parameters.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
@@ -1698,9 +1698,9 @@ Partial Class Clientes
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Private Sub CargaHistorial(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1)
|
||||
Private Sub CargaHistorial(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1, Optional TipoDocto As String = "-1")
|
||||
Dim ObjClientes As New ClsClientes()
|
||||
If ObjClientes.GetHistorialVentas(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then
|
||||
If ObjClientes.GetHistorialVentas(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, TipoDocto:=TipoDocto) Then
|
||||
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
||||
'Carga Generales
|
||||
LtlCantidad.Text = ObjClientes.DtResultados.Rows(0)("CountTotal").ToString.FormatoNumero(0)
|
||||
@@ -1894,10 +1894,10 @@ Partial Class Clientes
|
||||
|
||||
Protected Sub BtnVerMasVentas_Click(sender As Object, e As EventArgs)
|
||||
If BtnVerMasVentas.Text = "Ver Más" Then
|
||||
CargaHistorial(-1)
|
||||
CargaHistorial(-1, TipoDocto:=RblTipo.SelectedValue)
|
||||
BtnVerMasVentas.Text = "Ver Menos"
|
||||
Else
|
||||
CargaHistorial(21)
|
||||
CargaHistorial(21, TipoDocto:=RblTipo.SelectedValue)
|
||||
BtnVerMasVentas.Text = "Ver Más"
|
||||
End If
|
||||
End Sub
|
||||
@@ -5426,26 +5426,7 @@ Partial Class Clientes
|
||||
|
||||
#Region "M E T O D O S "
|
||||
Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipo.SelectedIndexChanged
|
||||
If DTHistorialVentas IsNot Nothing AndAlso RblTipo.SelectedValue <> "-1" Then
|
||||
|
||||
Dim tmp As DataTable = DTHistorialVentas.FiltraParametros($"TipoDocto = '{RblTipo.SelectedValue}'")
|
||||
If tmp.Rows.Count > 0 Then
|
||||
Dim Totales As DataRow = tmp.NewRow
|
||||
Totales("SubTotal") = tmp.SUM("SubTotal")
|
||||
Totales("Total") = tmp.SUM("Total")
|
||||
Totales("Descuento") = tmp.SUM("Descuento")
|
||||
Totales("Amortizacion") = tmp.SUM("Amortizacion")
|
||||
Totales("MAX_Total") = tmp.MAX("MAX_Total")
|
||||
Totales("AVG_Total") = tmp.AVG("AVG_Total")
|
||||
Totales("MIN_Total") = tmp.MIN("MIN_Total")
|
||||
Totales("CountTotal") = tmp.COUNT("CountTotal")
|
||||
tmp.Rows.InsertAt(Totales, 0)
|
||||
End If
|
||||
GVHistorial.DataSource = tmp
|
||||
ElseIf DTHistorialVentas IsNot Nothing AndAlso RblTipo.SelectedValue = "-1" Then
|
||||
GVHistorial.DataSource = DTHistorialVentas
|
||||
End If
|
||||
GVHistorial.DataBind()
|
||||
CargaHistorial(TipoDocto:=RblTipo.SelectedValue)
|
||||
End Sub
|
||||
Private Sub DdlSucursalCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSucursalCliente.SelectedIndexChanged
|
||||
CargaCotizaciones(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo
|
||||
|
||||
Reference in New Issue
Block a user