Concepto de ajuste o garantia total,bonificacion por usados, porcentaje de ajuste

This commit is contained in:
2020-11-25 22:09:14 -07:00
parent 887cda3224
commit 0df4303f89
5 changed files with 343 additions and 257 deletions

View File

@@ -728,7 +728,7 @@ Public Class ClsAcumuladores
Public Function AddGarantiasDetalle(CveVentaDetalle As Integer, CvePS As Integer, CveFolioGarantia As Integer, CveTipoUso As Integer,
CodigoEnsamble As String, CodigoLinea As String, CodigoInspeccion As String,
CveTipoDefecto As Integer, NumPoliza As String, Importe As Double,
Consecutivo As String, FechaAjuste As DateTime) As Boolean
Consecutivo As String, FechaAjuste As DateTime, PorcentajeAjuste As Decimal) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_GarantiasDetalleAdd")
With SqlAdapter.SelectCommand.Parameters
@@ -744,6 +744,7 @@ Public Class ClsAcumuladores
.Add("@Importe", SqlDbType.Float).Value = Importe
.Add("@Consecutivo", SqlDbType.VarChar).Value = Consecutivo
.Add("@FechaAjuste", SqlDbType.DateTime).Value = FechaAjuste
.Add("@PorcentajeAjuste", SqlDbType.Float).Value = PorcentajeAjuste
End With
Try
SqlAdapter.Fill(Data)
@@ -926,7 +927,7 @@ Public Class ClsAcumuladores
Return Retorno
End Function
Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha, Optional CveVentaRNCCargo As Integer = -1) As Boolean
Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha, Optional CveVentaRNCCargo As Integer = -1, Optional CveConcepto As Integer = -1) As Boolean
Dim Retorno As Boolean = False
'Data = New DataTable
@@ -938,6 +939,7 @@ Public Class ClsAcumuladores
.Add("@FechaI", SqlDbType.Date).Value = FechaI
.Add("@FechaF", SqlDbType.Date).Value = FechaF
.Add("@CveVentaRNCCargo", SqlDbType.Int).Value = CveVentaRNCCargo
.Add("@CveConcepto", SqlDbType.Int).Value = CveConcepto
End With
Try

View File

@@ -1468,7 +1468,7 @@ Namespace Modelos
For Each Dr As DataRow In DtAjustes.Rows
If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero,
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero,
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime()) Then
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime(), Dr("PorcentajeAjuste").ToString.ToDecimal()) Then
ErrorList.Add("Ocurrió un error al agregar la garantia detalle.")
End If
Next

View File

@@ -1902,7 +1902,7 @@ Partial Class PV
For Each Dr As DataRow In TmpDTAjustes.Rows
If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero,
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero,
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime()) Then
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime(), Dr("PorcentajeAjuste").ToString.ToDecimal()) Then
ErrorList.Add("Ocurrió un error al agregar la garantia detalle.")
End If
Next

View File

@@ -6152,7 +6152,7 @@
<br />
<div class="col-md-12" style="height: 440px; overflow: auto">
<asp:GridView ID="GvCxC" runat="server" AutoGenerateColumns="False" OnRowDataBound="GvCxC_RowDataBound"
DataKeyNames="CveVenta" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
DataKeyNames="CveVenta,CveMetodoPago33,CveFormaPago33" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
@@ -6427,16 +6427,19 @@
<h4 class="modal-title">Aplicar Devolución</h4>
</div>
<div class="modal-body">
<div class="row" id="">
<div class="row" id="DivPenalizacion" runat="server" visible="false">
<div class="col-md-2">
<label>Aplicar % de Penalización</label>
</div>
<div class="col-md-4">
<asp:TextBox ID="TxtPorPenalizacion" runat="server" CssClass="form-control input-sm" Text="0" onkeyup="CalculaPenalizacionDevolucion(this);"></asp:TextBox>
<div class="col-md-2">
<asp:TextBox ID="TxtPorPenalizacion" runat="server" CssClass="form-control input-sm" Text="" onkeyup="LimitaPenalizacionDevolucion(this);"></asp:TextBox>
<asp:RangeValidator ID="RFVPenalizacion" runat="server" Type="Integer" MinimumValue="0" MaximumValue="100" ErrorMessage="El campo <b>''Penalización''</b> es necesario, por favor ingréselo." ControlToValidate="TxtPorPenalizacion" Display="None"></asp:RangeValidator>
<ajax:FilteredTextBoxExtender ID="FTBPenalizacion" runat="server" TargetControlID="TxtPorPenalizacion" FilterType="Custom, Numbers" ValidChars=".," />
</div>
<div class="col-md-6"></div>
<div class="col-md-2">
<asp:Button ID="BtnCalcularPenalizacion" runat="server" CssClass="btn btn-primary btn-sm" Text="Calcular" OnClick="BtnCalcularPenalizacion_Click" />
</div>
<div class="col-md-6"> </div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="text-right col-md-offset-8 col-md-4">
@@ -6480,7 +6483,7 @@
<asp:BoundField HeaderText="PU" DataField="PU" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:TemplateField HeaderText="PU Editado" Visible="false">
<ItemTemplate>
<asp:TextBox ID="TxtPrecioEditado" runat="server" Text='<%#Eval("PU").ToString%>' MaxLength="12" Width="90%" Height="24px" CssClass="ImporteDevolucion"></asp:TextBox>
<asp:TextBox ID="TxtPrecioEditado" runat="server" Text='<%#Eval("PU").ToString%>' MaxLength="12" Width="50%" Height="24px" CssClass="ImporteDevolucion"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros1Editado" runat="server" TargetControlID="TxtPrecioEditado" FilterType="Custom, Numbers" ValidChars=".," />
</ItemTemplate>
</asp:TemplateField>
@@ -7351,14 +7354,10 @@
}
}
function CalculaPenalizacionDevolucion(TxtPenalizacion) {
const Porcentaje = ToDouble(TxtPenalizacion.value) / ToDouble(100);
if (Porcentaje <= 1) {
$('.ImporteDevolucion').each(function () {
const importe = ToDouble($(this).val());
const resta = importe * Porcentaje;
$(this).val(FormatoNumero((importe - resta), 2));
});
function LimitaPenalizacionDevolucion(TxtPenalizacion) {
const Porcentaje = ToDouble(TxtPenalizacion.value)
if (Porcentaje >= 100) {
TxtPenalizacion.value = "100"
}
}
@@ -7931,7 +7930,6 @@
}
function chkAnt(t, txt, importe, AmorContrato = 0) {
debugger;
var totalAnt = 0;
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();

View File

@@ -2053,6 +2053,10 @@ Partial Class Ventas
thPoliza2.Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso UsuarioActual.CveUsuario = 100 Then
DivPenalizacion.Visible = True
End If
DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat")
DivPSSAT.Visible = True
@@ -23892,6 +23896,8 @@ Partial Class Ventas
End Sub
Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False)
Try
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
@@ -23952,13 +23958,21 @@ Partial Class Ventas
Next
End If
Else
Dim NumVentasAplicar As Integer = 1
For Each Gvr As GridViewRow In GvCxC.Rows
If Gvr.FCCheckBox("ChkCxC").Checked Then
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
'CARGA FACTURA A LA CUAL SE APLICA LA NC
AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal
CargaNCDT(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal)
If UsuarioActual.CveEmpresa = 140 AndAlso NumVentasAplicar = 1 Then
DdlMetodoPago33.Enabled = True
DdlMetodoPago33.SelectedValueExist(Gvr.DataKey("CveMetodoPago33").ToString())
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
DdlFormaPago33.Enabled = True
DdlFormaPago33.SelectedValueExist(Gvr.DataKey("CveFormaPago33").ToString())
End If
NumVentasAplicar += 1
End If
Next
End If
@@ -24091,7 +24105,7 @@ Partial Class Ventas
Dim Ajuste As Decimal = 0
'DEBE AGREGAR LOS USADOS DE LA REMISION EN LA NOTA DE CREDITO
If UsuarioActual.CveEmpresa = 140 AndAlso ListaRemisionesNC.Count > 0 Then
If UsuarioActual.CveEmpresa = 140 AndAlso (ListaRemisionesNC IsNot Nothing AndAlso ListaRemisionesNC.Count > 0) Then
CrearDTNCCargo(ListaRemisionesNC, DtImpuestos, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
@@ -24148,7 +24162,12 @@ Partial Class Ventas
LBNotaCredito.Visible = False
CambiaTipoDocto()
End If
Catch ex As Exception
OnError("Ocurrió un error al aplicar NC", ex)
End Try
UPCondicionesPago.Update()
End Sub
Private Sub CrearDTNCCargo(ListaNC As List(Of Modelos.Factura), DtImpuestos As DataTable, ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
@@ -24467,11 +24486,13 @@ Partial Class Ventas
'ACTIVA CONDICIONES DE PAGO
DdlUsoCFDI.Enabled = True
DdlUsoCFDI.SelectedValueExist("2")
If UsuarioActual.CveEmpresa <> 140 Then
DdlMetodoPago33.Enabled = True
DdlMetodoPago33.SelectedValueExist("1") ' PUE
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
DdlFormaPago33.Enabled = True
DdlFormaPago33.SelectedValueExist("11") ' condonación por default
End If
UpEstatus.Update()
UpnTools.Update()
@@ -24595,6 +24616,22 @@ Partial Class Ventas
UpDevolucion.Update()
End Sub
Protected Sub BtnCalcularPenalizacion_Click(sender As Object, e As EventArgs)
Dim PorcentajePenalizacion As Decimal = (TxtPorPenalizacion.Text.ToDecimal() / 100D)
For Each GvRow As GridViewRow In GvAplicaDevolucion.Rows
If GvRow.FCCheckBox("Chk").Checked Then
Dim Total As Decimal = GvRow.DataKey("PU").ToDecimal() - (GvRow.DataKey("Descuento").ToDecimal() / GvRow.DataKey("Cantidad").ToDecimal())
'APLICA EL PORCENTAJE DE PENALIZACION
GvRow.FCTextBox("TxtPrecioEditado").Text = (Total - (Total * PorcentajePenalizacion)).FormatoNumero(2)
End If
Next
UpDevolucion.Update()
End Sub
Protected Sub BtnAplicaDevolucion_Click(sender As Object, e As EventArgs)
'VALIDACIONES
@@ -27229,6 +27266,33 @@ Partial Class Ventas
End If
Next
'SI TIENE ALGUN AJUSTE O GARANTIA
If ListaRemisionesNC.Any(Function(RNC) RNC.Num2 = 1) Then
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
Dim Salir As Boolean = False
Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
'SI ES GARANTIA TOTAL
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
DdlNCPS.SelectedValueExist(443174)
DdlNCPS.Enabled = False
Salir = True
Else
DdlNCPS.SelectedValueExist(443173)
DdlNCPS.Enabled = False
End If
End If
End Using
If Salir Then
Exit For
End If
Next
Else
DdlNCPS.Enabled = True
End If
For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
@@ -27304,6 +27368,28 @@ Partial Class Ventas
End If
Next
'SI TIENE ALGUN AJUSTE O GARANTIA
If ListaNCDesc.Any(Function(RNC) RNC.Num2 = 1) Then
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
Dim Salir As Boolean = False
Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
'SI ES GARANTIA TOTAL
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=443174, AplicaParaVenta:=1).Rows(0)
Salir = True
Else
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=443173, AplicaParaVenta:=1).Rows(0)
End If
End If
End Using
If Salir Then
Exit For
End If
Next
End If
Dim LimiteUsados As Decimal = LblSaldoMaximoUsados.Text.Trim().ToDecimal()
'VERIFICA EL LIMITE DE LOS USADOS