--SMS-- Actualizacion de multiples listas de precios, limitado a 15
This commit is contained in:
@@ -8,7 +8,16 @@ Imports Extensiones
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Partial Class Ventas_ActualizarPrecios
|
||||
Inherits ClsPaginas
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property DtListasPrecios As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DtListasPrecios")), Nothing, CType(ViewState("DtListasPrecios"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtListasPrecios") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtSubProyectos As DataTable
|
||||
Get
|
||||
@@ -78,6 +87,10 @@ Partial Class Ventas_ActualizarPrecios
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
If UsuarioActual.CveEmpresa = 186 Then
|
||||
LblModalidad.Visible = True
|
||||
DivModalidad.Visible = True
|
||||
End If
|
||||
CargaCombos()
|
||||
End If
|
||||
End Sub
|
||||
@@ -99,12 +112,15 @@ Partial Class Ventas_ActualizarPrecios
|
||||
|
||||
DdlPrecioLista.Items.Clear()
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'si manneja precios de lista
|
||||
If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'si manneja precios de lista
|
||||
|
||||
Dim ObjVta As New ClsVentas
|
||||
Dim primerItem As String = ""
|
||||
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
|
||||
DdlPrecioLista.DataSource = ObjVta.DtResultados.Copy()
|
||||
DdlPrecioListaCarga.DataSource = ObjVta.DtResultados.Copy()
|
||||
DtListasPrecios = ObjVta.DtResultados.Copy()
|
||||
DdlPrecioLista.DataSource = DtListasPrecios
|
||||
DdlPrecioListaCarga.DataSource = DtListasPrecios
|
||||
DdlMultiplePrecioLista.DataSource = DtListasPrecios
|
||||
primerItem = ObjVta.DtResultados.FiltroPrimeroValor("CvePrecioLista")
|
||||
End If
|
||||
ObjVta.Dispose()
|
||||
@@ -112,6 +128,19 @@ Partial Class Ventas_ActualizarPrecios
|
||||
|
||||
DdlPrecioLista.DataBind()
|
||||
DdlPrecioListaCarga.DataBind()
|
||||
DdlMultiplePrecioLista.DataBind()
|
||||
|
||||
Dim SeleccionMaxima As Integer = 14
|
||||
If (DtListasPrecios.Rows.Count - 1) < 14 Then
|
||||
SeleccionMaxima = DtListasPrecios.Rows.Count - 1
|
||||
End If
|
||||
|
||||
Dim sbMultiple As New StringBuilder
|
||||
For Each Row As DataRow In DtListasPrecios.FiltraPorIndices(0, SeleccionMaxima).Rows
|
||||
sbMultiple.AppendFormat("{0},", Row("CvePrecioLista"))
|
||||
Next
|
||||
|
||||
DdlMultiplePrecioLista.SelectedValuesIfExistM(sbMultiple.ToString(), True)
|
||||
|
||||
If (DdlPrecioLista.Items.Count = 1) Then
|
||||
DdlPrecioLista.Items.FindByValue(primerItem).Selected = True
|
||||
@@ -158,7 +187,7 @@ Partial Class Ventas_ActualizarPrecios
|
||||
DdlMarca.DataBind()
|
||||
|
||||
LblMarca.Visible = True
|
||||
DdlMarca.Visible = True
|
||||
DivMarca.Visible = True
|
||||
End If
|
||||
|
||||
DdlMarca.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
@@ -166,7 +195,7 @@ Partial Class Ventas_ActualizarPrecios
|
||||
Private Sub CargarModelos()
|
||||
If UsuarioActual.Empresa.Funcionalidad(558).ToString = "1" Then
|
||||
lblModelo.Visible = True
|
||||
DdlModelo.Visible = True
|
||||
DivModelo.Visible = True
|
||||
Dim ObjGeneral As New ClsGenerales
|
||||
If ObjGeneral.GetModelos(UsuarioActual.CveEmpresa) Then
|
||||
DdlModelo.DataSource = ObjGeneral.DtResultados
|
||||
@@ -217,8 +246,11 @@ Partial Class Ventas_ActualizarPrecios
|
||||
|
||||
'MULTIPLE LISTAS DE PRECIO
|
||||
If DdlModalidad.SelectedValue = "2" Then
|
||||
|
||||
Dim ListasPrecios As String = If(DdlMultiplePrecioLista.GetSelectedValuesM = "", "-1", DdlMultiplePrecioLista.GetSelectedValuesM)
|
||||
|
||||
Dim objPS As New ClsProductosServicios
|
||||
If objPS.GetPSMultiplesPreciosLista(UsuarioActual.CveEmpresa, CveClasificacion:=DDlClasificacion.SelectedValue.ToEntero, CvePS:=CvePS,
|
||||
If objPS.GetPSMultiplesPreciosLista(UsuarioActual.CveEmpresa, ListasPrecios:=ListasPrecios, CveClasificacion:=DDlClasificacion.SelectedValue.ToEntero, CvePS:=CvePS,
|
||||
CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero) Then
|
||||
DtPreciosMultiple = objPS.DtResultados.Copy()
|
||||
GvMultiple.DataSource = DtPreciosMultiple
|
||||
@@ -229,6 +261,14 @@ Partial Class Ventas_ActualizarPrecios
|
||||
dvMultiple.Visible = True
|
||||
DivActualizarPrecio.Visible = False
|
||||
|
||||
For colIndex = 2 To GvMultiple.Columns.Count - 1
|
||||
If colIndex <= DtPreciosMultiple.Columns.Count - 1 Then
|
||||
GvMultiple.Columns(colIndex).Visible = True
|
||||
Else
|
||||
GvMultiple.Columns(colIndex).Visible = False
|
||||
End If
|
||||
Next
|
||||
|
||||
GvMultiple.DataBind()
|
||||
End If
|
||||
|
||||
@@ -779,42 +819,76 @@ Partial Class Ventas_ActualizarPrecios
|
||||
End Sub
|
||||
Protected Sub GvMultiple_RowCreated(sender As Object, e As GridViewRowEventArgs)
|
||||
'QUITAR COLUMNA "CvePS"
|
||||
e.Row.Cells(1).Visible = False
|
||||
'e.Row.Cells(1).Visible = False
|
||||
|
||||
'If e.Row.RowType = DataControlRowType.Header Then
|
||||
' For colIndex = 2 To e.Row.Cells.Count - 1
|
||||
|
||||
' Dim indiceColumna As Integer = (colIndex)
|
||||
' Dim LtlId = "LtlLista" + (colIndex - 1).ToString()
|
||||
' Dim Dr = DtPreciosMultiple.Rows(e.Row.RowIndex)
|
||||
' If Dr IsNot Nothing Then
|
||||
' 'VERIFICA QUE EL INDICE DE LA COLUMNA DEL DT NO SEA MAYOR A LA DEL GRIDVIEW
|
||||
' If indiceColumna <= DtPreciosMultiple.Columns.Count - 1 Then
|
||||
' Dim cell = e.Row.Cells(colIndex)
|
||||
|
||||
' Dim text = cell.Text
|
||||
' Dim splitValues = text.Split("|"c)
|
||||
|
||||
' If splitValues.Length > 1 Then
|
||||
' Dim CvePrecioLista = splitValues(0)
|
||||
' Dim PrecioLista = splitValues(1)
|
||||
' e.Row.FCLiteral(LtlId).Text = PrecioLista
|
||||
' cell.Attributes.Add("cvepreciolista", CvePrecioLista)
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
' Next
|
||||
'End If
|
||||
End Sub
|
||||
Protected Sub GvMultiple_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.Header Then
|
||||
For index = 0 To e.Row.Cells.Count - 1
|
||||
Dim cell = e.Row.Cells(index)
|
||||
For colIndex = 2 To e.Row.Cells.Count - 1
|
||||
|
||||
Dim text = cell.Text
|
||||
Dim indiceColumna As Integer = (colIndex)
|
||||
Dim LtlId = "LtlLista_" + (colIndex - 1).ToString()
|
||||
|
||||
Dim splitValues = text.Split("|"c)
|
||||
If indiceColumna <= DtPreciosMultiple.Columns.Count - 1 Then
|
||||
|
||||
If splitValues.Length > 1 Then
|
||||
Dim CvePrecioLista = splitValues(0)
|
||||
Dim PrecioLista = splitValues(1)
|
||||
Dim text = DtPreciosMultiple.Columns(indiceColumna).ColumnName
|
||||
Dim splitValues = text.Split("|"c)
|
||||
|
||||
If splitValues.Length > 1 Then
|
||||
Dim CvePrecioLista = splitValues(0)
|
||||
Dim PrecioLista = splitValues(1)
|
||||
e.Row.FCLabel(LtlId).Text = PrecioLista
|
||||
e.Row.FCLabel(LtlId).Attributes.Add("cvepreciolista", CvePrecioLista)
|
||||
End If
|
||||
|
||||
cell.Text = PrecioLista
|
||||
cell.Attributes.Add("cvepreciolista", CvePrecioLista)
|
||||
End If
|
||||
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvMultiple_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
For index = 3 To e.Row.Cells.Count - 1
|
||||
Dim valor = e.Row.Cells(index).Text.ToDecimal()
|
||||
For colIndex = 2 To e.Row.Cells.Count - 1
|
||||
|
||||
Dim CvePS = DtPreciosMultiple.Rows(e.Row.RowIndex)("CvePS").ToString()
|
||||
Dim indiceColumna As Integer = (colIndex)
|
||||
Dim TxtId = "TxtPrecio_" + (colIndex - 1).ToString()
|
||||
Dim Dr = DtPreciosMultiple.Rows(e.Row.RowIndex)
|
||||
If Dr IsNot Nothing Then
|
||||
|
||||
Dim idTxt = "txt" + CvePS + "_" + index.ToString()
|
||||
'VERIFICA QUE EL INDICE DE LA COLUMNA DEL DT NO SEA MAYOR A LA DEL GRIDVIEW
|
||||
If indiceColumna <= DtPreciosMultiple.Columns.Count - 1 Then
|
||||
Dim Valor = DtPreciosMultiple.Rows(e.Row.RowIndex)(indiceColumna).ToString().ToDecimal()
|
||||
|
||||
e.Row.Cells(index).EnableViewState = True
|
||||
e.Row.Cells(index).ViewStateMode = ViewStateMode.Enabled
|
||||
e.Row.FCTextBox(TxtId).Text = Valor.FormatoNumero(2)
|
||||
End If
|
||||
|
||||
Dim textBox = New TextBox() With {.ID = idTxt, .Text = valor.FormatoNumero(2), .Width = 100, .AutoCompleteType = AutoCompleteType.Disabled}
|
||||
|
||||
e.Row.Cells(index).Controls.Add(textBox)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
@@ -824,29 +898,30 @@ Partial Class Ventas_ActualizarPrecios
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
ObjPS.IniciaTransacSQL()
|
||||
Try
|
||||
For Each row As GridViewRow In GvMultiple.Rows
|
||||
For Each GvRow As GridViewRow In GvMultiple.Rows
|
||||
|
||||
If row.FCCheckBox("chkPS").Checked Then
|
||||
For index = 3 To row.Cells.Count - 1
|
||||
Dim cell = row.Cells(index)
|
||||
If GvRow.FCCheckBox("chkPS").Checked Then
|
||||
For colIndex = 2 To GvRow.Cells.Count - 1
|
||||
|
||||
Dim valor = cell.Text.ToDecimal()
|
||||
Dim indiceColumna As Integer = (colIndex)
|
||||
|
||||
Dim CvePS = DtPreciosMultiple.Rows(row.RowIndex)("CvePS").ToString().ToEntero()
|
||||
Dim LtlId = "LtlLista_" + (colIndex - 1).ToString()
|
||||
Dim TxtId = "TxtPrecio_" + (colIndex - 1).ToString()
|
||||
|
||||
Dim CvePrecioLista = GvMultiple.HeaderRow.Cells(index).Attributes("cvepreciolista").ToEntero()
|
||||
If indiceColumna <= DtPreciosMultiple.Columns.Count - 1 Then
|
||||
|
||||
Dim idTxt = "txt" + CvePS.ToString() + "_" + index.ToString()
|
||||
Dim CvePrecioLista As Integer = GvMultiple.HeaderRow.FCLabel(LtlId).Attributes().Item("cvepreciolista").ToEntero()
|
||||
Dim CvePS = DtPreciosMultiple.Rows(GvRow.RowIndex)("CvePS").ToString().ToEntero()
|
||||
|
||||
Dim TxtPrecio = cell.Controls.Cast(Of Control).First(Function(x) x.ID = idTxt)
|
||||
Dim Precio = GvRow.FCTextBox(TxtId).Text.ToDecimal()
|
||||
|
||||
Dim Precio As Decimal = DirectCast(TxtPrecio, TextBox).Text.ToDecimal()
|
||||
TieneError = Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLista, 0, CvePS, UsuarioActual.CveUsuario, NowADS(), True)
|
||||
|
||||
TieneError = Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLista, 0, CvePS, UsuarioActual.CveUsuario, NowADS(), True)
|
||||
|
||||
If TieneError Then
|
||||
Exit For
|
||||
If TieneError Then
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
@@ -876,4 +951,23 @@ Partial Class Ventas_ActualizarPrecios
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Sub DdlModalidad_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
DivPrecioLista.Visible = DdlModalidad.SelectedValue = "1"
|
||||
DivMultiplePrecioLista.Visible = DdlModalidad.SelectedValue = "2"
|
||||
|
||||
|
||||
Dim SeleccionMaxima As Integer = 14
|
||||
If (DtListasPrecios.Rows.Count - 1) < 14 Then
|
||||
SeleccionMaxima = DtListasPrecios.Rows.Count - 1
|
||||
End If
|
||||
|
||||
Dim sbMultiple As New StringBuilder
|
||||
For Each Row As DataRow In DtListasPrecios.FiltraPorIndices(0, SeleccionMaxima).Rows
|
||||
sbMultiple.AppendFormat("{0},", Row("CvePrecioLista"))
|
||||
Next
|
||||
|
||||
DdlMultiplePrecioLista.SelectedValuesIfExistM(sbMultiple.ToString(), True)
|
||||
|
||||
UpEncabezado.Update()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user