Generar nuevo modal solo para las RNC, que son de tipo devolución, para simple selección y generación

This commit is contained in:
2021-05-03 14:45:46 -07:00
parent f9cb9213c4
commit 6fea4dd055
2 changed files with 303 additions and 32 deletions

View File

@@ -231,6 +231,10 @@
<asp:LinkButton ID="LBNotaCredito" runat="server" CausesValidation="False" Text="<i class='fa fa-pencil'></i> Aplicar Nota de Crédito"
data-toggle="modal" data-target="#ModalAplicarNC" Visible="false" />
</li>
<li>
<asp:LinkButton ID="LnkAplicarRNCDevolucion" runat="server" Visible="false" CausesValidation="False" Text="<i class='fa fa-pencil'></i> Aplicar RNC por devolución"
OnClick="LnkAplicarRNCDevolucion_Click" />
</li>
<li>
<asp:LinkButton ID="LBAplicaDevolucion" runat="server" CausesValidation="False" Text="<i class='fa fa-pencil'></i> Aplicar Devolución"
data-toggle="modal" data-target="#DivAplicaDevolucion" Visible="false" />
@@ -6749,6 +6753,83 @@
</asp:UpdatePanel>
</div>
<%--APLICAR REMISIONES DE NC DE DEVOLUCION--%>
<div id="ModalAplicaRNCDevolucion" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpRNCDevolucion" class="modal-dialog rowpadding modal-lg" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Aplicar Remisiones de Nota de Crédito</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Devoluciones</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
<div class="row" style="margin-right: 10px;" align="right">
<input type="text" id="TxtBusquedaRNCDev" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaRNCDev','{0}')", GvRNCDevoluciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaRNCDev','{0}')", GvRNCDevoluciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="row">
<div class="col-md-12" style="max-height: 440px; overflow: auto">
<asp:GridView ID="GvRNCDevoluciones" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveVenta" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="ChkAplicar" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="Folio" HeaderText="Folio" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Literal ID="LtlTotal" runat="server" Text='<%# Eval("Original", "{0:N2}") %>'></asp:Literal>
<asp:Literal ID="LtlAbrev" runat="server" Text='<%# Eval("Abreviatura") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Saldo" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Literal ID="LtlSaldo" runat="server" Text='<%# Eval("Saldo", "{0:N2}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TxtImporte" CssClass="myvalue ImportesRNCCargo" runat="server" Width="75px" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<asp:Button Text="Aplicar Remisiones" ID="BtnAplicarRNCDevoluciones" OnClick="BtnAplicarRNCDevoluciones_Click" CssClass="btn btn-primary" runat="server" ValidationGroup="VGAplicarRNC" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div id="ModalSaldarVenta" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpSaldarVenta" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
@@ -8932,23 +9013,23 @@
function showDivAgregarSucursal() {
$('#<%= TxtNombreSucursal.ClientID %>').val('');
$('#<%= TxtDireccionSucursal.ClientID %>').val('');
$('#<%= TxtNumExtSucursal.ClientID %>').val('');
$('#<%= TxtNumIntSucursal.ClientID %>').val('');
$('#<%= TxtCPSucursal.ClientID %>').val('');
$('#<%= TxtColoniaSucursal.ClientID %>').val('');
$('#<%= TxtTelefonoSucursal.ClientID %>').val('');
$('#<%= TxtCiudadSucursal.ClientID %>').val('');
$('#<%= TxtLocalidadSucursal.ClientID %>').val('');
$('#<%= TxtEstadoSucursal.ClientID %>').val('');
$('#<%= TxtPaisSucursal.ClientID %>').val('');
$('#<%= TxtCorreoSucursal.ClientID %>').val('');
$('#divAgregarSucursal').modal();
}
$('#<%= TxtDireccionSucursal.ClientID %>').val('');
$('#<%= TxtNumExtSucursal.ClientID %>').val('');
$('#<%= TxtNumIntSucursal.ClientID %>').val('');
$('#<%= TxtCPSucursal.ClientID %>').val('');
$('#<%= TxtColoniaSucursal.ClientID %>').val('');
$('#<%= TxtTelefonoSucursal.ClientID %>').val('');
$('#<%= TxtCiudadSucursal.ClientID %>').val('');
$('#<%= TxtLocalidadSucursal.ClientID %>').val('');
$('#<%= TxtEstadoSucursal.ClientID %>').val('');
$('#<%= TxtPaisSucursal.ClientID %>').val('');
$('#<%= TxtCorreoSucursal.ClientID %>').val('');
$('#divAgregarSucursal').modal();
}
function hideDivAgregarSucursal() {
$('#divAgregarSucursal').modal('hide');
}
function hideDivAgregarSucursal() {
$('#divAgregarSucursal').modal('hide');
}
</script>
</asp:Content>

View File

@@ -9403,6 +9403,15 @@ Partial Class Ventas
ObjFactura.CveVentaPadre = DtVentasNC.Rows(0)("CveVenta").ToString().ToEntero()
ObjFactura.SerieFolioPadre = DtVentasNC.Rows(0)("FolioFiscal").ToString()
End If
If DdlTipoComprobante.SelectedValue = "Dev" AndAlso ListaRemisionesNC IsNot Nothing AndAlso ListaRemisionesNC.Count > 0 Then
Dim ObjRNC = ListaRemisionesNC.FirstOrDefault
If ObjRNC IsNot Nothing Then
ObjFactura.CveVentaPadre = ObjRNC.CveVentaPadre
ObjFactura.SerieFolioPadre = ObjRNC.SerieFolioPadre
End If
End If
ObjFactura.CveVendedor = DdlVendedor.SelectedValue.ToEntero()
If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
DdlVendedor.Enabled = False
@@ -24798,6 +24807,11 @@ Partial Class Ventas
AplicaNCMasiva = False
AplicaNC = False
LBNotaCredito.Visible = True
If UsuarioActual.CveUsuario = 100 Then
LnkAplicarRNCDevolucion.Visible = True
End If
'LkNotaCredito.Visible = False
TxtNCPorcentaje.Attributes.Add("onkeyup", "CalculaImporteNC();")
@@ -24848,6 +24862,9 @@ Partial Class Ventas
AplicaNCMasiva = True
LBNotaCredito.Visible = True
If UsuarioActual.CveUsuario = 100 Then
LnkAplicarRNCDevolucion.Visible = True
End If
'LkNotaCredito.Visible = False
DivGvCxC.Visible = True
CargaCxC()
@@ -25391,6 +25408,12 @@ Partial Class Ventas
End If
End If
End Sub
Protected Sub GvRNCDevoluciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRNCDevoluciones.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
End If
End Sub
Protected Sub GvDescNCBonificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonificaciones.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -25516,26 +25539,31 @@ 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)
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, Optional TipoDoctoNC As String = "Egs")
Try
Me.AplicaDocumentoNuevoNC = AplicaNuevoDocumento
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)
Dim DrPS As DataRow = Nothing
If CvePS > 0 AndAlso TipoDoctoNC = "Egs" Then
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
End If
If Not AplicaImpuestosLocales Then
If TmpDTImpuestos IsNot Nothing Then
TmpDTImpuestos.Rows.Clear()
@@ -25737,7 +25765,7 @@ Partial Class Ventas
Else
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
DdlTipoComprobante.SelectedValueExist("Egs")
DdlTipoComprobante.SelectedValueExist(TipoDoctoNC)
'verifica el total de multiples facturas
Dim Acumulado12 As Decimal = 0
Dim UltimoRenglon As Integer = 1
@@ -25768,7 +25796,10 @@ Partial Class Ventas
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
ElseIf TipoDoctoNC = "Dev" Then
CrearDTNCDevolucion(ListaRemisionesNC, TmpDT, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
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
@@ -25795,7 +25826,16 @@ Partial Class Ventas
CalculaTotalesVenta(RecalculaImpuestosLocales:=AplicaImpuestosLocales)
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("1")
If TipoDoctoNC = "Egs" Then
DdlTiposRelacion.SelectedValueExist("1")
ElseIf TipoDoctoNC = "Dev" Then
If DdlTipoComprobante.Items.FindByValue("Dev") Is Nothing Then
DdlTipoComprobante.Items.Insert(0, New ListItem("Devolucion", "Dev"))
End If
DdlTipoComprobante.SelectedValueExist("Dev")
DdlTiposRelacion.SelectedValueExist("3")
End If
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
@@ -25804,6 +25844,7 @@ Partial Class Ventas
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()
@@ -25812,6 +25853,7 @@ Partial Class Ventas
UpPS.Update()
LBNotaCredito.Visible = False
LnkAplicarRNCDevolucion.Visible = False
CambiaTipoDocto()
End If
@@ -26160,6 +26202,88 @@ Partial Class Ventas
End If
End Sub
Private Sub CrearDTNCDevolucion(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
For Each RNC In ListaNC
Dim UltimoRenglonRNC As Integer = 1
Dim TotalAcumuladoRNC As Decimal = 0
Dim Terminar As Boolean = False
For Each RowRNC As DataRow In RNC.DtDetalle.FiltraParametros("", Orderby:="PU").Rows
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=RowRNC("CvePS").ToString().ToEntero()).FiltroPrimero("")
Dim Cantidad As Decimal = RowRNC("Cantidad").ToString().ToDecimal()
Dim CvePSCargo As Integer = RowRNC("CvePS").ToString().ToEntero()
Dim ImportePU = RowRNC("PU").ToString().ToDecimal
Dim Obs As String = ""
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
Dim ImporteIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteIEPS = (TotalCalculableImpuestos * RowRNC("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetISR = (TotalCalculableImpuestos * RowRNC("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
Dim ImporteTotal = TotalCalculableImpuestos
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR).RoundSQL
'SI EL IMPORTE ES MAYOR REALIZA EL AJUSTE
If TotalAcumuladoRNC > RNC.TotalRemNCAplicado Then
Terminar = True
'RESTA LO SUMANDO DEL ACUMULADO
TotalAcumuladoRNC -= (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
Dim Diferencia As Decimal = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
Dim TotalPartida As Decimal = (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
Dim PorcentajePorAplicar As Decimal = (Diferencia / TotalPartida)
Cantidad = Cantidad * PorcentajePorAplicar
TotalCalculableImpuestos = (Cantidad * ImportePU)
ImporteIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
ImporteIEPS = (TotalCalculableImpuestos * RowRNC("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
ImporteRetIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
ImporteRetISR = (TotalCalculableImpuestos * RowRNC("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
ImporteTotal = TotalCalculableImpuestos
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR).RoundSQL
End If
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count OrElse Terminar Then
Dim Ajuste As Decimal = 0
If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
If ImporteIVA > 0 Then
ImporteIVA += Ajuste
ElseIf ImporteIEPS > 0 Then
ImporteIEPS += Ajuste
End If
End If
End If
UltimoRenglonRNC += 1
AgregaTempDT(TmpDTCargo, 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,
Obs, Cantidad, ImportePU, RowRNC("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowRNC("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowRNC("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowRNC("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowRNC("CveVentaDetalle").ToString().ToEntero())
If Terminar Then
Exit For
End If
Next
Next
End Sub
Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional NivelTotal As Integer = 1, Optional AplicaNCUsado As Boolean = False) As DataTable
Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0
@@ -26367,6 +26491,7 @@ Partial Class Ventas
HplDownPDF.Visible = False
HLSaldarVenta.Visible = False
LBNotaCredito.Visible = False
LnkAplicarRNCDevolucion.Visible = False
LiComplementoPago.Visible = False
HlCuentaTerminal.Visible = False
LiLnkGuias.Visible = False
@@ -26743,6 +26868,7 @@ Partial Class Ventas
HplDownPDF.Visible = False
HLSaldarVenta.Visible = False
LBNotaCredito.Visible = False
LnkAplicarRNCDevolucion.Visible = False
LiComplementoPago.Visible = False
HlCuentaTerminal.Visible = False
LiLnkGuias.Visible = False
@@ -31150,4 +31276,68 @@ Partial Class Ventas
#End Region
End Class
Protected Sub LnkAplicarRNCDevolucion_Click(sender As Object, e As EventArgs)
Dim DtNC As DataTable = Nothing
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND TipoRNC = 3 AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
End If
ObjMovtos.Dispose()
GvRNCDevoluciones.DataSource = DtNC
GvRNCDevoluciones.DataBind()
UpRNCDevolucion.Update()
RegistraScript("$('#ModalAplicaRNCDevolucion').modal('show');")
End Sub
Protected Sub BtnAplicarRNCDevoluciones_Click(sender As Object, e As EventArgs)
Me.AplicaRNCXDetalle = False
If ListaRemisionesNC Is Nothing Then
ListaRemisionesNC = New List(Of Modelos.Factura)
Else
ListaRemisionesNC.Clear()
End If
If ListaNCBonificacion Is Nothing Then
ListaNCBonificacion = New List(Of Modelos.Factura)
Else
ListaNCBonificacion.Clear()
End If
Dim TotalRemNCAplicado As Decimal = 0
For Each GvRow As GridViewRow In GvRNCDevoluciones.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaRemisionesNC.Clear()
Exit Sub
End If
ListaRemisionesNC.Add(RemNC)
End If
End If
Next
TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero
TxtNCImporte.Text = TotalRemNCAplicado.FormatoNumero
UpModalRemisionesNC.Update()
UpAplicarNC.Update()
AplicarNC(-1, NCDescuento:=False, EsNCAmortizacion:=False, AplicaImpuestosLocales:=True, AplicaNuevoDocumento:=True, AplicoNCFacturaActual:=True, TipoDoctoNC:="Dev")
RegistraScript("$('#ModalAplicaRNCDevolucion').modal('hide');")
End Sub
End Class