--SMS-- Actualizacion de multiples listas de precios, limitado a 15

This commit is contained in:
2023-12-08 19:18:41 -07:00
parent a741e55c63
commit b956f99c64
3 changed files with 287 additions and 66 deletions

View File

@@ -1811,12 +1811,13 @@ Public Class ClsProductosServicios
Return Retorno Return Retorno
End Function End Function
Public Function GetPSMultiplesPreciosLista(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional CvePS As Integer = -1, Public Function GetPSMultiplesPreciosLista(CveEmpresa As Integer, Optional ListasPrecios As String = "-1", Optional CveClasificacion As Integer = -1, Optional CvePS As Integer = -1,
Optional CveProveedor As Integer = -1, Optional Estado As Integer = -1, Optional Marcas As String = "-1", Optional CveModelo As Integer = -1) As Boolean Optional CveProveedor As Integer = -1, Optional Estado As Integer = -1, Optional Marcas As String = "-1", Optional CveModelo As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PSPrecioListaMultipleGet") DataAdapter("PA_Vta_PSPrecioListaMultipleGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@ListasPrecios", SqlDbType.VarChar).Value = ListasPrecios
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
.Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor

View File

@@ -42,52 +42,57 @@
</div> </div>
<div class="titlefiltros caption "> <div class="titlefiltros caption ">
<div class="row v-center"> <div class="row v-center">
<label class="col-md-1 v-center truncate" runat="server" visible="false">Modalidad:</label> <label class="col-md-1 v-center truncate" runat="server" id="LblModalidad" visible="false" style="width: 80px;">Modalidad:</label>
<div class="col-md-1 v-center" runat="server" visible="false"> <div class="col-md-2 v-center" runat="server" id="DivModalidad" visible="false">
<asp:DropDownList ID="DdlModalidad" runat="server" AppendDataBoundItems="true" Width="100%" CssClass="select2me"> <asp:DropDownList ID="DdlModalidad" runat="server" AppendDataBoundItems="true" Width="100%" CssClass="select2me" AutoPostBack="true" OnSelectedIndexChanged="DdlModalidad_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="1" Text="Por lista de precio"></asp:ListItem> <asp:ListItem Selected="True" Value="1" Text="Por lista de precio"></asp:ListItem>
<asp:ListItem Value="2" Text="Multiples listas de precio"></asp:ListItem> <asp:ListItem Value="2" Text="Multiples listas de precio"></asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
</div> </div>
<label class="col-md-1 v-center truncate">Precio de Lista:</label> <label class="col-md-1 v-center truncate" style="width: 80px;">PS:</label>
<div class="col-md-1 v-center"> <div class="col-md-2 v-center">
<asp:DropDownList ID="DdlPrecioLista" runat="server" AppendDataBoundItems="true" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista"></asp:DropDownList> <ADS:Dropdownlost ID="DDlPs" AutoPostBack="false" runat="server" DataTextField="PSCodigo" DataValueField="CvePS" CssClassDdl="select2me" CssStyle="width:250px;"></ADS:Dropdownlost>
</div> </div>
<label class="col-md-1 v-center truncate">Clasificación:</label> <label class="col-md-1 v-center truncate">Clasificación:</label>
<div class="col-md-1 v-center"> <div class="col-md-2 v-center">
<asp:DropDownList ID="DDlClasificacion" runat="server" Width="100%" CssClass="select2me" OnSelectedIndexChanged="DDlClasificacion_SelectedIndexChanged" AutoPostBack="True" DataValueField="CveClasificacion" DataTextField="Clasificacion"></asp:DropDownList> <asp:DropDownList ID="DDlClasificacion" runat="server" Width="100%" CssClass="select2me" OnSelectedIndexChanged="DDlClasificacion_SelectedIndexChanged" AutoPostBack="True" DataValueField="CveClasificacion" DataTextField="Clasificacion"></asp:DropDownList>
</div> </div>
<label class="col-md-1 v-center truncate">PS:</label> <label class="col-md-1 v-center truncate">Precio de Lista:</label>
<div class="col-md-2 v-center"> <div class="col-md-2 v-center" id="DivPrecioLista" runat="server">
<ADS:Dropdownlost ID="DDlPs" AutoPostBack="false" runat="server" DataTextField="PSCodigo" DataValueField="CvePS" CssClassDdl="select2me" CssStyle="width:200px;"></ADS:Dropdownlost> <asp:DropDownList ID="DdlPrecioLista" runat="server" AppendDataBoundItems="true" Width="220px" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista"></asp:DropDownList>
</div> </div>
<label id="LblMarca" runat="server" visible="false" class="col-md-1 v-center truncate">Marca:</label> <div class="col-md-2 v-center" id="DivMultiplePrecioLista" runat="server" visible="false">
<div class="col-md-9"> <asp:ListBox ID="DdlMultiplePrecioLista" runat="server" DataTextField="PrecioLista" DataValueField="CvePrecioLista" data-text="Todos" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width:200px; height: 50px !important;"></asp:ListBox>
<asp:ListBox ID="DdlMarca" Visible="false" runat="server" DataTextField="Marca" DataValueField="CveMarca" data-text="Todos" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width: 50%; height: 50px !important;"></asp:ListBox>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="portlet-body"> <div class="portlet-body">
<br /> <br />
<div class="row v-center"> <div class="row v-center">
<label class="col-md-1 v-center" id="LblProveedorCompra" runat="server" visible="false">Proveedor:</label> <label class="col-md-1 v-center truncate" style="width: 80px;">Estado:</label>
<div class="col-md-1 v-center" id="DivProveedorCompra" runat="server" visible="false"> <div class="col-md-2 v-center">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlProveedor" Width="100%" data-metodo="getproveedores" runat="server" DataTextField="RazonSocial" DataValueField="CveProveedor" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
<label class="col-md-1 v-center truncate">Estado:</label>
<div class="col-md-1 v-center">
<asp:DropDownList ID="DdlEstado" runat="server" Width="100%" CssClass="select2me"> <asp:DropDownList ID="DdlEstado" runat="server" Width="100%" CssClass="select2me">
<asp:ListItem Value="-1">Todos</asp:ListItem> <asp:ListItem Value="-1">Todos</asp:ListItem>
<asp:ListItem Value="1" Selected="True">Activos</asp:ListItem> <asp:ListItem Value="1" Selected="True">Activos</asp:ListItem>
<asp:ListItem Value="0">Incativos</asp:ListItem> <asp:ListItem Value="0">Incativos</asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
</div> </div>
<label id="LblMarca" runat="server" visible="false" class="col-md-1 v-center truncate" style="width: 80px;">Marca:</label>
<div class="col-md-2 v-center" id="DivMarca" runat="server" visible="false">
<asp:ListBox ID="DdlMarca" runat="server" DataTextField="Marca" DataValueField="CveMarca" data-text="Todos" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width:250px; height: 50px !important;"></asp:ListBox>
</div>
<label id="lblModelo" runat="server" class="col-md-1 v-center truncate" visible="false">Modelo:</label> <label id="lblModelo" runat="server" class="col-md-1 v-center truncate" visible="false">Modelo:</label>
<div class="col-md-1 v-center"> <div class="col-md-2 v-center" id="DivModelo" runat="server" visible="false">
<asp:DropDownList ID="DdlModelo" Visible="false" runat="server" Width="100%" CssClass="select2me" DataTextField="Modelo" DataValueField="CveModelo"> <asp:DropDownList ID="DdlModelo" runat="server" Width="100%" CssClass="select2me" DataTextField="Modelo" DataValueField="CveModelo">
</asp:DropDownList> </asp:DropDownList>
</div> </div>
<label class="col-md-1 v-center" id="LblProveedorCompra" runat="server" visible="false">Proveedor:</label>
<div class="col-md-2 v-center" id="DivProveedorCompra" runat="server" visible="false">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlProveedor" Width="100%" data-metodo="getproveedores" runat="server" DataTextField="RazonSocial" DataValueField="CveProveedor" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -238,7 +243,7 @@
</div> </div>
</div> </div>
<br /> <br />
<asp:GridView ID="GvMultiple" runat="server" GridLines="None" AutoGenerateColumns="true" ClientIDMode="Static" <asp:GridView ID="GvMultiple" runat="server" GridLines="None" ClientIDMode="Static" AutoGenerateColumns="false"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" EmptyDataText="No se encontraron registros" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" EmptyDataText="No se encontraron registros"
OnRowCreated="GvMultiple_RowCreated" OnRowDataBound="GvMultiple_RowDataBound"> OnRowCreated="GvMultiple_RowCreated" OnRowDataBound="GvMultiple_RowDataBound">
<Columns> <Columns>
@@ -247,6 +252,127 @@
<asp:CheckBox runat="server" ID="chkPS" /> <asp:CheckBox runat="server" ID="chkPS" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="CodigoPS" HeaderText="Producto/Servicio" />
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_1" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_1" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_2" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_2" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_3" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_3" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_4" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_4" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_5" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_5" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_6" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_6" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_7" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_7" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_8" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_8" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_9" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_9" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_10" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_10" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_11" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_11" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_12" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_12" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_13" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_13" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_14" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_14" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:Label ID="LtlLista_15" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio_15" runat="server" CssClass="CssCamviaPrecio" MaxLength="39" Width="90%" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
@@ -400,7 +526,7 @@
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script> <script>
function convertirTabla(){ function convertirTabla() {
let json = tableToJson($('#GvMultiple').get(0)); let json = tableToJson($('#GvMultiple').get(0));
} }

View File

@@ -10,6 +10,15 @@ Imports GemBox.Spreadsheet
Partial Class Ventas_ActualizarPrecios 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 Private Property DtSubProyectos As DataTable
Get Get
Return If(IsNothing(ViewState("DtSubProyectos")), Nothing, CType(ViewState("DtSubProyectos"), DataTable)) Return If(IsNothing(ViewState("DtSubProyectos")), Nothing, CType(ViewState("DtSubProyectos"), DataTable))
@@ -78,6 +87,10 @@ Partial Class Ventas_ActualizarPrecios
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
If UsuarioActual.CveEmpresa = 186 Then
LblModalidad.Visible = True
DivModalidad.Visible = True
End If
CargaCombos() CargaCombos()
End If End If
End Sub End Sub
@@ -100,11 +113,14 @@ Partial Class Ventas_ActualizarPrecios
DdlPrecioLista.Items.Clear() 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 ObjVta As New ClsVentas
Dim primerItem As String = "" Dim primerItem As String = ""
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
DdlPrecioLista.DataSource = ObjVta.DtResultados.Copy() DtListasPrecios = ObjVta.DtResultados.Copy()
DdlPrecioListaCarga.DataSource = ObjVta.DtResultados.Copy() DdlPrecioLista.DataSource = DtListasPrecios
DdlPrecioListaCarga.DataSource = DtListasPrecios
DdlMultiplePrecioLista.DataSource = DtListasPrecios
primerItem = ObjVta.DtResultados.FiltroPrimeroValor("CvePrecioLista") primerItem = ObjVta.DtResultados.FiltroPrimeroValor("CvePrecioLista")
End If End If
ObjVta.Dispose() ObjVta.Dispose()
@@ -112,6 +128,19 @@ Partial Class Ventas_ActualizarPrecios
DdlPrecioLista.DataBind() DdlPrecioLista.DataBind()
DdlPrecioListaCarga.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 If (DdlPrecioLista.Items.Count = 1) Then
DdlPrecioLista.Items.FindByValue(primerItem).Selected = True DdlPrecioLista.Items.FindByValue(primerItem).Selected = True
@@ -158,7 +187,7 @@ Partial Class Ventas_ActualizarPrecios
DdlMarca.DataBind() DdlMarca.DataBind()
LblMarca.Visible = True LblMarca.Visible = True
DdlMarca.Visible = True DivMarca.Visible = True
End If End If
DdlMarca.Items.Insert(0, New ListItem("Todos", "-1")) DdlMarca.Items.Insert(0, New ListItem("Todos", "-1"))
@@ -166,7 +195,7 @@ Partial Class Ventas_ActualizarPrecios
Private Sub CargarModelos() Private Sub CargarModelos()
If UsuarioActual.Empresa.Funcionalidad(558).ToString = "1" Then If UsuarioActual.Empresa.Funcionalidad(558).ToString = "1" Then
lblModelo.Visible = True lblModelo.Visible = True
DdlModelo.Visible = True DivModelo.Visible = True
Dim ObjGeneral As New ClsGenerales Dim ObjGeneral As New ClsGenerales
If ObjGeneral.GetModelos(UsuarioActual.CveEmpresa) Then If ObjGeneral.GetModelos(UsuarioActual.CveEmpresa) Then
DdlModelo.DataSource = ObjGeneral.DtResultados DdlModelo.DataSource = ObjGeneral.DtResultados
@@ -217,8 +246,11 @@ Partial Class Ventas_ActualizarPrecios
'MULTIPLE LISTAS DE PRECIO 'MULTIPLE LISTAS DE PRECIO
If DdlModalidad.SelectedValue = "2" Then If DdlModalidad.SelectedValue = "2" Then
Dim ListasPrecios As String = If(DdlMultiplePrecioLista.GetSelectedValuesM = "", "-1", DdlMultiplePrecioLista.GetSelectedValuesM)
Dim objPS As New ClsProductosServicios 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 CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero) Then
DtPreciosMultiple = objPS.DtResultados.Copy() DtPreciosMultiple = objPS.DtResultados.Copy()
GvMultiple.DataSource = DtPreciosMultiple GvMultiple.DataSource = DtPreciosMultiple
@@ -229,6 +261,14 @@ Partial Class Ventas_ActualizarPrecios
dvMultiple.Visible = True dvMultiple.Visible = True
DivActualizarPrecio.Visible = False 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() GvMultiple.DataBind()
End If End If
@@ -779,42 +819,76 @@ Partial Class Ventas_ActualizarPrecios
End Sub End Sub
Protected Sub GvMultiple_RowCreated(sender As Object, e As GridViewRowEventArgs) Protected Sub GvMultiple_RowCreated(sender As Object, e As GridViewRowEventArgs)
'QUITAR COLUMNA "CvePS" '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 If e.Row.RowType = DataControlRowType.Header Then
For index = 0 To e.Row.Cells.Count - 1 For colIndex = 2 To e.Row.Cells.Count - 1
Dim cell = e.Row.Cells(index)
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 text = DtPreciosMultiple.Columns(indiceColumna).ColumnName
Dim CvePrecioLista = splitValues(0) Dim splitValues = text.Split("|"c)
Dim PrecioLista = splitValues(1)
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 End If
Next Next
End If End If
End Sub
Protected Sub GvMultiple_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
For index = 3 To e.Row.Cells.Count - 1 For colIndex = 2 To e.Row.Cells.Count - 1
Dim valor = e.Row.Cells(index).Text.ToDecimal()
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.FCTextBox(TxtId).Text = Valor.FormatoNumero(2)
e.Row.Cells(index).ViewStateMode = ViewStateMode.Enabled End If
Dim textBox = New TextBox() With {.ID = idTxt, .Text = valor.FormatoNumero(2), .Width = 100, .AutoCompleteType = AutoCompleteType.Disabled} End If
e.Row.Cells(index).Controls.Add(textBox)
Next Next
End If End If
End Sub End Sub
@@ -824,29 +898,30 @@ Partial Class Ventas_ActualizarPrecios
Dim ObjPS As New ClsProductosServicios Dim ObjPS As New ClsProductosServicios
ObjPS.IniciaTransacSQL() ObjPS.IniciaTransacSQL()
Try Try
For Each row As GridViewRow In GvMultiple.Rows For Each GvRow As GridViewRow In GvMultiple.Rows
If row.FCCheckBox("chkPS").Checked Then If GvRow.FCCheckBox("chkPS").Checked Then
For index = 3 To row.Cells.Count - 1 For colIndex = 2 To GvRow.Cells.Count - 1
Dim cell = row.Cells(index)
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 End If
Exit For
End If End If
Next Next
End If End If
@@ -876,4 +951,23 @@ Partial Class Ventas_ActualizarPrecios
End If End If
End Sub 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 End Class