--definicion de tablas para multiples listas de precios en actualizarprecios.aspx
This commit is contained in:
@@ -26,6 +26,15 @@ Partial Class Ventas_ActualizarPrecios
|
||||
Set(value As DataTable)
|
||||
ViewState("DtDatosPrecios") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtPreciosMultiple As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DtPreciosMultiple")), Nothing, CType(ViewState("DtPreciosMultiple"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtPreciosMultiple") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CveSucursal As Integer
|
||||
@@ -169,7 +178,7 @@ Partial Class Ventas_ActualizarPrecios
|
||||
|
||||
End Sub
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
Dim objPS As New ClsProductosServicios
|
||||
|
||||
Dim CveProveedor As Integer = -1
|
||||
Dim CvePS As Integer = -1
|
||||
Dim Marcas As String = If(DdlMarca.GetSelectedValuesM = "", "-1", DdlMarca.GetSelectedValuesM)
|
||||
@@ -180,28 +189,53 @@ Partial Class Ventas_ActualizarPrecios
|
||||
|
||||
If DdlProveedor.txtValue.Value.ToEntero > 0 Then
|
||||
CveProveedor = DdlProveedor.txtValue.Value.ToEntero
|
||||
End If
|
||||
|
||||
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, DdlPrecioLista.SelectedValue.ToEntero, DDlClasificacion.SelectedValue.ToEntero, CvePS,
|
||||
CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero) Then
|
||||
DtDatosPrecios = objPS.DtResultados
|
||||
GVPrecios.DataSource = DtDatosPrecios
|
||||
End If
|
||||
objPS.Dispose()
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores
|
||||
GVPrecios.Columns(2).Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa = 153 Then 'Empresa servec
|
||||
GVPrecios.Columns(11).Visible = True
|
||||
End If
|
||||
'POR LISTA DE PRECIO
|
||||
If DdlModalidad.SelectedValue = "1" Then
|
||||
Dim objPS As New ClsProductosServicios
|
||||
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, DdlPrecioLista.SelectedValue.ToEntero, DDlClasificacion.SelectedValue.ToEntero, CvePS,
|
||||
CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero) Then
|
||||
DtDatosPrecios = objPS.DtResultados
|
||||
GVPrecios.DataSource = DtDatosPrecios
|
||||
End If
|
||||
objPS.Dispose()
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores
|
||||
GVPrecios.Columns(2).Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa = 153 Then 'Empresa servec
|
||||
GVPrecios.Columns(11).Visible = True
|
||||
End If
|
||||
|
||||
dvDatos.Visible = True
|
||||
dvMultiple.Visible = False
|
||||
DivActualizarPrecio.Visible = True
|
||||
GVPrecios.DataBind()
|
||||
End If
|
||||
|
||||
'MULTIPLE LISTAS DE PRECIO
|
||||
If DdlModalidad.SelectedValue = "2" Then
|
||||
Dim objPS As New ClsProductosServicios
|
||||
If objPS.GetPSMultiplesPreciosLista(UsuarioActual.CveEmpresa, 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
|
||||
End If
|
||||
objPS.Dispose()
|
||||
|
||||
dvDatos.Visible = False
|
||||
dvMultiple.Visible = True
|
||||
DivActualizarPrecio.Visible = False
|
||||
|
||||
GvMultiple.DataBind()
|
||||
End If
|
||||
|
||||
dvDatos.Visible = True
|
||||
GVPrecios.DataBind()
|
||||
|
||||
UpDescargar.Update()
|
||||
UpDatos.Update()
|
||||
UPPrecioLista.Update()
|
||||
End Sub
|
||||
Protected Sub DDlClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CargaPS()
|
||||
@@ -743,4 +777,103 @@ Partial Class Ventas_ActualizarPrecios
|
||||
FileExcel.Save(Response, "Precios.xlsx", SaveOptions.XlsxDefault)
|
||||
|
||||
End Sub
|
||||
Protected Sub GvMultiple_RowCreated(sender As Object, e As GridViewRowEventArgs)
|
||||
'QUITAR COLUMNA "CvePS"
|
||||
e.Row.Cells(1).Visible = False
|
||||
|
||||
If e.Row.RowType = DataControlRowType.Header Then
|
||||
For index = 0 To e.Row.Cells.Count - 1
|
||||
Dim cell = e.Row.Cells(index)
|
||||
|
||||
Dim text = cell.Text
|
||||
|
||||
Dim splitValues = text.Split("|"c)
|
||||
|
||||
If splitValues.Length > 1 Then
|
||||
Dim CvePrecioLista = splitValues(0)
|
||||
Dim PrecioLista = splitValues(1)
|
||||
|
||||
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()
|
||||
|
||||
Dim CvePS = DtPreciosMultiple.Rows(e.Row.RowIndex)("CvePS").ToString()
|
||||
|
||||
Dim idTxt = "txt" + CvePS + "_" + index.ToString()
|
||||
|
||||
e.Row.Cells(index).EnableViewState = True
|
||||
e.Row.Cells(index).ViewStateMode = ViewStateMode.Enabled
|
||||
|
||||
Dim textBox = New TextBox() With {.ID = idTxt, .Text = valor.FormatoNumero(2), .Width = 100, .AutoCompleteType = AutoCompleteType.Disabled}
|
||||
|
||||
e.Row.Cells(index).Controls.Add(textBox)
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub LnkGuardarMultiple_Click(sender As Object, e As EventArgs)
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
ObjPS.IniciaTransacSQL()
|
||||
Try
|
||||
For Each row As GridViewRow In GvMultiple.Rows
|
||||
|
||||
If row.FCCheckBox("chkPS").Checked Then
|
||||
For index = 3 To row.Cells.Count - 1
|
||||
Dim cell = row.Cells(index)
|
||||
|
||||
Dim valor = cell.Text.ToDecimal()
|
||||
|
||||
Dim CvePS = DtPreciosMultiple.Rows(row.RowIndex)("CvePS").ToString().ToEntero()
|
||||
|
||||
Dim CvePrecioLista = GvMultiple.HeaderRow.Cells(index).Attributes("cvepreciolista").ToEntero()
|
||||
|
||||
Dim idTxt = "txt" + CvePS.ToString() + "_" + index.ToString()
|
||||
|
||||
Dim TxtPrecio = cell.Controls.Cast(Of Control).First(Function(x) x.ID = idTxt)
|
||||
|
||||
Dim Precio As Decimal = DirectCast(TxtPrecio, TextBox).Text.ToDecimal()
|
||||
|
||||
TieneError = Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLista, 0, CvePS, UsuarioActual.CveUsuario, NowADS(), True)
|
||||
|
||||
If TieneError Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Next
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al actualizar precios", ex)
|
||||
TieneError = True
|
||||
End Try
|
||||
|
||||
|
||||
If Not TieneError Then
|
||||
Alert("Los Precios de lista de los Productos/Servicios se actualizaron correctamente")
|
||||
Else
|
||||
Alert("Ocurrió un error al actualizar precios", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
If TieneError Then
|
||||
ObjPS.RollBack()
|
||||
Else
|
||||
ObjPS.Commit()
|
||||
End If
|
||||
|
||||
ObjPS.Dispose()
|
||||
|
||||
If Not TieneError Then
|
||||
BtnConsultar_Click(Nothing, Nothing)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user