--definicion de tablas para multiples listas de precios en actualizarprecios.aspx
This commit is contained in:
@@ -1811,6 +1811,29 @@ 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,
|
||||||
|
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
|
||||||
|
DataAdapter("PA_Vta_PSPrecioListaMultipleGet")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
|
||||||
|
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||||
|
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
|
||||||
|
.Add("@Estado", SqlDbType.Int).Value = Estado
|
||||||
|
.Add("@Marcas", SqlDbType.VarChar).Value = Marcas
|
||||||
|
.Add("@CveModelo", SqlDbType.Int).Value = CveModelo
|
||||||
|
End With
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener los precios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Function UpdatePSPreciosLista(Importe As Decimal, CvePrecioLista As Integer, Porcentaje As Decimal, CvePS As Integer, CveUsuario As Integer, Fecha As DateTime, Fijo As Boolean, Optional PrecioMinimo As Decimal = Nothing) As Boolean
|
Public Function UpdatePSPreciosLista(Importe As Decimal, CvePrecioLista As Integer, Porcentaje As Decimal, CvePS As Integer, CveUsuario As Integer, Fecha As DateTime, Fijo As Boolean, Optional PrecioMinimo As Decimal = Nothing) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Vta_PSPrecioListaAdd")
|
DataAdapter("PA_Vta_PSPrecioListaAdd")
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:UpdatePanel ID="UpExportarExcel" runat="server">
|
<asp:UpdatePanel ID="UpExportarExcel" runat="server">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:LinkButton ID="LnkExportarExcel" Text="<i class='fa fa-file-excel-o'></i> ExportarExcel" runat="server" OnClick="LnkExportarExcel_Click"></asp:LinkButton>
|
<asp:LinkButton ID="LnkExportarExcel" Text="<i class='fa fa-file-excel-o'></i> ExportarExcel" runat="server" OnClick="LnkExportarExcel_Click"></asp:LinkButton>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
<Triggers>
|
<Triggers>
|
||||||
<asp:PostBackTrigger ControlID="LnkExportarExcel"/>
|
<asp:PostBackTrigger ControlID="LnkExportarExcel" />
|
||||||
</Triggers>
|
</Triggers>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</li>
|
</li>
|
||||||
@@ -42,6 +42,13 @@
|
|||||||
</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>
|
||||||
|
<div class="col-md-1 v-center" runat="server" visible="false">
|
||||||
|
<asp:DropDownList ID="DdlModalidad" runat="server" AppendDataBoundItems="true" Width="100%" CssClass="select2me">
|
||||||
|
<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:DropDownList>
|
||||||
|
</div>
|
||||||
<label class="col-md-1 v-center truncate">Precio de Lista:</label>
|
<label class="col-md-1 v-center truncate">Precio de Lista:</label>
|
||||||
<div class="col-md-1 v-center">
|
<div class="col-md-1 v-center">
|
||||||
<asp:DropDownList ID="DdlPrecioLista" runat="server" AppendDataBoundItems="true" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista"></asp:DropDownList>
|
<asp:DropDownList ID="DdlPrecioLista" runat="server" AppendDataBoundItems="true" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista"></asp:DropDownList>
|
||||||
@@ -56,13 +63,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<label id="LblMarca" runat="server" visible="false" class="col-md-1 v-center truncate">Marca:</label>
|
<label id="LblMarca" runat="server" visible="false" class="col-md-1 v-center truncate">Marca:</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<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 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>
|
||||||
</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" id="LblProveedorCompra" runat="server" visible="false">Proveedor:</label>
|
||||||
@@ -89,7 +95,7 @@
|
|||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
<asp:UpdatePanel runat="server" UpdateMode="conditional" ID="UPPrecioLista">
|
<asp:UpdatePanel runat="server" UpdateMode="conditional" ID="UPPrecioLista">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div class="row">
|
<div class="row" id="DivActualizarPrecio" runat="server">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="portlet light smmallpadding traspasorow bordered xspadding">
|
<div class="portlet light smmallpadding traspasorow bordered xspadding">
|
||||||
<div class="portlet-title">
|
<div class="portlet-title">
|
||||||
@@ -164,7 +170,7 @@
|
|||||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBuscar','{0}')", GVPrecios.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBuscar','{0}')", GVPrecios.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<asp:GridView ID="GVPrecios" runat="server" GridLines="None" DataKeyNames="CvePS, CvePrecioLista,PrecioLista,PS,Codigo,Codigo2,Porcentaje,CodigoPS"
|
<asp:GridView ID="GVPrecios" runat="server" GridLines="None" DataKeyNames="CvePS, CvePrecioLista,PrecioLista,PS,Codigo,Codigo2,Porcentaje,CodigoPS"
|
||||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" AutoGenerateColumns="False" data-sort="true" EmptyDataText="No se encontraron registros" >
|
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" AutoGenerateColumns="False" data-sort="true" EmptyDataText="No se encontraron registros">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="5%">
|
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="5%">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
@@ -173,7 +179,7 @@
|
|||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:BoundField DataField="Codigo" ItemStyle-Width="5%" HeaderText="Código" />
|
<asp:BoundField DataField="Codigo" ItemStyle-Width="5%" HeaderText="Código" />
|
||||||
<asp:BoundField DataField="Codigo2" ItemStyle-Width="5%" HeaderText="Código CPK" Visible="false" />
|
<asp:BoundField DataField="Codigo2" ItemStyle-Width="5%" HeaderText="Código CPK" Visible="false" />
|
||||||
<asp:BoundField DataField="PS" HeaderText="Producto/Servicio" />
|
<asp:BoundField DataField="PS" HeaderText="Producto/Servicio" />
|
||||||
<asp:BoundField DataField="Clasificacion" ItemStyle-Width="15%" HeaderText="Clasificación" />
|
<asp:BoundField DataField="Clasificacion" ItemStyle-Width="15%" HeaderText="Clasificación" />
|
||||||
<asp:BoundField DataField="PrecioLista" NullDisplayText="N/A" ItemStyle-Width="10%" HeaderText="Importe" DataFormatString="$ {0:N2}" ItemStyle-HorizontalAlign="right" />
|
<asp:BoundField DataField="PrecioLista" NullDisplayText="N/A" ItemStyle-Width="10%" HeaderText="Importe" DataFormatString="$ {0:N2}" ItemStyle-HorizontalAlign="right" />
|
||||||
<asp:TemplateField HeaderText="">
|
<asp:TemplateField HeaderText="">
|
||||||
@@ -192,13 +198,13 @@
|
|||||||
<asp:TemplateField HeaderText="">
|
<asp:TemplateField HeaderText="">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:TextBox ID="TxtPrecioMinimo" runat="server" Text='<%# Eval("PrecioMinimo", "{0:0.######}")%>' CssClass="CssCamviaPrecio" MaxLength="39" Width="60px" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
|
<asp:TextBox ID="TxtPrecioMinimo" runat="server" Text='<%# Eval("PrecioMinimo", "{0:0.######}")%>' CssClass="CssCamviaPrecio" MaxLength="39" Width="60px" onkeypress="return onlyNumberKey(event)"></asp:TextBox>
|
||||||
<%-- <ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtPrecioMinimo" FilterType="Numbers,Custom" ValidChars="." />
|
<%-- <ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtPrecioMinimo" FilterType="Numbers,Custom" ValidChars="." />
|
||||||
<asp:RegularExpressionValidator ID="REVTxtPrecioMinimo" runat="server" ControlToValidate="TxtPrecioMinimo" Display="None" EnableClientScript="True" ErrorMessage="El campo <b>''PrecioLista''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." ValidationGroup="GrpGuardar" ValidationExpression="^[0-9]{1,15}(?:\.[0-9]{1,4})?$" />
|
<asp:RegularExpressionValidator ID="REVTxtPrecioMinimo" runat="server" ControlToValidate="TxtPrecioMinimo" Display="None" EnableClientScript="True" ErrorMessage="El campo <b>''PrecioLista''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." ValidationGroup="GrpGuardar" ValidationExpression="^[0-9]{1,15}(?:\.[0-9]{1,4})?$" />
|
||||||
<ajax:ValidatorCalloutExtender ID="VCTxtPrecioMinimo" runat="server" HighlightCssClass="vco" TargetControlID="REVTxtPrecioMinimo" Width="300px"></ajax:ValidatorCalloutExtender>--%>
|
<ajax:ValidatorCalloutExtender ID="VCTxtPrecioMinimo" runat="server" HighlightCssClass="vco" TargetControlID="REVTxtPrecioMinimo" Width="300px"></ajax:ValidatorCalloutExtender>--%>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:BoundField DataField="UnidadMedida" NullDisplayText="N/A" ItemStyle-Width="10%" HeaderText="U.M." />
|
<asp:BoundField DataField="UnidadMedida" NullDisplayText="N/A" ItemStyle-Width="10%" HeaderText="U.M." />
|
||||||
<asp:BoundField DataField="Moneda" NullDisplayText="N/A" ItemStyle-Width="10%" HeaderText="Moneda" ItemStyle-HorizontalAlign="Left" />
|
<asp:BoundField DataField="Moneda" NullDisplayText="N/A" ItemStyle-Width="10%" HeaderText="Moneda" ItemStyle-HorizontalAlign="Left" />
|
||||||
<asp:BoundField DataField="CostoPromedio" NullDisplayText="-" ItemStyle-Width="5%" DataFormatString="{0:N2}" Visible="false" HeaderText="C. Promedio" ItemStyle-HorizontalAlign="right" />
|
<asp:BoundField DataField="CostoPromedio" NullDisplayText="-" ItemStyle-Width="5%" DataFormatString="{0:N2}" Visible="false" HeaderText="C. Promedio" ItemStyle-HorizontalAlign="right" />
|
||||||
<asp:BoundField DataField="VentaMinima" NullDisplayText="N/A" ItemStyle-Width="10%" HeaderText="E. Mínimo" ItemStyle-HorizontalAlign="right" />
|
<asp:BoundField DataField="VentaMinima" NullDisplayText="N/A" ItemStyle-Width="10%" HeaderText="E. Mínimo" ItemStyle-HorizontalAlign="right" />
|
||||||
@@ -216,6 +222,34 @@
|
|||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="dvMultiple" runat="server" visible="false">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<asp:LinkButton ID="LnkGuardarMultiple" runat="server" AlternateText="Actualizar" CausesValidation="True" CssClass="btn btn-primary" Text="Actualizar Seleccionadas" OnClick="LnkGuardarMultiple_Click" />
|
||||||
|
<%--<button onclick="convertirTabla(); return false;"> test</button>--%>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div align="right">
|
||||||
|
<input type="text" id="TxtBuscarM" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBuscarM','{0}')", GvMultiple.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||||
|
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBuscarM','{0}')", GvMultiple.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<asp:GridView ID="GvMultiple" runat="server" GridLines="None" AutoGenerateColumns="true" ClientIDMode="Static"
|
||||||
|
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" EmptyDataText="No se encontraron registros"
|
||||||
|
OnRowCreated="GvMultiple_RowCreated" OnRowDataBound="GvMultiple_RowDataBound">
|
||||||
|
<Columns>
|
||||||
|
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="5%">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:CheckBox runat="server" ID="chkPS" />
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
</Columns>
|
||||||
|
</asp:GridView>
|
||||||
|
</div>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
<div id="ModalActualizaPrecios" class="modal ADS fade" role="dialog">
|
<div id="ModalActualizaPrecios" class="modal ADS fade" role="dialog">
|
||||||
@@ -255,7 +289,7 @@
|
|||||||
<asp:TemplateField>
|
<asp:TemplateField>
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:CheckBox ID="chkSucursal" runat="server" Checked="false" CssClass="CsMCheckGvSucursal" />
|
<asp:CheckBox ID="chkSucursal" runat="server" Checked="false" CssClass="CsMCheckGvSucursal" />
|
||||||
<asp:HiddenField ID="hdnEnBD" runat="server" Value='<%# If (IsDBNull(Eval("CvePS")),0,1) %>' />
|
<asp:HiddenField ID="hdnEnBD" runat="server" Value='<%# If(IsDBNull(Eval("CvePS")), 0, 1) %>' />
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:TemplateField HeaderText="Sucursal" ItemStyle-Width="30%">
|
<asp:TemplateField HeaderText="Sucursal" ItemStyle-Width="30%">
|
||||||
@@ -366,12 +400,37 @@
|
|||||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
function convertirTabla(){
|
||||||
|
let json = tableToJson($('#GvMultiple').get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
function tableToJson(table) {
|
||||||
|
var data = [];
|
||||||
|
|
||||||
|
// first row needs to be headers
|
||||||
|
var headers = [];
|
||||||
|
for (var i = 0; i < table.rows[0].cells.length; i++) {
|
||||||
|
if (table.rows[0].cells[i].innerHTML != "") {
|
||||||
|
headers[i] = table.rows[0].cells[i].innerText.toLowerCase().replace(/ /gi, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// go through cells
|
||||||
|
for (var i = 1; i < table.rows.length; i++) {
|
||||||
|
var tableRow = table.rows[i];
|
||||||
|
var rowData = {};
|
||||||
|
for (var j = 1; j < tableRow.cells.length; j++) {
|
||||||
|
rowData[headers[j]] = tableRow.cells[j].innerText;
|
||||||
|
}
|
||||||
|
data.push(rowData);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
function onlyNumberKey(evt) {
|
function onlyNumberKey(evt) {
|
||||||
|
|
||||||
// Only ASCII character in that range allowed
|
// Only ASCII character in that range allowed
|
||||||
var ASCIICode = (evt.which) ? evt.which : evt.keyCode
|
var ASCIICode = (evt.which) ? evt.which : evt.keyCode
|
||||||
if (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57))
|
if (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57)) {
|
||||||
{
|
|
||||||
if (ASCIICode == 46) {
|
if (ASCIICode == 46) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -28,6 +28,15 @@ Partial Class Ventas_ActualizarPrecios
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
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
|
Private Property CveSucursal As Integer
|
||||||
Get
|
Get
|
||||||
If ViewState("CveSucursal") Is Nothing Then
|
If ViewState("CveSucursal") Is Nothing Then
|
||||||
@@ -169,7 +178,7 @@ Partial Class Ventas_ActualizarPrecios
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||||
Dim objPS As New ClsProductosServicios
|
|
||||||
Dim CveProveedor As Integer = -1
|
Dim CveProveedor As Integer = -1
|
||||||
Dim CvePS As Integer = -1
|
Dim CvePS As Integer = -1
|
||||||
Dim Marcas As String = If(DdlMarca.GetSelectedValuesM = "", "-1", DdlMarca.GetSelectedValuesM)
|
Dim Marcas As String = If(DdlMarca.GetSelectedValuesM = "", "-1", DdlMarca.GetSelectedValuesM)
|
||||||
@@ -182,26 +191,51 @@ Partial Class Ventas_ActualizarPrecios
|
|||||||
CveProveedor = DdlProveedor.txtValue.Value.ToEntero
|
CveProveedor = DdlProveedor.txtValue.Value.ToEntero
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, DdlPrecioLista.SelectedValue.ToEntero, DDlClasificacion.SelectedValue.ToEntero, CvePS,
|
'POR LISTA DE PRECIO
|
||||||
CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero) Then
|
If DdlModalidad.SelectedValue = "1" Then
|
||||||
DtDatosPrecios = objPS.DtResultados
|
Dim objPS As New ClsProductosServicios
|
||||||
GVPrecios.DataSource = DtDatosPrecios
|
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, DdlPrecioLista.SelectedValue.ToEntero, DDlClasificacion.SelectedValue.ToEntero, CvePS,
|
||||||
End If
|
CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero) Then
|
||||||
objPS.Dispose()
|
DtDatosPrecios = objPS.DtResultados
|
||||||
|
GVPrecios.DataSource = DtDatosPrecios
|
||||||
|
End If
|
||||||
|
objPS.Dispose()
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores
|
||||||
GVPrecios.Columns(2).Visible = True
|
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
|
End If
|
||||||
|
|
||||||
If UsuarioActual.CveEmpresa = 153 Then 'Empresa servec
|
'MULTIPLE LISTAS DE PRECIO
|
||||||
GVPrecios.Columns(11).Visible = True
|
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
|
End If
|
||||||
|
|
||||||
dvDatos.Visible = True
|
|
||||||
GVPrecios.DataBind()
|
|
||||||
|
|
||||||
UpDescargar.Update()
|
UpDescargar.Update()
|
||||||
UpDatos.Update()
|
UpDatos.Update()
|
||||||
|
UPPrecioLista.Update()
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub DDlClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs)
|
Protected Sub DDlClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||||
CargaPS()
|
CargaPS()
|
||||||
@@ -743,4 +777,103 @@ Partial Class Ventas_ActualizarPrecios
|
|||||||
FileExcel.Save(Response, "Precios.xlsx", SaveOptions.XlsxDefault)
|
FileExcel.Save(Response, "Precios.xlsx", SaveOptions.XlsxDefault)
|
||||||
|
|
||||||
End Sub
|
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
|
End Class
|
||||||
Reference in New Issue
Block a user