--Porcentajes. Costo promedio y ultimo costo

This commit is contained in:
2025-05-16 16:48:43 -07:00
parent 19335eeced
commit 402296f8f7
2 changed files with 79 additions and 20 deletions

View File

@@ -222,7 +222,7 @@
</div>
<div class="portlet-body">
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<asp:RadioButtonList AutoPostBack="true" OnSelectedIndexChanged="RblTipo_SelectedIndexChanged" RepeatDirection="Horizontal" ID="RblTipo" runat="server">
<asp:ListItem Selected="true" Value="Imp" Text="Importe Fijo" />
<asp:ListItem Value="Por" Text="Porcentaje" />
@@ -230,18 +230,26 @@
<asp:HiddenField ID="HdnTipo" runat="server" ClientIDMode="Static" Value="1" />
</div>
</div>
<div class="row">
<div class="col-md-3">
<div runat="Server" id="ImporteFijo" class="form-group form-md-line-input input-iconright" style="width: 100%">
<asp:TextBox ID="TxtImporte" runat="server" CssClass="form-control" CausesValidation="true"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="TxtImporte" FilterType="Numbers, Custom" ValidChars="." />
<label for="<%= TxtImporte.ClientID.ToString()%>">
<asp:Literal ID="LtlImporte" runat="server" Text="Precio nuevo:"></asp:Literal></label>
<i>
<asp:Literal ID="LtlSimbolo" runat="server" Text="$"></asp:Literal></i>
</div>
<div class="row" style="display: flex;">
<div class="form-group form-md-line-input input-iconright col-md-3">
<asp:TextBox ID="TxtImporte" runat="server" CssClass="form-control" CausesValidation="true"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="TxtImporte" FilterType="Numbers, Custom" ValidChars="." />
<label for="<%= TxtImporte.ClientID.ToString()%>">
<asp:Literal ID="LtlImporte" runat="server" Text="Precio nuevo:"></asp:Literal></label>
<i>
<asp:Literal ID="LtlSimbolo" runat="server" Text="$"></asp:Literal></i>
</div>
<div class="form-group form-md-line-input input-iconright col-md-3" id="DivTipoPorcentaje" runat="server" visible="false">
<asp:DropDownList ID="DdlTipoPorcentaje" runat="server" CssClass="form-control input-sm select2me">
<asp:ListItem Text="Precio actual" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Último costo" Value="2"></asp:ListItem>
<asp:ListItem Text="Costo promedio" Value="3"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoPorcentaje.ClientID.ToString()%>">Precio base:</label>
<i></i>
</div>
<div class="col-md-1">
<label></label>
<a class="btn btn-default" onclick="CambiaImporte();">Aplicar</a>
</div>
</div>
@@ -258,6 +266,7 @@
<a class="btn btn-default" onclick="CambiaPrecio();">Aplicar Precio Min.</a>
</div>
</div>
<br />
<div class="row">
<div class="col-md-12" style="display: flex; justify-content: center;">
<asp:LinkButton ID="BtnGuardar" runat="server" AlternateText="Actualizar" CausesValidation="True" CssClass="btn btn-primary" Text="Actualizar Seleccionadas" ValidationGroup="GrpGuardar" />
@@ -313,8 +322,16 @@
<ajax:ValidatorCalloutExtender ID="VCTxtPrecioMinimo" runat="server" HighlightCssClass="vco" TargetControlID="REVTxtPrecioMinimo" Width="300px"></ajax:ValidatorCalloutExtender>--%>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="UltimoCosto" ItemStyle-Width="5%" HeaderText="Ult.Costo" DataFormatString="{0:#,##0.00}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="CostoPromedio" ItemStyle-Width="5%" HeaderText="Costo Prom." DataFormatString="{0:#,##0.00}" ItemStyle-HorizontalAlign="Right" />
<asp:TemplateField ItemStyle-Width="5%" HeaderText="Ult.Costo" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LtlUltimoCosto" runat="server" Text='<%# Eval("UltimoCosto", "{0:#,##0.00}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="5%" HeaderText="Costo Prom." ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LtlCostoPromedio" runat="server" Text='<%# Eval("CostoPromedio", "{0:#,##0.00}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="UnidadMedida" NullDisplayText="N/A" ItemStyle-Width="2.5%" HeaderText="U.M." />
<asp:BoundField DataField="Moneda" NullDisplayText="N/A" ItemStyle-Width="2.5%" HeaderText="Moneda" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="VentaMinima" NullDisplayText="N/A" ItemStyle-Width="10%" HeaderText="E. Mínimo" ItemStyle-HorizontalAlign="right" Visible="false" />
@@ -890,11 +907,11 @@
}
function CambiaImporte() {
var topLevelElem = document.getElementById("form1");
var checks = topLevelElem.getElementsByTagName("input");
var idd = '';
let topLevelElem = document.getElementById("form1");
let checks = topLevelElem.getElementsByTagName("input");
let idd = '';
var valor = $('#<%= TxtImporte.ClientID %>').val();
let valor = ToDouble($('#<%= TxtImporte.ClientID %>').val());
for (var i = 0; i < checks.length; i++) {
if (checks[i].type == "checkbox") {
@@ -905,14 +922,54 @@
//ASIGNAR PRECIO NUEVO
if (tipo == '1') {
$get('C_GVPrecios_TxtPrecio_' + idd).value = FormatoNumero(ToDouble(valor), 2);
$get('C_GVPrecios_TxtPrecio_' + idd).value = FormatoNumero(valor, 2);
}
//AUMENTAR PRECIO POR PORCENTAJE
if (tipo == '2') {
let precioActual = ToDouble($get('C_GVPrecios_LtlPrecio_' + idd).innerText.replace(" ", "").replace("$", "").replace(",",""));
let precioRef = 0;
let precioNuevo = ToDouble(((valor / 100) * precioActual) + precioActual)
let precioActual = 0;
let ultimoCosto = 0;
let costoPromedio = 0;
if ($get('C_GVPrecios_LtlPrecio_' + idd)) {
precioActual = ToDouble($get('C_GVPrecios_LtlPrecio_' + idd).innerText.replace(" ", "").replace("$", "").replace(",", ""));
}
if ($get('C_GVPrecios_LtlUltimoCosto_' + idd)) {
ultimoCosto = ToDouble($get('C_GVPrecios_LtlUltimoCosto_' + idd).innerText.replace(" ", "").replace("$", "").replace(",", ""));
}
if ($get('C_GVPrecios_LtlCostoPromedio_' + idd)) {
costoPromedio = ToDouble($get('C_GVPrecios_LtlCostoPromedio_' + idd).innerText.replace(" ", "").replace("$", "").replace(",", ""));
}
let Referencia = $get('C_DdlTipoPorcentaje').value;
//PRECIO ACTUAL
if (Referencia == '1') {
precioRef = precioActual;
}
//ULTIMO COSTO
if (Referencia == '2') {
if (ultimoCosto > 0 && ultimoCosto != 'NaN') {
precioRef = ultimoCosto;
} else {
precioRef = precioActual;
}
}
//COSTO PROMEDIO
if (Referencia == '3') {
if (costoPromedio > 0 && costoPromedio != 'NaN') {
precioRef = costoPromedio;
} else {
precioRef = precioActual;
}
}
let precioNuevo = ToDouble(((valor / 100) * precioRef) + precioRef);
$get('C_GVPrecios_TxtPrecio_' + idd).value = FormatoNumero(precioNuevo, 2);
}

View File

@@ -336,10 +336,12 @@ Partial Class Ventas_ActualizarPrecios
LtlImporte.Text = "Precio nuevo:"
LtlSimbolo.Text = "$"
HdnTipo.Value = "1"
DivTipoPorcentaje.Visible = False
Else
LtlImporte.Text = "Porcentaje a incrementar:"
LtlSimbolo.Text = "%"
HdnTipo.Value = "2"
DivTipoPorcentaje.Visible = True
End If
UPPrecioLista.Update()
End Sub