diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb index e51b8636f..2ce881836 100644 --- a/App_Code/CFDITimbre.vb +++ b/App_Code/CFDITimbre.vb @@ -466,6 +466,8 @@ Public Class CFDIComplementoPagos tRetorno.TotalTrasladosImpuestoIVA8 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0.08 Select c.Importe).Sum() tRetorno.TotalTrasladosImpuestoIVA16 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0.16 Select c.Importe).Sum() + tRetorno.TotalRetencionesIEPS = (From c In Retenciones Where c.Impuesto = "003" Select c.Importe).Sum() + Return tRetorno End Get End Property diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 6ef8dab01..1297e28ae 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -730,7 +730,7 @@ Public Class ClsPaginas End Set End Property - Property GlobalDTRegimenesFiscales() As DataTable + Property GlobalDTRegimenesFiscales(Optional TipoPersona As Integer = -1) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTRegimenesFiscales") 'sino existe, recarga los datos @@ -739,7 +739,18 @@ Public Class ClsPaginas If ObjGral.GetRegimenFiscal(-1) Then Application(AppNombre) = ObjGral.DtResultados ObjGral.Dispose() End If - GlobalDTRegimenesFiscales = DirectCast(Application(AppNombre), DataTable) + If TipoPersona <> -1 Then + Dim Str As New StringBuilder + If TipoPersona = 0 Then Str.Append("AplicaPersonaFisica = 1") '0 - Fisica + If TipoPersona = 1 Then Str.Append("AplicaPersonaMoral = 1") '1 - Moral + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) + GlobalDTRegimenesFiscales = Dv.ToTable + Dv.Dispose() + Else + GlobalDTRegimenesFiscales = DirectCast(Application(AppNombre), DataTable) + End If + + End Get Set(value As DataTable) Dim AppNombre As String = String.Format("GlobalDTRegimenesFiscales") @@ -8965,7 +8976,7 @@ Public Class ClsPaginas Dim validaElementoPago = XmlDoc.DocumentElement("cfdi:Conceptos") If Version = "3.3" Then cfdVer = "http://www.sat.gob.mx/cfd/3" - namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos10") + namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos") PagoVersion = "pago10" Else ' se considera que es la version 4.0 cfdVer = "http://www.sat.gob.mx/cfd/4" @@ -8990,7 +9001,7 @@ Public Class ClsPaginas End If Dim nodePagos As XmlNodeList - nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/pago20:Pagos/pago20:Pago", Prefijo), namespaces) + nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/{1}:Pagos/{1}:Pago", Prefijo, PagoVersion), namespaces) For Each Pagos As XmlNode In nodePagos If Version = "4.0" AndAlso Pagos.Name = "pago20:Totales" Then diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 1b4b48413..f9341507e 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -4113,40 +4113,44 @@ Public Class Timbrado Totales.TotalTrasladosBaseIVA16 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA16.RoundSQL Totales.TotalTrasladosBaseIVA16Specified = Totales.TotalTrasladosBaseIVA16 > 0 Totales.TotalTrasladosImpuestoIVA16 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosImpuestoIVA16.RoundSQL - Totales.TotalTrasladosImpuestoIVA16Specified = Totales.TotalTrasladosBaseIVA16 > 0 + Totales.TotalTrasladosImpuestoIVA16Specified = Totales.TotalTrasladosImpuestoIVA16 > 0 Totales.TotalTrasladosBaseIVA8 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA8.RoundSQL Totales.TotalTrasladosBaseIVA8Specified = Totales.TotalTrasladosBaseIVA8 > 0 - Totales.TotalTrasladosImpuestoIVA8 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA8.RoundSQL - Totales.TotalTrasladosImpuestoIVA8Specified = Totales.TotalTrasladosBaseIVA8 > 0 + Totales.TotalTrasladosImpuestoIVA8 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosImpuestoIVA8.RoundSQL + Totales.TotalTrasladosImpuestoIVA8Specified = Totales.TotalTrasladosImpuestoIVA8 > 0 Totales.TotalTrasladosBaseIVA0 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA0.RoundSQL Totales.TotalTrasladosBaseIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0 Totales.TotalTrasladosImpuestoIVA0 = 0 - Totales.TotalTrasladosImpuestoIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0 + Totales.TotalTrasladosImpuestoIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0 ' si hay base > 0, debe de ponerse aunque sea en cero + If ObjCFDITimbre.ComplementoPagos.Totales.TotalRetencionesIEPS > 0 Then + Totales.TotalRetencionesIEPS = ObjCFDITimbre.ComplementoPagos.Totales.TotalRetencionesIEPS.RoundSQL + Totales.TotalRetencionesIEPSSpecified = True + Else + Totales.TotalRetencionesIEPSSpecified = False + End If - - Totales.TotalRetencionesIEPSSpecified = False ComPag.Totales = Totales - ComPag.Pago(0).DoctoRelacionado = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionado(ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados.Count - 1) {} - Dim i As Integer - For Each doc As CFDIComplementoPagosDocsRelacionados In ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados - ComPag.Pago(0).DoctoRelacionado(i) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionado() - ComPag.Pago(0).DoctoRelacionado(i).IdDocumento = doc.IdDocumento - If Not String.IsNullOrEmpty(doc.Serie) Then - ComPag.Pago(0).DoctoRelacionado(i).Serie = doc.Serie - End If - ComPag.Pago(0).DoctoRelacionado(i).Folio = doc.Folio - ComPag.Pago(0).DoctoRelacionado(i).MonedaDR = doc.MonedaDR - ComPag.Pago(0).DoctoRelacionado(i).NumParcialidad = doc.NumParcialidad.ToString - ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoAnt = doc.ImpSaldoAnt.RoundSQL - ComPag.Pago(0).DoctoRelacionado(i).ImpPagadoSpecified = True - ComPag.Pago(0).DoctoRelacionado(i).ImpPagado = doc.ImpPagado.RoundSQL - ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoInsoluto = doc.ImpSaldoInsoluto.RoundSQL - ComPag.Pago(0).DoctoRelacionado(i).EquivalenciaDR = doc.EquivalenciaDR - ComPag.Pago(0).DoctoRelacionado(i).EquivalenciaDRSpecified = True - ComPag.Pago(0).DoctoRelacionado(i).ObjetoImpDR = doc.ObjetoImpuesto + ComPag.Pago(0).DoctoRelacionado = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionado(ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados.Count - 1) {} + Dim i As Integer + For Each doc As CFDIComplementoPagosDocsRelacionados In ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados + ComPag.Pago(0).DoctoRelacionado(i) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionado() + ComPag.Pago(0).DoctoRelacionado(i).IdDocumento = doc.IdDocumento + If Not String.IsNullOrEmpty(doc.Serie) Then + ComPag.Pago(0).DoctoRelacionado(i).Serie = doc.Serie + End If + ComPag.Pago(0).DoctoRelacionado(i).Folio = doc.Folio + ComPag.Pago(0).DoctoRelacionado(i).MonedaDR = doc.MonedaDR + ComPag.Pago(0).DoctoRelacionado(i).NumParcialidad = doc.NumParcialidad.ToString + ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoAnt = doc.ImpSaldoAnt.RoundSQL + ComPag.Pago(0).DoctoRelacionado(i).ImpPagadoSpecified = True + ComPag.Pago(0).DoctoRelacionado(i).ImpPagado = doc.ImpPagado.RoundSQL + ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoInsoluto = doc.ImpSaldoInsoluto.RoundSQL + ComPag.Pago(0).DoctoRelacionado(i).EquivalenciaDR = doc.EquivalenciaDR.RoundSQL(6) + ComPag.Pago(0).DoctoRelacionado(i).EquivalenciaDRSpecified = True + 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 @@ -4154,8 +4158,9 @@ Public Class Timbrado ''retenciones If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then Dim j As Integer = 0 + ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R").Count - 1) {} + 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.RoundSQL(6) @@ -4169,12 +4174,13 @@ Public Class Timbrado Next End If - ''traslados + ''traslados If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then Dim j As Integer = 0 + ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T").Count - 1) {} + 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.RoundSQL(6) @@ -4191,83 +4197,50 @@ Public Class Timbrado End If End If i += 1 - Next - - If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 Then - Dim x As Integer - If ComPag.Pago(0).ImpuestosP(0) Is Nothing Then ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {} - ComPag.Pago(0).ImpuestosP(0).RetencionesP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP((ObjCFDITimbre.ComplementoPagos.Retenciones).Count - 1) {} - For Each Ret As CFDIRetenciones In ObjCFDITimbre.ComplementoPagos.Retenciones - ComPag.Pago(0).ImpuestosP(0).RetencionesP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP() - ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImpuestoP = Ret.Impuesto - ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImporteP = Ret.Importe - x += 1 Next - End If - If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then - Dim x As Integer + If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 OrElse ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {} ComPag.Pago(0).ImpuestosP(0) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP() - ComPag.Pago(0).ImpuestosP(0).TrasladosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP((ObjCFDITimbre.ComplementoPagos.Traslados).Count - 1) {} - For Each Tra As CFDITraslados In (ObjCFDITimbre.ComplementoPagos.Traslados) - ComPag.Pago(0).ImpuestosP(0).TrasladosP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP() - ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImpuestoP = Tra.Impuesto - ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TipoFactorP = Tra.TipoFactor - ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TasaOCuotaP = Tra.TasaOCuota.RoundSQL(6) - ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.Importe.RoundSQL(6) - ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).BaseP = Tra.Base.RoundSQL(6) - x += 1 - Next + + If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 Then + Dim x As Integer + ComPag.Pago(0).ImpuestosP(0).RetencionesP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP((ObjCFDITimbre.ComplementoPagos.Retenciones).Count - 1) {} + For Each Ret As CFDIRetenciones In ObjCFDITimbre.ComplementoPagos.Retenciones + ComPag.Pago(0).ImpuestosP(0).RetencionesP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP() + ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImpuestoP = Ret.Impuesto + ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImporteP = Ret.Importe + x += 1 + Next + End If + + If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then + Dim x As Integer + ComPag.Pago(0).ImpuestosP(0).TrasladosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP((ObjCFDITimbre.ComplementoPagos.Traslados).Count - 1) {} + For Each Tra As CFDITraslados In (ObjCFDITimbre.ComplementoPagos.Traslados) + ComPag.Pago(0).ImpuestosP(0).TrasladosP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP() + ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImpuestoP = Tra.Impuesto + ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TipoFactorP = Tra.TipoFactor + ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TasaOCuotaP = Tra.TasaOCuota.RoundSQL(6) + ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.Importe.RoundSQL(6) + ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).BaseP = Tra.Base.RoundSQL(6) + x += 1 + Next + End If End If - - - ''Estos impuestos aplicarían para anticipos - 'If ObjCFDITimbre.ComplementoPagos.tota > 0 OrElse ObjCFDITimbre.ComplementoPagos.TotalImpuestosTrasladados > 0 Then - ' ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {} - ' ComPag.Pago(0).ImpuestosP(0) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP() - - ' If (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then - ' Dim x As Integer - ' ComPag.Pago(0).ImpuestosP(0).TrasladosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP((ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "T").Count - 1) {} - ' For Each Tra As CFDIConceptosImpuestos In (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "T") - ' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP() - ' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImpuestoP = Tra.Impuesto - ' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TipoFactorP = Tra.TipoFactor - ' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TasaOCuotaP = Tra.TasaOCuota - ' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.Importe - ' x += 1 - ' Next - ' End If - - ' If (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then - ' Dim x As Integer - ' ComPag.Pago(0).ImpuestosP(0).RetencionesP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP((ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "R").Count - 1) {} - ' For Each Ret As CFDIConceptosImpuestos In (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "R") - ' ComPag.Pago(0).ImpuestosP(0).RetencionesP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP() - ' ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImpuestoP = Ret.Impuesto - ' ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImporteP = Ret.Importe - ' x += 1 - ' Next - ' End If - - - 'End If - - Dim nsComp As New System.Xml.Serialization.XmlSerializerNamespaces() - 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 - LXmlComplementos.Add(docComp.DocumentElement) - TieneComplemento = True - End If + 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 + LXmlComplementos.Add(docComp.DocumentElement) + TieneComplemento = True + End If - End If + End If #End Region diff --git a/Bin/GoCfdi.dll b/Bin/GoCfdi.dll index 8375b7d16..7e2aee54e 100644 Binary files a/Bin/GoCfdi.dll and b/Bin/GoCfdi.dll differ