--Descuento global para alatel
This commit is contained in:
@@ -1127,8 +1127,8 @@
|
||||
</th>
|
||||
<th id="thPredial1" runat="server" visible="false">Predial
|
||||
</th>
|
||||
<th id="thCantConversion1" runat="server" visible="false">Ed. Med
|
||||
</th>
|
||||
<th id="thCantConversion1" runat="server" visible="false">Ed. Med
|
||||
</th>
|
||||
<th id="thEncIVA1" runat="server" visible="true">IVA
|
||||
</th>
|
||||
<th id="thEncIEPS1" runat="server" visible="false">IEPS
|
||||
@@ -1262,8 +1262,7 @@
|
||||
<th id="thPredial2" runat="server" visible="false">
|
||||
<asp:TextBox ID="TxtCuentaPredial" runat="server" Width="75px" CssClass="form-control input-sm" type="number"></asp:TextBox>
|
||||
</th>
|
||||
<th id="thCantConversion2" runat="server" visible="false">
|
||||
</th>
|
||||
<th id="thCantConversion2" runat="server" visible="false"></th>
|
||||
<th id="thEncIVA2" runat="server" visible="true"></th>
|
||||
<th id="thEncIEPS2" runat="server" visible="false"></th>
|
||||
<th id="thPoliza2" runat="server" visible="false">
|
||||
@@ -4726,6 +4725,54 @@
|
||||
</asp:Panel>
|
||||
</div>
|
||||
|
||||
<div id="ModalDescuentoGlobal" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Descuento global</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<asp:UpdatePanel runat="server" ID="UpDescuentoGlobal" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Por Porcentaje</td>
|
||||
<td>
|
||||
<asp:TextBox ID="TxtPorDescGlobal" runat="server" CausesValidation="true" ClientIDMode="Static" MaxLength="12" Text="0" ValidationGroup="GrpDescuentoGlobal" Width="72px"></asp:TextBox>
|
||||
<asp:CompareValidator ID="CVPorDescGlobal" runat="server" ControlToValidate="TxtPorDescGlobal" Display="None" ErrorMessage="El campo <b>''Descuento por Porcentaje''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Currency" ValidationGroup="GrpDescuentoGlobal"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEPorDescGlobal" runat="server" HighlightCssClass="vco" TargetControlID="CVPorDescGlobal" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
(%)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Por Monto</td>
|
||||
<td>
|
||||
<asp:TextBox ID="TxtMontoDescGlobal" runat="server" CausesValidation="true" ClientIDMode="Static" MaxLength="12" Text="0" ValidationGroup="GrpDescuentoGlobal" Width="72px"></asp:TextBox>
|
||||
<asp:CompareValidator ID="CVMontoDescGlobal" runat="server" ControlToValidate="TxtMontoDescGlobal" Display="None" ErrorMessage="El campo <b>''Descuento por Monto''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Currency" ValidationGroup="GrpDescuentoGlobal"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender27" runat="server" HighlightCssClass="vco" TargetControlID="CVMontoDescGlobal" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
($)
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:UpdatePanel runat="server">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnAplicarDescGlobal" runat="server" ClientIDMode="Static" Text="Aplicar" ValidationGroup="GrpDescuentoGlobal" CssClass="btn btn-primary" />
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="DivAnticipos" class="modal ADS fade" role="dialog">
|
||||
<asp:UpdatePanel runat="server" ID="UpAnticipos" UpdateMode="Conditional" RenderMode="Inline">
|
||||
<ContentTemplate>
|
||||
@@ -7380,7 +7427,7 @@
|
||||
Tipo Venta:
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<asp:Label runat="server" ID="LblTipoVentaAsignado" ></asp:Label>
|
||||
<asp:Label runat="server" ID="LblTipoVentaAsignado"></asp:Label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
|
||||
@@ -3667,11 +3667,22 @@ Partial Class Ventas
|
||||
|
||||
InicializaDevolucionAlmacen()
|
||||
|
||||
HabilitarDescuentoGlobal()
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub HabilitarDescuentoGlobal()
|
||||
If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.CveEmpresa.Contiene(181, 182, 183) AndAlso (CveVenta <= 0 OrElse EsCreaApartirDe) Then
|
||||
ImgDescTotal.Visible = True
|
||||
ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuentoGlobal').modal();")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "Bloqueo Pantalla"
|
||||
|
||||
Private Sub ValidaUsuarioAcceso()
|
||||
'VERIFICAR SI LA SESION SE ENCUENTRA BLOQUEADA
|
||||
If UsuarioActual.Empresa.Funcionalidad(599) = "1" Then
|
||||
@@ -17539,9 +17550,9 @@ Partial Class Ventas
|
||||
saldo = (e.Row.DataKey("Saldo").ToString().ToDecimal * tipoCambio).TruncateDecimal
|
||||
Else
|
||||
saldo = e.Row.DataKey("Saldo").ToDecimal
|
||||
End If
|
||||
Else
|
||||
saldo = e.Row.DataKey("Saldo").ToString().ToDecimal
|
||||
End If
|
||||
Else
|
||||
saldo = e.Row.DataKey("Saldo").ToString().ToDecimal
|
||||
|
||||
If CveVenta <= 0 Then
|
||||
If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("2") Then 'cuando es por NC, debe de tomar el total de su saldo respectivo
|
||||
@@ -18592,6 +18603,25 @@ Partial Class Ventas
|
||||
RegistraScript("$('#ModalDescuento').modal('hide')", "hidemodal")
|
||||
UpPS.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAplicarDescGlobal_Click(sender As Object, e As System.EventArgs) Handles BtnAplicarDescGlobal.Click
|
||||
Dim DescuentoManual As Decimal = TxtMontoDescGlobal.Text.ToDecimal()
|
||||
Dim PorcentajeDescuento As Decimal = TxtPorDescGlobal.Text.ToDecimal()
|
||||
|
||||
If DescuentoManual <> 0 AndAlso PorcentajeDescuento <> 0 Then
|
||||
Alert("Debe elegir un solo tipo de descuento", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If PorcentajeDescuento > 100 Then
|
||||
Alert("El porcentaje no puede ser mayor a 100", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
RecalculaPrecios(False, False, AplicarDescuentoGlobal:=True)
|
||||
RegistraScript("$('#ModalDescuentoGlobal').modal('hide')", "hidemodal")
|
||||
UpPS.Update()
|
||||
End Sub
|
||||
Private Sub BtnAplicarOtrosConceptos_Click(sender As Object, e As EventArgs) Handles BtnAplicarOtrosConceptos.Click
|
||||
TotalOtrosConceptos = 0
|
||||
|
||||
@@ -40796,9 +40826,16 @@ Partial Class Ventas
|
||||
RegistraScript("MuestraAnticipos();", "AE")
|
||||
End Sub
|
||||
|
||||
Private Sub RecalculaPrecios(ByRef RecalculoPromociones As Boolean, Optional AplicarPromociones As Boolean = False)
|
||||
Private Sub RecalculaPrecios(ByRef RecalculoPromociones As Boolean, Optional AplicarPromociones As Boolean = False, Optional AplicarDescuentoGlobal As Boolean = False)
|
||||
Dim PuedeRecalcular As Boolean = False
|
||||
|
||||
Dim DescuentoManual As Decimal = 0, DescuentoPorcentaje As Decimal = 0
|
||||
|
||||
If AplicarDescuentoGlobal Then
|
||||
DescuentoManual = TxtMontoDescGlobal.Text.ToDecimal()
|
||||
DescuentoPorcentaje = TxtPorDescGlobal.Text.ToDecimal()
|
||||
End If
|
||||
|
||||
If CveVenta <= 0 OrElse EsCreaApartirDe OrElse (ModalidadEdicion AndAlso Not DdlTipoComprobante.SelectedValue = "Cot") Then
|
||||
PuedeRecalcular = True
|
||||
End If
|
||||
@@ -40812,19 +40849,25 @@ Partial Class Ventas
|
||||
PuedeRecalcular = True
|
||||
End If
|
||||
|
||||
If AplicarDescuentoGlobal Then
|
||||
PuedeRecalcular = True
|
||||
End If
|
||||
|
||||
If TmpDT IsNot Nothing AndAlso PuedeRecalcular Then
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
|
||||
Dim CveClasificacion As Integer = Row("CveClasificacion").ToString().ToEntero
|
||||
Dim CvePS As Integer = Row("CvePS").ToString().ToEntero
|
||||
Dim CodigoPS As String = Row("CodigoPS").ToString()
|
||||
Dim PUOriginal As Decimal = Row("PU").ToString().ToDecimal()
|
||||
|
||||
Dim CvePrecioListaSugerido As Integer = -1
|
||||
|
||||
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = Nothing
|
||||
|
||||
If AplicarPromociones Then
|
||||
If AplicarPromociones OrElse AplicarDescuentoGlobal Then
|
||||
ObjPrecioSugerido = New Modelos.MPrecioSugerido()
|
||||
ObjPrecioSugerido.PrecioSugerido = Row("PU").ToString().ToDecimal()
|
||||
ObjPrecioSugerido.PrecioSugerido = PUOriginal
|
||||
ObjPrecioSugerido.CvePrecioLista = Row("CvePrecioLista").ToString().ToEntero()
|
||||
Else
|
||||
ObjPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
|
||||
@@ -40834,8 +40877,30 @@ Partial Class Ventas
|
||||
Dim PU As Decimal = ObjPrecioSugerido.PrecioSugerido.RoundSQL(6)
|
||||
|
||||
Dim ObjDescuento As Modelos.VentaDescuentos = CalcularDescuentos(CvePS, Cantidad, PU)
|
||||
If ObjDescuento.EsPUModificado Then
|
||||
PU = ObjDescuento.PU
|
||||
If AplicarDescuentoGlobal Then
|
||||
|
||||
If DescuentoManual > 0 Then
|
||||
ObjDescuento.EsPUModificado = False
|
||||
ObjDescuento.ImporteDescuento = DescuentoManual
|
||||
ObjDescuento.ImporteProntoPago = 0
|
||||
|
||||
If ObjDescuento.ImporteDescuento > (Cantidad * PU) Then
|
||||
Alert($"El producto y/o servicio '{CodigoPS}' no puede tener un descuento mayor al total", TipoMensaje.MsgAdvertencia)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If DescuentoPorcentaje > 0 Then
|
||||
ObjDescuento.EsPUModificado = False
|
||||
ObjDescuento.ImporteDescuento = (Cantidad * PU) * (DescuentoPorcentaje / 100D)
|
||||
ObjDescuento.ImporteProntoPago = 0
|
||||
End If
|
||||
|
||||
Else
|
||||
If ObjDescuento.EsPUModificado Then
|
||||
PU = ObjDescuento.PU
|
||||
End If
|
||||
End If
|
||||
|
||||
'SI NO TIENE PROMOCION, NO MODIFICAR NADA
|
||||
|
||||
Reference in New Issue
Block a user