--Ventas.aspx. % de descuento limitado por clasificación

This commit is contained in:
2024-06-10 19:01:46 -07:00
parent 4413e28341
commit 6332a2ba4f
3 changed files with 39 additions and 16 deletions

View File

@@ -462,6 +462,10 @@ Partial Class Sistemas_UsuarioDetalle
DivDatosAutorizacion.Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(109).ToString = "1" Then
TrDescuentoAutorizado.Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(599) = "1" Then
TrCodigoAcceso.Visible = True
End If

View File

@@ -4409,6 +4409,7 @@
<asp:HiddenField ID="HdnIVADescPS" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnConsecPS" runat="server" ClientIDMode="Static" Value="-1" />
<asp:HiddenField ID="HdnTotalCompra" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnPorcentajeMaxDescPS" runat="server" ClientIDMode="Static" Value="100" />
<table style="width: 90%">
<tr>
<td>SubTotal</td>
@@ -10083,15 +10084,20 @@
function CalculaDescPS() {
console.log("evento descuento");
let ivaPor = parseFloat($get("HdnIVADescPS").value) ;
if ($get("TxtPorPS").value != "") {
let PorcentajeDescuento = parseFloat($get("TxtPorPS").value);
if (PorcentajeDescuento < 0 || PorcentajeDescuento > 100) {
alert("No se puede aplicar ese porcentaje de descuento");
let PorcentajeMaximoDescuento = parseFloat($get("HdnPorcentajeMaxDescPS").value);
if (PorcentajeDescuento < 0 || PorcentajeDescuento > PorcentajeMaximoDescuento) {
alert("No se puede aplicar ese porcentaje de descuento. El porcentaje máximo permitido es del " + PorcentajeMaximoDescuento.toFixed(2) + "%.");
$get("TxtPorPS").value = "0";
$get("HdnDescPS").value = "0";
LimpiarTotalDescPS(ivaPor);
recalcularUtilidad(0);
return;
}
let ivaPor = parseFloat($get("HdnIVADescPS").value) ;
let subTotal = parseFloat($get("LblSubtotalDescPS").innerText.replace(",", "").replace(",", ""));
@@ -10111,6 +10117,13 @@
recalcularUtilidad(descuento)
} else {
LimpiarTotalDescPS(ivaPor);
recalcularUtilidad(0);
}
}
function LimpiarTotalDescPS(ivaPor){
let subTotal = parseFloat($get("LblSubtotalDescPS").innerText.replace(",", "").replace(",", ""));
$get("LblIVADescPS").innerText = formato_numero((subTotal * ivaPor), 2, '.', ',');
let importeIVA =parseFloat($get("LblIVADescPS").innerText.replace(",", "").replace(",", ""));
@@ -10120,9 +10133,6 @@
$get("LblDescPS").innerText = "0.00";
$get("LblUtilidadPorcentaje").innerText = "0.00";
$get("HdnDescPS").innerText = "0.00";
recalcularUtilidad(0);
}
}
function recalcularUtilidad(descuento){
@@ -10667,7 +10677,7 @@
var td;
let idxHeader = 0;
for (var key in item) {
if (idxHeader == 0 && '<%= UsuarioActual.Empresa.Funcionalidad(382) %>' == '1') {
if (idxHeader == 0 && '<%= "" %>' == '1') {
tr.append('<td style="font-weight:bold;"> </td>');
tr.append('<td style="font-weight:bold;"></td>');
tr.append('<td style="font-weight:bold;"></td>');
@@ -10685,7 +10695,7 @@
let idxColumn = 0;
for (var key in item) {
if (idxColumn == 0 && '<%= UsuarioActual.Empresa.Funcionalidad(382) %>' == '1') {
if (idxColumn == 0 && '<%= "" %>' == '1') {
let tdExistencia = '<a href="javascript:void(0);" title="Ver existencias" onclick="javascript:AbrirVentana(' + "'/Inventarios/PopUpExistenciasAlmacen.aspx?CvePS=" + item.id + "'" + ", 800, 547," + "'N'" + ",'PopUpBuscar');$('#C_Tab_TabGenerales_DdlPS > select').select2('close');" + '"> <img style="width:15px; height: 13px;" src="../Content/CustomIcons/existencia_verde.svg"></img > </a>';
tr.append('<td>' + tdExistencia + '</td>');

View File

@@ -3228,7 +3228,7 @@ Partial Class Ventas
' End If
'End If
If UsuarioActual.Empresa.Funcionalidad(301) <> "" Then
If UsuarioActual.Empresa.Funcionalidad(301) = "1" Then
TxtFecha.Enabled = True
ImgFecha.Visible = True
Else
@@ -25024,6 +25024,15 @@ Partial Class Ventas
LblIVADescPS.Text = GvRow.DataKey("ImporteIVA").FormatoNumero()
HdnIVADescPS.Value = GvRow.DataKey("IVA").FormatoNumero()
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=GvRow.DataKey("CvePS").ToEntero()).FiltroPrimero("")
If DrPS IsNot Nothing Then
If DrPS("PorMaximoDescuento").ToString().ToDecimal() > 0 Then
HdnPorcentajeMaxDescPS.Value = DrPS("PorMaximoDescuento").ToString()
Else
HdnPorcentajeMaxDescPS.Value = UsuarioActual.DescuentoAutorizado.ToString()
End If
End If
Using ObjPS As New ClsProductosServicios
Dim PrecioCompra = ObjPS.GetUltimoPrecioCompra(UsuarioActual.CveEmpresa, GvRow.DataKey("CvePS").ToEntero())
If PrecioCompra > 0 Then