Al crear o editar un producto poder introducir el precio de lista de cada una

This commit is contained in:
RPimienta
2024-09-22 02:13:59 -06:00
parent ed5bfaf1e9
commit 8cb75e5633
2 changed files with 115 additions and 1 deletions

View File

@@ -723,6 +723,42 @@
</div>
</div>
</div>
<div class="row">
<div class="col-md-12" id="DivListaPrecios" runat="server" >
<div class="portlet xspadding light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-briefcase font-green"></i>
<span class="caption-subject bold uppercase">Lista de Precios &nbsp;&nbsp;</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
</div>
<div class="portlet-body form">
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvMultiple" Width="100%" runat="server" GridLines="None" ClientIDMode="Static" AutoGenerateColumns="false" DataKeyNames="CvePrecioLista,PrecioLista,Precio"
CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" EmptyDataText="No se encontraron registros" OnRowDataBound="GvMultiple_RowDataBound">
<Columns>
<asp:BoundField DataField="PrecioLista" HeaderText="Lista de Precio" />
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label ID="LtlLista" runat="server">Precio</asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio" runat="server" MaxLength="39" onkeypress="return onlyNumberKey(event)" Style="text-align: right !important;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
@@ -2672,7 +2708,19 @@
}
//TERMINA: ECOMMERCE
function onlyNumberKey(evt) {
// Only ASCII character in that range allowed
var ASCIICode = (evt.which) ? evt.which : evt.keyCode
if (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57)) {
if (ASCIICode == 46) {
return true
} else {
return false;
}
}
return true;
}
</script>

View File

@@ -141,6 +141,15 @@ Partial Class ProductosyServicios
ViewState("Imagen") = 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
#End Region
Private ReadOnly Property PermiteClasificacion2 As Boolean
@@ -273,6 +282,7 @@ Partial Class ProductosyServicios
'CargaFamilia(ViewState("CveSubFamilia").ToString.ToEntero)
CargaSucursaless()
CargaImpuestosLocales()
CargaListaPrecios()
If UsuarioActual.TienePermisoProceso(122) Then
BtnEliminar.Visible = False
@@ -1714,6 +1724,10 @@ Partial Class ProductosyServicios
Next
End If
If Not TieneError Then
GuardarListasPrecios(ObjProductosServicios)
End If
If ObjProductosServicios.CvePS > 0 And Not TieneError Then
TieneError = GuardaEcommerce()
End If
@@ -2967,6 +2981,58 @@ Partial Class ProductosyServicios
#End Region
#Region "LISTA PRECIOS"
Private Sub CargaListaPrecios()
Dim objPS As New ClsProductosServicios
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, -1, CveClasificacion:=-1, CvePS:=CvePS,
CveProveedor:=-1, Estado:=-1, Marcas:="-1", CveModelo:=-1) Then
DtPreciosMultiple = objPS.DtResultados.Copy()
GvMultiple.DataSource = DtPreciosMultiple
End If
objPS.Dispose()
GvMultiple.DataBind()
End Sub
Protected Sub GvMultiple_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Valor As Decimal = DtPreciosMultiple.Rows(e.Row.RowIndex)(2).ToString().ToDecimal()
e.Row.FCTextBox("TxtPrecio").Text = Valor.FormatoNumero(2)
End If
End Sub
Private Sub GuardarListasPrecios(ObjPS As ClsProductosServicios)
Dim TieneError As Boolean = False
Try
For Each GvRow As GridViewRow In GvMultiple.Rows
Dim CvePrecioLista As Integer = GvRow.DataKey("CvePrecioLista").ToEntero()
Dim Precio As Decimal = GvRow.FCTextBox("TxtPrecio").Text.ToDecimal()
TieneError = Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLista, 0, CvePS, UsuarioActual.CveUsuario, NowADS(), True)
If TieneError Then
Exit For
End If
Next
Catch ex As Exception
OnError("Ocurrió un error al actualizar precios", ex)
TieneError = True
End Try
If TieneError Then
Alert("Ocurrió un error al actualizar precios", TipoMensaje.MsgError)
End If
End Sub
#End Region
#Region "EXISTENCIAS"
Protected Sub GVExistencias_RowDataBound(sender As Object, e As GridViewRowEventArgs)