Bonificaciones por productos al aplicar NC. pt2
This commit is contained in:
@@ -6680,11 +6680,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<asp:CheckBox ID="ChkMostarProductosRNCBon" runat="server" AutoPostBack="true" Text="Mostrar Productos" OnCheckedChanged="ChkMostarProductosRNCBon_CheckedChanged" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-right: 10px;" align="right">
|
||||
<input type="text" id="TxtBusquedaNCBon" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaNCBon','{0}')", GvRemisionesNCBon.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaNCBon','{0}')", GvRemisionesNCBon.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row" id="DivRNCBonificaciones" runat="server" visible="false">
|
||||
<div class="col-md-12" style="max-height: 440px; overflow: auto">
|
||||
<asp:GridView ID="GvRemisionesNCBon" runat="server" AutoGenerateColumns="False"
|
||||
DataKeyNames="CveVenta,CveVentaRNCCargo" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
||||
@@ -6716,6 +6721,35 @@
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="DivRNCBonificacionesDetalle" runat="server" visible="false">
|
||||
<div class="col-md-12" style="max-height: 440px; overflow: auto">
|
||||
<asp:GridView ID="GvRemisionesNCBonDetalle" runat="server" AutoGenerateColumns="False"
|
||||
DataKeyNames="CveVenta,CveVentaDetalleRNC,CvePS,PU,PorcentajeIVA" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="ChkAplicar" runat="server" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Cantidad">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtCantidadRNC" runat="server" Text='<%#Eval("CantidadPendiente").ToString%>' MaxLength="12" Width="46px" Height="24px"></asp:TextBox>
|
||||
<asp:RangeValidator ID="RVCantRNC" runat="server" Type="Double" MinimumValue="0" MaximumValue='<%#Eval("CantidadPendiente").ToString%>' ErrorMessage="Cantidad Excedida" ControlToValidate="TxtCantidadRNC" Display="None" ValidationGroup="VGAplicarRNC"></asp:RangeValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCECantidad3" runat="server" HighlightCssClass="vco" TargetControlID="RVCantRNC" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="Folio" HeaderText="Folio" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="TtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -7769,7 +7803,6 @@
|
||||
|
||||
|
||||
}
|
||||
|
||||
function CalculaSaldoRNCChkDetalleBonificacion(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
|
||||
//ImportesRNCCargo
|
||||
let Importe = 0;
|
||||
@@ -7836,6 +7869,73 @@
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function CalculaSaldoRNCChkDetalleBon(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
|
||||
//ImportesRNCCargo
|
||||
let Importe = 0;
|
||||
if (Chk.checked) {
|
||||
let SaldoMaximoUtilizable = ToDouble(HdnSMUBon.value);
|
||||
let ImportesAsignados = 0;
|
||||
|
||||
$('.ImportesRNCDetalleBonificacion').each(function () {
|
||||
|
||||
if (Chk.id != $(this).find("td").eq(0).find(":checkbox").attr('id')) {
|
||||
let seleccionado = $(this).find("td").eq(0).find(":checkbox").is(':checked');
|
||||
|
||||
if (seleccionado) {
|
||||
let cantidad = ToDouble($(this).find("td").eq(1).find(":text").val());
|
||||
let porcentajeIVA = ToDouble($(this).find("td").eq(0).find(":hidden").val());
|
||||
let precio = ToDouble($(this).find("td").eq(5).find(":hidden").val());
|
||||
|
||||
let totalcalculableImpuestos = (cantidad * precio);
|
||||
let iva = ToDouble((totalcalculableImpuestos * porcentajeIVA).toFixed(2));
|
||||
|
||||
ImportesAsignados += totalcalculableImpuestos + iva;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Importe = SaldoMaximoUtilizable - ImportesAsignados;
|
||||
|
||||
if (Importe > 0) {
|
||||
|
||||
} else {
|
||||
if (SaldoMaximoUtilizable > 0) {
|
||||
Importe = 0;
|
||||
Chk.checked = false;
|
||||
} else {
|
||||
Importe = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Importe = 0;
|
||||
}
|
||||
|
||||
Importe = ToDouble(Importe.toFixed(2));
|
||||
|
||||
if (Importe > 0) {
|
||||
|
||||
let pu = (ImporteTotal / CantidadPendiente);
|
||||
|
||||
if (pu > 0) {
|
||||
const cantidadSugerida = (Importe / pu);
|
||||
if (cantidadSugerida > CantidadPendiente) {
|
||||
TxtCantidad.value = CantidadPendiente.toString();
|
||||
}else {
|
||||
TxtCantidad.value = cantidadSugerida.toString();
|
||||
}
|
||||
|
||||
}else {
|
||||
TxtCantidad.value = "0";
|
||||
}
|
||||
|
||||
}else {
|
||||
TxtCantidad.value = "0";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function LimitaSaldoRNCChk(TxtImporte, Saldo) {
|
||||
|
||||
Reference in New Issue
Block a user