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

View File

@@ -1468,7 +1468,7 @@ Namespace Modelos
For Each Dr As DataRow In DtAjustes.Rows 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, 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("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.") ErrorList.Add("Ocurrió un error al agregar la garantia detalle.")
End If End If
Next Next

View File

@@ -1902,7 +1902,7 @@ Partial Class PV
For Each Dr As DataRow In TmpDTAjustes.Rows 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, 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("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.") ErrorList.Add("Ocurrió un error al agregar la garantia detalle.")
End If End If
Next Next

View File

@@ -6152,7 +6152,7 @@
<br /> <br />
<div class="col-md-12" style="height: 440px; overflow: auto"> <div class="col-md-12" style="height: 440px; overflow: auto">
<asp:GridView ID="GvCxC" runat="server" AutoGenerateColumns="False" OnRowDataBound="GvCxC_RowDataBound" <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> <Columns>
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>
@@ -6427,16 +6427,19 @@
<h4 class="modal-title">Aplicar Devolución</h4> <h4 class="modal-title">Aplicar Devolución</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row" id=""> <div class="row" id="DivPenalizacion" runat="server" visible="false">
<div class="col-md-2"> <div class="col-md-2">
<label>Aplicar % de Penalización</label> <label>Aplicar % de Penalización</label>
</div> </div>
<div class="col-md-4"> <div class="col-md-2">
<asp:TextBox ID="TxtPorPenalizacion" runat="server" CssClass="form-control input-sm" Text="0" onkeyup="CalculaPenalizacionDevolucion(this);"></asp:TextBox> <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> <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=".," /> <ajax:FilteredTextBoxExtender ID="FTBPenalizacion" runat="server" TargetControlID="TxtPorPenalizacion" FilterType="Custom, Numbers" ValidChars=".," />
</div> </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>
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="text-right col-md-offset-8 col-md-4"> <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:BoundField HeaderText="PU" DataField="PU" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:TemplateField HeaderText="PU Editado" Visible="false"> <asp:TemplateField HeaderText="PU Editado" Visible="false">
<ItemTemplate> <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=".," /> <ajax:FilteredTextBoxExtender ID="SoloNumeros1Editado" runat="server" TargetControlID="TxtPrecioEditado" FilterType="Custom, Numbers" ValidChars=".," />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
@@ -7351,14 +7354,10 @@
} }
} }
function CalculaPenalizacionDevolucion(TxtPenalizacion) { function LimitaPenalizacionDevolucion(TxtPenalizacion) {
const Porcentaje = ToDouble(TxtPenalizacion.value) / ToDouble(100); const Porcentaje = ToDouble(TxtPenalizacion.value)
if (Porcentaje <= 1) { if (Porcentaje >= 100) {
$('.ImporteDevolucion').each(function () { TxtPenalizacion.value = "100"
const importe = ToDouble($(this).val());
const resta = importe * Porcentaje;
$(this).val(FormatoNumero((importe - resta), 2));
});
} }
} }
@@ -7931,7 +7930,6 @@
} }
function chkAnt(t, txt, importe, AmorContrato = 0) { function chkAnt(t, txt, importe, AmorContrato = 0) {
debugger;
var totalAnt = 0; var totalAnt = 0;
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val(); let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();

View File

@@ -2053,6 +2053,10 @@ Partial Class Ventas
thPoliza2.Visible = True thPoliza2.Visible = True
End If 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") DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat")
DivPSSAT.Visible = True DivPSSAT.Visible = True
@@ -23892,263 +23896,278 @@ Partial Class Ventas
End Sub 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) 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 Try
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError) Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
Exit Sub If DrPS Is Nothing Then
Else Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
'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 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 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) If Not AplicaImpuestosLocales Then
Exit Sub If TmpDTImpuestos IsNot Nothing Then
TmpDTImpuestos.Rows.Clear()
GvImpuestosLocales2.DataSource = TmpDTImpuestos
GvImpuestosLocales2.DataBind()
End If
End If End If
End If
If Not AplicaImpuestosLocales Then Me.AplicoNCFacturaActual = AplicoNCFacturaActual
If TmpDTImpuestos IsNot Nothing Then
TmpDTImpuestos.Rows.Clear()
GvImpuestosLocales2.DataSource = TmpDTImpuestos
GvImpuestosLocales2.DataBind()
End If
End If
Me.AplicoNCFacturaActual = AplicoNCFacturaActual 'CREAMOS DT PARA UTILIZAR AL TIMBRAR
InicializaDTVentasNC()
'CREAMOS DT PARA UTILIZAR AL TIMBRAR Dim DtImpuestos As New DataTable
InicializaDTVentasNC() 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 Dim DtImpuestosBonificacion As DataTable = DtImpuestos.Copy()
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() 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 'SI HAY RNC DE BONIFICACION SE AGREGAN
If AplicaNCMasiva Then If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
If NCDescuento Then For Each RNC In ListaNCBonificacion
For Each RNC In ListaNCDesc DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore) Next
Next End If
Else
'SI HAY RNC DE BONIFICACION SE AGREGAN Dim NumVentasAplicar As Integer = 1
If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then For Each Gvr As GridViewRow In GvCxC.Rows
For Each RNC In ListaNCBonificacion If Gvr.FCCheckBox("ChkCxC").Checked Then
DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore) 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 Next
End If End If
Else Else
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero())
For Each Gvr As GridViewRow In GvCxC.Rows If EsNCAmortizacion Then
If Gvr.FCCheckBox("ChkCxC").Checked Then If DtAnticipoAmortizacion Is Nothing Then
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore) InicializaDTAnticiposAmortizacion()
'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)
End If 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 Next
End If End If
Else
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero())
If EsNCAmortizacion Then TrTipoRelacion.Visible = True
If DtAnticipoAmortizacion Is Nothing Then DdlTiposRelacion.SelectedValueExist("1")
InicializaDTAnticiposAmortizacion()
'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 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 Else
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia) For Each Dr As DataRow In DtImpuestos.Rows
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto) Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
End If If UltimoRenglon = DtImpuestos.Rows.Count Then
'ajusta 5 centavos de diferencia
Else If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
For Each Dr As DataRow In DtImpuestos.Rows Ajuste = (Acumulado12 - AcumuladoNC)
AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(), End If
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)
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(), 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, 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, 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, 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) 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 End If
Catch ex As Exception
OnError("Ocurrió un error al aplicar NC", ex)
GvPS.DataSource = TmpDT End Try
GvPS.DataBind() UPCondicionesPago.Update()
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
End Sub 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) 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 'ACTIVA CONDICIONES DE PAGO
DdlUsoCFDI.Enabled = True DdlUsoCFDI.Enabled = True
DdlUsoCFDI.SelectedValueExist("2") DdlUsoCFDI.SelectedValueExist("2")
DdlMetodoPago33.Enabled = True If UsuarioActual.CveEmpresa <> 140 Then
DdlMetodoPago33.SelectedValueExist("1") ' PUE DdlMetodoPago33.Enabled = True
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) DdlMetodoPago33.SelectedValueExist("1") ' PUE
DdlFormaPago33.Enabled = True CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
DdlFormaPago33.SelectedValueExist("11") ' condonación por default DdlFormaPago33.Enabled = True
DdlFormaPago33.SelectedValueExist("11") ' condonación por default
End If
UpEstatus.Update() UpEstatus.Update()
UpnTools.Update() UpnTools.Update()
@@ -24595,6 +24616,22 @@ Partial Class Ventas
UpDevolucion.Update() UpDevolucion.Update()
End Sub 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) Protected Sub BtnAplicaDevolucion_Click(sender As Object, e As EventArgs)
'VALIDACIONES 'VALIDACIONES
@@ -27229,6 +27266,33 @@ Partial Class Ventas
End If End If
Next 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 For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
If GvRow.RowType = DataControlRowType.DataRow Then If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then If GvRow.FCCheckBox("ChkAplicar").Checked Then
@@ -27304,6 +27368,28 @@ Partial Class Ventas
End If End If
Next 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() Dim LimiteUsados As Decimal = LblSaldoMaximoUsados.Text.Trim().ToDecimal()
'VERIFICA EL LIMITE DE LOS USADOS 'VERIFICA EL LIMITE DE LOS USADOS