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)) {
|
||||
|
||||
@@ -1062,7 +1062,7 @@ Partial Class PV
|
||||
ViewState("ClienteRetIVA") = 0
|
||||
ViewState("ClienteRetISR") = 0
|
||||
ViewState("EnviarCorreoCliente") = False
|
||||
HdnPorcentajeDescuentoMaximo.Value = UsuarioActual.DescuentoAutorizado.ToString()
|
||||
HdnPorcentajeDescuentoMaximo.Value = If(UsuarioActual.DescuentoAutorizado > 0, UsuarioActual.DescuentoAutorizado, 15).ToString()
|
||||
CveVentaDetalle = -1
|
||||
EstablecioFolio = False
|
||||
EstatusCliente = False
|
||||
@@ -1113,7 +1113,19 @@ Partial Class PV
|
||||
LblUsuario.Text = UsuarioActual.Usuario
|
||||
TxtCantidad.Attributes.Add("onKeyUp ", "Recalcula();")
|
||||
TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();")
|
||||
ImgDescPU.Attributes.Add("onclick", "javascript:$('#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 = '';")
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
ImgDescPU.Attributes.Add("onclick", "javascript:AbrirModalDescuentoAdicional();")
|
||||
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuentoAdicional();")
|
||||
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuentoMontoAdicional();")
|
||||
TrDescuentoIncluido.Visible = True
|
||||
TrDescuentoAdicional.Visible = True
|
||||
Else
|
||||
ImgDescPU.Attributes.Add("onclick", "javascript:$('#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 = '';")
|
||||
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
|
||||
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuentoMonto();")
|
||||
End If
|
||||
|
||||
'ImgDescConcepto.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '1'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = ''; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
|
||||
'ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
|
||||
ImgOtrosConceptos.Attributes.Add("onclick", "javascript:$('#ModalOtrosConceptos').modal();")
|
||||
@@ -1131,8 +1143,8 @@ Partial Class PV
|
||||
'ImgCerrarTerminoCorte.Attributes.Add("OnClick", "$('#DivTerminarCorte').hide();")
|
||||
'ImgCerrarIE.Attributes.Add("OnClick", "$('#DivIngresoEgreso').hide();")
|
||||
'ImgCerrarEstadoCaja.Attributes.Add("OnClick", "$('#DivEstadoCaja').hide();")
|
||||
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
|
||||
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuentoMonto();")
|
||||
|
||||
|
||||
'TxtFechaAjuste.Attributes.Add("onchange", "CalculaMesesUso();")
|
||||
|
||||
CreaDTmpC()
|
||||
@@ -4049,6 +4061,14 @@ Partial Class PV
|
||||
TxtDescuento.Text = (PrecioSugerido * ClasificacionesDescuentos(drPS("CveClasificacion").ToString.ToEntero)).ToString("F2")
|
||||
End If
|
||||
|
||||
HdnDescuentoOriginal.Value = TxtDescuento.Text.ToDecimal().ToString()
|
||||
LblDescuentoIncluido.Text = TxtDescuento.Text.ToDecimal().FormatoNumero(2)
|
||||
|
||||
If PrecioSugerido > 0 AndAlso TxtDescuento.Text.ToDecimal() > 0 Then
|
||||
TxtPrecio.Text = PrecioSugerido.FormatoNumero()
|
||||
RegistraScript("$get('LblPrecio1').innerText = formato_numero(" + PrecioSugerido.ToString() + ", 2, '.', ',');", "A1")
|
||||
End If
|
||||
|
||||
If ChkAjuste.Checked Then
|
||||
CalculaMesesUso()
|
||||
UpAjuste.Update()
|
||||
@@ -4072,6 +4092,7 @@ Partial Class PV
|
||||
UpPS.Update()
|
||||
UpUnidadMedida.Update()
|
||||
UpAddVenta.Update()
|
||||
UPPDescuento.Update()
|
||||
End Sub
|
||||
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange
|
||||
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS)
|
||||
|
||||
Reference in New Issue
Block a user