diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index fe46d8524..2a0453b04 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -1370,6 +1370,15 @@ Partial Class Ventas End Set End Property + Private Property ListaDevolucionesAplicadas As List(Of Modelos.MAnticipoRelacionado) + Get + Return If(IsNothing(ViewState("ListaDevolucionesAplicadas")), Nothing, CType(ViewState("ListaDevolucionesAplicadas"), List(Of Modelos.MAnticipoRelacionado))) + End Get + Set(value As List(Of Modelos.MAnticipoRelacionado)) + ViewState("ListaDevolucionesAplicadas") = value + End Set + End Property + Private Property CveTimbreCartaPorteVenta As Integer Get Return If(IsNothing(ViewState("CveTimbreCartaPorteVenta")), -1, ViewState("CveTimbreCartaPorteVenta").ToString().ToEntero()) @@ -10981,6 +10990,10 @@ Partial Class Ventas ListaAnticiposAplicados.Clear() End If + If ListaDevolucionesAplicadas IsNot Nothing Then + ListaDevolucionesAplicadas.Clear() + End If + 'ENVIAR POLIZA VIRTUAL If ErrorList.Count = 0 Then If UsuarioActual.Empresa.Funcionalidad(576) = "1" AndAlso EsProduccion Then @@ -13505,6 +13518,26 @@ Partial Class Ventas Next End If + 'DEVOLUCIONES DE OTRA VENTA, APLICADAS EN UNA NUEVA + If UsuarioActual.CveEmpresa.Contiene(1, 189) AndAlso Obj.TipoDocto = "Ing" AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then + If ListaDevolucionesAplicadas IsNot Nothing AndAlso ListaDevolucionesAplicadas.Count > 0 Then + Timbre.CFDIRelacionados.UUID.Clear() + For Each Dev As Modelos.MAnticipoRelacionado In ListaDevolucionesAplicadas + Timbre.CFDIRelacionados.UUID.Add(Dev.FolioFiscal) + Next + + 'TEMPORAL- DEBE SER TIPO RELACION "01 - Nota de crédito de los documentos relacionados" + Dim CveTipoRelacion As Integer = 1 + + Obj.CveTipoRelacion = CveTipoRelacion + + Dim RowTipoRelacion As DataRow = GlobalDTVtaTiposRelacion().FiltroPrimero($"CveTipoRelacion = {CveTipoRelacion}") + + Timbre.CFDIRelacionados.TipoRelacion = RowTipoRelacion("SATClaveTipoRelacion").ToString() + Timbre.CFDIRelacionados.TipoRelacionTexto = RowTipoRelacion("SATTipoRelacion").ToString() + End If + End If + Dim totSubTotal As Decimal = Obj.SubTotal Dim totIVA As Decimal = Obj.IVA Dim totRetIVA As Decimal = Obj.RetIVA @@ -17471,6 +17504,12 @@ Partial Class Ventas ListaAnticiposAplicados = New List(Of Modelos.MAnticipoRelacionado) End If + If ListaDevolucionesAplicadas IsNot Nothing Then + ListaDevolucionesAplicadas.Clear() + Else + ListaDevolucionesAplicadas = New List(Of Modelos.MAnticipoRelacionado) + End If + HdnIVACalculado.Value = HdnIVAOriginal.Value For Each gvr As GridViewRow In GVAnticipos.Rows If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then @@ -17481,6 +17520,13 @@ Partial Class Ventas 'CvePSAmortizacion = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", "CveConceptoContable = 11").ToEntero() End If + + 'AGREGAR LAS DEV + If UsuarioActual.CveEmpresa.Contiene(1, 189) AndAlso DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("4") Then + If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(12) Then + ListaDevolucionesAplicadas.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal")}) + End If + End If Next 'Amortizacion += TmpDTImpuestos.SUM("Importe").ToDecimal 'RMF. 2018.12.20- saque de la jugada en la amortización los impuestos locales