Descuento Adicional en PV.aspx
This commit is contained in:
155
Ventas/PV.aspx
155
Ventas/PV.aspx
@@ -1584,6 +1584,12 @@
|
||||
<asp:Label ID="LblAmort" runat="server" ClientIDMode="Static" Text="0.00" Style="display: none;"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="TrDescuentoIncluido" runat="server" visible="false">
|
||||
<td>Descuento Incluido:</td>
|
||||
<td>
|
||||
<asp:Label ID="LblDescuentoIncluido" runat="server" ClientIDMode="Static" Text="0.00"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Por Porcentaje</td>
|
||||
<td>
|
||||
@@ -1604,6 +1610,12 @@
|
||||
($)
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="TrDescuentoAdicional" runat="server" visible="false">
|
||||
<td>Descuento Adicional:</td>
|
||||
<td>
|
||||
<asp:Label ID="LblDescuentoAdicional" runat="server" ClientIDMode="Static" Text="0.00"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b>
|
||||
@@ -2846,6 +2858,7 @@
|
||||
<asp:CustomValidator ID="CVDescuento" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtDescuento" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descuento''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GrpAddVenta"></asp:CustomValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender6" runat="server" HighlightCssClass="vco" TargetControlID="CVDescuento" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
<label for="<%= TxtDescuento.ClientID.ToString()%>">Descuento:</label>
|
||||
<asp:HiddenField ID="HdnDescuentoOriginal" runat="server" Value="0" ClientIDMode="Static" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
@@ -3374,6 +3387,68 @@
|
||||
|
||||
}
|
||||
|
||||
function CalculaDescuentoAdicional() {
|
||||
if ($get("TxtPorDescP").value != "0" && $get("TxtPorDescP").value != "") {
|
||||
var MontoOriginal = ToDouble($get("HdnDescuentoOriginal").value);
|
||||
|
||||
var Monto = 0;
|
||||
var TipoDescuento = $get("HdnTipoDescuento").value;
|
||||
|
||||
if (TipoDescuento == 0) {
|
||||
Monto = parseFloat($get("LblPrecio1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 1) {
|
||||
Monto = parseFloat($get("LblTotalPS1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 2) {
|
||||
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 3) {
|
||||
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
|
||||
if (MontoOriginal > 0) {
|
||||
Monto = Monto - MontoOriginal;
|
||||
}
|
||||
|
||||
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";
|
||||
$get("LblDescuentoAdicional").innerText = "0.00";
|
||||
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(",", ""))) ;
|
||||
|
||||
$get("LblDescuentoAdicional").innerText = formato_numero(Total, 2, '.', ',');
|
||||
|
||||
//SUMA EL DESCUENTO YA EXISTENTE AL ORIGINAL
|
||||
Total = Total + MontoOriginal;
|
||||
|
||||
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
|
||||
$get("TxtDescuento").value = formato_numero(Total, 2, '.', ',');
|
||||
$get("TxtDescP").value = formato_numero(0, 2, '.', ',');
|
||||
$get("HdnDescuento").value = Total;
|
||||
if (TipoDescuento == 2) {
|
||||
$get("LblDescuentos").innerText = formato_numero(Total, 2, '.', ',');
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$get("LblPrecioFinal").innerText = "0.00";
|
||||
$get("LblDescuento").innerText = "0.00";
|
||||
$get("HdnDescuento").value = "0.00";
|
||||
$get("LblDescuentoAdicional").innerText = "0.00";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function CalculaDescuentoMonto() {
|
||||
|
||||
if ($get("TxtDescP").value != "0" && $get("TxtDescP").value) {
|
||||
@@ -3423,6 +3498,69 @@
|
||||
}
|
||||
}
|
||||
|
||||
function CalculaDescuentoMontoAdicional() {
|
||||
|
||||
if ($get("TxtDescP").value != "0" && $get("TxtDescP").value) {
|
||||
var MontoOriginal = ToDouble($get("HdnDescuentoOriginal").value);
|
||||
|
||||
var Monto = 0;
|
||||
var TipoDescuento = $get("HdnTipoDescuento").value;
|
||||
|
||||
if (TipoDescuento == 0) {
|
||||
Monto = parseFloat($get("LblPrecio1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 1) {
|
||||
Monto = parseFloat($get("LblTotalPS1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 2) {
|
||||
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 3) {
|
||||
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
|
||||
if (MontoOriginal > 0) {
|
||||
Monto = Monto - MontoOriginal;
|
||||
}
|
||||
|
||||
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";
|
||||
$get("LblDescuentoAdicional").innerText = "0.00";
|
||||
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, '.', ',');
|
||||
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
|
||||
|
||||
$get("LblDescuentoAdicional").innerText = formato_numero(Total, 2, '.', ',');
|
||||
|
||||
//SUMA EL DESCUENTO YA EXISTENTE AL ORIGINAL
|
||||
Total = Total + MontoOriginal;
|
||||
|
||||
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
|
||||
$get("TxtDescuento").value = formato_numero(Total, 2, '.', ',');
|
||||
$get("HdnDescuento").value = Total;
|
||||
if (TipoDescuento == 2) {
|
||||
Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$get("LblPrecioFinal").innerText = "0.00";
|
||||
$get("LblDescuento").innerText = "0.00";
|
||||
$get("HdnDescuento").value = "0.00";
|
||||
$get("LblDescuentoAdicional").innerText = "0.00";
|
||||
}
|
||||
}
|
||||
|
||||
function BorraDescuentos() {
|
||||
$get("TxtPorDescP").value = "0";
|
||||
$get("TxtDescP").value = "0";
|
||||
@@ -3433,6 +3571,23 @@
|
||||
$("#LblSubTotal1").text($("#TxtSubTotal").val());
|
||||
}
|
||||
|
||||
function AbrirModalDescuentoAdicional()
|
||||
{
|
||||
$('#ModalDescuento').modal();
|
||||
$get('LblTitulo1').style.display = '';
|
||||
$get('LblTitulo2').style.display = 'none';
|
||||
$get('LblTituloTipo1').style.display = '';
|
||||
$get('LblTituloTipo2').style.display = 'none';
|
||||
$get('HdnTipoDescuento').value = '0';
|
||||
$get('LblPrecio1').style.display = '';
|
||||
$get('LblTotalPS1').style.display = 'none';
|
||||
$get('LblSubTotal1').style.display = 'none';
|
||||
$get('LblAmort').style.display = 'none';
|
||||
$get('BtnAplicarDescP').style.display = '';
|
||||
$get('BtnAplicarDescG').style.display = 'none';
|
||||
$get('TrMotivoDescuento').style.display = '';
|
||||
}
|
||||
|
||||
function formato_numero(numero, decimales, separador_decimal, separador_miles) { // v2007-08-06
|
||||
numero = parseFloat(numero);
|
||||
if (isNaN(numero)) {
|
||||
|
||||
Reference in New Issue
Block a user