@@ -313,8 +322,16 @@
--%>
-
-
+
+
+
+
+
+
+
+
+
+
@@ -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);
}
diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb
index f30e1a2a1..9893d756c 100644
--- a/Ventas/ActualizarPrecios.aspx.vb
+++ b/Ventas/ActualizarPrecios.aspx.vb
@@ -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