diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb index 6600b448e..ddd73483a 100644 --- a/App_Code/CFDITimbre.vb +++ b/App_Code/CFDITimbre.vb @@ -235,7 +235,9 @@ End Class Public Class CFDIComplementos + Public Property ComercioExterior11 As CFDIComercioExterior11 + Public Property CartaPorte As CFDICartaPorte Sub New() ComercioExterior11 = New CFDIComercioExterior11 @@ -568,4 +570,151 @@ Public Class CFDIComercioExterior11MercanciasDescripcionesEspecificas Public Property Modelo As String = "" Public Property SubModelo As String = "" Public Property NumeroSerie As String = "" -End Class \ No newline at end of file +End Class + + + +Public Class CFDICartaPorte + Public Property TranspInternac As String = "" + Public Property EntradaSalidaMercancia As String = "" + Public Property ViaEntradaSalida As String = "" + Public Property TotalDistanciaRecorrida As Double = 0 + Public Property Ubicaciones As New List(Of CFDICartaPorteUbicaciones) + Public Property Mercancias As New CFDICartaPorteMercancias + Public Property FiguraTransporte As New CFDICartaPorteFiguraTransporte +End Class + + +Public Class CFDICartaPorteUbicaciones + Public Property TipoEstacion As String = "" + Public Property DistanciaRecorrida As Double = 0 + 'Public Property Ubicacion As New CFDICartaPorteUbicacion + Public Property Origen As New CFDICartaPorteUbicacionOrigen + Public Property Destino As New CFDICartaPorteUbicacionDestino +End Class + + + +Public Class CFDICartaPorteAutoTransporteFederal + Public Property PermSCT As String = "" + Public Property NumPermisoSCT As String = "" + Public Property NombreAseg As String = "" + Public Property NumPolizaSeguro As String = "" + Public Property Vehiculo As New CFDICartaPorteIdentificacionVehicular + Public Property Remolques As New List(Of CFDICartaPorteRemolque) + +End Class + + +Public Class CFDICartaPorteUbicacionOrigen + Public Property IDOrigen As String = "" + Public Property RFCRemitente As String = "" + Public Property NombreRemitente As String = "" + Public Property NumRegIdTrib As String = "" + Public Property ResidenciaFiscal As String = "" + Public Property NumEstacion As String = "" + Public Property NombreEstacion As String = "" + Public Property NavegacionTrafico As String = "" + Public Property FechaHoraSalida As String = "" + Public Property Domicilio As New CFDICartaPorteDomicilio +End Class + + +Public Class CFDICartaPorteUbicacionDestino + Public Property IDDestino As String = "" + Public Property RFCDestinatario As String = "" + Public Property NombreDestinatario As String = "" + Public Property NumRegIdTrib As String = "" + Public Property ResidenciaFiscal As String + Public Property NumEstacion As String + Public Property NombreEstacion As String + Public Property NavegacionTrafico As String + Public Property FechaHoraProgLlegada As String + Public Property Domicilio As New CFDICartaPorteDomicilio +End Class + + +Public Class CFDICartaPorteDomicilio + Public Property Calle As String = "" + Public Property NumeroExterior As String = "" + Public Property NumeroInterior As String = "" + Public Property Colonia As String = "" + Public Property Localidad As String = "" + Public Property Referencia As String = "" + Public Property Municipio As String = "" + Public Property Estado As String = "" + Public Property Pais As String = "" + Public Property CP As String = "" +End Class + + +Public Class CFDICartaPorteMercancias + Public Property PesoBrutoTotal As Double = 0 + Public Property UnidadPeso As String = "" + Public ReadOnly Property PesoNetoTotal As Double + Get + Return Mercancias.Sum(Function(item) item.PesoenKg) + End Get + End Property + + Public ReadOnly Property NumTotalMercancias As Integer + Get + 'Return Mercancias.Sum(Function(item) item.Cantidad).ToEntero + Return Mercancias.Count + End Get + End Property + Public Property CargoporTasacion As Double = 0 + Public Property Mercancias As New List(Of CFDICartaPorteMercancia) +End Class + + +Public Class CFDICartaPorteMercancia + Public Property BienesTransp As String = "" + Public Property ClaveSTCC As String = "" + Public Property Descripción As String = "" + Public Property Cantidad As Decimal = 0 + Public Property ClaveUnidad As String = "" + Public Property Unidad As String = "" + Public Property Dimensiones As String = "" + Public Property ClaveMaterialPeligroso As String = "" + Public Property MaterialPeligroso As String = "" + Public Property Embalaje As String = "" + Public Property DescripEmbalaje As String = "" + Public Property PesoenKg As Double + Public Property ValorMercancia As Double + Public Property Moneda As String = "" + Public Property FraccionArrancelaria As String = "" + Public Property UUIDComercioExt As String = "" + +End Class + + +Public Class CFDICartaPorteIdentificacionVehicular + Public Property ConfigVehicular As String = "" + Public Property PlacaVM As String = "" + Public Property AnioModeloVM As Integer = 0 +End Class + + +Public Class CFDICartaPorteRemolque + Public Property SubTipoRemolque As String = "" + Public Property Placa As String = "" + Public Property AnioModeloVM As String = "" +End Class + + +Public Class CFDICartaPorteFiguraTransporte + Public Property ClaveTransporte As String = "01" + Public Property AutoTransporteFederal As New CFDICartaPorteAutoTransporteFederal + Public Property Operadores As New List(Of CFDICartaPorteOperador) +End Class + + +Public Class CFDICartaPorteOperador + Public Property RFCOperador As String = "" + Public Property NumLicencia As String = "" + Public Property NombreOperador As String = "" + Public Property NumRegidTribOperador As String = "" + Public Property ResidenciaFiscalOperador As String = "" + Public Property Domicilio As New CFDICartaPorteDomicilio +End Class diff --git a/App_Code/ClsAcarreos.vb b/App_Code/ClsAcarreos.vb index 6ec08daaa..6c42c9419 100644 --- a/App_Code/ClsAcarreos.vb +++ b/App_Code/ClsAcarreos.vb @@ -109,7 +109,8 @@ Public Class ClsAcarreos #Region "Choferes" - Public Function AddChofer(Chofer As String, CveUsuario As Integer, CveEmpresa As Integer, CveTransportista As Integer, Identificacion As String, Domicilio As String, Telefono As String, Ciudad As String, Licencia As String) As Boolean + Public Function AddChofer(Chofer As String, CveUsuario As Integer, CveEmpresa As Integer, CveTransportista As Integer, Identificacion As String, Telefono As String, Licencia As String, RFC As String, Domicilio As String, + Optional NumeroExterior As String = "", Optional NumeroInterior As String = "", Optional Colonia As String = "", Optional Ciudad As String = "", Optional Estado As String = "", Optional CP As String = "") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Acar_ChoferesAdd") With SqlAdapter.SelectCommand.Parameters @@ -118,10 +119,16 @@ Public Class ClsAcarreos .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveTransportista", SqlDbType.Int).Value = CveTransportista .Add("@Identificacion", SqlDbType.VarChar).Value = Identificacion - .Add("@Domicilio", SqlDbType.VarChar).Value = Domicilio .Add("@Telefono", SqlDbType.VarChar).Value = Telefono - .Add("@Ciudad", SqlDbType.VarChar).Value = Ciudad .Add("@Licencia", SqlDbType.VarChar).Value = Licencia + .Add("@RFC", SqlDbType.VarChar).Value = RFC + .Add("@Domicilio", SqlDbType.VarChar).Value = Domicilio + .Add("@NumeroExterior", SqlDbType.VarChar).Value = NumeroExterior + .Add("@NumeroInterior", SqlDbType.VarChar).Value = NumeroInterior + .Add("@Colonia", SqlDbType.VarChar).Value = Colonia + .Add("@Ciudad", SqlDbType.VarChar).Value = Ciudad + .Add("@Estado", SqlDbType.VarChar).Value = Estado + .Add("@CP", SqlDbType.VarChar).Value = CP End With Try SqlAdapter.Fill(Data) @@ -133,7 +140,8 @@ Public Class ClsAcarreos Return Retorno End Function - Public Function UpdateChofer(CveChofer As Integer, Chofer As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer, CveTransportista As Integer, Identificacion As String, Domicilio As String, Telefono As String, Ciudad As String, Licencia As String) As Boolean + Public Function UpdateChofer(CveChofer As Integer, Chofer As String, CveUsuario As Integer, CveEmpresa As Integer, Estatus As Integer, CveTransportista As Integer, Identificacion As String, Telefono As String, Licencia As String, RFC As String, Domicilio As String, + Optional NumeroExterior As String = "", Optional NumeroInterior As String = "", Optional Colonia As String = "", Optional Ciudad As String = "", Optional Estado As String = "", Optional CP As String = "") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Acar_ChoferesUpdate") With SqlAdapter.SelectCommand.Parameters @@ -141,13 +149,19 @@ Public Class ClsAcarreos .Add("@Chofer", SqlDbType.VarChar).Value = Chofer .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@CveTransportista", SqlDbType.Int).Value = CveTransportista .Add("@Identificacion", SqlDbType.VarChar).Value = Identificacion - .Add("@Domicilio", SqlDbType.VarChar).Value = Domicilio .Add("@Telefono", SqlDbType.VarChar).Value = Telefono - .Add("@Ciudad", SqlDbType.VarChar).Value = Ciudad .Add("@Licencia", SqlDbType.VarChar).Value = Licencia + .Add("@RFC", SqlDbType.VarChar).Value = RFC + .Add("@Domicilio", SqlDbType.VarChar).Value = Domicilio + .Add("@NumeroExterior", SqlDbType.VarChar).Value = NumeroExterior + .Add("@NumeroInterior", SqlDbType.VarChar).Value = NumeroInterior + .Add("@Colonia", SqlDbType.VarChar).Value = Colonia + .Add("@Ciudad", SqlDbType.VarChar).Value = Ciudad + .Add("@Estado", SqlDbType.VarChar).Value = Estado + .Add("@CP", SqlDbType.VarChar).Value = CP + .Add("@Estatus", SqlDbType.Int).Value = Estatus End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 1a7713d2c..266a9a71c 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5774,7 +5774,7 @@ Public Class ClsContabilidad Public Function AddCuentasAsignaciones(Optional CveConceptoContable As Integer = -1, Optional CveEmpresa As Integer = -1, Optional CveCuenta As Integer = -1, Optional IdCtaContable As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveClasificacion As Integer = -1, Optional CveAlmacen As Integer = -1, Optional PorcentajeIVA As Decimal = -1, Optional CveConceptoNomina As Decimal = -1, Optional CveBancoCuenta As Integer = -1, - Optional CveSubProyecto As Integer = -1) As Boolean + Optional CveSubProyecto As Integer = -1, Optional CveActivoFijo As Integer = -1) As Boolean Dim Retorno = False DataAdapter("PA_Conta_CuentasAsignacionesAdd") @@ -5793,6 +5793,7 @@ Public Class ClsContabilidad .Add("@CveConceptoNomina", SqlDbType.Decimal).Value = CveConceptoNomina .Add("@CveBancoCuenta", SqlDbType.Int).Value = CveBancoCuenta .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo End With Try @@ -5828,7 +5829,7 @@ Public Class ClsContabilidad Optional IdCtaContable As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveClasificacion As Integer = -1, Optional CveAlmacen As Integer = -1, Optional PorcentajeIVA As Decimal = -1, Optional CveConceptoNomina As Decimal = -1, Optional CveBancoCuenta As Integer = -1, - Optional CveSubProyecto As Integer = -1) As Boolean + Optional CveSubProyecto As Integer = -1, Optional CveActivoFijo As Integer = -1) As Boolean Dim Retorno = False DataAdapter("PA_Conta_CuentasAsignacionesUpdate") @@ -5847,6 +5848,7 @@ Public Class ClsContabilidad .Add("@CveConceptoNomina", SqlDbType.Decimal).Value = CveConceptoNomina .Add("@CveBancoCuenta", SqlDbType.Int).Value = CveBancoCuenta .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo End With Try diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 4bba5cb11..43eab1487 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -5489,12 +5489,18 @@ Public Class ClsInventarios End Try Return Retorno End Function - Public Function AddCamiones(Placa As String, Especificacion As String, CveEmpresa As Integer) As Boolean + Public Function AddCamiones(Placa As String, Especificacion As String, CveEmpresa As Integer, Optional ConfigCartaPorte As String = "", Optional Anio As Integer = 0, Optional TipoPermisoSCT As String = "", Optional NumPermisoSCT As String = "", Optional NombreAseguradora As String = "", Optional NumPolizaSeguro As String = "") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_CamionesAdd") With SqlAdapter.SelectCommand.Parameters .Add("@Placa", SqlDbType.VarChar).Value = Placa .Add("@Especificacion", SqlDbType.VarChar).Value = Especificacion + .Add("@ConfigCartaPorte", SqlDbType.VarChar).Value = ConfigCartaPorte + .Add("@Anio", SqlDbType.Int).Value = Anio + .Add("@TipoPermisoSCT", SqlDbType.VarChar).Value = TipoPermisoSCT + .Add("@NumPermisoSCT", SqlDbType.VarChar).Value = NumPermisoSCT + .Add("@NombreAseguradora", SqlDbType.VarChar).Value = NombreAseguradora + .Add("@NumPolizaSeguro", SqlDbType.VarChar).Value = NumPolizaSeguro .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try @@ -5519,13 +5525,19 @@ Public Class ClsInventarios End Try Return Retorno End Function - Public Function UpdateCamiones(CveCamion As Integer, Placa As String, Especificacion As String) As Boolean + Public Function UpdateCamiones(CveCamion As Integer, Placa As String, Especificacion As String, Optional ConfigCartaPorte As String = "", Optional Anio As Integer = 0, Optional TipoPermisoSCT As String = "", Optional NumPermisoSCT As String = "", Optional NombreAseguradora As String = "", Optional NumPolizaSeguro As String = "") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_CamionesUpdate") With SqlAdapter.SelectCommand.Parameters .Add("@CveCamion", SqlDbType.Int).Value = CveCamion .Add("@Placa", SqlDbType.VarChar).Value = Placa .Add("@Especificacion", SqlDbType.VarChar).Value = Especificacion + .Add("@ConfigCartaPorte", SqlDbType.VarChar).Value = ConfigCartaPorte + .Add("@Anio", SqlDbType.Int).Value = Anio + .Add("@TipoPermisoSCT", SqlDbType.VarChar).Value = TipoPermisoSCT + .Add("@NumPermisoSCT", SqlDbType.VarChar).Value = NumPermisoSCT + .Add("@NombreAseguradora", SqlDbType.VarChar).Value = NombreAseguradora + .Add("@NumPolizaSeguro", SqlDbType.VarChar).Value = NumPolizaSeguro End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 25ac07be4..aa405c7f4 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -1723,7 +1723,7 @@ Public Class Timbrado If Ventas.CveVenta > 0 Then Dim ObjVentas As New ClsVentas() - If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC) Then + If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC, RFCReceptor:=ObjCFDITimbre.Receptor.RFC) Then Retorno = "" Else Retorno = "Error" @@ -2125,6 +2125,77 @@ Public Class Timbrado End If + + +#Region "C O M P L E M E N T O C A R T A P O R T E" + + If ObjCFDITimbre.Complementos.CartaPorte IsNot Nothing Then + If ObjCFDITimbre.Complementos.CartaPorte IsNot Nothing Then + + Dim Carta As CFDICartaPorte = ObjCFDITimbre.Complementos.CartaPorte + + ''DATOS GENERALES + cfdi.CartaPorte(Carta.TranspInternac, Carta.EntradaSalidaMercancia, Carta.ViaEntradaSalida, Carta.TotalDistanciaRecorrida) + + 'UBICACIONES + If Carta.Ubicaciones IsNot Nothing AndAlso Carta.Ubicaciones.Count > 0 Then + For Each ubica As CFDICartaPorteUbicaciones In Carta.Ubicaciones + 'origen + cfdi.CartaPorteUbicacion(ubica.TipoEstacion, ubica.DistanciaRecorrida) + cfdi.CartaPorteOrigen(ubica.Origen.IDOrigen, ubica.Origen.RFCRemitente, ubica.Origen.NombreRemitente, ubica.Origen.NumRegIdTrib, ubica.Origen.ResidenciaFiscal, ubica.Origen.NumEstacion, ubica.Origen.NombreEstacion, ubica.Origen.NavegacionTrafico, ubica.Origen.FechaHoraSalida) + cfdi.CartaPorteDomicilio(ubica.Origen.Domicilio.Calle, ubica.Origen.Domicilio.NumeroExterior, ubica.Origen.Domicilio.NumeroInterior, ubica.Origen.Domicilio.Colonia, ubica.Origen.Domicilio.Localidad, ubica.Origen.Domicilio.Referencia, ubica.Origen.Domicilio.Municipio, ubica.Origen.Domicilio.Estado, ubica.Origen.Domicilio.Pais, ubica.Origen.Domicilio.CP) + 'destino + cfdi.CartaPorteUbicacion(ubica.TipoEstacion, ubica.DistanciaRecorrida) + cfdi.CartaPorteDestino(ubica.Destino.IDDestino, ubica.Destino.RFCDestinatario, ubica.Destino.NombreDestinatario, ubica.Destino.NumRegIdTrib, ubica.Destino.ResidenciaFiscal, ubica.Destino.NumEstacion, ubica.Destino.NombreEstacion, ubica.Destino.NavegacionTrafico, ubica.Destino.FechaHoraProgLlegada) + cfdi.CartaPorteDomicilio(ubica.Destino.Domicilio.Calle, ubica.Destino.Domicilio.NumeroExterior, ubica.Destino.Domicilio.NumeroInterior, ubica.Destino.Domicilio.Colonia, ubica.Destino.Domicilio.Localidad, ubica.Destino.Domicilio.Referencia, ubica.Destino.Domicilio.Municipio, ubica.Destino.Domicilio.Estado, ubica.Destino.Domicilio.Pais, ubica.Destino.Domicilio.CP) + Next + + End If + + 'MERCANCIAS + If Carta.Mercancias IsNot Nothing Then + cfdi.CartaPorteMercancias(Carta.Mercancias.PesoBrutoTotal, Carta.Mercancias.UnidadPeso, Carta.Mercancias.PesoNetoTotal, Carta.Mercancias.NumTotalMercancias, Carta.Mercancias.CargoporTasacion) + If Carta.Mercancias IsNot Nothing AndAlso Carta.Mercancias.Mercancias.Count > 0 Then + For Each concep As CFDICartaPorteMercancia In Carta.Mercancias.Mercancias + cfdi.CartaPorteMercancia(concep.BienesTransp, concep.ClaveSTCC, concep.Descripción, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Dimensiones, concep.MaterialPeligroso, concep.ClaveMaterialPeligroso, concep.Embalaje, concep.DescripEmbalaje, concep.PesoenKg, concep.ValorMercancia, concep.Moneda, concep.FraccionArrancelaria, concep.UUIDComercioExt) + Next + End If + End If + + ' + If Carta.FiguraTransporte IsNot Nothing Then + + If Carta.FiguraTransporte.AutoTransporteFederal IsNot Nothing Then + + cfdi.CartaPorteAutotransporteFederal(Carta.FiguraTransporte.AutoTransporteFederal.PermSCT, Carta.FiguraTransporte.AutoTransporteFederal.NumPermisoSCT, Carta.FiguraTransporte.AutoTransporteFederal.NombreAseg, Carta.FiguraTransporte.AutoTransporteFederal.NumPolizaSeguro) + + cfdi.CartaPorteIdentificacionVehicular(Carta.FiguraTransporte.AutoTransporteFederal.Vehiculo.ConfigVehicular, Carta.FiguraTransporte.AutoTransporteFederal.Vehiculo.PlacaVM, Carta.FiguraTransporte.AutoTransporteFederal.Vehiculo.AnioModeloVM) + + If Carta.FiguraTransporte.AutoTransporteFederal.Remolques IsNot Nothing AndAlso Carta.FiguraTransporte.AutoTransporteFederal.Remolques.Count > 0 Then + For Each concep As CFDICartaPorteRemolque In Carta.FiguraTransporte.AutoTransporteFederal.Remolques + cfdi.CartaPorteRemolque(concep.SubTipoRemolque, concep.Placa) + Next + + End If + End If + + cfdi.CartaPorteFiguraTransporte(Carta.FiguraTransporte.ClaveTransporte) + + If Carta.FiguraTransporte.Operadores IsNot Nothing AndAlso Carta.FiguraTransporte.Operadores.Count > 0 Then + For Each concep As CFDICartaPorteOperador In Carta.FiguraTransporte.Operadores + cfdi.CartaPorteOperador(concep.RFCOperador, concep.NumLicencia, concep.NombreOperador, concep.NumRegidTribOperador, concep.ResidenciaFiscalOperador) + Next + End If + + End If + + End If + + End If + +#End Region + + #Region "Complemento Pago" If ObjCFDITimbre.Comprobante.TipoComprobante = "P" Then @@ -2344,7 +2415,7 @@ Public Class Timbrado Using ObjVentas As New ClsVentas() - If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=CvePACEspecial) Then + If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=CvePACEspecial, RFCReceptor:=ObjCFDITimbre.Receptor.RFC) Then Retorno = "" Else Retorno = "Error" @@ -3132,6 +3203,7 @@ Public Class Timbrado Dim NombreArchivoXML As String = $"{ObjCFDITimbre.Comprobante.SerieFolio}" Dim SubTotal As Decimal = 0 Dim AmbienteProductivo As Boolean = True + Dim NumDecimalesImporte As Integer = 2 If Not Directory.Exists(RutaArchivo) Then Directory.CreateDirectory(RutaArchivo) If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then @@ -3220,19 +3292,19 @@ Public Class Timbrado comprobante.Version = "3.3" comprobante.Fecha = ObjCFDITimbre.Comprobante.Fecha comprobante.FormaPago = ObjCFDITimbre.Comprobante.FormadePago - If ObjCFDITimbre.Comprobante.TipoComprobante <> "P" Then comprobante.CondicionesDePago = ObjCFDITimbre.Comprobante.CondicionesdePago + If ObjCFDITimbre.Comprobante.TipoComprobante.Contiene("I", "E", "N") Then comprobante.CondicionesDePago = ObjCFDITimbre.Comprobante.CondicionesdePago - comprobante.SubTotal = ObjCFDITimbre.Comprobante.Subtotal - If ObjCFDITimbre.Comprobante.TipoComprobante <> "P" Then + comprobante.SubTotal = ObjCFDITimbre.Comprobante.Subtotal.RoundSQL(NumDecimalesImporte) + If ObjCFDITimbre.Comprobante.TipoComprobante.Contiene("I", "E", "N") Then If ObjCFDITimbre.Comprobante.Descuentos > 0 Then comprobante.DescuentoSpecified = True - comprobante.Descuento = ObjCFDITimbre.Comprobante.Descuentos + comprobante.Descuento = ObjCFDITimbre.Comprobante.Descuentos.RoundSQL(NumDecimalesImporte) End If End If comprobante.Moneda = ObjCFDITimbre.Comprobante.Moneda comprobante.TipoCambio = ObjCFDITimbre.Comprobante.TipoCambio.ToDecimal comprobante.TipoCambioSpecified = If(ObjCFDITimbre.Comprobante.Moneda <> "XXX", True, False) - comprobante.Total = ObjCFDITimbre.Comprobante.Total + comprobante.Total = ObjCFDITimbre.Comprobante.Total.RoundSQL(NumDecimalesImporte) comprobante.TipoDeComprobante = ObjCFDITimbre.Comprobante.TipoComprobante comprobante.FormaPagoSpecified = If(ObjCFDITimbre.Comprobante.FormadePago <> "", True, False) comprobante.MetodoPago = ObjCFDITimbre.Comprobante.MetodoPago @@ -3274,7 +3346,7 @@ Public Class Timbrado comprobante.Conceptos(i).ClaveUnidad = concep.ClaveUnidad comprobante.Conceptos(i).Descripcion = concep.Descripcion comprobante.Conceptos(i).ValorUnitario = concep.ValorUnitario - comprobante.Conceptos(i).Importe = concep.Importe + comprobante.Conceptos(i).Importe = concep.Importe.RoundSQL(NumDecimalesImporte) comprobante.Conceptos(i).ClaveProdServ = concep.ClaveProdServ If ObjCFDITimbre.Comprobante.TipoComprobante <> "P" Then @@ -3310,7 +3382,7 @@ Public Class Timbrado comprobante.Conceptos(i).Impuestos.Traslados(j).Base = imp.Base comprobante.Conceptos(i).Impuestos.Traslados(j).Impuesto = imp.Impuesto comprobante.Conceptos(i).Impuestos.Traslados(j).TipoFactor = imp.TipoFactor - comprobante.Conceptos(i).Impuestos.Traslados(j).Importe = imp.Importe + comprobante.Conceptos(i).Impuestos.Traslados(j).Importe = imp.Importe.RoundSQL(NumDecimalesImporte) comprobante.Conceptos(i).Impuestos.Traslados(j).ImporteSpecified = True comprobante.Conceptos(i).Impuestos.Traslados(j).TasaOCuota = imp.TasaOCuota.FormatoNumero(6) comprobante.Conceptos(i).Impuestos.Traslados(j).TasaOCuotaSpecified = True @@ -3320,7 +3392,7 @@ Public Class Timbrado comprobante.Conceptos(i).Impuestos.Retenciones(k).Base = imp.Base comprobante.Conceptos(i).Impuestos.Retenciones(k).Impuesto = imp.Impuesto comprobante.Conceptos(i).Impuestos.Retenciones(k).TipoFactor = imp.TipoFactor - comprobante.Conceptos(i).Impuestos.Retenciones(k).Importe = imp.Importe + comprobante.Conceptos(i).Impuestos.Retenciones(k).Importe = imp.Importe.RoundSQL(NumDecimalesImporte) comprobante.Conceptos(i).Impuestos.Retenciones(k).TasaOCuota = imp.TasaOCuota.ToString.ToDecimal k += 1 End If @@ -3597,7 +3669,7 @@ Public Class Timbrado ComPag.Pago(0).FechaPago = ObjCFDITimbre.ComplementoPagos.FechaPago.ToString("yyyy-MM-ddTHH:mm:ss").ToDate() ComPag.Pago(0).FormaDePagoP = ObjCFDITimbre.ComplementoPagos.FormaDePagoP ComPag.Pago(0).MonedaP = ObjCFDITimbre.ComplementoPagos.MonedaP - ComPag.Pago(0).TipoCadPagoSpecified = If(ObjCFDITimbre.ComplementoPagos.MonedaP = "MXN", False, True) + ComPag.Pago(0).TipoCambioPSpecified = If(ObjCFDITimbre.ComplementoPagos.MonedaP = "MXN", False, True) ComPag.Pago(0).TipoCambioP = ObjCFDITimbre.ComplementoPagos.TipoCambioP.ToDecimal ComPag.Pago(0).Monto = ObjCFDITimbre.ComplementoPagos.Monto.ToDecimal If ObjCFDITimbre.ComplementoPagos.NumOperacion <> "" Then @@ -3618,7 +3690,11 @@ Public Class Timbrado If ObjCFDITimbre.ComplementoPagos.CtaBeneficiario <> "" Then ComPag.Pago(0).CtaBeneficiario = ObjCFDITimbre.ComplementoPagos.CtaBeneficiario End If - ComPag.Pago(0).TipoCadPago = ObjCFDITimbre.ComplementoPagos.TipoCadPago + If ObjCFDITimbre.ComplementoPagos.TipoCadPago <> "" Then + ComPag.Pago(0).TipoCadPagoSpecified = True + ComPag.Pago(0).TipoCadPago = ObjCFDITimbre.ComplementoPagos.TipoCadPago + End If + If ObjCFDITimbre.ComplementoPagos.CertPago <> "" Then ComPag.Pago(0).CertPago = System.Text.Encoding.Default.GetBytes(ObjCFDITimbre.ComplementoPagos.CertPago).ToString End If @@ -3868,191 +3944,191 @@ Public Class Timbrado #End Region -#Region "Detallista" - If Ventas.Cliente.AplicaDetallista Then - Dim detallista As Profact.TimbraCFDI33.Complementos.Detallista.detallista = New Profact.TimbraCFDI33.Complementos.Detallista.detallista - detallista.type = "SimpleInvoiceType" - detallista.contentVersion = "1.3.1" - detallista.documentStructureVersion = "AMC8.1" - detallista.documentStatus = Profact.TimbraCFDI33.Complementos.Detallista.detallistaDocumentStatus.ORIGINAL + '#Region "Detallista" + ' If Ventas.Cliente.AplicaDetallista Then + ' Dim detallista As Profact.TimbraCFDI33.Complementos.Detallista.detallista = New Profact.TimbraCFDI33.Complementos.Detallista.detallista + ' detallista.type = "SimpleInvoiceType" + ' detallista.contentVersion = "1.3.1" + ' detallista.documentStructureVersion = "AMC8.1" + ' detallista.documentStatus = Profact.TimbraCFDI33.Complementos.Detallista.detallistaDocumentStatus.ORIGINAL - detallista.DeliveryNote = New Profact.TimbraCFDI33.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.DeliveryNote = New Profact.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallistaRequestForPaymentIdentification - detallista.requestForPaymentIdentification.entityType = Profact.TimbraCFDI33.Complementos.Detallista.detallistaRequestForPaymentIdentificationEntityType.INVOICE + ' detallista.requestForPaymentIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaRequestForPaymentIdentification + ' detallista.requestForPaymentIdentification.entityType = Profact.TimbraCFDI33.Complementos.Detallista.detallistaRequestForPaymentIdentificationEntityType.INVOICE - detallista.specialInstruction = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaSpecialInstruction((1)) {} - detallista.specialInstruction(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaSpecialInstruction - detallista.specialInstruction(0).code = Profact.TimbraCFDI33.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.specialInstruction = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaSpecialInstruction((1)) {} + ' detallista.specialInstruction(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaSpecialInstruction + ' detallista.specialInstruction(0).code = Profact.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallistaOrderIdentification - detallista.orderIdentification.referenceIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentification((1)) {} - detallista.orderIdentification.referenceIdentification(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentification - detallista.orderIdentification.referenceIdentification(0).type = Profact.TimbraCFDI33.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentificationType.ON - detallista.orderIdentification.referenceIdentification(0).Value = Ventas.Det_OrdenCompra - detallista.orderIdentification.ReferenceDateSpecified = True - detallista.orderIdentification.ReferenceDate = Ventas.Det_FechaOrdenCompra.ToDate() + ' detallista.orderIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaOrderIdentification + ' detallista.orderIdentification.referenceIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentification((1)) {} + ' detallista.orderIdentification.referenceIdentification(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentification + ' detallista.orderIdentification.referenceIdentification(0).type = Profact.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallistaReferenceIdentification((1)) {} - detallista.AdditionalInformation(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaReferenceIdentification - detallista.AdditionalInformation(0).type = Profact.TimbraCFDI33.Complementos.Detallista.detallistaReferenceIdentificationType.ATZ - detallista.AdditionalInformation(0).Value = Ventas.Det_ContraRecibo + ' detallista.AdditionalInformation = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaReferenceIdentification((1)) {} + ' detallista.AdditionalInformation(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaReferenceIdentification + ' detallista.AdditionalInformation(0).type = Profact.TimbraCFDI33.Complementos.Detallista.detallistaReferenceIdentificationType.ATZ + ' detallista.AdditionalInformation(0).Value = Ventas.Det_ContraRecibo - detallista.DeliveryNote = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaDeliveryNote - detallista.DeliveryNote.ReferenceDate = Ventas.Det_FechaOrdenCompra.ToDate - detallista.DeliveryNote.referenceIdentification = New String((1)) {} - detallista.DeliveryNote.referenceIdentification(0) = Ventas.Det_ContraRecibo + ' detallista.DeliveryNote = New Profact.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallistaBuyer - detallista.buyer.gln = Ventas.Cliente.Detallista_GLNComprador - detallista.buyer.contactInformation = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaBuyerContactInformation - detallista.buyer.contactInformation.personOrDepartmentName = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaBuyerContactInformationPersonOrDepartmentName - detallista.buyer.contactInformation.personOrDepartmentName.text = Ventas.Cliente.Detallista_Departamento + ' detallista.buyer = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaBuyer + ' detallista.buyer.gln = Ventas.Cliente.Detallista_GLNComprador + ' detallista.buyer.contactInformation = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaBuyerContactInformation + ' detallista.buyer.contactInformation.personOrDepartmentName = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaBuyerContactInformationPersonOrDepartmentName + ' detallista.buyer.contactInformation.personOrDepartmentName.text = Ventas.Cliente.Detallista_Departamento - detallista.seller = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaSeller - detallista.seller.gln = Ventas.Cliente.Detallista_GLNVendedor - detallista.seller.alternatePartyIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaSellerAlternatePartyIdentification - detallista.seller.alternatePartyIdentification.type = Profact.TimbraCFDI33.Complementos.Detallista.detallistaSellerAlternatePartyIdentificationType.SELLER_ASSIGNED_IDENTIFIER_FOR_A_PARTY - detallista.seller.alternatePartyIdentification.Value = Ventas.Cliente.Detallista_NumProveedor + ' detallista.seller = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaSeller + ' detallista.seller.gln = Ventas.Cliente.Detallista_GLNVendedor + ' detallista.seller.alternatePartyIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaSellerAlternatePartyIdentification + ' detallista.seller.alternatePartyIdentification.type = Profact.TimbraCFDI33.Complementos.Detallista.detallistaSellerAlternatePartyIdentificationType.SELLER_ASSIGNED_IDENTIFIER_FOR_A_PARTY + ' detallista.seller.alternatePartyIdentification.Value = Ventas.Cliente.Detallista_NumProveedor - 'detallista.shipTo = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaShipTo - 'detallista.shipTo.gln = "0000000000000" - 'detallista.shipTo.nameAndAddress = New Profact.TimbraCFDI33.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.shipTo = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaShipTo + ' 'detallista.shipTo.gln = "0000000000000" + ' 'detallista.shipTo.nameAndAddress = New Profact.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTerms - detallista.paymentTerms.netPayment = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTermsNetPayment - detallista.paymentTerms.netPayment.paymentTimePeriod = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriod - detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDue - detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.timePeriod = Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDueTimePeriod.DAYS - detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.value = "0" + ' detallista.paymentTerms = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTerms + ' detallista.paymentTerms.netPayment = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTermsNetPayment + ' detallista.paymentTerms.netPayment.paymentTimePeriod = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriod + ' detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDue + ' detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.timePeriod = Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDueTimePeriod.DAYS + ' detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.value = "0" - detallista.paymentTerms.discountPayment = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaPaymentTermsDiscountPayment - detallista.paymentTerms.discountPayment.percentage = If(Ventas.DescuentoTC > 0 AndAlso Ventas.SubTotalTC > 0, (Ventas.DescuentoTC * 100) / Ventas.SubTotalTC, 0).ToString().FormatoNumero() + ' detallista.paymentTerms.discountPayment = New Profact.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallistaCurrency((1)) {} - detallista.currency(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrency - detallista.currency(0).currencyISOCode = If(Ventas.CveMoneda = 1, Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrencyCurrencyISOCode.MXN, Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrencyCurrencyISOCode.USD) - detallista.currency(0).currencyFunction = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrencyCurrencyFunction((1)) {} - detallista.currency(0).currencyFunction(0) = Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrencyCurrencyFunction.BILLING_CURRENCY - detallista.currency(0).rateOfChangeSpecified = True - detallista.currency(0).rateOfChange = 1 + ' detallista.currency = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrency((1)) {} + ' detallista.currency(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrency + ' detallista.currency(0).currencyISOCode = If(Ventas.CveMoneda = 1, Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrencyCurrencyISOCode.MXN, Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrencyCurrencyISOCode.USD) + ' detallista.currency(0).currencyFunction = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrencyCurrencyFunction((1)) {} + ' detallista.currency(0).currencyFunction(0) = Profact.TimbraCFDI33.Complementos.Detallista.detallistaCurrencyCurrencyFunction.BILLING_CURRENCY + ' detallista.currency(0).rateOfChangeSpecified = True + ' detallista.currency(0).rateOfChange = 1 - detallista.allowanceCharge = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaAllowanceCharge(1) {} - detallista.allowanceCharge(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaAllowanceCharge - detallista.allowanceCharge(0).monetaryAmountOrPercentage = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentage - detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentageRate - detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate.base = Profact.TimbraCFDI33.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) + ' detallista.allowanceCharge = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaAllowanceCharge(1) {} + ' detallista.allowanceCharge(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaAllowanceCharge + ' detallista.allowanceCharge(0).monetaryAmountOrPercentage = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentage + ' detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentageRate + ' detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate.base = Profact.TimbraCFDI33.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.TimbraCFDI33.ComprobanteConcepto In comprobante.Conceptos - articuloCounter = (articuloCounter + 1) - Next - detallista.lineItem = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItem((articuloCounter)) {} - Dim counter As Integer = 0 - For Each concepto As Profact.TimbraCFDI33.ComprobanteConcepto In comprobante.Conceptos - detallista.lineItem(counter) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItem - detallista.lineItem(counter).type = "SimpleInvoiceLineItemType" - detallista.lineItem(counter).number = (counter + 1).ToString - detallista.lineItem(counter).tradeItemIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemIdentification - detallista.lineItem(counter).tradeItemIdentification.gtin = comprobante.Conceptos(counter).NoIdentificacion - detallista.lineItem(counter).alternateTradeItemIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentification(1) {} - detallista.lineItem(counter).alternateTradeItemIdentification(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentification - detallista.lineItem(counter).alternateTradeItemIdentification(0).type = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentificationType - detallista.lineItem(counter).alternateTradeItemIdentification(0).type = Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentificationType.BUYER_ASSIGNED - detallista.lineItem(counter).tradeItemDescriptionInformation = New Profact.TimbraCFDI33.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.TimbraCFDI33.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 + ' Dim articuloCounter As Integer = 0 + ' For Each concepto As Profact.TimbraCFDI33.ComprobanteConcepto In comprobante.Conceptos + ' articuloCounter = (articuloCounter + 1) + ' Next + ' detallista.lineItem = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItem((articuloCounter)) {} + ' Dim counter As Integer = 0 + ' For Each concepto As Profact.TimbraCFDI33.ComprobanteConcepto In comprobante.Conceptos + ' detallista.lineItem(counter) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItem + ' detallista.lineItem(counter).type = "SimpleInvoiceLineItemType" + ' detallista.lineItem(counter).number = (counter + 1).ToString + ' detallista.lineItem(counter).tradeItemIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemIdentification + ' detallista.lineItem(counter).tradeItemIdentification.gtin = comprobante.Conceptos(counter).NoIdentificacion + ' detallista.lineItem(counter).alternateTradeItemIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentification(1) {} + ' detallista.lineItem(counter).alternateTradeItemIdentification(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentification + ' detallista.lineItem(counter).alternateTradeItemIdentification(0).type = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentificationType + ' detallista.lineItem(counter).alternateTradeItemIdentification(0).type = Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentificationType.BUYER_ASSIGNED + ' detallista.lineItem(counter).tradeItemDescriptionInformation = New Profact.TimbraCFDI33.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.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAditionalQuantity(1) {} - detallista.lineItem(counter).aditionalQuantity(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAditionalQuantity - detallista.lineItem(counter).aditionalQuantity(0).QuantityType = Profact.TimbraCFDI33.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).aditionalQuantity = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAditionalQuantity(1) {} + ' detallista.lineItem(counter).aditionalQuantity(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAditionalQuantity + ' detallista.lineItem(counter).aditionalQuantity(0).QuantityType = Profact.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallistaLineItemGrossPrice - detallista.lineItem(counter).grossPrice.Amount = comprobante.Conceptos(counter).ValorUnitario + ' detallista.lineItem(counter).grossPrice = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemGrossPrice + ' detallista.lineItem(counter).grossPrice.Amount = comprobante.Conceptos(counter).ValorUnitario - detallista.lineItem(counter).netPrice = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemNetPrice - detallista.lineItem(counter).netPrice.Amount = comprobante.Conceptos(counter).ValorUnitario + ' detallista.lineItem(counter).netPrice = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemNetPrice + ' detallista.lineItem(counter).netPrice.Amount = comprobante.Conceptos(counter).ValorUnitario - detallista.lineItem(counter).AdditionalInformation = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAdditionalInformation - detallista.lineItem(counter).AdditionalInformation.referenceIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAdditionalInformationReferenceIdentification - detallista.lineItem(counter).AdditionalInformation.referenceIdentification.type = Profact.TimbraCFDI33.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.TimbraCFDI33.ComprobanteImpuestosTraslado In comprobante.Impuestos.Traslados - tasa = Decimal.Parse(traslado.TasaOCuota) - importeImp = (comprobante.Conceptos(counter).Importe * (tasa / 100)) - Next - End If + ' detallista.lineItem(counter).AdditionalInformation = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAdditionalInformation + ' detallista.lineItem(counter).AdditionalInformation.referenceIdentification = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemAdditionalInformationReferenceIdentification + ' detallista.lineItem(counter).AdditionalInformation.referenceIdentification.type = Profact.TimbraCFDI33.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.TimbraCFDI33.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 + ' Catch ex As System.Exception - End Try + ' End Try - detallista.lineItem(counter).tradeItemTaxInformation = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemTaxInformation(1) {} - detallista.lineItem(counter).tradeItemTaxInformation(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemTaxInformation - detallista.lineItem(counter).tradeItemTaxInformation(0).taxTypeDescription = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTaxTypeDescription - detallista.lineItem(counter).tradeItemTaxInformation(0).taxTypeDescription = Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTaxTypeDescription.VAT - detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTradeItemTaxAmount - detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount.taxPercentage = tasa - detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount.taxAmount = importeImp + ' detallista.lineItem(counter).tradeItemTaxInformation = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemTaxInformation(1) {} + ' detallista.lineItem(counter).tradeItemTaxInformation(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemTaxInformation + ' detallista.lineItem(counter).tradeItemTaxInformation(0).taxTypeDescription = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTaxTypeDescription + ' detallista.lineItem(counter).tradeItemTaxInformation(0).taxTypeDescription = Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTaxTypeDescription.VAT + ' detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount = New Profact.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTotalLineAmount - detallista.lineItem(counter).totalLineAmount.grossAmount = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTotalLineAmountGrossAmount - detallista.lineItem(counter).totalLineAmount.grossAmount.Amount = comprobante.Conceptos(counter).Importe - detallista.lineItem(counter).totalLineAmount.netAmount = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTotalLineAmountNetAmount - detallista.lineItem(counter).totalLineAmount.netAmount.Amount = comprobante.Conceptos(counter).Importe - counter = (counter + 1) - Next - detallista.totalAmount = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaTotalAmount - detallista.totalAmount.Amount = comprobante.SubTotal + ' detallista.lineItem(counter).totalLineAmount = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTotalLineAmount + ' detallista.lineItem(counter).totalLineAmount.grossAmount = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTotalLineAmountGrossAmount + ' detallista.lineItem(counter).totalLineAmount.grossAmount.Amount = comprobante.Conceptos(counter).Importe + ' detallista.lineItem(counter).totalLineAmount.netAmount = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaLineItemTotalLineAmountNetAmount + ' detallista.lineItem(counter).totalLineAmount.netAmount.Amount = comprobante.Conceptos(counter).Importe + ' counter = (counter + 1) + ' Next + ' detallista.totalAmount = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaTotalAmount + ' detallista.totalAmount.Amount = comprobante.SubTotal - detallista.TotalAllowanceCharge = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaTotalAllowanceCharge(1) {} - detallista.TotalAllowanceCharge(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaTotalAllowanceCharge - detallista.TotalAllowanceCharge(0).allowanceOrChargeType = Profact.TimbraCFDI33.Complementos.Detallista.detallistaTotalAllowanceChargeAllowanceOrChargeType.ALLOWANCE - detallista.TotalAllowanceCharge(0).Amount = Ventas.DescuentoTC + ' detallista.TotalAllowanceCharge = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaTotalAllowanceCharge(1) {} + ' detallista.TotalAllowanceCharge(0) = New Profact.TimbraCFDI33.Complementos.Detallista.detallistaTotalAllowanceCharge + ' detallista.TotalAllowanceCharge(0).allowanceOrChargeType = Profact.TimbraCFDI33.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.TimbraCFDI33.Complementos.Detallista.detallista), nombres) + ' 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.TimbraCFDI33.Complementos.Detallista.detallista), nombres) - Dim docDetallista As XmlDocument = New XmlDocument - docDetallista.LoadXml(xmlDetallista) - comprobante.DetallistaSpecified = True - LXmlComplementos.Add(docDetallista.DocumentElement) + ' Dim docDetallista As XmlDocument = New XmlDocument + ' docDetallista.LoadXml(xmlDetallista) + ' comprobante.DetallistaSpecified = True + ' LXmlComplementos.Add(docDetallista.DocumentElement) - TieneComplemento = True - End If -#End Region + ' TieneComplemento = True + ' End If + '#End Region If TieneComplemento Then comprobante.Complemento = New Profact.TimbraCFDI33.ComprobanteComplemento @@ -4109,7 +4185,7 @@ Public Class Timbrado Dim ObjVentas As New ClsVentas() - If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", Now, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC) Then + If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", Now, Ventas.CveVenta, CvePAC:=UsuarioActual.Empresa.CvePAC, RFCReceptor:=ObjCFDITimbre.Receptor.RFC) Then Retorno = "" Else Retorno = "Error" @@ -4133,7 +4209,7 @@ Public Class Timbrado resultadoTimbre.GuardaCodigoBidimensional(RutaCBB, NombreCBB) 'Genero la addenda Ford - If Ventas.Cliente.Ford_GSDB <> "" Then + If Ventas.Cliente IsNot Nothing AndAlso Ventas.Cliente.Ford_GSDB <> "" Then Dim RutaCadena As String = String.Format("{0}{1}.xml", RutaArchivo, NombreArchivoXML) 'If(UsuarioActual.Empresa.FacturaProduccion, String.Format("{0}XML\{1}\{2}.xml", Ruta, Ventas.SerieFolio), String.Format("{0}XML\{1}\{2}.xml", Ruta, Ventas.TipoDocto, Ventas.SerieFolio)) diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 5c0aa1737..635df042b 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -2583,12 +2583,11 @@ Partial Class Inventarios_TraspasoAlmacen ObjFactura.Version = "3.3" ObjFactura.CveUsuario = UsuarioActual.CveUsuario ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa - ObjFactura.TipoCambio = 0 + 'ObjFactura.TipoCambio = 1 ObjFactura.ConvertirPesos = False - ObjFactura.TipoCambio = 0 ObjFactura.CveMoneda = 1 ObjFactura.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {ObjFactura.CveMoneda} ") - ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", "CveMoneda = 1") + ObjFactura.MonedaSAT = "XXX" 'GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", "CveMoneda = 1") ObjFactura.MonedaAbreviatura = GlobalDTMonedas.FiltroPrimeroValor("Abreviatura", $"CveMoneda = {ObjFactura.CveMoneda} ") ObjFactura.TipoDocto = "Tra" ObjFactura.RefDocto = "" @@ -2656,23 +2655,22 @@ Partial Class Inventarios_TraspasoAlmacen ObjFactura.Inv_CveMovimiento = CveMovimientoTimbrado - ObjFactura.Timbre = PreParaTimbre(ObjFactura) + ObjFactura.Timbre = PreParaTimbreCartaPorte(ObjFactura) End Sub - Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre + Private Function PreParaTimbreCartaPorte(Obj As Modelos.Factura) As CFDITimbre Dim Timbre As New CFDITimbre Timbre.Comprobante.TipoComprobante = "T" Timbre.Comprobante.Folio = Obj.Folio.ToString Timbre.Comprobante.Serie = Obj.Serie Timbre.Comprobante.Fecha = Obj.Fecha Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 - Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 + Timbre.Comprobante.CondicionesdePago = "" Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT Timbre.Comprobante.Subtotal = Obj.SubTotal Timbre.Comprobante.Descuentos = Obj.Descuento - Timbre.Comprobante.Moneda = Obj.MonedaSAT - Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) - Timbre.Comprobante.Total = Obj.Total + Timbre.Comprobante.Moneda = "XXX" + Timbre.Comprobante.TipoCambio = "" ' CONDICIÓN SI LA MONEDA ES 'XXX' Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP Timbre.Comprobante.Confirmacion = "" @@ -2690,7 +2688,75 @@ Partial Class Inventarios_TraspasoAlmacen 'DETALLES Dim tPS As String = "" + Dim CartaPorte As New CFDICartaPorte + CartaPorte.TranspInternac = "No" + CartaPorte.EntradaSalidaMercancia = "" + CartaPorte.ViaEntradaSalida = "" + CartaPorte.TotalDistanciaRecorrida = 12 + + CartaPorte.Mercancias.PesoBrutoTotal = 0 + CartaPorte.Mercancias.UnidadPeso = "" + CartaPorte.Mercancias.CargoporTasacion = 0 + + CartaPorte.FiguraTransporte.AutoTransporteFederal.PermSCT = "TPAF01" + CartaPorte.FiguraTransporte.AutoTransporteFederal.NumPermisoSCT = "1234567890" + CartaPorte.FiguraTransporte.AutoTransporteFederal.NombreAseg = "GNP" + CartaPorte.FiguraTransporte.AutoTransporteFederal.NumPolizaSeguro = "P123" + CartaPorte.FiguraTransporte.AutoTransporteFederal.Vehiculo.ConfigVehicular = "C2" + CartaPorte.FiguraTransporte.AutoTransporteFederal.Vehiculo.PlacaVM = "WTF757A" + CartaPorte.FiguraTransporte.AutoTransporteFederal.Vehiculo.AnioModeloVM = 2007 + + Dim DomOrigen As New CFDICartaPorteDomicilio With {.Calle = "calle", + .Colonia = "", + .CP = "45200", + .Estado = "JAL", + .Pais = "MEX", + .Localidad = ""} + Dim DomDestino As New CFDICartaPorteDomicilio With {.Calle = "calle destino", + .Colonia = "", + .CP = "45200", + .Estado = "JAL", + .Pais = "MEX", + .Localidad = ""} + Dim Ubica As New CFDICartaPorteUbicaciones + Ubica.TipoEstacion = "01" + Ubica.DistanciaRecorrida = 6 + Ubica.Origen = New CFDICartaPorteUbicacionOrigen With {.RFCRemitente = "CAMJ841219I33", + .FechaHoraSalida = "2021-08-23T11:13:01", + .NombreRemitente = "Empresa", + .Domicilio = DomOrigen} + Ubica.Destino = New CFDICartaPorteUbicacionDestino With {.RFCDestinatario = "CAMJ841219I33", + .FechaHoraProgLlegada = "2021-08-23T11:13:01", + .NombreDestinatario = "Empresa dest", + .Domicilio = DomDestino} + + CartaPorte.Ubicaciones.Add(Ubica) + + CartaPorte.FiguraTransporte.ClaveTransporte = "01" + CartaPorte.FiguraTransporte.Operadores.Add(New CFDICartaPorteOperador With {.RFCOperador = "CAMJ841219I33", + .Domicilio = Nothing, + .NombreOperador = "juan Perez", + .NumLicencia = "Num Lic", + .NumRegidTribOperador = "", + .ResidenciaFiscalOperador = ""}) + + 'concepto único + + Dim concepto As New CFDIConceptos With {.Cantidad = 1, + .Descripcion = "Flete", + .ValorUnitario = 0, + .Importe = 0, + .Descuento = 0L, + .Unidad = "Servicio", + .ClaveUnidad = "E48", + .ClaveProdServ = "78101802", + .Noidentificacion = "", + .CuentaPredial = ""} + + Timbre.Conceptos.Add(concepto) + For Each drr As DataRow In Obj.DtDetalle.Rows + If drr("PS").ToString.Length = 1 Then tPS = drr("Obs").ToString Else @@ -2700,32 +2766,32 @@ Partial Class Inventarios_TraspasoAlmacen tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) End If End If + Dim conceptoCarta As New CFDICartaPorteMercancia With { + .BienesTransp = drr("SATClaveProdServ").ToString, + .ClaveSTCC = "01334", + .Cantidad = drr("Cantidad").ToString.ToDecimal, + .Descripción = tPS, + .ClaveUnidad = drr("SATClaveUM").ToString, + .Unidad = drr("UM").ToString, + .Dimensiones = "", + .MaterialPeligroso = "", + .Embalaje = "", + .DescripEmbalaje = "", + .PesoenKg = 203, + .ValorMercancia = drr("PU").ToString.ToDecimal, + .Moneda = "MXN", 'tempral + .FraccionArrancelaria = "", + .UUIDComercioExt = "" + } - 'CONDICIONANTE, ESPECIAL - If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" 'LES COMENTAN QUE NO DEBE IR LA ETIQUETA DE LA UNIDAD EN EL PRODUCTO - Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal, - .Descripcion = tPS, - .ValorUnitario = drr("PU").ToString.ToDecimal, - .Importe = drr("TotalImporte").ToString.ToDecimal, - .Descuento = drr("Descuento").ToString.ToDecimal, - .Unidad = drr("UM").ToString, - .ClaveUnidad = drr("SATClaveUM").ToString, - .ClaveProdServ = drr("SATClaveProdServ").ToString, - .Noidentificacion = drr("Noidentificacion").ToString, - .CuentaPredial = drr("CuentaPredial").ToString} - 'VERIFICA SUMA SUBTOTALES - If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'PROCESO DE AJUSTA DE DECIMALES - concepto.Importe = totSubTotal - End If totSubTotal = totSubTotal - concepto.Importe + CartaPorte.Mercancias.Mercancias.Add(conceptoCarta) - 'SIEMPRE ESTAMOS AGREGANDO EL IVA - 'concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) - - Timbre.Conceptos.Add(concepto) i += 1 Next + Timbre.Complementos.CartaPorte = CartaPorte + Return Timbre End Function @@ -2783,6 +2849,11 @@ Partial Class Inventarios_TraspasoAlmacen Dim TmpDTComplementosTimbrado As New DataTable PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) MensajeAlert.Append("

") + + + 'If TimbrarFacturaGoCFDIv33(ObjFactura, UsuarioActual, 4) <> "" Then + ' MensajeAlert.AppendFormat("
  • -- no timbró-{0}
", MensajeErrorCFDI) + 'End If If ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then MensajeAlert.Append("Emitido con exito.") 'XML @@ -2800,7 +2871,7 @@ Partial Class Inventarios_TraspasoAlmacen MensajeAlert.AppendFormat("", Encripta(String.Format("OP=CARPO&CVEMOV={0}", CveMovimientoTimbrado))) Else - MensajeAlert.AppendFormat(ObjTimbrado.MensajeErrorCFDI) + MensajeAlert.AppendFormat("
  • {0}
", ObjTimbrado.MensajeErrorCFDI) End If End Sub @@ -3010,54 +3081,6 @@ Partial Class Inventarios_TraspasoAlmacen End If End Sub - - Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable - SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) - Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath) - - Dim unnamed As Integer = 0 - Dim cols As Integer - Dim columns As String() - Dim curRow As Integer = 0 - Dim curCol As Integer = 0 - Dim dataTable As DataTable = New DataTable() - Dim worksheet As ExcelWorksheet = excelFile.Worksheets(0) - - For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1 - - If firstRowHasHeaders Then - - If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then - dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString()) - Else - dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed))) - End If - - curRow = 1 - Else - dataTable.Columns.Add("Column " & (cols + 1)) - End If - Next - - While curRow < worksheet.Rows.Count - columns = New String(cols - 1) {} - - For curCol = 0 To cols - 1 - - If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then - columns(curCol) = "" - Else - columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString() - End If - Next - - dataTable.Rows.Add(columns) - curRow += 1 - End While - - Return dataTable - End Function - Public Sub CargarCamiones() DdlUnidadCamion.Items.Clear() Dim ObjInventarios As New ClsInventarios @@ -3151,4 +3174,5 @@ Partial Class Inventarios_TraspasoAlmacen UpDatos.Update() End If End Sub + End Class