Descuento definido por el porcentaje maximo autorizado
This commit is contained in:
@@ -1571,6 +1571,7 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<asp:HiddenField ID="HdnDescuento" runat="server" ClientIDMode="Static" Value="0" />
|
||||
<asp:HiddenField ID="HdnPorcentajeDescuentoMaximo" runat="server" ClientIDMode="Static" Value="0" />
|
||||
<asp:HiddenField ID="HdnDescuentoGeneral" runat="server" ClientIDMode="Static" Value="-1" />
|
||||
<asp:HiddenField ID="HdnTipoDescuento" runat="server" ClientIDMode="Static" Value="-1" />
|
||||
<table>
|
||||
@@ -3344,6 +3345,15 @@
|
||||
}
|
||||
|
||||
var Descuento = parseFloat($get("TxtPorDescP").value);
|
||||
var PorcentajeDescuentoMaximo = parseFloat($get("HdnPorcentajeDescuentoMaximo").value);
|
||||
|
||||
if (PorcentajeDescuentoMaximo > 0 && Descuento > PorcentajeDescuentoMaximo) {
|
||||
$get("TxtDescP").value = "0";
|
||||
$get("TxtPorDescP").value = "0";
|
||||
Descuento = 0;
|
||||
alert("No puede exceder el descuento maximo autorizado.");
|
||||
}
|
||||
|
||||
$get("LblPrecioFinal").innerText = formato_numero(Monto - ((Monto * Descuento) / 100), 2, '.', ',');
|
||||
$get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
|
||||
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
|
||||
@@ -3354,6 +3364,7 @@
|
||||
if (TipoDescuento == 2) {
|
||||
$get("LblDescuentos").innerText = formato_numero(Total, 2, '.', ',');
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$get("LblPrecioFinal").innerText = "0.00";
|
||||
@@ -3383,6 +3394,17 @@
|
||||
}
|
||||
|
||||
var Descuento = parseFloat($get("TxtDescP").value);
|
||||
|
||||
var PorcentajeDescuento = (Descuento * 100 / Monto)
|
||||
var PorcentajeDescuentoMaximo = parseFloat($get("HdnPorcentajeDescuentoMaximo").value);
|
||||
|
||||
if (PorcentajeDescuentoMaximo > 0 && PorcentajeDescuento > PorcentajeDescuentoMaximo) {
|
||||
$get("TxtDescP").value = "0";
|
||||
$get("TxtPorDescP").value = "0";
|
||||
Descuento = 0;
|
||||
alert("No puede exceder el descuento maximo autorizado.");
|
||||
}
|
||||
|
||||
$get("TxtPorDescP").value = formato_numero((Descuento * 100 / Monto), 2, '.', ',');
|
||||
$get("LblPrecioFinal").innerText = formato_numero(Monto - Descuento, 2, '.', ',');
|
||||
$get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
|
||||
|
||||
@@ -1062,6 +1062,7 @@ Partial Class PV
|
||||
ViewState("ClienteRetIVA") = 0
|
||||
ViewState("ClienteRetISR") = 0
|
||||
ViewState("EnviarCorreoCliente") = False
|
||||
HdnPorcentajeDescuentoMaximo.Value = UsuarioActual.DescuentoAutorizado.ToString()
|
||||
CveVentaDetalle = -1
|
||||
EstablecioFolio = False
|
||||
EstatusCliente = False
|
||||
@@ -5102,52 +5103,52 @@ Partial Class PV
|
||||
|
||||
End Sub
|
||||
Protected Sub BtnAplicarDescG_Click(sender As Object, e As System.EventArgs) Handles BtnAplicarDescG.Click
|
||||
If HdnTipoDescuento.Value = "2" Then
|
||||
'If HdnTipoDescuento.Value = "2" Then
|
||||
|
||||
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
|
||||
Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2)
|
||||
Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble
|
||||
' If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
|
||||
' Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2)
|
||||
' Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble
|
||||
|
||||
If IVAPromedio <> IVA Then
|
||||
Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError)
|
||||
Else
|
||||
AplicarDescuentos()
|
||||
'Dim Descuento As Double = HdnDescuento.Value.Trim.Replace(",", "").ToDouble
|
||||
CalculaTotalesVenta()
|
||||
'LblDescuentos.Text = Descuento.FormatoNumero(2)
|
||||
'TxtIVA.Text = ((TxtSubTotal.Text.Trim.Replace(",", "").ToDouble - Descuento - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble) * IVAPromedio).FormatoNumero(2)
|
||||
'HdnIVAOriginal.Value = TxtIVA.Text
|
||||
'CalculaTotales(True)
|
||||
HdnTipoDescuento.Value = "-1"
|
||||
HdnDescuento.Value = "0"
|
||||
RegistraScript("BorraDescuentos();")
|
||||
End If
|
||||
End If
|
||||
UpPS.Update()
|
||||
' If IVAPromedio <> IVA Then
|
||||
' Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError)
|
||||
' Else
|
||||
' AplicarDescuentos()
|
||||
' 'Dim Descuento As Double = HdnDescuento.Value.Trim.Replace(",", "").ToDouble
|
||||
' CalculaTotalesVenta()
|
||||
' 'LblDescuentos.Text = Descuento.FormatoNumero(2)
|
||||
' 'TxtIVA.Text = ((TxtSubTotal.Text.Trim.Replace(",", "").ToDouble - Descuento - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble) * IVAPromedio).FormatoNumero(2)
|
||||
' 'HdnIVAOriginal.Value = TxtIVA.Text
|
||||
' 'CalculaTotales(True)
|
||||
' HdnTipoDescuento.Value = "-1"
|
||||
' HdnDescuento.Value = "0"
|
||||
' RegistraScript("BorraDescuentos();")
|
||||
' End If
|
||||
' End If
|
||||
' UpPS.Update()
|
||||
|
||||
ElseIf HdnTipoDescuento.Value = "3" Then
|
||||
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
|
||||
Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2)
|
||||
Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble
|
||||
'ElseIf HdnTipoDescuento.Value = "3" Then
|
||||
' If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
|
||||
' Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2)
|
||||
' Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble
|
||||
|
||||
If IVAPromedio <> IVA Then
|
||||
Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError)
|
||||
Else
|
||||
AplicarDescuentos()
|
||||
'Dim Amortizacion As Decimal = HdnDescuento.Value.Trim.Replace(",", "").ToDecimal
|
||||
'LblAmortizacion.Text = Amortizacion.FormatoNumero(2)
|
||||
'TxtIVA.Text = ((TxtSubTotal.Text.Trim.Replace(",", "").ToDouble - Amortizacion - LblDescuentos.Text.Trim.Replace(",", "").ToDouble) * IVAPromedio).FormatoNumero(2)
|
||||
'HdnIVAOriginal.Value = TxtIVA.Text
|
||||
'CalculaTotales(True)
|
||||
CalculaTotalesVenta()
|
||||
HdnTipoDescuento.Value = "-1"
|
||||
HdnDescuento.Value = "0"
|
||||
RegistraScript("BorraDescuentos();")
|
||||
End If
|
||||
End If
|
||||
UpPS.Update()
|
||||
' If IVAPromedio <> IVA Then
|
||||
' Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError)
|
||||
' Else
|
||||
' AplicarDescuentos()
|
||||
' 'Dim Amortizacion As Decimal = HdnDescuento.Value.Trim.Replace(",", "").ToDecimal
|
||||
' 'LblAmortizacion.Text = Amortizacion.FormatoNumero(2)
|
||||
' 'TxtIVA.Text = ((TxtSubTotal.Text.Trim.Replace(",", "").ToDouble - Amortizacion - LblDescuentos.Text.Trim.Replace(",", "").ToDouble) * IVAPromedio).FormatoNumero(2)
|
||||
' 'HdnIVAOriginal.Value = TxtIVA.Text
|
||||
' 'CalculaTotales(True)
|
||||
' CalculaTotalesVenta()
|
||||
' HdnTipoDescuento.Value = "-1"
|
||||
' HdnDescuento.Value = "0"
|
||||
' RegistraScript("BorraDescuentos();")
|
||||
' End If
|
||||
' End If
|
||||
' UpPS.Update()
|
||||
|
||||
End If
|
||||
'End If
|
||||
|
||||
RegistraScript("$('#ModalDescuento').modal('hide')", "hidemodal")
|
||||
End Sub
|
||||
@@ -6463,7 +6464,7 @@ Partial Class PV
|
||||
Else
|
||||
'TxtPUFactura.Enabled = True
|
||||
'TxtPUFactura.Text = ""
|
||||
DdlPSAjuste.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, AplicaParaVenta:=1)
|
||||
DdlPSAjuste.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
End If
|
||||
DdlPSAjuste.DataBind()
|
||||
' DdlPSAjuste.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
Reference in New Issue
Block a user