Productos servicios Ultimo costo 6 decimales, promosiones UK Promocion CveEmpresa

This commit is contained in:
rakcsle
2024-12-23 10:30:05 -07:00
parent 3da65326ba
commit 214bd26c08
5 changed files with 66 additions and 7 deletions

View File

@@ -2551,10 +2551,9 @@ Public Class ClsProductosServicios
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@UltimoCosto", SqlDbType.Money).Value = UltimoCosto
.Add("@UltimoCosto", SqlDbType.Decimal).Value = UltimoCosto
.Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try

View File

@@ -2525,7 +2525,14 @@ Public Class ClsVentas
SqlAdapter.Fill(Data)
Retorno = SqlAdapter.SelectCommand.Parameters("@CvePromocion").Value.ToString.ToEntero
Catch ex As Exception
OnError("Ocurrió un error al agregar la Promoción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
If ex.Message.Contains("UK_Vta_Promociones_CveEmpresa_Promocion") Then
Alert($"Ya existe una promoción con el nombre {Promocion} .", TipoMensaje.MsgAdvertencia)
Else
OnError("Ocurrió un error al agregar la Promoción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End If
End Try
Return Retorno
@@ -2580,7 +2587,13 @@ Public Class ClsVentas
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar la Promoción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
If ex.Message.Contains("UK_Vta_Promociones_CveEmpresa_Promocion") Then
Alert($"Ya existe una promoción con el nombre {Promocion} .", TipoMensaje.MsgAdvertencia)
Else
OnError("Ocurrió un error al actualizar la Promoción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End If
End Try
Return Retorno

View File

@@ -2569,7 +2569,7 @@
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright" style="width:100px">
<asp:TextBox ID="TxtUltimoCostoModal" runat="server" Width="100px" CausesValidation="true" CssClass="form-control" onkeyup="FormatoMoneda(this)" ></asp:TextBox>
<asp:TextBox ID="TxtUltimoCostoModal" runat="server" Width="100px" CausesValidation="true" CssClass="form-control" onkeyup="FormatoMoneda6Decimales(this)" ></asp:TextBox>
<label for="<%= TxtUltimoCostoModal.ClientID.ToString()%>">Ultimo Costo:</label>
<asp:RequiredFieldValidator ID="RfvTxtUltimoCostoModal" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtUltimoCostoModal" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Ultimo Costo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpUltimoCostoModal"></asp:RequiredFieldValidator>
<i></i>
@@ -2789,5 +2789,43 @@
}
function FormatoMoneda6Decimales(t) {
var input = t.value.replace(/[^0-9.]/g, "");
var firstDotIndex = input.indexOf(".");
if (firstDotIndex !== -1) {
var beforeDot = input.substring(0, firstDotIndex + 1);
var afterDot = input.substring(firstDotIndex + 1).replace(/\./g, "");
input = beforeDot + afterDot;
}
var decimalIndex = input.indexOf(".");
var integerPart = decimalIndex !== -1 ? input.slice(0, decimalIndex) : input;
var decimalPart = decimalIndex !== -1 ? input.slice(decimalIndex + 1) : "";
if (integerPart === "" && decimalIndex === 0) {
integerPart = "0";
}
if (decimalPart.length > 6) {
decimalPart = decimalPart.substring(0, 6);
}
var reversed = integerPart.split("").reverse().join("");
reversed = reversed.replace(/(\d{3})(?=\d)/g, "$1,");
integerPart = reversed.split("").reverse().join("");
t.value = decimalIndex !== -1
? integerPart + "." + decimalPart
: integerPart;
}
</script>
</asp:Content>

View File

@@ -1022,7 +1022,7 @@ Partial Class ProductosyServicios
LblCostoPromedio.Text = ObjProductosServicios.DtResultados.Rows(0)("CostoPromedio").ToString.FormatoNumero
LblUltimoCosto.Text = ObjProductosServicios.DtResultados.Rows(0)("UltimoCosto").ToString.FormatoNumero
LblUltimoCosto.Text = ObjProductosServicios.DtResultados.Rows(0)("UltimoCosto").ToString.ToDecimal.ToString("###,###,###.######")
LblFechaUltimaCompra.Text = ObjProductosServicios.DtResultados.Rows(0)("FechaUltimaCompra").ToString
HplKardex.NavigateUrl = $"/Inventarios/Kardex.aspx?CvePS={CvePS}"
@@ -3868,7 +3868,7 @@ Partial Class ProductosyServicios
If ProcesoOK Then
RegistraScript("$('#DVUltimoCostoModal').modal('hide');")
Alert("Ultimo Costo guardado correctamente", TipoMensaje.MsgInformacion, "window.location.reload();")
Alert("Ultimo Costo guardado correctamente", TipoMensaje.MsgInformacion)
End If
End Sub

View File

@@ -296,7 +296,16 @@ Partial Class Ventas_Promociones
divDistribuidor.Visible = True
End If
If EmpresaGrupoDiaz Then
For Each item As ListItem In DdlTipoAplicacion.Items
If item.Value = "1" Then
DdlTipoAplicacion.Items.Remove(item)
Exit For
End If
Next
End If
End Sub