diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb index 928706684..e51b8636f 100644 --- a/App_Code/CFDITimbre.vb +++ b/App_Code/CFDITimbre.vb @@ -395,7 +395,7 @@ End Class Public Class CFDIRetenciones Public Property Impuesto As String - Public Property Importe As Decimal + Public Property Importe As Decimal = 0.000000D Public Property TasaOCuota As String End Class @@ -417,11 +417,11 @@ End Class Public Class CFDITraslados Public Property Impuesto As String - Public Property Tasa As Decimal + Public Property Tasa As Decimal = 0.000000D Public Property TipoFactor As String - Public Property TasaOCuota As Decimal - Public Property Importe As Decimal - Public Property Base As Decimal + Public Property TasaOCuota As Decimal = 0.000000D + Public Property Importe As Decimal = 0.000000D + Public Property Base As Decimal = 0.000000D End Class diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index ea7eb8782..19070fdbf 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -1087,6 +1087,7 @@ Public Class ClsBancos Dim Timbre As CFDITimbre = Nothing Dim Timbrado As New Timbrado + Dim CFDIVersion As String = "4.0" If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then @@ -1100,6 +1101,7 @@ Public Class ClsBancos UsuarioActual.Empresa.CP.ToString, CuentaBeneficiario, dr("TipoCambioPago").ToString.ToDecimal, dttpagos, dttpagosimpuestos, CFDIRelacionado:=CFDIRelacionado) Else + CFDIVersion = "3.3" 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.ToDecimal, @@ -1137,7 +1139,7 @@ Public Class ClsBancos ' Dim StrRetorno As String = Modelos.TimbrarFactura(Ventas, UsuarioActual) If SeTimbro Then - If UpdateComplementoPago(tCveComplementoPago, ObjTimbrado.UUID, UsuarioActual.Empresa.CvePAC, UsuarioActual.CveEmpresa) Then + If UpdateComplementoPago(tCveComplementoPago, ObjTimbrado.UUID, UsuarioActual.Empresa.CvePAC, CFDIVersion, UsuarioActual.CveEmpresa) Then CveComplementoPago = tCveComplementoPago Retorno = True End If @@ -1201,8 +1203,7 @@ Public Class ClsBancos 'End Function - Public Function UpdateComplementoPago(CveComplementoPago As Integer, FolioFiscal As String, CvePAC As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CvePACCancelacion As Integer = -1, - Optional FechaCancelacion As Date = MinFecha, Optional SelloCancelacion As String = "", Optional CveSATMotivoCancelacion As Integer = -1) As Boolean + Public Function UpdateComplementoPago(CveComplementoPago As Integer, FolioFiscal As String, CvePAC As Integer, CFDIVersion As String, CveEmpresa As Integer, Optional Estatus As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Banc_ComplementoPagoUpdate") @@ -1213,11 +1214,37 @@ Public Class ClsBancos .Add("@CvePAC", SqlDbType.Int).Value = CvePAC .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Estatus", SqlDbType.Int).Value = Estatus + + .Add("@CFDIVersion", SqlDbType.VarChar).Value = CFDIVersion + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + + OnError("Ocurrió un error al actualizar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + End Try + + Return Retorno + End Function + + + Public Function UpdateComplementoPagoCancelado(CveComplementoPago As Integer, CveEstatus As Integer, CvePACCancelacion As Integer, CveEmpresa As Integer, FechaCancelacion As DateTime, SelloCancelacion As String, CveSATMotivoCancelacion As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Banc_ComplementoPagoUpdateCancelado") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion .Add("@FechaCancelacion", SqlDbType.Date).Value = FechaCancelacion .Add("@SelloCancelacion", SqlDbType.VarChar).Value = SelloCancelacion .Add("@CveSATMotivoCancelacion", SqlDbType.Int).Value = CveSATMotivoCancelacion - + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try @@ -1227,7 +1254,7 @@ Public Class ClsBancos If SelloCancelacion.Trim.Length > 0 Then OnError($"Ocurrió un error al actualizar complemento de pago sello: {SelloCancelacion} ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) Else - OnError("Ocurrió un error al actualizar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al cancelar estatus complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End If End Try @@ -1235,29 +1262,6 @@ Public Class ClsBancos Return Retorno End Function - - Public Function UpdateComplementoPagoCancelado(CveComplementoPago As Integer, CveEstatus As Integer, CvePACCancelacion As Integer, CveEmpresa As Integer, FechaCancelacion As DateTime) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Banc_ComplementoPagoUpdateCancelado") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@FechaCancelacion", SqlDbType.DateTime).Value = FechaCancelacion - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al cancelar estatus complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function AddComplementoPagosSinc(cveUsuario As Int32, fechaInicio As String, cveEmpresa As Int32) As Boolean Dim retorno As Boolean = False DataAdapter("PA_AddComplementoPagosSinc", CommandType.StoredProcedure) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index b766012f0..d76a89776 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -8918,20 +8918,22 @@ Public Class ClsPaginas Dim namespaces As New XmlNamespaceManager(XmlDoc.NameTable) Dim Prefijo As String = If(XmlDoc.DocumentElement.Prefix = "", "cfd", XmlDoc.DocumentElement.Prefix) Dim cfdVer As String = "" + Dim PagoVersion As String = "pago20" Dim validaElemento = XmlDoc.DocumentElement("cfdi:Complemento") Dim validaElementoPago = XmlDoc.DocumentElement("cfdi:Conceptos") - - If Version = "3.3" Then - cfdVer = "http://www.sat.gob.mx/cfd/3" - Else ' se considera que es la version 4.0 - cfdVer = "http://www.sat.gob.mx/cfd/4" - End If - namespaces.AddNamespace(Prefijo, cfdVer) namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal") - namespaces.AddNamespace("pago20", "http://www.sat.gob.mx/Pagos20") + + If Version = "3.3" Then + cfdVer = "http://www.sat.gob.mx/cfd/3" + namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos10") + PagoVersion = "pago10" + Else ' se considera que es la version 4.0 + cfdVer = "http://www.sat.gob.mx/cfd/4" + namespaces.AddNamespace("pago20", "http://www.sat.gob.mx/Pagos20") + End If 'Datos Fiscales If Not IsNothing(validaElemento) Then @@ -8946,15 +8948,58 @@ Public Class ClsPaginas Next End If - 'Pago - If Not IsNothing(validaElemento) Then + 'Pago10 + If Version = "3.3" AndAlso Not IsNothing(validaElemento) Then Dim PagosChild = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes.Cast(Of XmlNode).Where(Function(a) a.LocalName.Equals("Pagos", StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault() + + For Each Pagos As XmlNode In PagosChild.ChildNodes + Dim Dr As DataRow = DTConceptosPago.NewRow + + If Not Pagos.Attributes("CtaOrdenante") Is Nothing Then Dr("CtaOrdenante") = Pagos.Attributes("CtaOrdenante").Value Else Dr("CtaOrdenante") = "" + If Not Pagos.Attributes("TipoCambioP") Is Nothing Then Dr("TipoCambioP") = Pagos.Attributes("TipoCambioP").Value Else Dr("TipoCambioP") = "" + + If Not Pagos.Attributes("RfcEmisorCtaOrd") Is Nothing Then + Dr("RfcEmisorCtaOrd") = Pagos.Attributes("RfcEmisorCtaOrd").Value + RFCOrdenante = Pagos.Attributes("RfcEmisorCtaOrd").Value + Else + Dr("RfcEmisorCtaOrd") = "" + End If + + Dr("Monto") = Pagos.Attributes("Monto").Value + Dr("MonedaP") = Pagos.Attributes("MonedaP").Value + Dr("FormaDePagoP") = GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPagoSAT", $"ClaveFormaPagoSAT= '{Pagos.Attributes("FormaDePagoP").Value}'") + Dr("FechaPago") = Pagos.Attributes("FechaPago").Value + + FechaRecibo = Pagos.Attributes("FechaPago").Value + TotalLetra = Pagos.Attributes("Monto").Value.ToString.ToDouble.Texto2Letras(CveMoneda) + + DTConceptosPago.Rows.Add(Dr) + + For Each Relacionado As XmlNode In Pagos.ChildNodes + Dim DrRelacionado As DataRow = DTConceptosPagoRelacionado.NewRow + + If Not Relacionado.Attributes("Folio") Is Nothing Then DrRelacionado("Folio") = Relacionado.Attributes("Folio").Value Else DrRelacionado("Folio") = "" + If Not Relacionado.Attributes("Serie") Is Nothing Then DrRelacionado("Serie") = Relacionado.Attributes("Serie").Value Else DrRelacionado("Serie") = "" + If Not Relacionado.Attributes("TipoCambioDR") Is Nothing Then DrRelacionado("TipoCambioDR") = Relacionado.Attributes("TipoCambioDR").Value Else DrRelacionado("TipoCambioDR") = "" + + DrRelacionado("IdDocumento") = Relacionado.Attributes("IdDocumento").Value + DrRelacionado("ImpPagado") = Relacionado.Attributes("ImpPagado").Value + DrRelacionado("ImpSaldoAnt") = Relacionado.Attributes("ImpSaldoAnt").Value + DrRelacionado("NumParcialidad") = Relacionado.Attributes("NumParcialidad").Value + DrRelacionado("MetodoDePagoDR") = Relacionado.Attributes("MetodoDePagoDR").Value + DrRelacionado("MonedaDR") = Relacionado.Attributes("MonedaDR").Value + + DTConceptosPagoRelacionado.Rows.Add(DrRelacionado) + Next + Next + + End If + + 'Pago20 + If Version = "4.0" AndAlso Not IsNothing(validaElemento) Then Dim nodePagos As XmlNodeList - If Version = "3.3" Then - nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/pago10:Pago", Prefijo), namespaces) - Else - nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/pago20:Pagos/pago20:Pago", Prefijo), namespaces) - End If + + nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/pago20:Pagos/pago20:Pago", Prefijo), namespaces) For Each Pagos As XmlNode In nodePagos If Version = "4.0" AndAlso Pagos.Name = "pago20:Totales" Then @@ -8983,7 +9028,7 @@ Public Class ClsPaginas DTConceptosPago.Rows.Add(Dr) - For Each Relacionado As XmlNode In Pagos.SelectNodes("//pago20:DoctoRelacionado", namespaces) + For Each Relacionado As XmlNode In Pagos.SelectNodes(String.Format("//{0}:DoctoRelacionado", PagoVersion), namespaces) Dim DrRelacionado As DataRow = DTConceptosPagoRelacionado.NewRow If Not Relacionado.Attributes("Folio") Is Nothing Then DrRelacionado("Folio") = Relacionado.Attributes("Folio").Value Else DrRelacionado("Folio") = "" @@ -8994,7 +9039,7 @@ Public Class ClsPaginas DrRelacionado("ImpPagado") = Relacionado.Attributes("ImpPagado").Value DrRelacionado("ImpSaldoAnt") = Relacionado.Attributes("ImpSaldoAnt").Value DrRelacionado("NumParcialidad") = Relacionado.Attributes("NumParcialidad").Value - If Version = "3.3" Then DrRelacionado("MetodoDePagoDR") = Relacionado.Attributes("MetodoDePagoDR").Value + ' If Version = "3.3" Then DrRelacionado("MetodoDePagoDR") = Relacionado.Attributes("MetodoDePagoDR").Value If Version = "4.0" Then DrRelacionado("ObjetoImpDR") = Relacionado.Attributes("ObjetoImpDR").Value DrRelacionado("MonedaDR") = Relacionado.Attributes("MonedaDR").Value @@ -9104,6 +9149,7 @@ Public Class ClsPaginas ObjClientes.Dispose() End Sub + #End Region Public Sub CargarCentrosDeCosto(DdlProyecto As DropDownList, DdlSubProyecto As DropDownList, LthProyectoP As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos", Optional DdlSubProyectoMultiple As ListBox = Nothing) diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index d09c9bc2b..10eecb119 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -4108,19 +4108,19 @@ Public Class Timbrado Dim Totales As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosTotales() 'Totales Generales - Totales.MontoTotalPagos = ObjCFDITimbre.ComplementoPagos.Totales.MontoTotalPagos + Totales.MontoTotalPagos = ObjCFDITimbre.ComplementoPagos.Totales.MontoTotalPagos.RoundSQL - Totales.TotalTrasladosBaseIVA16 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA16 + 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.TotalTrasladosBaseIVA8 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA8 + 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.TotalTrasladosBaseIVA0 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA0 + Totales.TotalTrasladosBaseIVA0 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA0.RoundSQL Totales.TotalTrasladosBaseIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0 Totales.TotalTrasladosImpuestoIVA0 = 0 Totales.TotalTrasladosImpuestoIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0 @@ -4150,26 +4150,6 @@ Public Class Timbrado 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 - Tra.TipoFactorDR = docimp.TipoFactor - Tra.TasaOCuotaDRSpecified = True - Tra.TasaOCuotaDR = docimp.TasaOCuota - 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 @@ -4178,36 +4158,41 @@ Public Class Timbrado 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.BaseDR = docimp.Base.RoundSQL(6) + Tra.ImporteDR = docimp.Importe.RoundSQL(6) Tra.ImpuestoDR = docimp.Impuesto Tra.TipoFactorDR = docimp.TipoFactor - Tra.TasaOCuotaDR = docimp.TasaOCuota + Tra.TasaOCuotaDR = docimp.TasaOCuota.RoundSQL(6) ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR(j) = Tra End If j += 1 Next End If + + ''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.RoundSQL(6) + Tra.ImporteDRSpecified = True + Tra.ImporteDR = docimp.Importe.RoundSQL(6) + Tra.ImpuestoDR = docimp.Impuesto + Tra.TipoFactorDR = docimp.TipoFactor + Tra.TasaOCuotaDRSpecified = True + Tra.TasaOCuotaDR = docimp.TasaOCuota.RoundSQL(6) + ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR(j) = Tra + End If + j += 1 + Next + End If End If i += 1 Next - If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then - Dim x As Integer - 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 - ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.Importe - ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).BaseP = Tra.Base - x += 1 - Next - End If - 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) {} @@ -4220,41 +4205,59 @@ Public Class Timbrado Next 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 + If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then + Dim x As Integer + 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 + End If - 'End If - Dim nsComp As New System.Xml.Serialization.XmlSerializerNamespaces() + ''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() @@ -4662,191 +4665,7 @@ Public Class Timbrado #End Region - '#Region "Detallista" - ' If Ventas.Cliente.AplicaDetallista Then - ' Dim detallista As Profact.TimbraCFDI40.Complementos.Detallista.detallista = New Profact.TimbraCFDI40.Complementos.Detallista.detallista - ' detallista.type = "SimpleInvoiceType" - ' detallista.contentVersion = "1.3.1" - ' detallista.documentStructureVersion = "AMC8.1" - ' detallista.documentStatus = Profact.TimbraCFDI40.Complementos.Detallista.detallistaDocumentStatus.ORIGINAL - ' detallista.DeliveryNote = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaDeliveryNote - ' detallista.DeliveryNote.referenceIdentification = New String((1)) {} - ' detallista.DeliveryNote.referenceIdentification(0) = "1" - ' detallista.DeliveryNote.ReferenceDate = New DateTime - ' detallista.DeliveryNote.ReferenceDate = comprobante.Fecha - ' detallista.DeliveryNote.ReferenceDateSpecified = True - - ' detallista.requestForPaymentIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaRequestForPaymentIdentification - ' detallista.requestForPaymentIdentification.entityType = Profact.TimbraCFDI40.Complementos.Detallista.detallistaRequestForPaymentIdentificationEntityType.INVOICE - - ' detallista.specialInstruction = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaSpecialInstruction((1)) {} - ' detallista.specialInstruction(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaSpecialInstruction - ' detallista.specialInstruction(0).code = Profact.TimbraCFDI40.Complementos.Detallista.detallistaSpecialInstructionCode.ZZZ - ' Dim TotalTexto = New String() {Ventas.TotalTC.ToString.ToDouble.Texto2Letras.ToUpper()} - ' Dim propertyInfo = detallista.specialInstruction(0).GetType().GetProperty("text") - ' propertyInfo.SetValue(detallista.specialInstruction(0), Convert.ChangeType(TotalTexto, propertyInfo.PropertyType), Nothing) - - ' detallista.orderIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaOrderIdentification - ' detallista.orderIdentification.referenceIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentification((1)) {} - ' detallista.orderIdentification.referenceIdentification(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentification - ' detallista.orderIdentification.referenceIdentification(0).type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentificationType.ON - ' detallista.orderIdentification.referenceIdentification(0).Value = Ventas.Det_OrdenCompra - ' detallista.orderIdentification.ReferenceDateSpecified = True - ' detallista.orderIdentification.ReferenceDate = Ventas.Det_FechaOrdenCompra.ToDate() - - ' detallista.AdditionalInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaReferenceIdentification((1)) {} - ' detallista.AdditionalInformation(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaReferenceIdentification - ' detallista.AdditionalInformation(0).type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaReferenceIdentificationType.ATZ - ' detallista.AdditionalInformation(0).Value = Ventas.Det_ContraRecibo - - ' detallista.DeliveryNote = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaDeliveryNote - ' detallista.DeliveryNote.ReferenceDate = Ventas.Det_FechaOrdenCompra.ToDate - ' detallista.DeliveryNote.referenceIdentification = New String((1)) {} - ' detallista.DeliveryNote.referenceIdentification(0) = Ventas.Det_ContraRecibo - - ' detallista.buyer = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaBuyer - ' detallista.buyer.gln = Ventas.Cliente.Detallista_GLNComprador - ' detallista.buyer.contactInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaBuyerContactInformation - ' detallista.buyer.contactInformation.personOrDepartmentName = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaBuyerContactInformationPersonOrDepartmentName - ' detallista.buyer.contactInformation.personOrDepartmentName.text = Ventas.Cliente.Detallista_Departamento - - ' detallista.seller = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaSeller - ' detallista.seller.gln = Ventas.Cliente.Detallista_GLNVendedor - ' detallista.seller.alternatePartyIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaSellerAlternatePartyIdentification - ' detallista.seller.alternatePartyIdentification.type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaSellerAlternatePartyIdentificationType.SELLER_ASSIGNED_IDENTIFIER_FOR_A_PARTY - ' detallista.seller.alternatePartyIdentification.Value = Ventas.Cliente.Detallista_NumProveedor - - ' 'detallista.shipTo = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaShipTo - ' 'detallista.shipTo.gln = "0000000000000" - ' 'detallista.shipTo.nameAndAddress = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaShipToNameAndAddress - ' 'detallista.shipTo.nameAndAddress.name = New String((1)) {} - ' 'detallista.shipTo.nameAndAddress.name(0) = Ventas.Cliente.Direccion - ' 'detallista.shipTo.nameAndAddress.streetAddressOne = New String((1)) {} - ' 'detallista.shipTo.nameAndAddress.streetAddressOne(0) = Ventas.Cliente.NoInt - ' 'detallista.shipTo.nameAndAddress.city = New String((1)) {} - ' 'detallista.shipTo.nameAndAddress.city(0) = Ventas.Cliente.Ciudad - ' 'detallista.shipTo.nameAndAddress.postalCode = New String((1)) {} - ' 'detallista.shipTo.nameAndAddress.postalCode(0) = Ventas.Cliente.CP - - ' detallista.paymentTerms = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTerms - ' detallista.paymentTerms.netPayment = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsNetPayment - ' detallista.paymentTerms.netPayment.paymentTimePeriod = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriod - ' detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDue - ' detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.timePeriod = Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDueTimePeriod.DAYS - ' detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.value = "0" - - ' detallista.paymentTerms.discountPayment = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsDiscountPayment - ' detallista.paymentTerms.discountPayment.percentage = If(Ventas.DescuentoTC > 0 AndAlso Ventas.SubTotalTC > 0, (Ventas.DescuentoTC * 100) / Ventas.SubTotalTC, 0).ToString().FormatoNumero() - - ' detallista.currency = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrency((1)) {} - ' detallista.currency(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrency - ' detallista.currency(0).currencyISOCode = If(Ventas.CveMoneda = 1, Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrencyCurrencyISOCode.MXN, Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrencyCurrencyISOCode.USD) - ' detallista.currency(0).currencyFunction = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrencyCurrencyFunction((1)) {} - ' detallista.currency(0).currencyFunction(0) = Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrencyCurrencyFunction.BILLING_CURRENCY - ' detallista.currency(0).rateOfChangeSpecified = True - ' detallista.currency(0).rateOfChange = 1 - - ' detallista.allowanceCharge = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceCharge(1) {} - ' detallista.allowanceCharge(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceCharge - ' detallista.allowanceCharge(0).monetaryAmountOrPercentage = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentage - ' detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentageRate - ' detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate.base = Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentageRateBase.INVOICE_VALUE - ' detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate.percentage = If(Ventas.DescuentoTC > 0 AndAlso Ventas.SubTotalTC > 0, (Ventas.DescuentoTC * 100) / Ventas.SubTotalTC, 0) - - ' Dim articuloCounter As Integer = 0 - ' For Each concepto As Profact.TimbraCFDI40.ComprobanteConcepto In comprobante.Conceptos - ' articuloCounter = (articuloCounter + 1) - ' Next - ' detallista.lineItem = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItem((articuloCounter)) {} - ' Dim counter As Integer = 0 - ' For Each concepto As Profact.TimbraCFDI40.ComprobanteConcepto In comprobante.Conceptos - ' detallista.lineItem(counter) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItem - ' detallista.lineItem(counter).type = "SimpleInvoiceLineItemType" - ' detallista.lineItem(counter).number = (counter + 1).ToString - ' detallista.lineItem(counter).tradeItemIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemIdentification - ' detallista.lineItem(counter).tradeItemIdentification.gtin = comprobante.Conceptos(counter).NoIdentificacion - ' detallista.lineItem(counter).alternateTradeItemIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentification(1) {} - ' detallista.lineItem(counter).alternateTradeItemIdentification(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentification - ' detallista.lineItem(counter).alternateTradeItemIdentification(0).type = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentificationType - ' detallista.lineItem(counter).alternateTradeItemIdentification(0).type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentificationType.BUYER_ASSIGNED - ' detallista.lineItem(counter).tradeItemDescriptionInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemDescriptionInformation - ' If (comprobante.Conceptos(counter).Descripcion.Length > 34) Then - ' detallista.lineItem(counter).tradeItemDescriptionInformation.longText = comprobante.Conceptos(counter).Descripcion.Substring(0, 34) - ' Else - ' detallista.lineItem(counter).tradeItemDescriptionInformation.longText = comprobante.Conceptos(counter).Descripcion - ' End If - ' detallista.lineItem(counter).invoicedQuantity = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemInvoicedQuantity - ' detallista.lineItem(counter).invoicedQuantity.unitOfMeasure = comprobante.Conceptos(counter).Unidad - ' detallista.lineItem(counter).invoicedQuantity.Text = New String((1)) {} - ' detallista.lineItem(counter).invoicedQuantity.Text(0) = comprobante.Conceptos(counter).Cantidad.ToString - - ' detallista.lineItem(counter).aditionalQuantity = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAditionalQuantity(1) {} - ' detallista.lineItem(counter).aditionalQuantity(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAditionalQuantity - ' detallista.lineItem(counter).aditionalQuantity(0).QuantityType = Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAditionalQuantityQuantityType.NUM_CONSUMER_UNITS - ' detallista.lineItem(counter).aditionalQuantity(0).Text = New String((1)) {} - ' detallista.lineItem(counter).aditionalQuantity(0).Text(0) = "1" - - ' detallista.lineItem(counter).grossPrice = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemGrossPrice - ' detallista.lineItem(counter).grossPrice.Amount = comprobante.Conceptos(counter).ValorUnitario - - ' detallista.lineItem(counter).netPrice = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemNetPrice - ' detallista.lineItem(counter).netPrice.Amount = comprobante.Conceptos(counter).ValorUnitario - - ' detallista.lineItem(counter).AdditionalInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAdditionalInformation - ' detallista.lineItem(counter).AdditionalInformation.referenceIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAdditionalInformationReferenceIdentification - ' detallista.lineItem(counter).AdditionalInformation.referenceIdentification.type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAdditionalInformationReferenceIdentificationType.ON - ' detallista.lineItem(counter).AdditionalInformation.referenceIdentification.Value = "1587" - ' 'Impuestos - ' Dim tasa As Decimal = 0 - ' Dim importeImp As Decimal = 0 - ' Try - ' If (Not (comprobante.Impuestos.Traslados) Is Nothing) Then - ' For Each traslado As Profact.TimbraCFDI40.ComprobanteImpuestosTraslado In comprobante.Impuestos.Traslados - ' tasa = Decimal.Parse(traslado.TasaOCuota) - ' importeImp = (comprobante.Conceptos(counter).Importe * (tasa / 100)) - ' Next - ' End If - - ' Catch ex As System.Exception - - ' End Try - - ' detallista.lineItem(counter).tradeItemTaxInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformation(1) {} - ' detallista.lineItem(counter).tradeItemTaxInformation(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformation - ' detallista.lineItem(counter).tradeItemTaxInformation(0).taxTypeDescription = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTaxTypeDescription - ' detallista.lineItem(counter).tradeItemTaxInformation(0).taxTypeDescription = Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTaxTypeDescription.VAT - ' detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTradeItemTaxAmount - ' detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount.taxPercentage = tasa - ' detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount.taxAmount = importeImp - - ' detallista.lineItem(counter).totalLineAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTotalLineAmount - ' detallista.lineItem(counter).totalLineAmount.grossAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTotalLineAmountGrossAmount - ' detallista.lineItem(counter).totalLineAmount.grossAmount.Amount = comprobante.Conceptos(counter).Importe - ' detallista.lineItem(counter).totalLineAmount.netAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTotalLineAmountNetAmount - ' detallista.lineItem(counter).totalLineAmount.netAmount.Amount = comprobante.Conceptos(counter).Importe - ' counter = (counter + 1) - ' Next - ' detallista.totalAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaTotalAmount - ' detallista.totalAmount.Amount = comprobante.SubTotal - - ' detallista.TotalAllowanceCharge = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaTotalAllowanceCharge(1) {} - ' detallista.TotalAllowanceCharge(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaTotalAllowanceCharge - ' detallista.TotalAllowanceCharge(0).allowanceOrChargeType = Profact.TimbraCFDI40.Complementos.Detallista.detallistaTotalAllowanceChargeAllowanceOrChargeType.ALLOWANCE - ' detallista.TotalAllowanceCharge(0).Amount = Ventas.DescuentoTC - - ' Dim nombres As System.Xml.Serialization.XmlSerializerNamespaces = New System.Xml.Serialization.XmlSerializerNamespaces - ' nombres.Add("detallista", "http://www.sat.gob.mx/detallista") - ' Dim xmlDetallista As String = Profact.TimbraCFDI.XMLUtilerias.SerializaObjeto(detallista, GetType(Profact.TimbraCFDI40.Complementos.Detallista.detallista), nombres) - - ' Dim docDetallista As XmlDocument = New XmlDocument - ' docDetallista.LoadXml(xmlDetallista) - ' comprobante.DetallistaSpecified = True - ' LXmlComplementos.Add(docDetallista.DocumentElement) - - ' TieneComplemento = True - ' End If - '#End Region If TieneComplemento Then comprobante.Complemento = New Profact.TimbraCFDI40.ComprobanteComplemento @@ -5351,6 +5170,17 @@ Public Class Timbrado doc.ObjetoImpuesto) If doc.Impuestos IsNot Nothing Then + ''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") + If docimp.TrasladooRetencion = "R" Then + cfdi.Pago20RetencionDR(docimp.Base, docimp.Impuesto, docimp.TipoFactor, docimp.TasaOCuota, docimp.Importe) + End If + j += 1 + Next + End If + ''traslados If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then Dim j As Integer = 0 @@ -5362,33 +5192,22 @@ Public Class Timbrado 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") - If docimp.TrasladooRetencion = "R" Then - cfdi.Pago20RetencionDR(docimp.Base, docimp.Impuesto, docimp.TipoFactor, docimp.TasaOCuota, docimp.Importe) - End If - j += 1 - Next - End If End If Next + If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 Then + For Each Ret As CFDIRetenciones In ObjCFDITimbre.ComplementoPagos.Retenciones + cfdi.Pago20RetencionP(Ret.Impuesto, Ret.Importe) + Next + End If + If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then For Each Tra As CFDITraslados In (ObjCFDITimbre.ComplementoPagos.Traslados) cfdi.Pago20TrasladoP(Tra.Base, Tra.Impuesto, Tra.TipoFactor, Tra.TasaOCuota, Tra.Importe) Next End If - - If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 Then - For Each Ret As CFDIRetenciones In ObjCFDITimbre.ComplementoPagos.Retenciones - cfdi.Pago20RetencionP(Ret.Impuesto, Ret.Importe) - Next - End If End If End If #End Region diff --git a/App_Code/WS/WSSIGVentas.vb b/App_Code/WS/WSSIGVentas.vb index 9cab10ea5..badabe60b 100644 --- a/App_Code/WS/WSSIGVentas.vb +++ b/App_Code/WS/WSSIGVentas.vb @@ -131,7 +131,7 @@ Namespace SIG CveComplementoPagoTimbre = objbancos.AddComplementoPago(dr("CveIE").ToString().ToEntero(), -1, "Pag", dr("FolioTimbre"), Me.CveUsuario, CveEmpresa, CvePrePoliza:=-1, Estatus:=1) continuar = CveComplementoPagoTimbre > 0 End If - If continuar Then continuar = objbancos.UpdateComplementoPago(CveComplementoPagoTimbre, dr("FolioFiscalTimbre").ToString(), dr("CvePAC").ToString().ToEntero(), CveEmpresa) + If continuar Then continuar = objbancos.UpdateComplementoPago(CveComplementoPagoTimbre, dr("FolioFiscalTimbre").ToString(), "4.0", dr("CvePAC").ToString().ToEntero(), CveEmpresa) If continuar Then dr("Sincronizado") = 1 End If