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 a15ada6c8..43eab1487 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -2877,12 +2877,13 @@ Public Class ClsInventarios #End Region #Region "I N V E N T A R I O - F I S I C O - R E S U L T A D O" - Public Function AddInventarioFisicoResultados(CveInventarioFisico As Integer, CveUsuario As Integer) As Boolean + Public Function AddInventarioFisicoResultados(CveInventarioFisico As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_InventarioFisicoResultadoAdd") With SqlAdapter.SelectCommand.Parameters .Add("@CveInventarioFisico", SqlDbType.Int).Value = CveInventarioFisico .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try SqlAdapter.Fill(Data) @@ -5488,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 @@ -5518,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/ClsVentas.vb b/App_Code/ClsVentas.vb index c0ca015c2..c8a9c42e7 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1273,7 +1273,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, IEPS As Decimal, PorcentajeIEPS As Decimal, IVA As Decimal, PorcentajeIVA As Decimal, Observaciones As String, Optional CveUsuarioModifico As Integer = -1) As Boolean + Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, IEPS As Decimal, PorcentajeIEPS As Decimal, IVA As Decimal, PorcentajeIVA As Decimal, Descuento As Decimal, Observaciones As String, Optional CveUsuarioModifico As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasDetalleRemisionUpdate") @@ -1286,6 +1286,7 @@ Public Class ClsVentas .Add("@PorcentajeIEPS", SqlDbType.Decimal).Value = PorcentajeIEPS .Add("@IVA", SqlDbType.Decimal).Value = IVA .Add("@PorcentajeIVA", SqlDbType.Decimal).Value = PorcentajeIVA + .Add("@Descuento", SqlDbType.Decimal).Value = Descuento .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico End With @@ -2561,13 +2562,13 @@ Public Class ClsVentas #End Region #Region " I M P U E S T O S L O C A L E S" - Public Function AddImpuestosLocales(ImpuestoLocal As String, Porcentaje As Double, Orden As Integer, TipoImpuesto As Integer, Estatus As Integer, IdCtaContable As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Public Function AddImpuestosLocales(ImpuestoLocal As String, Porcentaje As Decimal, Orden As Integer, TipoImpuesto As Integer, Estatus As Integer, IdCtaContable As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_ImpuestosLocalesAdd") With SqlAdapter.SelectCommand.Parameters .Add("@ImpuestoLocal", SqlDbType.VarChar).Value = ImpuestoLocal - .Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje + .Add("@Porcentaje", SqlDbType.Decimal).Value = Porcentaje .Add("@Orden", SqlDbType.Int).Value = Orden .Add("@TipoImpuesto", SqlDbType.Int).Value = TipoImpuesto .Add("@Estatus", SqlDbType.Bit).Value = Estatus @@ -2603,14 +2604,14 @@ Public Class ClsVentas Return Retorno End Function - Public Function UpdateImpuestosLocales(CveImpuestoLocal As Integer, ImpuestoLocal As String, Porcentaje As Double, Orden As Integer, TipoImpuesto As Integer, Estatus As Integer, IdCtaContable As Integer) As Boolean + Public Function UpdateImpuestosLocales(CveImpuestoLocal As Integer, ImpuestoLocal As String, Porcentaje As Decimal, Orden As Integer, TipoImpuesto As Integer, Estatus As Integer, IdCtaContable As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_ImpuestosLocalesUpdate") With SqlAdapter.SelectCommand.Parameters .Add("@CveImpuestoLocal", SqlDbType.Int).Value = CveImpuestoLocal .Add("@ImpuestoLocal", SqlDbType.VarChar).Value = ImpuestoLocal - .Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje + .Add("@Porcentaje", SqlDbType.Decimal).Value = Porcentaje .Add("@TipoImpuesto", SqlDbType.Int).Value = TipoImpuesto .Add("@Orden", SqlDbType.Int).Value = Orden .Add("@Estatus", SqlDbType.Bit).Value = Estatus diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 093752da9..7bd11e2fc 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -4615,10 +4615,6 @@ Namespace Modelos '1 NORMAL, 2 CON PAGOS Dim ModalidadRefacturacion As Integer = UsuarioActual.Empresa.Funcionalidad(586).ToEntero() - If UsuarioActual.CveUsuario = 1719 Then - ModalidadRefacturacion = 2 - End If - If EsRefacturacion AndAlso ModalidadRefacturacion <= 0 Then Retorno.Mensaje = "La factura no se puede refacturar debido a que la empresa no tiene asignada una modalidad de refacturación." Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia 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/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index c0ec85953..330068893 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -709,9 +709,10 @@ Partial Class Bancos_PopIEVentas End If Else 'no se pudo validar, pero ya tuvo la primera vuelta de validacion - Alert("La factura no se pudo validar.") + Alert("La factura no se pudo validar.", TipoMensaje.MsgAdvertencia) Validada = False - BtnGuardar.Visible = False + BtnGuardar.Enabled = False + BtnGuardar.ToolTip = "La factura no se pudo validar" End If Valida.Dispose() Else diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 3f4ef0686..bb6625d18 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -12413,8 +12413,9 @@ Partial Class Compras_Compras dr1("Cantidad") = (dr1("Cantidad").ToString.ToDouble - Cantidad.ToDouble) dr1("Total") = dr1("PU").ToString.ToDouble * dr1("Cantidad").ToString.ToDecimal - dr1("Importe") = dr1("Total") + dr1("IVA") = Math.Round(dr1("IVAPorcentaje").ToString.ToDecimal * dr1("Total").ToString.ToDecimal, 6) + dr1("IEPSPS") = Math.Round(dr1("IEPSPSPorcentaje").ToString.ToDecimal * dr1("Total").ToString.ToDecimal, 6) TmpDT.AcceptChanges() @@ -12423,8 +12424,9 @@ Partial Class Compras_Compras dr("CodAF") = "" dr("Cantidad") = Cantidad.ToDecimal dr("Total") = dr("PU").ToString.ToDecimal * Cantidad.ToDecimal - dr("Importe") = dr("Total") + 'dr("Importe") = dr("Total") dr("IVA") = Math.Round(dr("IVAPorcentaje").ToString.ToDecimal * dr("Total").ToString.ToDecimal, 6) + dr("IEPSPS") = Math.Round(dr("IEPSPSPorcentaje").ToString.ToDecimal * dr("Total").ToString.ToDecimal, 6) TmpDT.Rows.InsertAt(dr, Index + 1) diff --git a/Contratos/ContratoAvance.aspx b/Contratos/ContratoAvance.aspx index f96d770f8..6a421e1a4 100644 --- a/Contratos/ContratoAvance.aspx +++ b/Contratos/ContratoAvance.aspx @@ -93,9 +93,9 @@ - - - + + + @@ -132,7 +132,7 @@ - + <%# Eval("Abreviatura")%> @@ -356,7 +356,7 @@ var cantidad = parseFloat(txtCantidad.val()); - + debugger; if (!Math.round10) { Math.round10 = function (value, exp) { @@ -364,13 +364,14 @@ }; } - if (opcion == 2) { + if (opcion == 2) { //editar importe if (txtimporte.val().toString().length > 0) { var importe = parseFloat(txtimporte.val()); cantidad = parseFloat(importe / pu); txtCantidad.val(cantidad); + txtPorcentaje.val(Math.round10(cantidad * 100 / max, -2)); }else{ cantidad = 0.0 @@ -379,12 +380,13 @@ } } - if (opcion == 3) { + if (opcion == 3) { //editar porcentaje if (txtPorcentaje.val().toString().length > 0) { var porcentaje = parseFloat(txtPorcentaje.val()); cantidad = (porcentaje * max / 100); txtCantidad.val(cantidad); + txtimporte.val((cantidad * pu).toFixed(2)); } else { cantidad = 0; txtCantidad.val(''); @@ -401,13 +403,13 @@ } - if (cantidad > 0) { - txtimporte.val(cantidad * pu); - txtPorcentaje.val(Math.round10(cantidad * 100 / max, -2)); - } else { - txtimporte.val(''); - txtPorcentaje.val(''); - } + //if (cantidad > 0) { + // txtimporte.val((cantidad * pu).toFixed(2)); + // txtPorcentaje.val(Math.round10(cantidad * 100 / max, -2)); + //} else { + // txtimporte.val(''); + // txtPorcentaje.val(''); + //} } diff --git a/Inventarios/InventarioFisicoDetalle.aspx.vb b/Inventarios/InventarioFisicoDetalle.aspx.vb index cdd2c7edb..8070583a5 100644 --- a/Inventarios/InventarioFisicoDetalle.aspx.vb +++ b/Inventarios/InventarioFisicoDetalle.aspx.vb @@ -569,7 +569,7 @@ Partial Class Inventarios_InventarioFisicoDetalle Dim Inventarios As New ClsInventarios Inventarios.IniciaTransacSQL() - If Inventarios.AddInventarioFisicoResultados(CveInventarioFisico, UsuarioActual.CveUsuario) Then + If Inventarios.AddInventarioFisicoResultados(CveInventarioFisico, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If Inventarios.UpdateInventarioFisicoEstatus(CveInventarioFisico, 3, UsuarioActual.CveEmpresa) Then Dim url As String = ("/Inventarios/RepAnomalias.aspx?CveInventarioFisico=" + CveInventarioFisico.ToString) Alert("Ha finalizado el Inventario Físico. Sera enviado al reporte de anomalías", TipoMensaje.MsgInformacion, " window.location=""" + url + """") @@ -779,9 +779,9 @@ Partial Class Inventarios_InventarioFisicoDetalle End If Dim serie As String = IIf(TxtSerieLote.Text.ToString = "", "-1", TxtSerieLote.Text.ToString) Dim Lote As String = IIf(TxtLoteEdit.Text.ToString = "", "-1", TxtLoteEdit.Text.ToString) - Dim FechaCaducida As Date = IIf(TxtFechaCaducida.Text.ToString = "", MinFecha, TxtFechaCaducida.Text.ToString.ToDate) + Dim FechaCaducidad As Date = IIf(TxtFechaCaducida.Text.ToString = "", MinFecha, TxtFechaCaducida.Text.ToString.ToDate) - If objInventario.UpdateInventarioFisicoDetalles(HfCveInventarioFisicoDetalle.Value.ToEntero, HfCvePS.Value.ToEntero, HfCveUM.Value.ToEntero, TxtCantidad.Text.ToEntero, serie, Lote, FechaCaducida) Then + If objInventario.UpdateInventarioFisicoDetalles(HfCveInventarioFisicoDetalle.Value.ToEntero, HfCvePS.Value.ToEntero, HfCveUM.Value.ToEntero, TxtCantidad.Text.ToDecimal, serie, Lote, FechaCaducidad) Then If objInventario.GetInventarioFisicoDetalle(CveInventarioFisico, ddlUsuario.SelectedValue.ToString.ToEntero) Then GvIFD.DataSource = objInventario.DtResultados End If diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index d93ba5ca0..7c9e2fa5b 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -2322,7 +2322,7 @@ Partial Class Inventarios_RecepcionAlmacen Dim tCveConcepto As Integer = 69 For Each RowInv As DataRow In tmpCostos.Rows - ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL + ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL If tCveConcepto = 69 Then IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero End If @@ -2532,7 +2532,7 @@ Partial Class Inventarios_RecepcionAlmacen ElseIf DtDetalleLote.Rows.Count > 0 Then Dim ContDt As Integer = 0 ' por redondeo - If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundAD + If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundSQL For Each Dr As DataRow In DtDetalleLote.Rows SumaTotal += Dr("Cantidad").ToString.ToDecimal * (PU + CostoIndirecto) If RecibidaCompleta AndAlso Cont + 1 = GvInv.Rows.Count AndAlso ContDt + 1 = DtDetalleLote.Rows.Count AndAlso (TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)).RoundSQL <> SumaTotal Then @@ -2633,7 +2633,7 @@ Partial Class Inventarios_RecepcionAlmacen ElseIf DtDetalleLote.Rows.Count > 0 Then Dim ContDt As Integer = 0 ' por redondeo - If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundAD + If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundSQL For Each Dr As DataRow In DtDetalleLote.Rows SumaTotal += Dr("Cantidad").ToString.ToDecimal * (PU + CostoIndirecto) If RecibidaCompleta AndAlso Cont + 1 = GvInv.Rows.Count AndAlso ContDt + 1 = DtDetalleLote.Rows.Count AndAlso (TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)).RoundSQL <> SumaTotal Then @@ -2650,7 +2650,7 @@ Partial Class Inventarios_RecepcionAlmacen Next Else ' por redondeo - If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundAD + If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundSQL SumaTotal += gvr.FCTextBox("TbCantidadF").Text.ToDecimal * (PU + CostoIndirecto) ' considerar el costo indirecto para el ajuste If RecibidaCompleta AndAlso Cont + 1 = GvInv.Rows.Count AndAlso (TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)).RoundSQL <> SumaTotal.RoundSQL Then Dim tTotal As Decimal = gvr.FCTextBox("TbCantidadF").Text.ToDecimal * (PU) @@ -3159,7 +3159,7 @@ Partial Class Inventarios_RecepcionAlmacen Dim ValorInventario As Decimal = 0 DtCostos = ObjInventario.DtResultados Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL - Dim TotalCostoExtranjero As Decimal = DtCostos.SUM("TotalExtranjero").ToDecimal + Dim TotalCostoExtranjero As Decimal = DtCostos.SUMD("TotalExtranjero") 'VARIABLES Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero @@ -4195,7 +4195,7 @@ Partial Class Inventarios_RecepcionAlmacen For Each Dr As DataRow In DtInv.Rows Dr("PU") = Dr("PUExtranjero") - Dr("Total") = Dr("PU").ToString.ToDouble * Dr("Cantidad").ToString.ToDouble + Dr("Total") = Dr("PU").ToString.ToDecimal * Dr("Cantidad").ToString.ToDecimal Dr("CostoIndirecto") = Dr("CostoIndirectoExtranjero") Next @@ -4222,9 +4222,9 @@ Partial Class Inventarios_RecepcionAlmacen End If For Each Dr As DataRow In DtInv.Rows - Dr("PU") = Dr("PUExtranjero").ToString.ToDouble * TipoCambio - Dr("Total") = Dr("PU").ToString.ToDouble * Dr("CantidadC").ToString.ToDouble - Dr("CostoIndirecto") = Dr("CostoIndirectoExtranjero").ToString.ToDouble * TipoCambio + Dr("PU") = Dr("PUExtranjero").ToString.ToDecimal * TipoCambio + Dr("Total") = Dr("PU").ToString.ToDecimal * Dr("CantidadC").ToString.ToDecimal + Dr("CostoIndirecto") = Dr("CostoIndirectoExtranjero").ToString.ToDecimal * TipoCambio Next DtInv.AcceptChanges() End Sub diff --git a/Inventarios/RepAnomalias.aspx.vb b/Inventarios/RepAnomalias.aspx.vb index 64302463c..12a19714f 100644 --- a/Inventarios/RepAnomalias.aspx.vb +++ b/Inventarios/RepAnomalias.aspx.vb @@ -198,7 +198,7 @@ Partial Class Inventarios_RepAnomalias If (GvF.Rows.Count > 0) Then GvF.UseAccessibleHeader = True GvF.HeaderRow.TableSection = TableRowSection.TableHeader - Script = "OrdenarGVF();" + divRegistradosFaltan.Visible = True LtlTotalRegistrosFaltan.Text = GvF.Rows.Count.ToString End If @@ -206,7 +206,7 @@ Partial Class Inventarios_RepAnomalias If (GvS.Rows.Count > 0) Then GvS.UseAccessibleHeader = True GvS.HeaderRow.TableSection = TableRowSection.TableHeader - Script += "OrdenarGVS();" + divRegistradosSobran.Visible = True LtlTotalRegistrosSobran.Text = GvS.Rows.Count.ToString End If @@ -214,7 +214,7 @@ Partial Class Inventarios_RepAnomalias If (GvC.Rows.Count > 0) Then GvC.UseAccessibleHeader = True GvC.HeaderRow.TableSection = TableRowSection.TableHeader - Script += "OrdenarGVS();" + divRegistradosCoinciden.Visible = True LtlCoincidentes.Text = GvC.Rows.Count.ToString End If @@ -233,7 +233,7 @@ Partial Class Inventarios_RepAnomalias Protected Sub btnFin_Click(sender As Object, e As EventArgs) Handles btnFin.Click Dim Inventarios As New ClsInventarios Inventarios.IniciaTransacSQL() - If Inventarios.AddInventarioFisicoResultados(CveInventarioFisico, UsuarioActual.CveUsuario) Then + If Inventarios.AddInventarioFisicoResultados(CveInventarioFisico, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If Inventarios.UpdateInventarioFisicoEstatus(CveInventarioFisico, 3, UsuarioActual.CveEmpresa) Then Dim url As String = ("/Inventarios/RepAnomalias.aspx?CveInventarioFisico=" + CveInventarioFisico.ToString) Alert("Ha finalizado el Inventario Físico. Sera enviado al reporte de anomalías", TipoMensaje.MsgInformacion, " window.location=""" + url + """") 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 diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 8ebe5351e..8f5277347 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -3754,8 +3754,12 @@ Partial Class OC e.Row.FCDropDownList("DdlPS").Enabled = False e.Row.FCDropDownList("DdlClasificacion").Enabled = False e.Row.FCDropDownList("CboUnidadMedidaEdit").Enabled = False - e.Row.FCTextBox("TxtImporteEdit").Enabled = False - e.Row.FCTextBox("TxtDescuentoEdit").Enabled = False + 'que tenga el permiso que no bloquee + If Not UsuarioActual.TienePermisoProceso(329) AndAlso e.Row.DBCampo("CantidadVinculadaCompra").ToDouble = 0 Then 'permite editar pu, aun estando recibida + e.Row.FCTextBox("TxtImporteEdit").Enabled = False + e.Row.FCTextBox("TxtDescuentoEdit").Enabled = False + End If + End If 'DDL PS diff --git a/Ventas/CatImpuestosLocales.aspx.vb b/Ventas/CatImpuestosLocales.aspx.vb index 88fafced9..b03199507 100644 --- a/Ventas/CatImpuestosLocales.aspx.vb +++ b/Ventas/CatImpuestosLocales.aspx.vb @@ -85,7 +85,7 @@ Partial Class Ventas_CatImpuestosLocales Dim TieneError = False Dim CveImpuestoLocal As Integer = GvImpuestos.Rows(e.RowIndex).DataKey("CveImpuestoLocal").ToEntero Dim Impuesto As String = GvImpuestos.Rows(e.RowIndex).FCTextBox("TxtImpuestoLocal").Text.Trim - Dim Porcentaje As Double = GvImpuestos.Rows(e.RowIndex).FCTextBox("TxtVentaPorcentaje").Text.ToDouble + Dim Porcentaje As Decimal = GvImpuestos.Rows(e.RowIndex).FCTextBox("TxtVentaPorcentaje").Text.ToDecimal Dim Orden = GvImpuestos.Rows(e.RowIndex).FCTextBox("TxtOrdenImpuesto").Text.ToEntero Dim TipoImpuesto = GvImpuestos.Rows(e.RowIndex).FCDropDownList("DdlTipoImpuestoEdit").SelectedValue.ToEntero Dim IdCtaContable = GvImpuestos.Rows(e.RowIndex).FCDropDownList("DdlCuentasContables").SelectedValue.ToEntero @@ -199,7 +199,7 @@ Partial Class Ventas_CatImpuestosLocales If CveImpuestoLocal = -1 Then If ChkEstatus.Checked Then Estatus = 1 - If ObjVentas.AddImpuestosLocales(TxtImpuesto.Text.Trim, TxtPorcentaje.Text.ToDouble, TxtOrden.Text.ToEntero, DdlTipoImpuesto.SelectedValue.ToEntero, Estatus, DdlCuentasContables.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + If ObjVentas.AddImpuestosLocales(TxtImpuesto.Text.Trim, TxtPorcentaje.Text.ToDecimal, TxtOrden.Text.ToEntero, DdlTipoImpuesto.SelectedValue.ToEntero, Estatus, DdlCuentasContables.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then CargaDatos() End If TxtImpuesto.Text = "" @@ -210,7 +210,7 @@ Partial Class Ventas_CatImpuestosLocales If CveImpuestoLocal <> -1 Then Dim TieneError = False Dim Impuesto As String = TxtImpuesto.Text.Trim - Dim Porcentaje As Double = TxtPorcentaje.Text.ToDouble + Dim Porcentaje As Decimal = TxtPorcentaje.Text.ToDecimal Dim Orden = TxtOrden.Text.ToEntero Dim TipoImpuesto = DdlTipoImpuesto.SelectedValue.ToEntero Dim IdCtaContable = DdlCuentasContables.SelectedValue.ToEntero diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index f7e8ca257..7c057ac43 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -688,7 +688,7 @@ Partial Class PV Get Return New Dictionary(Of Integer, Decimal) From { {20516, 0.23D}, 'Descuento para lubricantes LTH - {20515, 0.24D} 'Descuento para filtros LTH + {20515, 0.274D} 'Descuento para filtros LTH } End Get End Property @@ -1934,7 +1934,7 @@ Partial Class PV For Each Row As DataRow In TmpDT.FiltraParametros("EliminarDB = False").Rows Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero() If CveVentaDetalle > 0 Then - If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString.ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then + If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString.ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Descuento").ToString().ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then OcurrioError = True Exit For End If diff --git a/Ventas/PopUpBuscarFolio.aspx.vb b/Ventas/PopUpBuscarFolio.aspx.vb index f6ecdce33..e0d9c2fb0 100644 --- a/Ventas/PopUpBuscarFolio.aspx.vb +++ b/Ventas/PopUpBuscarFolio.aspx.vb @@ -280,19 +280,19 @@ Partial Class PopUpBuscarFolio End Sub Private Function ValidarUnFiltroSeleccionado() As Boolean - If DdlClasificacion.SelectedValue.ToEntero > 0 Then Return True - If DdlTipoDocto.SelectedValue <> "-1" Then Return True - If DdlSubProyecto.SelectedValue.ToEntero > 0 Then Return True - If DdlEstatusFactura.SelectedValue.ToEntero > 0 Then Return True - If DdlUsuario.SelectedValue.ToEntero > 0 Then Return True - If DdlPS.SelectedValue.ToEntero > 0 Then Return True - If TxtFolio.Text.Trim.Length > 0 Then Return True - If DdlNombre.SelectedValue.ToEntero > 0 Then Return True - If TxtFolioFiscal.Text.Trim.Length > 0 Then Return True - If TxtPedidoContrato.Text.Length > 0 Then Return True - If TxtOrdenCompra.Text.Length > 0 Then Return True + 'If DdlClasificacion.SelectedValue.ToEntero > 0 Then Return True + 'If DdlTipoDocto.SelectedValue <> "-1" Then Return True + 'If DdlSubProyecto.SelectedValue.ToEntero > 0 Then Return True + 'If DdlEstatusFactura.SelectedValue.ToEntero > 0 Then Return True + 'If DdlUsuario.SelectedValue.ToEntero > 0 Then Return True + 'If DdlPS.SelectedValue.ToEntero > 0 Then Return True + 'If TxtFolio.Text.Trim.Length > 0 Then Return True + 'If DdlNombre.SelectedValue.ToEntero > 0 Then Return True + 'If TxtFolioFiscal.Text.Trim.Length > 0 Then Return True + 'If TxtPedidoContrato.Text.Length > 0 Then Return True + 'If TxtOrdenCompra.Text.Length > 0 Then Return True - Return False + Return True End Function End Class diff --git a/Ventas/RepVentasUtilidadDetalle.aspx.vb b/Ventas/RepVentasUtilidadDetalle.aspx.vb index e09ed1d94..d1db922ca 100644 --- a/Ventas/RepVentasUtilidadDetalle.aspx.vb +++ b/Ventas/RepVentasUtilidadDetalle.aspx.vb @@ -154,6 +154,10 @@ Partial Class Ventas_RepVentasUtilidadDetalle DdlPS.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If + DdlMarcas.DataSource = GlobalDTGralMarcas(UsuarioActual.CveEmpresa) + DdlMarcas.DataBind() + DdlMarcas.Items.Insert(0, New ListItem("Todas", "-1")) + 'Cargo Clasificaciones DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) DdlClasificacion.DataBind() diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 9c6fbc075..4848a0119 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3271,7 +3271,12 @@ Partial Class Ventas If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, CveCliente, -1, 1) Then If ObjContratos.DtResultados.FiltraParametros("Estatus = True").Rows.Count > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ped") Or DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev")) Then - DtContratos = ObjContratos.DtResultados.FiltraParametros($"Estatus = True AND FechaFinal >= '{Now.ToShortDateString}' AND FechaInicial <= '{Now.ToShortDateString}'") + If UsuarioActual.CveEmpresa.Contiene(72, 80) Then + DtContratos = ObjContratos.DtResultados.FiltraParametros($"Estatus = True AND FechaFinal >= '{Now.ToShortDateString}' AND FechaInicial <= '{Now.ToShortDateString}'") + Else + DtContratos = ObjContratos.DtResultados.FiltraParametros($"Estatus = True ") + End If + If AfterPageLoad Then RegistraScript("window.onload = function MuestraContratos() { document.getElementById(""C_BtnMostrarContrato"").click(); }") @@ -8255,7 +8260,7 @@ Partial Class Ventas For Each Row As DataRow In DtMovDetalles.Rows Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToDecimal() - Cantidad += Cantidad + CantidadTotal += Cantidad If SaldoAlmacen < 0 AndAlso Cantidad = Math.Abs(SaldoAlmacen) Then TotalSalida += Math.Abs(SaldoAlmacen) @@ -8266,7 +8271,7 @@ Partial Class Ventas Next 'SI SE VERIFICA QUE TODO ESTA SURTIDO, SE MARCA TODA LA FACTURA - If CantidadTotal = Total Then + If CantidadTotal = TotalSalida Then If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") End If @@ -8472,10 +8477,10 @@ Partial Class Ventas If AutoConta Then If idCuentaContabilizacion > 0 Then If ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then - + If ObjContPaq IsNot Nothing Then ObjContPaq.Commit() Else Alert("Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) - + If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() End If Else Alert(String.Format("Falta asignación de las siguientes cuentas contables: {0}", CuentasContablesInvalidas), TipoMensaje.MsgAdvertencia) @@ -8483,7 +8488,7 @@ Partial Class Ventas End If End If - If ObjContPaq IsNot Nothing Then ObjContPaq.Commit() + 'If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() 'RMF, cuando es pedido, se manda autorización. @@ -10693,7 +10698,7 @@ Partial Class Ventas .CuentaPredial = drr("CuentaPredial").ToString(), .ImporteGravaIVAAdicional = drr("ImporteIEPS").ToString().ToDecimal} 'verifica suma subtotales - If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales + If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal.RoundSQL(2) <> concepto.Importe.RoundSQL(2) AndAlso Math.Abs(totSubTotal.RoundSQL(2) - concepto.Importe.RoundSQL(2)) <= 0.01 Then 'proceso de ajusta de decimales concepto.Importe = totSubTotal End If totSubTotal = totSubTotal - concepto.Importe @@ -10703,19 +10708,19 @@ Partial Class Ventas 'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos, y si la BASE de calculo es mayor a cero If Timbre.Comprobante.Total > 0 AndAlso concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional > 0 Then - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional, .TasaOCuota = drr("PorcentajeIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString().ToDecimal}) + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional).RoundSQL(6), .TasaOCuota = drr("PorcentajeIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString().ToDecimal}) End If If drr("ImporteIEPS").ToString().ToDouble > 0 Then - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString().ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString().ToDecimal}) + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = (concepto.Importe - concepto.Descuento).RoundSQL(6), .TasaOCuota = drr("PorcentajeIEPS").ToString().ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString().ToDecimal}) End If If drr("ImporteRetIVA").ToString().ToDouble > 0 Then 'si hay retenciones - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString().ToDecimal}) + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = (concepto.Importe - concepto.Descuento).RoundSQL(6), .TasaOCuota = drr("PorcentajeRetIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString().ToDecimal}) End If If drr("ImporteRetISR").ToString().ToDouble > 0 Then 'retención de ISR - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetISR").ToString().ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString().ToDecimal}) + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = (concepto.Importe - concepto.Descuento).RoundSQL(6), .TasaOCuota = drr("PorcentajeRetISR").ToString().ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString().ToDecimal}) End If Timbre.Conceptos.Add(concepto) @@ -13256,9 +13261,6 @@ Partial Class Ventas End If Dim ModalidadRefacturacion As Integer = UsuarioActual.Empresa.Funcionalidad(586).ToEntero() - If UsuarioActual.CveUsuario.Contiene(100, 1719) Then - ModalidadRefacturacion = 2 - End If 'REFACTURACION CON PAGOS, DEBE CANCELAR SALDOS DEL DOCUMENTO ANTERIOR Y TRASPASAR PAGOS AL NUEVO If ModalidadRefacturacion = 2 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso ObjFactura.NuevaFactura = 1 Then @@ -19962,6 +19964,9 @@ Partial Class Ventas sb.Append("Está seguro de cancelar el documento para realizar la refacturación?.") End If Else + If Not UsuarioActual.Empresa.FacturaProduccion Then + script = "BtnRefacturacionConfirmar();" + End If sb.Append("No encontrado
") End If Else @@ -20215,7 +20220,7 @@ Partial Class Ventas For Each Row As DataRow In TmpDT.Rows Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString().ToEntero() If CveVentaDetalle > 0 Then - If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString().ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then + If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString().ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Descuento").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then OcurrioError = True Exit For End If @@ -31505,7 +31510,7 @@ Partial Class Ventas Dim Respuesta As Boolean = False - If EscontratoObra Then + If EscontratoObra AndAlso PorAmortizacionAnticipo > 0 Then ' si es contrato de obra y tiene amortización de anticipo If DdlTipoComprobante.SelectedValue = "Ing" Then @@ -31526,7 +31531,7 @@ Partial Class Ventas Respuesta = True Else Respuesta = False - Alert("Debe de seleccioanr un importe de amortización.", TipoMensaje.MsgAdvertencia) + Alert("Debe de seleccionar un importe de amortización.", TipoMensaje.MsgAdvertencia) End If Else