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,263 +23896,278 @@ 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)
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)
Exit Sub
Else
'VALIDA CLAVES SAT
If DrPS("SATClavePS").ToString() = "" Then
Alert($"El concepto <b>{DrPS("Codigo").ToString()}-{DrPS("PS").ToString()}</b> no cuenta con producto SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
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)
Exit Sub
Else
'VALIDA CLAVES SAT
If DrPS("SATClavePS").ToString() = "" Then
Alert($"El concepto <b>{DrPS("Codigo").ToString()}-{DrPS("PS").ToString()}</b> no cuenta con producto SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DrPS("SATClaveUnidadMedida").ToString() = "" Then
Alert($"El concepto <b>{DrPS("Codigo").ToString()}-{DrPS("PS").ToString()}</b> no cuenta con Unidad Medida SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
If DrPS("SATClaveUnidadMedida").ToString() = "" Then
Alert($"El concepto <b>{DrPS("Codigo").ToString()}-{DrPS("PS").ToString()}</b> no cuenta con Unidad Medida SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
Exit Sub
If Not AplicaImpuestosLocales Then
If TmpDTImpuestos IsNot Nothing Then
TmpDTImpuestos.Rows.Clear()
GvImpuestosLocales2.DataSource = TmpDTImpuestos
GvImpuestosLocales2.DataBind()
End If
End If
End If
If Not AplicaImpuestosLocales Then
If TmpDTImpuestos IsNot Nothing Then
TmpDTImpuestos.Rows.Clear()
GvImpuestosLocales2.DataSource = TmpDTImpuestos
GvImpuestosLocales2.DataBind()
End If
End If
Me.AplicoNCFacturaActual = AplicoNCFacturaActual
Me.AplicoNCFacturaActual = AplicoNCFacturaActual
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
InicializaDTVentasNC()
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
InicializaDTVentasNC()
Dim DtImpuestos As New DataTable
DtImpuestos.Columns.Add("ImportePU", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteTotal", GetType(Decimal))
DtImpuestos.Columns.Add("PorcentajeIVA", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteIVA", GetType(Decimal))
DtImpuestos.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteRetIVA", GetType(Decimal))
DtImpuestos.Columns.Add("PorcentajeRetISR", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteRetISR", GetType(Decimal))
DtImpuestos.Columns.Add("PorcentajeIEPS", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteIEPS", GetType(Decimal))
DtImpuestos.Columns.Add("CveSubProyecto", GetType(Integer))
DtImpuestos.AcceptChanges()
Dim AcumuladoNC As Decimal = 0
Dim DtImpuestos As New DataTable
DtImpuestos.Columns.Add("ImportePU", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteTotal", GetType(Decimal))
DtImpuestos.Columns.Add("PorcentajeIVA", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteIVA", GetType(Decimal))
DtImpuestos.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteRetIVA", GetType(Decimal))
DtImpuestos.Columns.Add("PorcentajeRetISR", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteRetISR", GetType(Decimal))
DtImpuestos.Columns.Add("PorcentajeIEPS", GetType(Decimal))
DtImpuestos.Columns.Add("ImporteIEPS", GetType(Decimal))
DtImpuestos.Columns.Add("CveSubProyecto", GetType(Integer))
DtImpuestos.AcceptChanges()
Dim AcumuladoNC As Decimal = 0
Dim DtImpuestosBonificacion As DataTable = DtImpuestos.Copy()
Dim DtImpuestosBonificacion As DataTable = DtImpuestos.Copy()
If Not AplicaNuevoDocumento Then
If AplicaNCMasiva Then
If NCDescuento Then
For Each RNC In ListaNCDesc
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
Next
If Not AplicaNuevoDocumento Then
If AplicaNCMasiva Then
If NCDescuento Then
For Each RNC In ListaNCDesc
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
Next
'SI HAY RNC DE BONIFICACION SE AGREGAN
If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
For Each RNC In ListaNCBonificacion
DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
'SI HAY RNC DE BONIFICACION SE AGREGAN
If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
For Each RNC In ListaNCBonificacion
DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
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
Else
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero())
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 EsNCAmortizacion Then
If DtAnticipoAmortizacion Is Nothing Then
InicializaDTAnticiposAmortizacion()
End If
Dim PorcentajeAplicado As Decimal = (TxtNCPorcentaje.Text.ToDecimal / 100D)
Dim RowAnticipo As DataRow = DtAnticipoAmortizacion.NewRow
RowAnticipo("CveVenta") = Me.CveVenta
RowAnticipo("Importe") = TxtNCImporte.Text.Trim.ToDecimal
RowAnticipo("SaldoAnticipo") = SaldoAnticipo * PorcentajeAplicado
DtAnticipoAmortizacion.Rows.Add(RowAnticipo)
End If
End If
Else
For Each RNC In ListaRemisionesNC
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
Next
For Each RNC In ListaNCBonificacion
DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
Next
End If
Dim query = From dr In DtImpuestos
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
Into x = Group
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
PorcentajeIVA = PorcentajeIVA,
PorcentajeRetIVA = PorcentajeRetIVA,
PorcentajeRetISR = PorcentajeRetISR,
PorcentajeIEPS = PorcentajeIEPS
Dim queryBonificacion = From dr In DtImpuestosBonificacion
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
Into x = Group
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
PorcentajeIVA = PorcentajeIVA,
PorcentajeRetIVA = PorcentajeRetIVA,
PorcentajeRetISR = PorcentajeRetISR,
PorcentajeIEPS = PorcentajeIEPS
Dim DrSubProyecto = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("")
If DrSubProyecto Is Nothing Then
Alert("Ocurrió un error al cargar la información de centro de costos. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
Exit Sub
End If
DtImpuestos = query.QueryToDataTable(False)
DtImpuestosBonificacion = queryBonificacion.QueryToDataTable(False)
If Not NCDescuento Then
LimpiaDocumentoNC()
End If
Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString().ToEntero()
Dim SubProyecto = DrSubProyecto("SubProyecto").ToString()
Dim CveProyecto = DrSubProyecto("CveProyecto").ToString().ToEntero()
Dim Proyecto = DrSubProyecto("Proyecto").ToString()
AplicaNC = True
If NCDescuento Then
TmpDTDescNC = TmpDT.Clone()
TmpDTDescNC.Clear()
If UsuarioActual.CveEmpresa = 140 Then
CrearDTNCCargo(ListaNCDesc, DtImpuestos, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
If DrPSBonificacion IsNot Nothing Then
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
Else
For Each Dr As DataRow In DtImpuestos.Rows
AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
Next
End If
Else
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero())
If EsNCAmortizacion Then
If DtAnticipoAmortizacion Is Nothing Then
InicializaDTAnticiposAmortizacion()
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("1")
'verifica el tipo de cambio que se actualice
If DdlMoneda.SelectedValue <> "1" Then
TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString()
End If
Else
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
DdlTipoComprobante.SelectedValueExist("Egs")
'verifica el total de multiples facturas
Dim Acumulado12 As Decimal = 0
Dim UltimoRenglon As Integer = 1
Dim Ajuste As Decimal = 0
'DEBE AGREGAR LOS USADOS DE LA REMISION EN LA NOTA DE CREDITO
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'
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
If DrPSBonificacion IsNot Nothing Then
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
Dim PorcentajeAplicado As Decimal = (TxtNCPorcentaje.Text.ToDecimal / 100D)
Dim RowAnticipo As DataRow = DtAnticipoAmortizacion.NewRow
RowAnticipo("CveVenta") = Me.CveVenta
RowAnticipo("Importe") = TxtNCImporte.Text.Trim.ToDecimal
RowAnticipo("SaldoAnticipo") = SaldoAnticipo * PorcentajeAplicado
DtAnticipoAmortizacion.Rows.Add(RowAnticipo)
End If
End If
Else
For Each RNC In ListaRemisionesNC
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
Next
For Each RNC In ListaNCBonificacion
DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
Next
End If
Dim query = From dr In DtImpuestos
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
Into x = Group
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
PorcentajeIVA = PorcentajeIVA,
PorcentajeRetIVA = PorcentajeRetIVA,
PorcentajeRetISR = PorcentajeRetISR,
PorcentajeIEPS = PorcentajeIEPS
Dim queryBonificacion = From dr In DtImpuestosBonificacion
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
Into x = Group
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
PorcentajeIVA = PorcentajeIVA,
PorcentajeRetIVA = PorcentajeRetIVA,
PorcentajeRetISR = PorcentajeRetISR,
PorcentajeIEPS = PorcentajeIEPS
Dim DrSubProyecto = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("")
If DrSubProyecto Is Nothing Then
Alert("Ocurrió un error al cargar la información de centro de costos. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
Exit Sub
End If
DtImpuestos = query.QueryToDataTable(False)
DtImpuestosBonificacion = queryBonificacion.QueryToDataTable(False)
If Not NCDescuento Then
LimpiaDocumentoNC()
End If
Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString().ToEntero()
Dim SubProyecto = DrSubProyecto("SubProyecto").ToString()
Dim CveProyecto = DrSubProyecto("CveProyecto").ToString().ToEntero()
Dim Proyecto = DrSubProyecto("Proyecto").ToString()
AplicaNC = True
If NCDescuento Then
TmpDTDescNC = TmpDT.Clone()
TmpDTDescNC.Clear()
If UsuarioActual.CveEmpresa = 140 Then
CrearDTNCCargo(ListaNCDesc, DtImpuestos, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
If DrPSBonificacion IsNot Nothing Then
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
Else
For Each Dr As DataRow In DtImpuestos.Rows
AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
Next
End If
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("1")
'verifica el tipo de cambio que se actualice
If DdlMoneda.SelectedValue <> "1" Then
TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString()
End If
Else
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
DdlTipoComprobante.SelectedValueExist("Egs")
'verifica el total de multiples facturas
Dim Acumulado12 As Decimal = 0
Dim UltimoRenglon As Integer = 1
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
CrearDTNCCargo(ListaRemisionesNC, DtImpuestos, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
If DrPSBonificacion IsNot Nothing Then
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
Else
For Each Dr As DataRow In DtImpuestos.Rows
Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
If UltimoRenglon = DtImpuestos.Rows.Count Then
'ajusta 5 centavos de diferencia
If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
Ajuste = (Acumulado12 - AcumuladoNC)
For Each Dr As DataRow In DtImpuestos.Rows
Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
If UltimoRenglon = DtImpuestos.Rows.Count Then
'ajusta 5 centavos de diferencia
If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
Ajuste = (Acumulado12 - AcumuladoNC)
End If
End If
End If
UltimoRenglon += 1
UltimoRenglon += 1
AgregaTempDT(TmpDT, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal(), "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
AgregaTempDT(TmpDT, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal(), "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
Next
End If
GvPS.DataSource = TmpDT
GvPS.DataBind()
CalculaTotalesVenta(RecalculaImpuestosLocales:=AplicaImpuestosLocales)
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("1")
DdlSubProyectoDatos.Enabled = False
'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00
If Not AplicaNCMasiva Then
Dim TT As Decimal = TxtNCImporte.Text.ToDecimal
If TT > TxtTotal.Text.ToDecimal Then TT = TxtTotal.Text.ToDecimal
CargaNCDT(CveVenta, TT)
End If
'verifica el tipo de cambio que se actualice
If DdlMoneda.SelectedValue <> "1" Then
TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString()
End If
LblTCValuacion.Visible = False
UpPS.Update()
LBNotaCredito.Visible = False
CambiaTipoDocto()
Next
End If
GvPS.DataSource = TmpDT
GvPS.DataBind()
CalculaTotalesVenta(RecalculaImpuestosLocales:=AplicaImpuestosLocales)
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("1")
DdlSubProyectoDatos.Enabled = False
'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00
If Not AplicaNCMasiva Then
Dim TT As Decimal = TxtNCImporte.Text.ToDecimal
If TT > TxtTotal.Text.ToDecimal Then TT = TxtTotal.Text.ToDecimal
CargaNCDT(CveVenta, TT)
End If
'verifica el tipo de cambio que se actualice
If DdlMoneda.SelectedValue <> "1" Then
TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString()
End If
LblTCValuacion.Visible = False
UpPS.Update()
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")
DdlMetodoPago33.Enabled = True
DdlMetodoPago33.SelectedValueExist("1") ' PUE
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
DdlFormaPago33.Enabled = True
DdlFormaPago33.SelectedValueExist("11") ' condonación por default
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