-- timbrado complementos de pago.
This commit is contained in:
@@ -469,6 +469,13 @@ Public Class CFDIComplementoPagos
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property TotalPagos As Decimal
|
||||
Get
|
||||
Return (From c In DocumentosRelacionados
|
||||
Select c.ImpPagado).Sum()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New()
|
||||
|
||||
DocumentosRelacionados = New List(Of CFDIComplementoPagosDocsRelacionados)
|
||||
@@ -476,6 +483,61 @@ Public Class CFDIComplementoPagos
|
||||
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Retenciones As List(Of CFDIRetenciones)
|
||||
Get
|
||||
Dim tRetorno As New List(Of CFDIRetenciones)
|
||||
Dim TRetenciones As New List(Of CFDIRetenciones)
|
||||
|
||||
For Each c As CFDIComplementoPagosDocsRelacionados In DocumentosRelacionados
|
||||
For Each imp As CFDIConceptosImpuestos In c.Impuestos
|
||||
If imp.TrasladooRetencion = "R" Then
|
||||
tRetorno.Add(New CFDIRetenciones With {.Impuesto = imp.Impuesto, .Importe = imp.Importe})
|
||||
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
If tRetorno.Count > 0 Then
|
||||
TRetenciones = tRetorno.GroupBy(Function(t) New With {Key t.Impuesto}) _
|
||||
.Select(Function(t) New CFDIRetenciones With {.Impuesto = t.Key.Impuesto,
|
||||
.Importe = t.Sum(Function(tt) tt.Importe)}) _
|
||||
.OrderBy(Function(x) x.Impuesto).ToList
|
||||
End If
|
||||
|
||||
tRetorno = Nothing
|
||||
Return TRetenciones
|
||||
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Traslados As List(Of CFDITraslados)
|
||||
Get
|
||||
Dim tRetorno As New List(Of CFDITraslados)
|
||||
Dim TTraslados As New List(Of CFDITraslados)
|
||||
For Each c As CFDIComplementoPagosDocsRelacionados In DocumentosRelacionados
|
||||
For Each imp As CFDIConceptosImpuestos In c.Impuestos
|
||||
If imp.TrasladooRetencion = "T" Then
|
||||
tRetorno.Add(New CFDITraslados With {.Impuesto = imp.Impuesto, .Base = imp.Base, .Importe = imp.Importe, .TasaOCuota = imp.TasaOCuota, .TipoFactor = imp.TipoFactor})
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
'ya generado todos los registros posibles, los agrupo y los sumo
|
||||
If tRetorno.Count > 0 Then
|
||||
TTraslados = tRetorno.GroupBy(Function(t) New With {Key t.TipoFactor, Key t.Impuesto, Key t.TasaOCuota}) _
|
||||
.Select(Function(t) New CFDITraslados With {.Impuesto = t.Key.Impuesto,
|
||||
.TipoFactor = t.Key.TipoFactor,
|
||||
.TasaOCuota = t.Key.TasaOCuota,
|
||||
.Base = t.Sum(Function(tt) tt.Base),
|
||||
.Importe = t.Sum(Function(tt) tt.Importe)}) _
|
||||
.OrderBy(Function(x) x.Impuesto).ToList
|
||||
|
||||
End If
|
||||
tRetorno = Nothing
|
||||
Return TTraslados
|
||||
|
||||
|
||||
End Get
|
||||
End Property
|
||||
|
||||
End Class
|
||||
|
||||
<Serializable>
|
||||
@@ -487,9 +549,14 @@ Public Class CFDIComplementoPagosDocsRelacionados
|
||||
Public Property MetodoDePagoDR As String = ""
|
||||
Public Property TipoCambioDR As Decimal
|
||||
Public Property NumParcialidad As Integer = 1
|
||||
Public Property ImpSaldoAnt As Double
|
||||
Public Property ImpPagado As Double
|
||||
Public Property ImpSaldoInsoluto As Double
|
||||
Public Property ImpSaldoAnt As Decimal
|
||||
Public Property ImpPagado As Decimal
|
||||
Public Property ImpSaldoInsoluto As Decimal
|
||||
Public Property ObjetoImpuesto As String = "01"
|
||||
Public Property Impuestos As List(Of CFDIConceptosImpuestos)
|
||||
Sub New()
|
||||
Impuestos = New List(Of CFDIConceptosImpuestos)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
@@ -953,6 +953,7 @@ Public Class ClsBancos
|
||||
Dim Estatus As Integer = 1
|
||||
|
||||
Dim dttpagos As DataTable = Nothing
|
||||
Dim dttpagosimpuestos As DataTable = Nothing
|
||||
Dim dr As Data.DataRow = Nothing
|
||||
|
||||
If GetComplementoPagosRep(-1, Now.AddYears(-5), Now, If(CvePrePoliza > 0, -1, CveIE), CveVenta, If(EsRegeneracion, 2, 1), UsuarioActual.CveEmpresa, CvePrePoliza:=CvePrePoliza) Then
|
||||
@@ -996,7 +997,6 @@ Public Class ClsBancos
|
||||
'ReceptorRFC = drr("RFC").ToString
|
||||
'ReceptorNombre = drr("NombreCliente").ToString
|
||||
|
||||
|
||||
Folio = FActual
|
||||
ComplementoSerieFolio = $"{Serie}-{Folio}"
|
||||
|
||||
@@ -1084,12 +1084,25 @@ Public Class ClsBancos
|
||||
Dim Timbre As CFDITimbre = Nothing
|
||||
Dim Timbrado As New Timbrado
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
|
||||
|
||||
If GetComplementoPagosImpuestos(CveIE, UsuarioActual.CveEmpresa) Then
|
||||
dttpagosimpuestos = DtResultados
|
||||
End If
|
||||
|
||||
Timbre = Timbrado.PreparaTimbrePago(RFCEmpresa, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal,
|
||||
Timbre = Timbrado.PreparaTimbrePago40(RFCEmpresa, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal,
|
||||
RFCCliente, dr("NombreCliente").ToString, RFCCliente, dr("NombreCliente").ToString, Serie, Folio.ToString, FechaTimbrado, Cuentapago,
|
||||
dr("FechaDocumento").ToString.ToDate, dr("ClaveFormaPagoSAT").ToString, dr("AbreviaturaSAT").ToString, dr("VentasTotalPagado").ToString.ToDecimal,
|
||||
UsuarioActual.Empresa.CP.ToString, CuentaBeneficiario, dr("TipoCambioPago").ToString.ToDecimal, dttpagos, dttpagosimpuestos, CFDIRelacionado:=CFDIRelacionado, EsCancelacion:=False)
|
||||
|
||||
Else
|
||||
Timbre = Timbrado.PreparaTimbrePago(RFCEmpresa, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal,
|
||||
RFCCliente, dr("NombreCliente").ToString, Serie, Folio.ToString, FechaTimbrado, Cuentapago,
|
||||
dr("FechaDocumento").ToString.ToDate, dr("ClaveFormaPagoSAT").ToString, dr("AbreviaturaSAT").ToString, dr("VentasTotalPagado").ToString.ToDouble,
|
||||
UsuarioActual.Empresa.CP.ToString, CuentaBeneficiario, dr("TipoCambioPago").ToString.ToDouble, dttpagos, CFDIRelacionado:=CFDIRelacionado, EsCancelacion:=False)
|
||||
dr("FechaDocumento").ToString.ToDate, dr("ClaveFormaPagoSAT").ToString, dr("AbreviaturaSAT").ToString, dr("VentasTotalPagado").ToString.ToDecimal,
|
||||
UsuarioActual.Empresa.CP.ToString, CuentaBeneficiario, dr("TipoCambioPago").ToString.ToDecimal, dttpagos, CFDIRelacionado:=CFDIRelacionado, EsCancelacion:=False)
|
||||
|
||||
End If
|
||||
|
||||
|
||||
''PREPARA PARA CANCELACION POR SUSTITUCION DE COMPLEMENTO DE PAGO
|
||||
'If CFDIRelacionado <> "-1" And CFDIRelacionado <> "" Then
|
||||
@@ -1365,6 +1378,26 @@ Public Class ClsBancos
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetComplementoPagosImpuestos(CveIE As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Banc_ComplementoPagoImpuestosGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveIE", SqlDbType.Int).Value = CveIE
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener informacion de complementos de pago en impuestos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetComplementoPagos(CveComplementoPago As Integer, CveIE As Integer, CveVenta As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
|
||||
@@ -686,7 +686,7 @@ Namespace Modelos
|
||||
|
||||
Return Not ErrorPrePolizas
|
||||
End Function
|
||||
Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura
|
||||
Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing, Optional Modulo As String = "Modelos/GuardarVentaM") As MMensajeFactura
|
||||
Dim Retorno As New MMensajeFactura()
|
||||
|
||||
If Me.Version = "3.3" AndAlso Not Me.TipoDocto.Contiene("Ped", "PeC") Then
|
||||
@@ -782,7 +782,7 @@ Namespace Modelos
|
||||
Next
|
||||
End If
|
||||
|
||||
GuardarVenta(Me, ObjVentas, ObjConta, ObjInventario, ObjContr, DtDetalle, Me.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes, ObjAcum:=ObjAcum, Resp:=Retorno)
|
||||
GuardarVenta(Me, ObjVentas, ObjConta, ObjInventario, ObjContr, DtDetalle, Me.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes, ObjAcum:=ObjAcum, Resp:=Retorno, Modulo:=Modulo)
|
||||
|
||||
'SI ES REFACTURACION
|
||||
Dim ObjNC As List(Of Object) = Nothing
|
||||
@@ -1453,10 +1453,10 @@ Namespace Modelos
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Public Sub GuardarVenta(ByRef factura As Modelos.Factura, ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNotaCredito As Boolean = False, Optional ObjAcum As ClsAcumuladores = Nothing, ByRef Optional Resp As MMensajeFactura = Nothing)
|
||||
Public Sub GuardarVenta(ByRef factura As Modelos.Factura, ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNotaCredito As Boolean = False, Optional ObjAcum As ClsAcumuladores = Nothing, ByRef Optional Resp As MMensajeFactura = Nothing, Optional Modulo As String = "Modelos/GuardarVentaM")
|
||||
Dim Msgok As New StringBuilder
|
||||
|
||||
factura.CvePrePoliza = ObjConta.AddPrePolizas("Modelos/GuardarVentaM", factura.CvePlantillaPoliza, factura.TotalTC, factura.TotalTC, factura.CveMoneda, factura.Fecha, If(factura.CveEmpresaCRM > 0, factura.EmpresaCRM, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa)
|
||||
factura.CvePrePoliza = ObjConta.AddPrePolizas(Modulo, factura.CvePlantillaPoliza, factura.TotalTC, factura.TotalTC, factura.CveMoneda, factura.Fecha, If(factura.CveEmpresaCRM > 0, factura.EmpresaCRM, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa)
|
||||
|
||||
Dim RFCReceptor As String = ""
|
||||
|
||||
|
||||
@@ -1017,6 +1017,156 @@ Public Class Timbrado
|
||||
If PorcentajeIEPS > 0 Then Timbre.ComplementoPagos.Impuestos.Add(New CFDIConceptosImpuestos With {.Base = VentaImportePago * PorcentajeIEPS, .TasaOCuota = PorcentajeIEPS, .Impuesto = "003"})
|
||||
|
||||
|
||||
'Next
|
||||
|
||||
Return Timbre
|
||||
|
||||
End Function
|
||||
|
||||
Public Function PreparaTimbrePago40(EmisorRFC As String, EmisorNombre As String, EmisorRegimenFiscal As String,
|
||||
ReceptorRFC As String, ReceptorNombre As String, ReceptorDomicilioFiscal As String, ReceptorRegimenFiscal As String,
|
||||
Serie As String, Folio As String, FechaTimbrado As DateTime,
|
||||
CuentaPago As String, FechaPago As DateTime, FormaPago As String, MonedaPago As String, Monto As Decimal, LugarExpedicion As String,
|
||||
CuentaBeneficiario As String, TipoCambioP As Decimal, dttpagos As Data.DataTable, dttpagosimpuestos As DataTable,
|
||||
Optional UsoCFDI As String = "P01", Optional CFDIRelacionado As String = "", Optional EsCancelacion As Boolean = False) As CFDITimbre
|
||||
' validación extra para cuando es cancelación requiere el folio relacionado
|
||||
If EsCancelacion AndAlso CFDIRelacionado = "" Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Dim Timbre As New CFDITimbre
|
||||
|
||||
Timbre.Comprobante.TipoComprobante = "P"
|
||||
Timbre.Comprobante.Folio = Folio
|
||||
Timbre.Comprobante.Serie = Serie
|
||||
Timbre.Comprobante.Fecha = FechaTimbrado
|
||||
Timbre.Comprobante.FormadePago = ""
|
||||
Timbre.Comprobante.CondicionesdePago = ""
|
||||
Timbre.Comprobante.MetodoPago = ""
|
||||
Timbre.Comprobante.SubTotal = 0
|
||||
Timbre.Comprobante.Descuentos = 0
|
||||
Timbre.Comprobante.Moneda = "XXX"
|
||||
Timbre.Comprobante.TipoCambio = ""
|
||||
Timbre.Comprobante.Total = 0
|
||||
|
||||
Timbre.Comprobante.LugarExpedicion = LugarExpedicion
|
||||
|
||||
Timbre.Emisor.RegimenFiscal = EmisorRegimenFiscal
|
||||
Timbre.Emisor.Nombre = EmisorNombre
|
||||
Timbre.Emisor.RFC = EmisorRFC
|
||||
|
||||
Timbre.Receptor.RFC = ReceptorRFC
|
||||
Timbre.Receptor.Nombre = ReceptorNombre
|
||||
Timbre.Receptor.DomicilioFiscalReceptor = ReceptorDomicilioFiscal
|
||||
Timbre.Receptor.RegimenFiscalReceptor = ReceptorRegimenFiscal
|
||||
Timbre.Receptor.UsoCFDI = UsoCFDI
|
||||
|
||||
If CFDIRelacionado <> "-1" And CFDIRelacionado <> "" Then
|
||||
Timbre.CFDIRelacionados.TipoRelacion = "04"
|
||||
Timbre.CFDIRelacionados.UUID.Add(CFDIRelacionado)
|
||||
End If
|
||||
|
||||
'detalles
|
||||
|
||||
Dim concepto As New CFDIConceptos With {.Cantidad = 1,
|
||||
.Descripcion = "Pago",
|
||||
.ValorUnitario = 0,
|
||||
.Importe = 0,
|
||||
.Unidad = "",
|
||||
.ClaveUnidad = "ACT",
|
||||
.ClaveProdServ = "84111506",
|
||||
.Noidentificacion = "",
|
||||
.ObjetoImpuesto = "01"}
|
||||
Timbre.Conceptos.Add(concepto)
|
||||
|
||||
Select Case FormaPago
|
||||
Case "01"
|
||||
CuentaPago = ""
|
||||
CuentaBeneficiario = ""
|
||||
|
||||
End Select
|
||||
|
||||
Dim ImporteCancelacion As Decimal = 1
|
||||
Dim MonedaCancelacion As String = "MXN"
|
||||
Dim TipoCambioCancelacion As Double = 1
|
||||
If EsCancelacion Then MonedaPago = MonedaCancelacion
|
||||
'como registra un peso por cada fatura que se cancele, se tiene que multiplicar por el numero de facturas, para que se pueda emitir el timbre
|
||||
If dttpagos IsNot Nothing AndAlso dttpagos.Rows.Count > 0 Then ImporteCancelacion = ImporteCancelacion * dttpagos.Rows.Count
|
||||
Timbre.ComplementoPagos.CtaOrdenante = CuentaPago
|
||||
Timbre.ComplementoPagos.CtaBeneficiario = CuentaBeneficiario
|
||||
Timbre.ComplementoPagos.FechaPago = FechaPago
|
||||
Timbre.ComplementoPagos.FormaDePagoP = FormaPago
|
||||
Timbre.ComplementoPagos.MonedaP = MonedaPago
|
||||
Timbre.ComplementoPagos.Monto = If(EsCancelacion, ImporteCancelacion, Monto)
|
||||
Timbre.ComplementoPagos.TipoCambioP = If(EsCancelacion, TipoCambioCancelacion, TipoCambioP)
|
||||
|
||||
|
||||
Dim VentaFolioFiscal, VentaSerie, VentaFolio, VentaAbreviaturaSAT, VentaMetodoPago, ObjetoImpuesto As String
|
||||
Dim VentaImportePago, VentaImporteSaldoInsoluto, VentaImporteSaldoAnterior, VentaTipoCambio, PorcentajeIVA, PorcentajeIEPS As Decimal
|
||||
Dim VentaNumParcialidad As Integer
|
||||
|
||||
If dttpagos IsNot Nothing AndAlso dttpagos.Rows.Count > 0 Then
|
||||
|
||||
For Each dr As Data.DataRow In dttpagos.Rows
|
||||
VentaFolioFiscal = dr("FolioFiscal").ToString
|
||||
VentaSerie = dr("VentaSerie").ToString
|
||||
VentaFolio = dr("VentaFolio").ToString
|
||||
VentaAbreviaturaSAT = dr("VentaAbreviaturaSAT").ToString
|
||||
VentaMetodoPago = dr("MetodoPago").ToString
|
||||
VentaImportePago = dr("VentaImportePagado").ToString.ToDecimal
|
||||
VentaImporteSaldoInsoluto = dr("ImpSaldoInsoluto").ToString.ToDecimal
|
||||
VentaImporteSaldoAnterior = dr("ImpSaldoAnterior").ToString.ToDecimal
|
||||
VentaTipoCambio = dr("TipoCambio").ToString.ToDecimal
|
||||
VentaNumParcialidad = dr("NumParcialidad").ToString.ToEntero
|
||||
PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal
|
||||
PorcentajeIEPS = dr("PorcentajeIEPS").ToString.ToDecimal
|
||||
ObjetoImpuesto = dr("ObjetoImpuesto").ToString
|
||||
' si la moneda es igual, se omite el tipo de cambio de la venta
|
||||
If MonedaPago = VentaAbreviaturaSAT Then VentaTipoCambio = 0
|
||||
|
||||
'condiciones especiales para el pago en pesos, facturas en moneda extranjera
|
||||
If MonedaPago = "MXN" AndAlso VentaAbreviaturaSAT <> "MXN" Then
|
||||
VentaTipoCambio = 1 / VentaTipoCambio
|
||||
End If
|
||||
|
||||
' For Each drr As Data.DataRow In DtFacturasPagadas.Rows
|
||||
Dim doc As New CFDIComplementoPagosDocsRelacionados With {.IdDocumento = VentaFolioFiscal,
|
||||
.Serie = VentaSerie,
|
||||
.Folio = VentaFolio,
|
||||
.MonedaDR = VentaAbreviaturaSAT,
|
||||
.MetodoDePagoDR = VentaMetodoPago,
|
||||
.ImpPagado = If(EsCancelacion, 1, VentaImportePago),
|
||||
.ImpSaldoInsoluto = If(EsCancelacion, VentaImporteSaldoAnterior - 1, VentaImporteSaldoInsoluto),
|
||||
.ImpSaldoAnt = VentaImporteSaldoAnterior,
|
||||
.TipoCambioDR = VentaTipoCambio,
|
||||
.NumParcialidad = VentaNumParcialidad,
|
||||
.ObjetoImpuesto = OBjetoImpuesto} 'If(drr("MetodoPago").ToString = "PUE", 0, drr("NumParcialidad").ToString.ToEntero)}
|
||||
|
||||
For Each drp As DataRow In dttpagosimpuestos.FiltraParametros(String.Format("FolioFiscal = '{0}'", VentaFolioFiscal.ToLower)).Rows
|
||||
doc.Impuestos.Add(New CFDIConceptosImpuestos With {
|
||||
.TrasladooRetencion = drp("Tipo").ToString,
|
||||
.Base = drp("Base").ToString.ToDecimal,
|
||||
.TasaOCuota = drp("PorcentajeImpuesto").ToString().ToDecimal,
|
||||
.Impuesto = drp("TipoImpuesto").ToString,
|
||||
.Importe = drp("Importe").ToString().ToDecimal
|
||||
}
|
||||
)
|
||||
|
||||
Next
|
||||
|
||||
Timbre.ComplementoPagos.DocumentosRelacionados.Add(doc)
|
||||
|
||||
Next
|
||||
|
||||
|
||||
End If
|
||||
'If drr("IVA").ToString.ToDouble > 0 Then
|
||||
'If PorcentajeIVA > 0 Then Timbre.ComplementoPagos.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = VentaImportePago * PorcentajeIVA, .TasaOCuota = PorcentajeIVA, .Impuesto = "002"})
|
||||
'Timbre.ComplementoPagos.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = 0, .TasaOCuota = 0, .Impuesto = "002"})
|
||||
|
||||
'If PorcentajeIEPS > 0 Then Timbre.ComplementoPagos.Impuestos.Add(New CFDIConceptosImpuestos With {.Base = VentaImportePago * PorcentajeIEPS, .TasaOCuota = PorcentajeIEPS, .Impuesto = "003"})
|
||||
|
||||
|
||||
'Next
|
||||
|
||||
Return Timbre
|
||||
@@ -3939,19 +4089,52 @@ Public Class Timbrado
|
||||
End If
|
||||
ComPag.Pago(0).DoctoRelacionado(i).Folio = doc.Folio
|
||||
ComPag.Pago(0).DoctoRelacionado(i).MonedaDR = doc.MonedaDR
|
||||
'ComPag.Pago(0).DoctoRelacionado(i).TipoCambioDRSpecifiedP = If(doc.TipoCambioDR = 0, False, True)
|
||||
'ComPag.Pago(0).DoctoRelacionado(i).TipoCambioDR = doc.TipoCambioDR
|
||||
'ComPag.Pago(0).DoctoRelacionado(i).MetodoDePagoDR = doc.MetodoDePagoDR
|
||||
ComPag.Pago(0).DoctoRelacionado(i).NumParcialidad = doc.NumParcialidad.ToString
|
||||
|
||||
'ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoAntSpecified = True
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoAnt = doc.ImpSaldoAnt.ToDecimal
|
||||
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoAnt = doc.ImpSaldoAnt
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpPagadoSpecified = True
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpPagado = doc.ImpPagado.ToDecimal
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpPagado = doc.ImpPagado
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoInsoluto = doc.ImpSaldoInsoluto
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ObjetoImpDR = doc.ObjetoImpuesto
|
||||
|
||||
If doc.Impuestos IsNot Nothing Then
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDR
|
||||
''traslados
|
||||
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then
|
||||
Dim j As Integer = 0
|
||||
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T")
|
||||
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T").Count - 1) {}
|
||||
If docimp.TrasladooRetencion = "T" Then
|
||||
Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR
|
||||
Tra.BaseDR = docimp.Base
|
||||
Tra.ImporteDRSpecified = True
|
||||
Tra.ImporteDR = docimp.Importe
|
||||
Tra.ImpuestoDR = docimp.Impuesto
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR(j) = Tra
|
||||
End If
|
||||
j += 1
|
||||
Next
|
||||
End If
|
||||
|
||||
''retenciones
|
||||
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then
|
||||
Dim j As Integer = 0
|
||||
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R")
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R").Count - 1) {}
|
||||
If docimp.TrasladooRetencion = "R" Then
|
||||
Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR
|
||||
Tra.BaseDR = docimp.Base
|
||||
Tra.ImporteDR = docimp.Importe
|
||||
Tra.ImpuestoDR = docimp.Impuesto
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR(j) = Tra
|
||||
End If
|
||||
j += 1
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoInsolutoSpecified = True
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoInsoluto = doc.ImpSaldoInsoluto.ToDecimal
|
||||
i += 1
|
||||
Next
|
||||
|
||||
@@ -3991,8 +4174,8 @@ Public Class Timbrado
|
||||
|
||||
|
||||
Dim nsComp As New System.Xml.Serialization.XmlSerializerNamespaces()
|
||||
nsComp.Add("pago20", "http://www.sat.gob.mx/Pagos")
|
||||
Dim xmlComp As String = Profact.TimbraCFDI.XMLUtilerias.SerializaObjeto(ComPag, GetType(Profact.TimbraCFDI33.Complementos.Pagos10.Pagos), nsComp)
|
||||
nsComp.Add("pago20", "http://www.sat.gob.mx/Pagos20")
|
||||
Dim xmlComp As String = Profact.TimbraCFDI.XMLUtilerias.SerializaObjeto(ComPag, GetType(Profact.TimbraCFDI40.Complementos.Pagos20.Pagos), nsComp)
|
||||
Dim docComp As New XmlDocument()
|
||||
docComp.LoadXml(xmlComp)
|
||||
'comprobante.PagosSpecified = True
|
||||
@@ -5119,8 +5302,9 @@ Public Class Timbrado
|
||||
#Region "Complemento Pago"
|
||||
|
||||
If ObjCFDITimbre.Comprobante.TipoComprobante = "P" Then
|
||||
cfdi.Pago20Totales(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ObjCFDITimbre.ComplementoPagos.TotalPagos)
|
||||
|
||||
cfdi.Pago(ObjCFDITimbre.ComplementoPagos.FechaPago.ToString("yyyy-MM-ddTHH:mm:ss"),
|
||||
cfdi.Pago20(ObjCFDITimbre.ComplementoPagos.FechaPago.ToString("yyyy-MM-ddTHH:mm:ss"),
|
||||
ObjCFDITimbre.ComplementoPagos.FormaDePagoP,
|
||||
ObjCFDITimbre.ComplementoPagos.MonedaP,
|
||||
ObjCFDITimbre.ComplementoPagos.TipoCambioP,
|
||||
@@ -5141,16 +5325,17 @@ Public Class Timbrado
|
||||
|
||||
|
||||
For Each doc As CFDIComplementoPagosDocsRelacionados In ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados
|
||||
cfdi.PagoDoctoRelacionado(doc.IdDocumento,
|
||||
cfdi.Pago20DoctoRelacionado(doc.IdDocumento,
|
||||
doc.Serie,
|
||||
doc.Folio,
|
||||
doc.MonedaDR,
|
||||
doc.TipoCambioDR,
|
||||
doc.MetodoDePagoDR,
|
||||
doc.NumParcialidad,
|
||||
doc.ImpSaldoAnt,
|
||||
doc.ImpPagado,
|
||||
doc.ImpSaldoInsoluto)
|
||||
doc.ImpSaldoInsoluto,
|
||||
doc.ObjetoImpuesto)
|
||||
'falta impuestos
|
||||
|
||||
Next
|
||||
|
||||
@@ -6748,13 +6933,13 @@ Public Class Timbrado
|
||||
ComPag.Pago(0).DoctoRelacionado(i).NumParcialidad = doc.NumParcialidad.ToString
|
||||
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoAntSpecified = True
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoAnt = doc.ImpSaldoAnt.ToDecimal
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoAnt = doc.ImpSaldoAnt
|
||||
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpPagadoSpecified = True
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpPagado = doc.ImpPagado.ToDecimal
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpPagado = doc.ImpPagado
|
||||
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoInsolutoSpecified = True
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoInsoluto = doc.ImpSaldoInsoluto.ToDecimal
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoInsoluto = doc.ImpSaldoInsoluto
|
||||
i += 1
|
||||
Next
|
||||
|
||||
|
||||
Reference in New Issue
Block a user