diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb index 68086bdba..4a747409e 100644 --- a/App_Code/CFDITimbre.vb +++ b/App_Code/CFDITimbre.vb @@ -72,7 +72,7 @@ Public Class CFDITimbre For Each c As CFDIConceptos In Conceptos For Each imp As CFDIConceptosImpuestos In c.Impuestos If imp.TrasladooRetencion = "T" Then - tRetorno.Add(New CFDITraslados With {.Impuesto = imp.Impuesto, .Importe = imp.Importe, .TasaOCuota = imp.TasaOCuota, .TipoFactor = imp.TipoFactor}) + tRetorno.Add(New CFDITraslados With {.Impuesto = imp.Impuesto, .Base = imp.Base, .Importe = imp.Importe, .TasaOCuota = imp.TasaOCuota, .TipoFactor = imp.TipoFactor}) End If Next Next @@ -82,6 +82,7 @@ Public Class CFDITimbre .Select(Function(t) New CFDITraslados With {.Impuesto = t.Key.Impuesto, .TipoFactor = t.Key.TipoFactor, .TasaOCuota = t.Key.TasaOCuota, + .Base = t.Sum(Function(tt) tt.Base), .Importe = t.Sum(Function(tt) tt.Importe)}) _ .OrderBy(Function(x) x.Impuesto).ToList @@ -228,6 +229,7 @@ Public Class CFDIComprobante Public Property Moneda As String = "" Public Property TipoComprobante As String = "" Public Property MetodoPago As String = "" + Public Property Exportacion As String = "01" '01-No Aplica Public Property LugarExpedicion As String = "" Public Property NumCuentaPago As String = "" Public Property Confirmacion As String = "" @@ -270,6 +272,8 @@ End Class Public Class CFDIReceptor Public Property RFC As String Public Property Nombre As String + Public Property RegimenFiscalReceptor As String = "601" + Public Property DomicilioFiscalReceptor As String = "601" Public Property ResidenciaFiscal As String = "" Public Property NumeroRegistroTributario As String = "" Public Property UsoCFDI As String @@ -314,6 +318,7 @@ Public Class CFDIConceptos Public Property ClaveUnidad As String = "" Public Property Impuestos As List(Of CFDIConceptosImpuestos) Public Property Descuento As Decimal = 0.00D + Public Property ObjetoImpuesto As String = "02" Public Property ImporteGravaIVAAdicional As Decimal = 0.00D 'caso IEPS Sub New() @@ -408,6 +413,7 @@ Public Class CFDITraslados Public Property TipoFactor As String Public Property TasaOCuota As Decimal Public Property Importe As Decimal + Public Property Base As Decimal End Class diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index ec1c98082..eccfb731a 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5935,7 +5935,7 @@ Public Class ClsPaginas Dim bdir As String = If(RutaReporte.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory) 'TOMAR LA RUTA BASE PARA EL DIRECTORIO DE LA EMPRESA - If Not String.IsNullOrEmpty(RutaEmpresa) AndAlso Not RutaReporte.Contains("Grales") Then + If Not String.IsNullOrEmpty(RutaEmpresa) AndAlso Not RutaReporte.Contains("Grales") AndAlso Not RutaReporte.Contains("Contabilidad/Reportes/") Then bdir = RutaEmpresa.Replace($"{CveEmpresa}/", "") End If diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index e36ba295e..fe1026c75 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -242,13 +242,14 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetVentasPendientesCancelacion(CveEmpresa As Integer, CveUsuarioConsulta As Integer) As Boolean + Public Function GetVentasPendientesCancelacion(CveEmpresa As Integer, CveUsuarioConsulta As Integer, Optional CveVenta As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasPendientesCancelacionGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta End With Try @@ -5270,15 +5271,17 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, TipoDocumento As String, Optional CveEstatus As Integer = -1) As Boolean + Public Function GetAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, TipoDocumento As String, Optional CveEstatus As Integer = -1, Optional FechaI As DateTime = MinFecha, Optional FechaF As DateTime = MaxFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_AutorizacionLimitesGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus .Add("@TipoDocumento", SqlDbType.VarChar).Value = TipoDocumento + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 7a03c7d0b..367c2a669 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -2125,7 +2125,8 @@ Namespace Modelos If factura.TipoDocto = "RNC" AndAlso factura.Num1 = 1 AndAlso factura.DtMovimientosUsados IsNot Nothing AndAlso ObjAcum IsNot Nothing Then 'Dim Mensaje As String = "" Dim CveMovimiento = ObjInventario.AddMovimiento(factura.CveAlmacen, factura.CveConceptoMovimiento, 1, factura.Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, factura.CveVenta, - CveSubProyecto, CveActivoFijo:=-1, Guia:="", Observaciones:=factura.ObservacionesMovimiento, CvePersonal:=-1, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, Modulo:="RU/G") + CveSubProyecto, CveActivoFijo:=-1, + Observaciones:=factura.MovimientoObservaciones, Recibio:=factura.MovimientoRecibio, CvePersonal:=-1, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, Modulo:="RU/GModel") If CveMovimiento <= 0 Then 'Mensaje = "Error al guardar los movimientos" Resultado = False @@ -2154,18 +2155,21 @@ Namespace Modelos End If 'si es selectedvalue = 42, es entrada ,3 -salida - Dim CveConceptoUsados As Integer = If(factura.CveConceptoMovimiento = 42, 1, 2) + If Not factura.EsGarantia Then + Dim CveConceptoUsados As Integer = If(factura.CveConceptoMovimiento = 42, 1, 2) - If factura.Cliente.EsDistribuidor AndAlso factura.CveConceptoMovimiento = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then + If factura.Cliente.EsDistribuidor AndAlso factura.CveConceptoMovimiento = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then + + If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToDecimal(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, + UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, factura.Fecha, CveMovimiento:=CveMovimiento) Then + ' Mensaje = "Error al guardar Movimientos de distribuidor" + Resultado = False + Exit For + End If - If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToDecimal(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, factura.Fecha, CveMovimiento:=CveMovimiento) Then - ' Mensaje = "Error al guardar Movimientos de distribuidor" - Resultado = False - Exit For End If - End If + Next End If @@ -2182,6 +2186,40 @@ Namespace Modelos Return Resultado End Function + + Private Function CancelarInventarioUsado(factura As Modelos.Factura, CveAlmacenUsado As Integer, CveMovimientoEntrada As Integer, ByRef ObjInventario As ClsInventarios) As Integer + Dim CveMovimiento As Integer = -1 + Try + Dim CveConceptoSalidaUsado As Integer = 45 + CveMovimiento = ObjInventario.AddMovimiento(CveAlmacenUsado, CveConceptoSalidaUsado, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, factura.CveVenta, + factura.CveSubProyecto, CveActivoFijo:=-1, Guia:="", Observaciones:="", CvePersonal:=-1, CveCliente:=factura.CveCliente, CveClienteSucursal:=-1, Modulo:="M/CU") + If CveMovimiento <= 0 Then + CveMovimiento = -1 + Else + Dim DtMovimientosEntrada As DataTable = Nothing + If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, factura.CveEmpresa) Then + DtMovimientosEntrada = ObjInventario.DtResultados.Copy() + End If + + If DtMovimientosEntrada IsNot Nothing Then + For Each Dr As DataRow In DtMovimientosEntrada.Rows + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + CveMovimiento = -1 + Exit For + End If + Next + + DtMovimientosEntrada.Dispose() + DtMovimientosEntrada = Nothing + End If + End If + Catch ex As Exception + OnError("Ocurrió un erro al cancelar el movimiento de usado", ex) + CveMovimiento = -1 + End Try + + Return CveMovimiento + End Function Private Function GuardarPolizasVirtuales(SqlTransaccion As SqlClient.SqlTransaction, ObjFactura As Modelos.Factura) As Boolean Dim Resultado As Boolean = True @@ -2405,17 +2443,25 @@ Namespace Modelos 'VERIFICA SI TIENE MOVIMIENTO DE ENTRADA DE USADO If CveMovimiento > 0 AndAlso CveAlmacen > 0 Then + Dim CveMovimientoReferencia As Integer = -1 + Dim TipoMovto68 = TipoMovimiento + 'SI ES CANCELACION DEBE GENERAR EL MOVIMIENTO DE SALIDA DE USADOS + If ValorMultiplicador = -1 Then + CveMovimientoReferencia = CancelarInventarioUsado(ObjFactura, CveAlmacen, CveMovimiento, ObjInventario) + Else + CveMovimientoReferencia = CveMovimiento + End If - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - Dim Importe68 As Decimal = ObjInventario.DtResultados.SUMD("Total").RoundSQL + If ObjInventario.GetMovimientosDetalle(CveMovimientoReferencia, UsuarioActual.CveEmpresa) Then + Dim Importe68 As Decimal = ObjInventario.DtResultados.SUMD("Total").RoundSQL * ValorMultiplicador Dim IdCtaContable68 = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacen}").ToEntero - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, Importe68, Referencia, 68, Concepto, FechaMovimiento, IdCtaContable68, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=Importe68, Contabilizable:=False) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovto68, Importe68, Referencia, 68, Concepto, FechaMovimiento, IdCtaContable68, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoReferencia, ImporteMX:=Importe68, Contabilizable:=False) Then ErrorPrepoliza = True End If - Dim Importe318 As Decimal = importeMovimiento - Importe68 + Dim Importe318 As Decimal = (Math.Abs(importeMovimiento) - Math.Abs(Importe68)) * ValorMultiplicador If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, Importe318, Referencia, 318, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Importe318, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True @@ -2428,7 +2474,6 @@ Namespace Modelos Else ErrorPrepoliza = True End If - Else If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then @@ -6259,7 +6304,8 @@ Namespace Modelos Public Property CveAlmacen As Integer Public Property GenerarSalidaAlmacen As Boolean = False Public Property CveConceptoMovimiento As Integer - Public Property ObservacionesMovimiento As String + Public Property MovimientoObservaciones As String + Public Property MovimientoRecibio As String Public Property DtMovimientosUsados As DataTable Public Property CveAlmacenDevolucion As Integer Public Property CveVenta As Integer @@ -6493,7 +6539,7 @@ Namespace Modelos End Property Public Property MotivoDescuento As String = "" - Public Property EsGarantia As Boolean + Public Property EsGarantia As Boolean = False #Region "Totales" @@ -9965,6 +10011,8 @@ Namespace Modelos Public Property Pais As String Public Property RFC As String Public Property CP As String + Public Property CveRegimenFiscal As Integer + Public Property CodigoRegimenFiscal As String Public Property Telefono As String Public Property Contacto As String Public Property Mail As String diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 191c38d6e..2af43a2fd 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -51,6 +51,83 @@ Public Class Timbrado #End Region + Public Function ObtenerAcuse(CveVenta As Integer, UsuarioActual As Usuario) As Boolean + Dim Retorno As Boolean = False + Try + Dim RowVentas As DataRow = Nothing + Dim RFCEmisor = UsuarioActual.Empresa.RFC + Dim RFCReceptor As String = "" + Dim FolioFiscal As String = "" + Dim FolioSustitucion As String = "" + Dim CvePACCancelacion As Integer = -1 + Dim CveSATMotivoCancelacion As Integer = -1 + Dim CveMotivoCancelacion As Integer = -1 + Dim TotalT As Decimal = 0 + + Using ObjVentas As New ClsVentas + If ObjVentas.GetVentasPendientesCancelacion(UsuarioActual.CveEmpresa, 100, CveVenta) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + RowVentas = ObjVentas.DtResultados.Rows(0) + End If + End Using + + If RowVentas IsNot Nothing Then + FolioFiscal = RowVentas("FolioFiscal").ToString() + RFCReceptor = RowVentas("RFCReceptor").ToString() + CvePACCancelacion = RowVentas("CvePAC").ToString().ToEntero() + CveMotivoCancelacion = RowVentas("CveMotivoCancelacion").ToString().ToEntero() + TotalT = RowVentas("Total").ToString().ToDecimal() + FolioSustitucion = RowVentas("FolioFiscalSustitucion").ToString() + End If + + If CveMotivoCancelacion > 0 Then + Dim Row As DataRow = ClsPaginas.GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa, CveMotivoCancelacion:=CveMotivoCancelacion).FiltroPrimero("") + If Row IsNot Nothing Then + CveSATMotivoCancelacion = Row("CveSATMotivoCancelacion").ToString().ToEntero() + End If + End If + + + If CvePACCancelacion = 4 Then + Dim solicitud As New WSGF.Service1SoapClient + Dim resp As New WSGF.StructXml() + resp = solicitud.GetAcuse(RFCEmisor, "rene.molina@adsistemas.mx", "rene2018", FolioFiscal) + If (resp.Estado = 0) Then + + Dim xmlDoc As New System.Xml.XmlDocument() + xmlDoc.LoadXml(Encoding.UTF8.GetString(Convert.FromBase64String(resp.CfdiB64))) + Dim xpath As String = "Acuse/Folios" + Dim nodes = xmlDoc.SelectNodes(xpath) + CancelacionState = xmlDoc.GetElementsByTagName("EstatusUUID")(0).InnerText.ToEntero + + xpath = "Acuse/Signature" + nodes = xmlDoc.SelectNodes(xpath) + + Me.CancelacionAcuse = xmlDoc.GetElementsByTagName("SignatureValue")(0).InnerText + Me.CancelacionFecha = xmlDoc.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate + Retorno = True + Else + CancelacionAcuse = resp.Descripcion + Retorno = False + End If + solicitud = Nothing + Else + If CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion) Then + 'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN + CancelacionFecha = Me.CancelacionFecha + CancelacionAcuse = Me.CancelacionAcuse + Retorno = True + End If + End If + + Catch ex As Exception + OnError("Ocurrió un error al intentar obtener el acuse", ex) + Retorno = False + End Try + + Return Retorno + End Function + + Public Shared Function VerificarVigenciaSAT(uuid As String, emisor As String, receptor As String, total As String, produccion As Boolean) As AcuseCancelacionSAT Dim Retorno As AcuseCancelacionSAT = Nothing Dim resp As Cancelacion2022.AcuseSat = New Cancelacion2022.AcuseSat() @@ -939,10 +1016,16 @@ Public Class Timbrado Retorno = TimbrarFacturaProFact(UsuarioActual, Ventas) 'Retorno = TimbrarFacturaProFact(UsuarioActual, Ventas, TmpDTConceptos, TmpDTImpuestos, TmpDTComplementos, Ruta, LstFordASN, FordGSDBM, ObjV) Case 4 + If Ventas.Version = "4.0" Then + Dim Ret As String = TimbrarFacturaGoCFDIv40(Ventas, UsuarioActual, CvePACEspecial) + If Ret <> "" Then MensajeErrorCFDI = Ret + Retorno = If(Ret = "", True, False) + Else + Dim Ret As String = TimbrarFacturaGoCFDIv33(Ventas, UsuarioActual, CvePACEspecial) + If Ret <> "" Then MensajeErrorCFDI = Ret + Retorno = If(Ret = "", True, False) + End If - Dim Ret As String = TimbrarFacturaGoCFDIv33(Ventas, UsuarioActual, CvePACEspecial) - If Ret <> "" Then MensajeErrorCFDI = Ret - Retorno = If(Ret = "", True, False) Case 5 @@ -2078,7 +2161,7 @@ Public Class Timbrado #Region "Impuestos" 'SI NO ES FACTURA EN 0 AGREGA LOS IMPUESTOS - If Ventas.Total <> 0 OrElse (ObjCFDITimbre.TotalImpuestosRetenidos > 0 OrElse ObjCFDITimbre.TotalImpuestosTrasladados > 0) Then + If Ventas.Total <> 0 And (ObjCFDITimbre.TotalImpuestosRetenidos > 0 OrElse ObjCFDITimbre.TotalImpuestosTrasladados > 0) Then cfdi.Impuestos(ObjCFDITimbre.TotalImpuestosRetenidos, ObjCFDITimbre.TotalImpuestosTrasladados) End If #End Region @@ -2092,55 +2175,59 @@ Public Class Timbrado Next End If - ''se acumulan los importes - For Each Tras In ObjCFDITimbre.Traslados - cfdi.Traslado(Tras.Impuesto, Tras.TipoFactor, Tras.TasaOCuota, Tras.Importe) - Next + + If ObjCFDITimbre.Traslados.Sum(Function(x) x.Importe) > 0 Then + ''se acumulan los importes + For Each Tras In ObjCFDITimbre.Traslados + cfdi.Traslado(Tras.Impuesto, Tras.TipoFactor, Tras.TasaOCuota, Tras.Importe) + Next + End If + #End Region #Region "Impuestos Locales" If ObjCFDITimbre.RetencionesLocales.Sum(Function(x) x.Importe) > 0 OrElse ObjCFDITimbre.TrasladosLocales.Sum(Function(x) x.Importe) > 0 Then - cfdi.ImpuestosLocales(ObjCFDITimbre.RetencionesLocales.Sum(Function(x) x.Importe), ObjCFDITimbre.TrasladosLocales.Sum(Function(x) x.Importe)) + cfdi.ImpuestosLocales(ObjCFDITimbre.RetencionesLocales.Sum(Function(x) x.Importe), ObjCFDITimbre.TrasladosLocales.Sum(Function(x) x.Importe)) - For Each ret As CFDIRetencionesLocales In ObjCFDITimbre.RetencionesLocales - If ret.Importe > 0 Then - cfdi.RetencionLocal(ret.ImpuestoLocalRetenido, ret.TasaRetencion, ret.Importe) - End If - Next + For Each ret As CFDIRetencionesLocales In ObjCFDITimbre.RetencionesLocales + If ret.Importe > 0 Then + cfdi.RetencionLocal(ret.ImpuestoLocalRetenido, ret.TasaRetencion, ret.Importe) + End If + Next - For Each ret As CFDITrasladosLocales In ObjCFDITimbre.TrasladosLocales - If ret.Importe > 0 Then - cfdi.TrasladoLocal(ret.ImpuestoLocalTraslado, ret.TasaTraslado, ret.Importe) - End If - Next - End If + For Each ret As CFDITrasladosLocales In ObjCFDITimbre.TrasladosLocales + If ret.Importe > 0 Then + cfdi.TrasladoLocal(ret.ImpuestoLocalTraslado, ret.TasaTraslado, ret.Importe) + End If + Next + End If - If Ventas.CveComplementoTimbrado > 0 Then + If Ventas.CveComplementoTimbrado > 0 Then - Select Case Ventas.CveComplementoTimbrado - Case 5 'INE Proceso Ordinario Directivo Estatal" - cfdi.Ine11("Ordinario", "Directivo Estatal", "0") + Select Case Ventas.CveComplementoTimbrado + Case 5 'INE Proceso Ordinario Directivo Estatal" + cfdi.Ine11("Ordinario", "Directivo Estatal", "0") - cfdi.IneEntidad(Ventas.ComplementoINE.INEEntidad, "") - cfdi.IneContabilidad(Ventas.ComplementoINE.INEIdContabilidad) - Case 6 'INE Proceso Ordinario Ejecutivo Estatal" - cfdi.Ine11("Ordinario", "Ejecutivo Estatal", "0") + cfdi.IneEntidad(Ventas.ComplementoINE.INEEntidad, "") + cfdi.IneContabilidad(Ventas.ComplementoINE.INEIdContabilidad) + Case 6 'INE Proceso Ordinario Ejecutivo Estatal" + cfdi.Ine11("Ordinario", "Ejecutivo Estatal", "0") - cfdi.IneEntidad(Ventas.ComplementoINE.INEEntidad, "") - cfdi.IneContabilidad(Ventas.ComplementoINE.INEIdContabilidad) - Case 7 'INE Proceso Ordinario Ejecutivo Nacional" + cfdi.IneEntidad(Ventas.ComplementoINE.INEEntidad, "") + cfdi.IneContabilidad(Ventas.ComplementoINE.INEIdContabilidad) + Case 7 'INE Proceso Ordinario Ejecutivo Nacional" - cfdi.Ine11("Ordinario", "Ejecutivo Nacional", Ventas.ComplementoINE.INEIdContabilidad.ToString) - Case 8 'INE PreCampaña - cfdi.Ine11(Ventas.ComplementoINE.INETipoProceso, "", "0") + cfdi.Ine11("Ordinario", "Ejecutivo Nacional", Ventas.ComplementoINE.INEIdContabilidad.ToString) + Case 8 'INE PreCampaña + cfdi.Ine11(Ventas.ComplementoINE.INETipoProceso, "", "0") - cfdi.IneEntidad(Ventas.ComplementoINE.INEEntidad, Ventas.ComplementoINE.INETipoComite) - cfdi.IneContabilidad(Ventas.ComplementoINE.INEIdContabilidad) - End Select + cfdi.IneEntidad(Ventas.ComplementoINE.INEEntidad, Ventas.ComplementoINE.INETipoComite) + cfdi.IneContabilidad(Ventas.ComplementoINE.INEIdContabilidad) + End Select - End If + End If @@ -2149,11 +2236,11 @@ Public Class Timbrado #Region "Comercio Exterior" - If Ventas.Cliente.AplicaComercioExterior And ObjCFDITimbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto Then - If ObjCFDITimbre.Complementos.ComercioExterior11 IsNot Nothing Then + If Ventas.Cliente.AplicaComercioExterior And ObjCFDITimbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto Then + If ObjCFDITimbre.Complementos.ComercioExterior11 IsNot Nothing Then - 'DATOS GENERALES - cfdi.ComercioExterior11(ObjCFDITimbre.Complementos.ComercioExterior11.MotivoTraslado, + 'DATOS GENERALES + cfdi.ComercioExterior11(ObjCFDITimbre.Complementos.ComercioExterior11.MotivoTraslado, ObjCFDITimbre.Complementos.ComercioExterior11.TipoOperacion, ObjCFDITimbre.Complementos.ComercioExterior11.ClavedePedimento, ObjCFDITimbre.Complementos.ComercioExterior11.CertificadoOrigen, @@ -2164,9 +2251,9 @@ Public Class Timbrado ObjCFDITimbre.Complementos.ComercioExterior11.Observaciones, ObjCFDITimbre.Complementos.ComercioExterior11.TipoCambioUSD, ObjCFDITimbre.Complementos.ComercioExterior11.TotalUSD) - 'EMISOR - cfdi.ComercioExterior11Emisor(If(EmisorRFC.Length >= 12, "", ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CURP)) - cfdi.ComercioExterior11Domicilio(ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Calle, + 'EMISOR + cfdi.ComercioExterior11Emisor(If(EmisorRFC.Length >= 12, "", ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CURP)) + cfdi.ComercioExterior11Domicilio(ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Calle, ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroExterior, ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroInterior, ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Colonia, @@ -2176,9 +2263,9 @@ Public Class Timbrado ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Estado, ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Pais, ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CP) - 'RECEPTOR - cfdi.ComercioExterior11Receptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib) - cfdi.ComercioExterior11DomicilioReceptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Calle, + 'RECEPTOR + cfdi.ComercioExterior11Receptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib) + cfdi.ComercioExterior11DomicilioReceptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Calle, ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroExterior, ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroInterior, ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Colonia, @@ -2188,7 +2275,7 @@ Public Class Timbrado ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Estado, ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Pais, ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.CP) - cfdi.ComercioExterior11Destinatario(ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumRegIdTrib, + cfdi.ComercioExterior11Destinatario(ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumRegIdTrib, ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Nombre, ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Calle, ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumeroExterior, @@ -2200,35 +2287,35 @@ Public Class Timbrado ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Estado, ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Pais, ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.CP) - 'MERCANCIAS - If ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias IsNot Nothing AndAlso ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias.Count > 0 Then - For Each concep As CFDIComercioExterior11Mercancias In ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias - cfdi.ComercioExterior11Mercancia(concep.NoIdentificacion, concep.FraccionArancelaria, concep.CantidadAduana, concep.UnidadAduana, concep.ValorUnitarioAduana, concep.ValorDolares) - If concep.DescripcionesEspecificas.Marca <> "" Then - cfdi.ComercioExterior11MercanciaDescripcionesEspeciales(concep.DescripcionesEspecificas.Marca, + 'MERCANCIAS + If ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias IsNot Nothing AndAlso ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias.Count > 0 Then + For Each concep As CFDIComercioExterior11Mercancias In ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias + cfdi.ComercioExterior11Mercancia(concep.NoIdentificacion, concep.FraccionArancelaria, concep.CantidadAduana, concep.UnidadAduana, concep.ValorUnitarioAduana, concep.ValorDolares) + If concep.DescripcionesEspecificas.Marca <> "" Then + cfdi.ComercioExterior11MercanciaDescripcionesEspeciales(concep.DescripcionesEspecificas.Marca, concep.DescripcionesEspecificas.Modelo, concep.DescripcionesEspecificas.SubModelo, concep.DescripcionesEspecificas.NumeroSerie) - End If - Next + End If + Next + + End If + End If - - End If - End If #End Region - End If + 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 @@ -3256,6 +3343,700 @@ Public Class Timbrado Return Retorno End Function + +#Region "T i m b r a d o v. 4. 0" + Public Function TimbrarFacturaGoCFDIv40(Ventas As Modelos.Factura, UsuarioActual As Usuario, Optional CvePACEspecial As Integer = -1) As String + If CvePACEspecial = -1 Then + CvePACEspecial = UsuarioActual.Empresa.CvePAC + End If + Dim sw As New Diagnostics.Stopwatch + Dim swmili As Long = 0 + Dim swTiempo As New StringBuilder + sw.Start() + Dim Retorno As String = "" + Dim ObjCFDITimbre As CFDITimbre = Ventas.Timbre + + Dim ArchivoLLave As String = String.Format("{0}Certificados\{1}", UsuarioActual.Empresa.Ruta, UsuarioActual.Empresa.ArchivoKey) + Dim ArchivoCertificado As String = String.Format("{0}Certificados\{1}", UsuarioActual.Empresa.Ruta, UsuarioActual.Empresa.ArchivoCer) + Dim UsuarioServicio As String = If(CvePACEspecial = 2, UsuarioActual.Empresa.RFC, "rene.molina@adsistemas.mx") + Dim ClaveServicio As String = If(CvePACEspecial = 2, UsuarioActual.Empresa.RFC.ToLower, "rene2018") + Dim Clave As String = UsuarioActual.Empresa.ContraseñaKey + Dim EmisorRFC As String = UsuarioActual.Empresa.RFC + Dim UrlServicio As String = "" ' Produccion + Dim RutaArchivo As String = String.Format("{0}XML\{1}\", UsuarioActual.Empresa.Ruta, Ventas.TipoDocto) + Dim NombreArchivoXML As String = ObjCFDITimbre.Comprobante.SerieFolio + Dim SubTotal As Decimal = 0 + Dim TimbraProduccion As Boolean = True + If Not Directory.Exists(RutaArchivo) Then Directory.CreateDirectory(RutaArchivo) + + UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL" + + If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then + + EmisorRFC = "EKU9003173C9" + UsuarioActual.Empresa.Empresa = "ESCUELA KEMPER URGATE SA DE CV" + ArchivoLLave = $"{UsuarioActual.Empresa.Ruta}Certificados\EKU9003173C9.key" + ArchivoCertificado = $"{UsuarioActual.Empresa.Ruta}Certificados\EKU9003173C9.cer" + + Clave = "12345678a" + TimbraProduccion = False + UsuarioServicio = "UserTest" + ClaveServicio = "1234567890" + + End If + +#Region "Valida" + If Not File.Exists(ArchivoCertificado) Then + Alert("El archivo de certificado no existe", TipoMensaje.MsgError) + Return "El archivo de certificado no existe" + End If + If Not File.Exists(ArchivoLLave) Then + Alert("El archivo de llave privada no existe", TipoMensaje.MsgError) + Return "El archivo de llave privada no existe" + End If + If UsuarioActual.Empresa.ContraseñaKey = "" Then + Alert("La clave no puede ser vacía", TipoMensaje.MsgError) + Return "La clave no puede ser vacía" + End If +#End Region + +#Region "Variables" + Dim llaveByte As Byte(), certByte As Byte() + Dim llaveBase64 As String, certBase64 As String + Dim cfdi As New GoFac.Cfdi4 + Dim complemento As String = "" + Dim complementoConcepto As String = "" + +#End Region + +#Region "Verifica" + Try + llaveByte = System.IO.File.ReadAllBytes(ArchivoLLave) + llaveBase64 = Convert.ToBase64String(llaveByte) + Catch ex As Exception + Alert($"Error al leer la llave privada: {ex.Message}", TipoMensaje.MsgError) + Return "Error al leer la llave privada" + End Try + + + Try + certByte = System.IO.File.ReadAllBytes(ArchivoCertificado) + certBase64 = Convert.ToBase64String(certByte) + Catch ex As Exception + Alert($"Error al leer el certificado: {ex.Message}", TipoMensaje.MsgError) + Return "Error al leer el certificado" + + End Try +#End Region + + + sw.Stop() + swTiempo.AppendFormat("Verificado : ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds) + swmili = sw.ElapsedMilliseconds + sw.Start() + + + 'cfdi.QuitarCerosDecimalDerecha = True ' no limita a 2 decimales, el atributo, de cantidad y precio unitario +#Region "Certificado" + cfdi.CertArchivo(ArchivoCertificado) +#End Region + + + sw.Stop() + swTiempo.AppendFormat("Certificado : ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds) + swmili = sw.ElapsedMilliseconds + sw.Start() + +#Region "Comprobante" + + cfdi.Comprobante( + ObjCFDITimbre.Comprobante.Serie, + ObjCFDITimbre.Comprobante.Folio, + ObjCFDITimbre.Comprobante.Fecha.ToString("yyyy-MM-ddTHH:mm:ss"), + ObjCFDITimbre.Comprobante.FormadePago, + ObjCFDITimbre.Comprobante.CondicionesdePago, + ObjCFDITimbre.Comprobante.SubTotal, + ObjCFDITimbre.Comprobante.Descuentos, + ObjCFDITimbre.Comprobante.Moneda, + ObjCFDITimbre.Comprobante.TipoCambio.ToString, + ObjCFDITimbre.Comprobante.Total, + ObjCFDITimbre.Comprobante.TipoComprobante, + ObjCFDITimbre.Comprobante.Exportacion, + ObjCFDITimbre.Comprobante.MetodoPago, + ObjCFDITimbre.Comprobante.LugarExpedicion, + ObjCFDITimbre.Comprobante.Confirmacion) + + If ObjCFDITimbre.CFDIRelacionados.TipoRelacion <> "" Then + cfdi.CfdiRelacionados(ObjCFDITimbre.CFDIRelacionados.TipoRelacion) + For Each uid As String In ObjCFDITimbre.CFDIRelacionados.UUID + cfdi.CfdiRelacionado(uid) + Next + End If +#Region "Emisor" + ' cfdi.agregarCfdiRelacionados() + cfdi.Emisor(EmisorRFC, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal, "") + +#End Region + +#Region "Receptor" + + cfdi.Receptor(ObjCFDITimbre.Receptor.RFC, ObjCFDITimbre.Receptor.Nombre, ObjCFDITimbre.Receptor.DomicilioFiscalReceptor, ObjCFDITimbre.Receptor.ResidenciaFiscal, ObjCFDITimbre.Receptor.NumeroRegistroTributario, ObjCFDITimbre.Receptor.RegimenFiscalReceptor, ObjCFDITimbre.Receptor.UsoCFDI) + +#End Region + +#End Region + +#Region "Conceptos" + + 'Nodo conceptos, se agregan los PS + + If ObjCFDITimbre.Conceptos IsNot Nothing AndAlso ObjCFDITimbre.Conceptos.Count > 0 Then + For Each concep As CFDIConceptos In ObjCFDITimbre.Conceptos + cfdi.Concepto(concep.ClaveProdServ, concep.Noidentificacion, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Descripcion, concep.ValorUnitario, concep.Importe, concep.Descuento, concep.ObjetoImpuesto) + For Each imp As CFDIConceptosImpuestos In concep.Impuestos + If imp.TrasladooRetencion = "T" Then + cfdi.ConceptoTraslado(imp.Base, imp.Impuesto, imp.TipoFactor, imp.TasaOCuota, imp.Importe) + Else + cfdi.ConceptoRetencion(imp.Base, imp.Impuesto, imp.TipoFactor, imp.TasaOCuota, imp.Importe) + End If + Next + If concep.CuentaPredial <> "" Then cfdi.CuentaPredial(concep.CuentaPredial) + If concep.NumeroPedimento <> "" Then cfdi.InformacionAduanera(concep.NumeroPedimento) + Next + End If + +#End Region + + If ObjCFDITimbre.Comprobante.TipoComprobante.Contiene("I", "E") Then + +#Region "Impuestos" + 'SI NO ES FACTURA EN 0 AGREGA LOS IMPUESTOS + If Ventas.Total <> 0 OrElse (ObjCFDITimbre.TotalImpuestosRetenidos > 0 OrElse ObjCFDITimbre.TotalImpuestosTrasladados > 0) Then + cfdi.Impuestos(ObjCFDITimbre.TotalImpuestosRetenidos, ObjCFDITimbre.TotalImpuestosTrasladados) + End If +#End Region +#Region " Traslados y Retenciones" + + + If ObjCFDITimbre.Retenciones.Sum(Function(x) x.Importe) > 0 Then + ''se acumulan los importes + For Each Ret In ObjCFDITimbre.Retenciones + cfdi.Retencion(Ret.Impuesto, Ret.Importe) + Next + End If + + ''se acumulan los importes + For Each Tras In ObjCFDITimbre.Traslados + cfdi.Traslado(Tras.Base, Tras.Impuesto, Tras.TipoFactor, Tras.TasaOCuota, Tras.Importe) + Next +#End Region + +#Region "Impuestos Locales" + + If ObjCFDITimbre.RetencionesLocales.Sum(Function(x) x.Importe) > 0 OrElse ObjCFDITimbre.TrasladosLocales.Sum(Function(x) x.Importe) > 0 Then + + cfdi.ImpuestosLocales(ObjCFDITimbre.RetencionesLocales.Sum(Function(x) x.Importe), ObjCFDITimbre.TrasladosLocales.Sum(Function(x) x.Importe)) + + For Each ret As CFDIRetencionesLocales In ObjCFDITimbre.RetencionesLocales + If ret.Importe > 0 Then + cfdi.RetencionLocal(ret.ImpuestoLocalRetenido, ret.TasaRetencion, ret.Importe) + End If + Next + + For Each ret As CFDITrasladosLocales In ObjCFDITimbre.TrasladosLocales + If ret.Importe > 0 Then + cfdi.TrasladoLocal(ret.ImpuestoLocalTraslado, ret.TasaTraslado, ret.Importe) + End If + Next + End If + + 'If Ventas.CveComplementoTimbrado > 0 Then + + ' Select Case Ventas.CveComplementoTimbrado + ' Case 5 'INE Proceso Ordinario Directivo Estatal" + ' cfdi.Ine11("Ordinario", "Directivo Estatal", "0") + + ' cfdi.IneEntidad(Ventas.ComplementoINE.INEEntidad, "") + ' cfdi.IneContabilidad(Ventas.ComplementoINE.INEIdContabilidad) + ' Case 6 'INE Proceso Ordinario Ejecutivo Estatal" + ' cfdi.Ine11("Ordinario", "Ejecutivo Estatal", "0") + + ' cfdi.IneEntidad(Ventas.ComplementoINE.INEEntidad, "") + ' cfdi.IneContabilidad(Ventas.ComplementoINE.INEIdContabilidad) + ' Case 7 'INE Proceso Ordinario Ejecutivo Nacional" + + ' cfdi.Ine11("Ordinario", "Ejecutivo Nacional", Ventas.ComplementoINE.INEIdContabilidad.ToString) + ' Case 8 'INE PreCampaña + ' cfdi.Ine11(Ventas.ComplementoINE.INETipoProceso, "", "0") + + ' cfdi.IneEntidad(Ventas.ComplementoINE.INEEntidad, Ventas.ComplementoINE.INETipoComite) + ' cfdi.IneContabilidad(Ventas.ComplementoINE.INEIdContabilidad) + ' End Select + + 'End If + + + +#End Region + + +#Region "Comercio Exterior" + + 'If Ventas.Cliente.AplicaComercioExterior And ObjCFDITimbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto Then + ' If ObjCFDITimbre.Complementos.ComercioExterior11 IsNot Nothing Then + + ' 'DATOS GENERALES + ' cfdi.ComercioExterior11(ObjCFDITimbre.Complementos.ComercioExterior11.MotivoTraslado, + ' ObjCFDITimbre.Complementos.ComercioExterior11.TipoOperacion, + ' ObjCFDITimbre.Complementos.ComercioExterior11.ClavedePedimento, + ' ObjCFDITimbre.Complementos.ComercioExterior11.CertificadoOrigen, + ' ObjCFDITimbre.Complementos.ComercioExterior11.NumCertificadoOrigen, + ' ObjCFDITimbre.Complementos.ComercioExterior11.NumeroExportadorConfiable, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Incoterm, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Subdivision, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Observaciones, + ' ObjCFDITimbre.Complementos.ComercioExterior11.TipoCambioUSD, + ' ObjCFDITimbre.Complementos.ComercioExterior11.TotalUSD) + ' 'EMISOR + ' cfdi.ComercioExterior11Emisor(If(EmisorRFC.Length >= 12, "", ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CURP)) + ' cfdi.ComercioExterior11Domicilio(ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Calle, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroExterior, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroInterior, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Colonia, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Localidad, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Referencia, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Municipio, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Estado, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Pais, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CP) + ' 'RECEPTOR + ' cfdi.ComercioExterior11Receptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib) + ' cfdi.ComercioExterior11DomicilioReceptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Calle, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroExterior, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroInterior, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Colonia, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Localidad, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Referencia, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Municipio, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Estado, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Pais, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.CP) + ' cfdi.ComercioExterior11Destinatario(ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumRegIdTrib, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Nombre, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Calle, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumeroExterior, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumeroInterior, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Colonia, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Localidad, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Referencia, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Municipio, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Estado, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Pais, + ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.CP) + ' 'MERCANCIAS + ' If ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias IsNot Nothing AndAlso ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias.Count > 0 Then + ' For Each concep As CFDIComercioExterior11Mercancias In ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias + ' cfdi.ComercioExterior11Mercancia(concep.NoIdentificacion, concep.FraccionArancelaria, concep.CantidadAduana, concep.UnidadAduana, concep.ValorUnitarioAduana, concep.ValorDolares) + ' If concep.DescripcionesEspecificas.Marca <> "" Then + ' cfdi.ComercioExterior11MercanciaDescripcionesEspeciales(concep.DescripcionesEspecificas.Marca, + ' concep.DescripcionesEspecificas.Modelo, + ' concep.DescripcionesEspecificas.SubModelo, + ' concep.DescripcionesEspecificas.NumeroSerie) + ' End If + ' Next + + ' End If + + + ' End If + 'End If + +#End Region + + + 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 + + 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 CFDICartaPorteUbicacion In Carta.Ubicaciones + 'origen + cfdi.CartaPorteUbicacion(ubica.TipoUbicacion, ubica.IDUbicacion, ubica.RFCRemitenteDestinatario, ubica.NombreRemitenteDestinatario, ubica.NumRegIdTrib, ubica.ResidenciaFiscal, ubica.NumEstacion, ubica.NombreEstacion, ubica.NavegacionTrafico, ubica.FechaHoraSalidaLlegada, ubica.TipoEstacion, ubica.DistanciaRecorrida) + 'cfdi.CartaPorteOrigen(ubica.Origen.IDOrigen, ubica.Origen.RFCRemitente, ubica.Origen.NombreRemitente, ubica.NumRegIdTrib, ubica.Origen.ResidenciaFiscal, ubica.Origen.NumEstacion, ubica.Origen.NombreEstacion, ubica.Origen.NavegacionTrafico, ubica.Origen.FechaHoraSalida) + cfdi.CartaPorteDomicilio(ubica.Domicilio.Calle, ubica.Domicilio.NumeroExterior, ubica.Domicilio.NumeroInterior, ubica.Domicilio.Colonia, ubica.Domicilio.Localidad, ubica.Domicilio.Referencia, ubica.Domicilio.Municipio, ubica.Domicilio.Estado, ubica.Domicilio.Pais, ubica.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, If(concep.ClaveMaterialPeligroso <> "", concep.Embalaje, ""), concep.DescripEmbalaje, concep.PesoenKg, concep.ValorMercancia, concep.Moneda, concep.FraccionArrancelaria, concep.UUIDComercioExt) + For Each transp In concep.MercanciasCantidadTransporta + cfdi.CartaPorteCantidadTransporta(transp.Cantidad, transp.IDOrigen, transp.IDDestino, transp.CvesTransportes) + Next + Next + End If + End If + ' + If Carta.FiguraTransporte IsNot Nothing Then + + If Carta.FiguraTransporte.AutoTransporte IsNot Nothing Then + + cfdi.CartaPorteAutotransporte(Carta.FiguraTransporte.AutoTransporte.PermisoSCT, Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT) + + cfdi.CartaPorteIdentificacionVehicular(Carta.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular, Carta.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM, Carta.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM) + + cfdi.CartaPorteSeguros(Carta.FiguraTransporte.AutoTransporte.NombreSeguroResponsabilidadCivil, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroResponsabilidadCivil, + Carta.FiguraTransporte.AutoTransporte.NombreSeguroMedioAmbiente, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroMedioAmbiente, + Carta.FiguraTransporte.AutoTransporte.NombreSeguroCarga, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroCarga, + Carta.FiguraTransporte.AutoTransporte.PrimaSeguro) + + If Carta.FiguraTransporte.AutoTransporte.Remolques IsNot Nothing AndAlso Carta.FiguraTransporte.AutoTransporte.Remolques.Count > 0 Then + For Each concep As CFDICartaPorteRemolque In Carta.FiguraTransporte.AutoTransporte.Remolques + cfdi.CartaPorteRemolque(concep.SubTipoRemolque, concep.Placa) + Next + + End If + End If + + If Carta.FiguraTransporte.Operadores IsNot Nothing AndAlso Carta.FiguraTransporte.Operadores.Count > 0 Then + For Each concep As CFDICartaPorteOperador In Carta.FiguraTransporte.Operadores + cfdi.CartaPorteTiposFigura(concep.TipoFigura, concep.RFCFigura, concep.NumLicencia, concep.NombreFigura, concep.NumRegidTribFigura, If(concep.ResidenciaFiscalFigura <> "MEX", concep.ResidenciaFiscalFigura, "")) + If concep.TipoFigura.Contiene("02", "03") Then ' “02”- Propietario o “03” -Arrendador + cfdi.CartaPortePartesTransporte("PT01") + cfdi.CartaPortePartesTransporteDomicilio(concep.Domicilio.Calle, concep.Domicilio.NumeroExterior, concep.Domicilio.NumeroInterior, concep.Domicilio.Colonia, concep.Domicilio.Localidad, concep.Domicilio.Referencia, concep.Domicilio.Municipio, concep.Domicilio.Estado, concep.Domicilio.Pais, concep.Domicilio.CP) + End If + Next + End If + + End If + + End If + + +#End Region + + +#Region "Complemento Pago" + + If ObjCFDITimbre.Comprobante.TipoComprobante = "P" Then + + cfdi.Pago(ObjCFDITimbre.ComplementoPagos.FechaPago.ToString("yyyy-MM-ddTHH:mm:ss"), + ObjCFDITimbre.ComplementoPagos.FormaDePagoP, + ObjCFDITimbre.ComplementoPagos.MonedaP, + ObjCFDITimbre.ComplementoPagos.TipoCambioP, + ObjCFDITimbre.ComplementoPagos.Monto, + ObjCFDITimbre.ComplementoPagos.NumOperacion, + ObjCFDITimbre.ComplementoPagos.RfcEmisorCtaOrd, + ObjCFDITimbre.ComplementoPagos.NomBancoOrdExt, + ObjCFDITimbre.ComplementoPagos.CtaOrdenante, + ObjCFDITimbre.ComplementoPagos.RfcEmisorCtaBen, + ObjCFDITimbre.ComplementoPagos.CtaBeneficiario, + ObjCFDITimbre.ComplementoPagos.TipoCadPago, + ObjCFDITimbre.ComplementoPagos.CertPago, + ObjCFDITimbre.ComplementoPagos.CadPago, + ObjCFDITimbre.ComplementoPagos.SelloPago) + + + If ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados.Count > 0 Then + + + For Each doc As CFDIComplementoPagosDocsRelacionados In ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados + cfdi.PagoDoctoRelacionado(doc.IdDocumento, + doc.Serie, + doc.Folio, + doc.MonedaDR, + doc.TipoCambioDR, + doc.MetodoDePagoDR, + doc.NumParcialidad, + doc.ImpSaldoAnt, + doc.ImpPagado, + doc.ImpSaldoInsoluto) + + Next + + 'Estos impuestos aplicarían para anticipos + If ObjCFDITimbre.ComplementoPagos.TotalImpuestosRetenidos > 0 OrElse ObjCFDITimbre.ComplementoPagos.TotalImpuestosTrasladados > 0 Then + + cfdi.PagoImpuestos(ObjCFDITimbre.ComplementoPagos.TotalImpuestosRetenidos, ObjCFDITimbre.ComplementoPagos.TotalImpuestosTrasladados) + If (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then + For Each Ret As CFDIConceptosImpuestos In (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "R") + cfdi.PagoRetencion(Ret.Impuesto, Ret.Importe) + Next + End If + If (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then + For Each Tra As CFDIConceptosImpuestos In (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "T") + cfdi.PagoTraslado(Tra.Impuesto, Tra.TipoFactor, Tra.TasaOCuota, Tra.Importe) + Next + End If + + End If + + + + End If + + End If +#End Region + + + +#Region "Nomina12" + If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then + + 'cfdi.Esquema.AgregarEsquema("http://www.sat.gob.mx/nomina12 http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina12.xsd") + cfdi.Nomina12(ObjCFDITimbre.Nomina.TipoNomina, ObjCFDITimbre.Nomina.FechaPago.ToString("yyyy-MM-dd"), ObjCFDITimbre.Nomina.FechaInicio.ToDate().ToString("yyyy-MM-dd"), ObjCFDITimbre.Nomina.FechaFin.ToDate().ToString("yyyy-MM-dd"), ObjCFDITimbre.Nomina.NumDiasPagados, If(ObjCFDITimbre.Nomina.Percepciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Percepciones.Count > 0, ObjCFDITimbre.Nomina.TotalPercepciones, 0), If(ObjCFDITimbre.Nomina.Deducciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Deducciones.Count > 0, ObjCFDITimbre.Nomina.TotalDeducciones, 0), If(ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing AndAlso ObjCFDITimbre.Nomina.OtrosPagos.Count > 0, ObjCFDITimbre.Nomina.TotalOtrosPagos, 0)) + + cfdi.Nomina12Emisor(ObjCFDITimbre.Emisor.CURP, If(ObjCFDITimbre.Nomina.Receptor.TipoContrato.Contiene("09", "10", "99"), "", ObjCFDITimbre.Emisor.RegistroPatronal), ObjCFDITimbre.Emisor.RFC) + + If UsuarioActual.Empresa.UsaAC Then cfdi.Nomina12EntidadSNCF("IF", 90) + + +#Region "Receptor" + + cfdi.Nomina12Receptor(ObjCFDITimbre.Nomina.Receptor.CURP, + ObjCFDITimbre.Nomina.Receptor.NSS, + ObjCFDITimbre.Nomina.Receptor.FechaInicioContrato.ToDate().ToString("yyyy-MM-dd"), + ObjCFDITimbre.Nomina.Receptor.Antiguedad, + ObjCFDITimbre.Nomina.Receptor.TipoContrato, + ObjCFDITimbre.Nomina.Receptor.Sindicalizado, + ObjCFDITimbre.Nomina.Receptor.CodigoTipoJornada, + ObjCFDITimbre.Nomina.Receptor.CodigoRegimenContratacion, + ObjCFDITimbre.Nomina.Receptor.CodigoEmpleado, + ObjCFDITimbre.Nomina.Receptor.Departamento, + ObjCFDITimbre.Nomina.Receptor.Puesto, + ObjCFDITimbre.Nomina.Receptor.CodigoRiesgoPuesto, + If(ObjCFDITimbre.Nomina.TipoNomina = "E", "99", ObjCFDITimbre.Nomina.Receptor.TipoPeriodo), + ObjCFDITimbre.Nomina.Receptor.CodigoBanco, + ObjCFDITimbre.Nomina.Receptor.NumeroCuenta, + ObjCFDITimbre.Nomina.Receptor.SBC, + ObjCFDITimbre.Nomina.Receptor.SDI, + ObjCFDITimbre.Nomina.Receptor.CodigoEntidadFederativa) + 'cfdi.Nomina12SubContratacion("", "0") + 'cfdi.agregarNominaPercepcionesPercepcionAccionesOTitulos12("100", "200"); + 'cfdi.agregarNominaPercepcionesSeparacionIndemnizacion12("100", "10", "1000", "100", "50"); + 'cfdi.agregarNominaPercepcionesJubilacionPensionRetiro12("50", "100", "10", "100", "0"); + + + End If +#End Region + If ObjCFDITimbre.Nomina IsNot Nothing Then + 'If cfdi.Nomina12SeparacionIndemnizacion Then + If ObjCFDITimbre.Nomina.Percepciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Percepciones.Count > 0 Then + cfdi.Nomina12Percepciones(ObjCFDITimbre.Nomina.TotalSueldos, ObjCFDITimbre.Nomina.TotalIndemnizacion, ObjCFDITimbre.Nomina.TotalJubilacion, ObjCFDITimbre.Nomina.TotalPercepcionesGravado, ObjCFDITimbre.Nomina.TotalPercepcionesExento) + For Each percep As CFDINominaPercepciones In ObjCFDITimbre.Nomina.Percepciones + cfdi.Nomina12Percepcion(percep.TipoPercepcion, percep.Clave, percep.Concepto, Math.Round(percep.ImporteGravado, 2), Math.Round(percep.ImporteExento, 2)) + If percep.TipoPercepcion.ToEntero() = 19 Then + + If ObjCFDITimbre.Nomina.HorasExtras IsNot Nothing AndAlso ObjCFDITimbre.Nomina.HorasExtras.Count > 0 Then + For Each HoraExtra As CFDINominaHorasExtras In ObjCFDITimbre.Nomina.HorasExtras + cfdi.Nomina12HorasExtra(HoraExtra.Dias.ToEntero, HoraExtra.TipoHoras, HoraExtra.HorasExtra, HoraExtra.ImportePagado) + Next + End If + End If + Next + End If + + If ObjCFDITimbre.IStimbreFiniquito Then + 'ObjCFDITimbre.Nomina. + Dim UltimoSueldoOrdinario As Double = ObjCFDITimbre.Nomina.UltimoSueldoOrdinario.ToString().ToDouble() + Dim TotalIndemnizacion As Double = ObjCFDITimbre.Nomina.TotalIndemnizacion + Dim t1 As Double = If(UltimoSueldoOrdinario < TotalIndemnizacion, UltimoSueldoOrdinario, TotalIndemnizacion) + Dim t2 As Double = If(UltimoSueldoOrdinario < TotalIndemnizacion, TotalIndemnizacion, UltimoSueldoOrdinario) + cfdi.Nomina12SeparacionIndemnizacion(TotalIndemnizacion, ObjCFDITimbre.Nomina.Antiguedad, UltimoSueldoOrdinario, t1, t2 - t1) + + End If + 'deducciones al final + If ObjCFDITimbre.Nomina.Deducciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Deducciones.Count > 0 Then + cfdi.Nomina12Deducciones(ObjCFDITimbre.Nomina.TotalDeduccionesOtras, Math.Round(ObjCFDITimbre.Nomina.TotalDeduccionesImpuestosRetenidos, 2)) + For Each deduc As CFDINominaDeducciones In ObjCFDITimbre.Nomina.Deducciones + cfdi.Nomina12Deduccion(deduc.TipoDeduccion, deduc.Clave, deduc.Concepto, Math.Round(deduc.Importe, 2)) + Next + End If + If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing Then + ' cfdi.agregarNominaOtrosPagosOtroPago12("002", "002", "Subsidio", "10.00"); + ' cfdi.agregarNominaOtrosPagosOtroPagoSubsidioAlEmpleo12("10.00"); + If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing AndAlso ObjCFDITimbre.Nomina.OtrosPagos.Count > 0 Then + For Each otpag As CFDINominaOtrosPagos In ObjCFDITimbre.Nomina.OtrosPagos + cfdi.Nomina12OtroPago(otpag.TipoOtroPago, otpag.Clave, otpag.Concepto, otpag.Importe) + If otpag.TipoOtroPago = "002" Then + cfdi.Nomina12SubsidioAlEmpleo(otpag.Subsidiocausado) + End If + + If otpag.TipoOtroPago = "004" AndAlso otpag.Importe > 0 Then + If otpag.ejercicio > 0 Then + cfdi.CompensacionSaldosAFavor(otpag.SaldoAFavor, otpag.ejercicio, otpag.RemanenteSalFav) 'otpag.SaldoAFavor + End If + End If + + Next + End If + End If + If ObjCFDITimbre.Nomina.Incapacidades IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Incapacidades.Count > 0 Then + For Each Incap As CFDINominaIncapacidades In ObjCFDITimbre.Nomina.Incapacidades + cfdi.Nomina12Incapacidad(Incap.DiasIncapacidad.ToEntero, Incap.TipoIncapacidad, Incap.Importe) + Next + End If + End If +#End Region + + sw.Stop() + swTiempo.AppendFormat("Armado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds) + swmili = sw.ElapsedMilliseconds + sw.Start() +#Region "Genera XML" + Dim ArchivoGenerado As Boolean = False + Try + cfdi.GenerarXMLB64(llaveBase64, Clave) + ArchivoGenerado = True + Catch ex As Exception + Retorno = cfdi.Mensaje + If Retorno = "" OrElse IsNothing(Retorno) Then + Retorno = $"llaveBase64 ={llaveBase64}
Clave ={Clave}
{ex.ToString()}" + End If + MensajeErrorCFDI = Retorno + End Try + +#End Region + sw.Stop() + swTiempo.AppendFormat("Genera: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds) + swmili = sw.ElapsedMilliseconds + sw.Start() + +#Region "Timbra" + If ArchivoGenerado Then + + cfdi.TimbrarCfdi(UsuarioServicio, ClaveServicio, UrlServicio, TimbraProduccion) + + sw.Stop() + swTiempo.AppendFormat("Timbrado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds) + swmili = sw.ElapsedMilliseconds + sw.Start() + 'Verifica el error + If cfdi.Mensaje = "" Then + + Dim FolioFiscal As String + + UUID = cfdi.CfdiInfo.UUID + FolioFiscal = cfdi.CfdiInfo.UUID 'obtenerAtributo(cfdi.XmlTimbrado, "TimbreFiscalDigital", "UUID") 'XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText + + If FolioFiscal <> "" Then + + cfdi.EscribirXml(RutaArchivo & NombreArchivoXML & ".xml") + + sw.Stop() + swTiempo.AppendFormat("Guardado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds) + swmili = sw.ElapsedMilliseconds + sw.Start() + + Select Case ObjCFDITimbre.Comprobante.TipoComprobante + Case "N" + + Using ObjNomina2 As New ClsNominas() + + If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0, isFiniquito:=Ventas.Timbre.IStimbreFiniquito) Then + Retorno = "" + Else + Retorno = "Error" + End If + End Using + + Case "T" + + Dim objGrales As New ClsGenerales + If objGrales.UpdateTimbreTimbrado(Ventas.CveTimbre, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.CvePAC) Then + Retorno = "" + Else + Retorno = "Error" + End If + objGrales.Dispose() + + Using ObjInv As New ClsInventarios() + If ObjInv.UpdateMovimientoTimbrado(Ventas.Inv_CveMovimiento, 1, FolioFiscal, MinFecha) Then + Retorno = "" + Else + Retorno = "Error" + End If + End Using + + + Case Else + + 'Actualiza Estatus Factura + If Ventas.CveVenta > 0 Then + + Using ObjVentas As New ClsVentas() + + If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=CvePACEspecial, RFCReceptor:=ObjCFDITimbre.Receptor.RFC) Then + Retorno = "" + Else + Retorno = "Error" + End If + End Using + + 'Genero la addenda Ford + If 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)) + + Dim FolioFactura As String = "" + If UsuarioActual.CveEmpresa = 8 Then FolioFactura = Ventas.Folio.ToString ' sogo, pordefault manda el folio de la factura + GeneraAddendaFord(RutaCadena, FolioFactura, Ventas.FordASN, Ventas.FordGSDB) + + End If + + End If + End Select + + + If Not IO.Directory.Exists($"{UsuarioActual.Empresa.Ruta}CBB\") Then IO.Directory.CreateDirectory($"{UsuarioActual.Empresa.Ruta}CBB\") + + Try + Dim RutaCBB As String = $"{UsuarioActual.Empresa.Ruta}CBB\{ObjCFDITimbre.Comprobante.SerieFolio}.jpg" + 'temp + 'Dim b As Byte() = cfdi. .QrCode($"?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}") + 'File.WriteAllBytes(RutaCBB, b) + Catch ex As Exception + OnError("Ocurrió un error al generar el QR", ex) + End Try + Retorno = "" + Else + Retorno = "No se pudo timbrar ante el SAT. UUID no generado." + End If + sw.Stop() + swTiempo.AppendFormat("Actualizado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds) + swmili = sw.ElapsedMilliseconds + sw.Start() + + Else + Retorno = cfdi.Mensaje + MensajeErrorCFDI = cfdi.Mensaje + If cfdi.Xml <> "" Then cfdi.EscribirXml(RutaArchivo & NombreArchivoXML & ".xml") + + End If + End If + +#End Region + GuardaLogTimbrado(swTiempo.ToString, CvePACEspecial) + Return Retorno + End Function + +#End Region + Public Class PADEServicioTimbradoResp diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index ea531cdb6..291b351fa 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1118,7 +1118,7 @@ Partial Class Compras_Compras CargaDatosAgregarPS() TieneAnticiposXML = False Modalidad = "" - Version = "3.3" + Version = "4.0" CveMetodoPago = -1 RFCProv = "" CargaDdlTipoGasto() @@ -1638,7 +1638,7 @@ Partial Class Compras_Compras End Sub Private Sub ValidaIVA() - If Version <> "3.3" And CveCompra <= 0 Then + If (Version <> "3.3" And Version <> "4.0") And CveCompra <= 0 Then Dim ImporteIVAXML As Double = (TxtSubTotal.Text.Trim.ToDouble - TxtDescuento.Text.Trim.ToDouble - TxtIEPS.Text.Trim.ToDouble) * 0.16 If Math.Abs(TxtIVA.Text.Trim.ToDouble - ImporteIVAXML) >= 1 Then Alert("El IVA del CFDi no tiene un comportamiento normal, por favor verifique que sea correcto.

NOTA: Esta advertencia no aplica en casos de conceptos(alimentos, combustibles o servicios de comunicación) exentos de IVA o causantes de IEPS.", TipoMensaje.MsgAdvertencia) @@ -1743,15 +1743,29 @@ Partial Class Compras_Compras CargaComprobanteXML(XMLDoc) - If NuevaValidacionXML = 1 Or Version = "3.3" Then + If NuevaValidacionXML = 1 Or (Version = "3.3" Or Version = "4.0") Then Dim Xml As New StringBuilder Dim nodo As XmlNode = XMLDoc.DocumentElement Dim Version = ValorXML(nodo, "version") + + Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) - Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3" + Dim cfdVer As String = "" Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) - If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2" + + If Version = "3.2" Then + Prefijo = "cfd" + cfdVer = "http://www.sat.gob.mx/cfd/2" + ElseIf Version = "3.3" Then + cfdVer = "http://www.sat.gob.mx/cfd/3" + + Else ' se considera que es la version 4.0 + cfdVer = "http://www.sat.gob.mx/cfd/4" + End If + + 'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2" + namespaces.AddNamespace(Prefijo, cfdVer) namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal") @@ -1759,7 +1773,8 @@ Partial Class Compras_Compras Dim nodeconceptos As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Conceptos", Prefijo), namespaces) - Xml.Append(Replace(Replace(Replace(nodeconceptos.OuterXml, " "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2" + Dim nodo As XmlNode = XMLDoc.DocumentElement + Dim VersionCFDI As String = ValorXML(nodo, "version") + + Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) + Dim cfdVer As String = "" + + If VersionCFDI = "3.2" Then + Prefijo = "cfd" + cfdVer = "http://www.sat.gob.mx/cfd/2" + ElseIf VersionCFDI = "3.3" Then + cfdVer = "http://www.sat.gob.mx/cfd/3" + + Else ' se considera que es la version 4.0 + cfdVer = "http://www.sat.gob.mx/cfd/4" + End If + namespaces.AddNamespace(Prefijo, cfdVer) namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal") @@ -3714,7 +3743,7 @@ Partial Class Compras_Compras 'Alert(ValorXML(node, "ClaveProdServ").Trim) - If Version = "3.3" Then + If Version = "3.3" Or Version = "4.0" Then If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then 'OBTENER TRASLADOS POR DETALLES Dim ContadorTraslado = 0 @@ -5171,7 +5200,7 @@ Partial Class Compras_Compras End If 'ACTUALIZAR PRODUCTO/SERVICIO SAT - If Version = "3.3" Then + If Version = "3.3" Or Version = "4.0" Then If Row("CveSATPSActualizado").ToString().ToEntero() = 1 Then If Not ObjProductosServicios.UpdateProductosServiciosSAT(Row("CvePS").ToString().ToEntero(), Row("CveSATPS").ToString().ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then ErrorSATPS = True @@ -10833,7 +10862,7 @@ Partial Class Compras_Compras - If Version = "3.3" Then + If Version = "3.3" Or Version = "4.0" Then Dim drm As DataRow = GlobalDTVtaMetodoPago.FiltroPrimero(String.Format("ClaveMetodoPagoSAT = '{0}'", ValorXML(nodo, "MetodoPago"))) If drm IsNot Nothing Then CveMetodoPago = drm("CveMetodoPago").ToString.ToEntero @@ -10842,11 +10871,28 @@ Partial Class Compras_Compras End If - Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) - Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3" Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) - If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2" + + + + + Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) + Dim cfdVer As String = "" + + If Version = "3.2" Then + Prefijo = "cfd" + cfdVer = "http://www.sat.gob.mx/cfd/2" + ElseIf Version = "3.3" Then + cfdVer = "http://www.sat.gob.mx/cfd/3" + + Else ' se considera que es la version 4.0 + cfdVer = "http://www.sat.gob.mx/cfd/4" + End If + + + + 'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2" namespaces.AddNamespace(Prefijo, cfdVer) namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal") @@ -10889,7 +10935,7 @@ Partial Class Compras_Compras TotalRetenciones = ValorXML(node, "totalImpuestosRetenidos", "0").ToDecimal - If Version = "3.3" Then + If Version = "3.3" Or Version = "4.0" Then For Each retencion As XmlNode In nodeRetenciones If retencion.Attributes("Impuesto").Value = "002" Then @@ -10920,7 +10966,7 @@ Partial Class Compras_Compras TotalTraslados = ValorXML(node, "totalImpuestosTrasladados", "0").ToDecimal Dim nodeTraslados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Impuestos/{0}:Traslados/{0}:Traslado", Prefijo), namespaces) - If Version = "3.3" Then + If Version = "3.3" Or Version = "4.0" Then For Each traslado As XmlNode In nodeTraslados If traslado.Attributes("Impuesto").Value = "002" Then @@ -15639,7 +15685,7 @@ Partial Class Compras_Compras e.Row.FCLabel("LbEstatusInv").Text = "NA" End If - If Version = "3.3" Then + If Version = "3.3" Or Version = "4.0" Then CargaPSSAT(e.Row.FCDropDownLost("DdlSATPS")) If e.Row.DBCampo("CveSATPS").ToEntero > 0 Then e.Row.FCDropDownLost("DdlSATPS").SelectedValue = e.Row.DBCampo("CveSATPS") @@ -18305,7 +18351,7 @@ Partial Class Compras_Compras Row("Consec") = TmpDT.Rows.Count + 1 End If - If Version = "3.3" And CveSATPS > 0 Then + If (Version = "3.3" Or Version = "4.0") And CveSATPS > 0 Then Dim DrPSSAT As DataRow = Nothing If CargaXml Then DrPSSAT = GlobalDTPSATPS("-1", CveSATPS.ToString).FiltroPrimero("") @@ -18362,7 +18408,7 @@ Partial Class Compras_Compras Row("NoDeducible") = NoDeducible Row("PU") = Math.Round(PU, DecimalesPermitidos) - If CargaXml And Version = "3.3" Then + If CargaXml And (Version = "3.3" Or Version = "4.0") Then Row("IVA") = Math.Round(IVA, DecimalesPermitidos) Row("IVAPorcentaje") = PorcentajeIVA Row("RetIVA") = Math.Round(RetIVA, DecimalesPermitidos) diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index c6f5f8713..d660ba9ab 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -14,6 +14,8 @@ Imports Stimulsoft.Report.Components Imports Stimulsoft.Report.Dictionary Imports Stimulsoft.Report.Web Imports Newtonsoft.Json.Linq +Imports System +Imports Microsoft.VisualBasic Partial Class PopUpVerFactura Inherits ClsPaginas @@ -4166,6 +4168,11 @@ Partial Class PopUpVerFactura 'ImprimirPDF(String.Format("Empresas/{0}/Formatos/Salidas.rdlc", 72), DtMovimientos, params, "ReporteSalidas", RDSName:="DsInventarios") ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/Salidas.rdlc", DtMovimientos, params, String.Format("Salida de Almacen - {0}", Folio.ToString), RDSName:="DsInventarios") Else + If UsuarioActual.CveEmpresa = 140 Then + params.Add(New ReportParameter("Concepto", ConceptoReporte)) + params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) + params.Add(New ReportParameter("UsuarioRegistro", UsuarioRegistro)) + End If params.Add(New ReportParameter("Folio", Folio)) params.Add(New ReportParameter("Fecha", Fecha)) params.Add(New ReportParameter("Almacen", Almacen)) @@ -4830,6 +4837,19 @@ Partial Class PopUpVerFactura Dim Titulo As String = "Acuse de cancelación de CFDI" Dim EstadoCFDI As String = "Cancelado" + + 'SI NO TIENE EL SELLO BUSCA OBTNERLO DE NUEVO + If String.IsNullOrEmpty(SelloCancelacion) Then + Dim ObjCancelacion As New Timbrado + If ObjCancelacion.ObtenerAcuse(CveVenta, UsuarioActual) Then + SelloCancelacion = ObjCancelacion.CancelacionAcuse + + If FechaCancelacion = Nothing OrElse FechaCancelacion = MinFecha Then + FechaCancelacion = ObjCancelacion.CancelacionFecha + End If + End If + End If + If CveEstatusFactura = 20 Then Titulo = "Acuse de solicitud de cancelación de CFDI" EstadoCFDI = "Vigente" diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index a1d01875f..bb3a00671 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -2845,6 +2845,8 @@ Partial Class Compras_eFacturas Dim XMLDoc As New XmlDocument Dim Archivo As String = String.Format("{0}Compras\{1}\{2}", UsuarioActual.Empresa.Ruta, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML")) + + Dim Prefijo As String = "" If IO.File.Exists(Archivo) Then @@ -2855,12 +2857,27 @@ Partial Class Compras_eFacturas XMLDoc.LoadXml(SXML) Dim Xml As New StringBuilder + + Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) - namespaces.AddNamespace(XMLDoc.DocumentElement.Prefix, "http://www.sat.gob.mx/cfd/3") + Dim RootDocumento As XmlElement = XMLDoc.DocumentElement + Dim VersionCFDI As String = ValorXML(RootDocumento, "version") + + If VersionCFDI = "3.3" Then + Prefijo = "pago10" + namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos") + namespaces.AddNamespace(XMLDoc.DocumentElement.Prefix, "http://www.sat.gob.mx/cfd/3") + ElseIf VersionCFDI = "4.0" Then + Prefijo = "pago20" + namespaces.AddNamespace("pago20", "http://www.sat.gob.mx/Pagos20") + namespaces.AddNamespace(XMLDoc.DocumentElement.Prefix, "http://www.sat.gob.mx/cfd/4") + End If + + namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") - ' namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos") + nodeComp = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", XMLDoc.DocumentElement.Prefix), namespaces) @@ -2868,20 +2885,20 @@ Partial Class Compras_eFacturas nodeTFD = nodeComp.SelectSingleNode(String.Format("//{0}:TimbreFiscalDigital", "tfd"), namespaces) - Dim PrefijoPagos As String = "" + 'Dim PrefijoPagos As String = "" - For Each nodoPrefijo As XmlNode In nodeComp.ChildNodes - If nodoPrefijo.Prefix <> "tfd" And nodoPrefijo.Prefix.ToUpper.Contains("PAGO") Then - PrefijoPagos = nodoPrefijo.Prefix - End If - Next + 'For Each nodoPrefijo As XmlNode In nodeComp.ChildNodes + ' If nodoPrefijo.Prefix <> "tfd" And nodoPrefijo.Prefix.ToUpper.Contains("PAGO") Then + ' PrefijoPagos = nodoPrefijo.Prefix + ' End If + 'Next - namespaces.AddNamespace(PrefijoPagos, "http://www.sat.gob.mx/Pagos") + 'namespaces.AddNamespace(PrefijoPagos, "http://www.sat.gob.mx/Pagos") nodeComp = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", XMLDoc.DocumentElement.Prefix), namespaces) - nodePagos = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos/{0}:Pago", PrefijoPagos), namespaces) - nodePagos2 = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos", PrefijoPagos), namespaces) + nodePagos = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos/{0}:Pago", Prefijo), namespaces) + nodePagos2 = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos", Prefijo), namespaces) @@ -2923,7 +2940,7 @@ Partial Class Compras_eFacturas Dim nodePagosN As XmlNodeList - nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", PrefijoPagos), namespaces) + nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", Prefijo), namespaces) For Each NodosPagos As XmlNode In nodePagosN @@ -2964,7 +2981,7 @@ Partial Class Compras_eFacturas MontoPago = Monto Dim ObjCompraFolios As New ClsCompras - If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace($"{PrefijoPagos}:", ""), UsuarioActual.CveEmpresa, OP:=If(CveComplementoPagoCompra > 0, 2, 1), CveFactura:=CveFacturaComplemento) Then + If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace($"{Prefijo}:", ""), UsuarioActual.CveEmpresa, OP:=If(CveComplementoPagoCompra > 0, 2, 1), CveFactura:=CveFacturaComplemento) Then ' '.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then If ObjCompraFolios.DtResultados.Rows.Count > 0 Then diff --git a/Contabilidad/RepBalanceGeneral.aspx.vb b/Contabilidad/RepBalanceGeneral.aspx.vb index 063f02588..4ca08cb36 100644 --- a/Contabilidad/RepBalanceGeneral.aspx.vb +++ b/Contabilidad/RepBalanceGeneral.aspx.vb @@ -1091,7 +1091,12 @@ Partial Class Contabilidad_RepBalanceGeneral 'parametros a enviar al reporte Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri)) + + 'LogoRuta = String.Format("file://{0}Formatos\Suc{1}.png", UsuarioActual.Empresa.Ruta, Vta.CveSucursal) + + Dim RutaLogo As String = String.Format("file://{0}Logo.png", UsuarioActual.Empresa.Ruta) + params.Add(New ReportParameter("pImg", RutaLogo)) + params.Add(New ReportParameter("pFirma1", "")) params.Add(New ReportParameter("pFirma2", "")) params.Add(New ReportParameter("pFechaFin", FechaF)) @@ -1125,7 +1130,10 @@ Partial Class Contabilidad_RepBalanceGeneral 'parametros a enviar al reporte Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri)) + + Dim RutaLogo As String = String.Format("file://{0}Logo.png", UsuarioActual.Empresa.Ruta) + params.Add(New ReportParameter("pImg", RutaLogo)) + 'params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri)) params.Add(New ReportParameter("pFechaFin", FechaF)) params.Add(New ReportParameter("pSubtotal", DdlSubtotales.SelectedValue.ToString)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) @@ -1148,7 +1156,9 @@ Partial Class Contabilidad_RepBalanceGeneral 'parametros a enviar al reporte Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri)) + Dim RutaLogo As String = String.Format("file://{0}Logo.png", UsuarioActual.Empresa.Ruta) + params.Add(New ReportParameter("pImg", RutaLogo)) + 'params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri)) params.Add(New ReportParameter("pFechaI", DdlEjercicio.SelectedValue)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) params.Add(New ReportParameter("FechaImpresion", Now.ToShortDateString)) diff --git a/Empresas/119/Formatos/RepIVAAcreditable.rpt b/Empresas/119/Formatos/RepIVAAcreditable.rpt index 7ba21b50b..ce9d8faf0 100644 Binary files a/Empresas/119/Formatos/RepIVAAcreditable.rpt and b/Empresas/119/Formatos/RepIVAAcreditable.rpt differ diff --git a/Empresas/140/Formatos/Factura.rdlc b/Empresas/140/Formatos/Factura.rdlc index f4d1e0625..7520029be 100644 --- a/Empresas/140/Formatos/Factura.rdlc +++ b/Empresas/140/Formatos/Factura.rdlc @@ -2,541 +2,6 @@ - - - - true - true - - - - - Serie: - - - - - - - - =Parameters!Serie.Value - - - - - - - - Folio: - - - - =Parameters!Folio.Value - - - - - - - Textbox81 - 0.36804in - 4.70028in - 0.18682in - 2.8585in - - - 2pt - 2pt - 2pt - 2pt - - - - Embedded - Logo - Fit - 0.23694in - 2.38455cm - 3.48217cm - 1 - - - - - - true - true - - - - - Cliente: - - - - =Parameters!ClienteCodigo.Value - - - - - - - - - =Parameters!ClienteNombre.Value - - - - - - - - - =Parameters!ClienteRFC.Value - - - - - - - - - Domicilio: - - - - =Parameters!ClienteDireccion.Value - - - - , - - - - =Parameters!ClienteCiudad.Value - - - - , - - - - =Parameters!ClienteEstado.Value - - - - - - - Textbox36 - 1.83775cm - 4.3204cm - 0.96667cm - 14.87889cm - 2 - - - 2pt - 2pt - 2pt - 2pt - - - - 3.08165cm - 0.635cm - 0cm - 18.56429cm - 3 - - - - - - true - true - - - - - POR ESTE - - - - PAGARÉ - - - - PROMETO(EMOS), Y ME (NOS) OBLIGO (AMOS) A PAGAR INCONDICIONALMENTE A LA ORDEN DE - - - - BDH BATERIAS DISTRIBUCIONES DE HERMOSILLO SA DE CV - - - - , EN LA CIUDAD DE HERMOSILLO, SONORA, O CUALQUIER OTRA CIUDAD QUE DESIGNE EL TITULAR DEL DOCUMENTO, LA CANTIDAD DE - - - - $ - - - - - - - - =Parameters!Total.Value - - - - *** - - - - SON - - - - =Microsoft.VisualBasic.Strings.UCase(Parameters!ImporteLetra.Value) - - - - *** VALOR QUE RECONOZCO (EMOS) ADEUDARLE OBLIGÁNDOME (NOS) A CUBRIR A SU VENCIMIENTO - - - - =Parameters!Vencimiento.Value - - - - , DE NO PAGARSE CAUSARÍA UN - - - - INTERÉS MORATORIO - - - - DEL 10% POR CIENTO MENSUAL, POR EL TIEMPO QUE PERMANEZCA INSOLUTO EL ADEUDO EXISTENTE, QUEDANDO EXPRESAMENTE CONVENIDO QUE LA FALTA DE PAGO OPORTUNO OCASIONA AL DEUDOR GASTOS DE COBRO JUDICIALES O EXTRAJUDICIALES Y LOS QUE SE OCASIONEN, RENUNCIANDO EL DEUDOR AL FUERO DE SU DOMICILIO QUE PUDIERA CORRESPONDERLE, ESTE PAGARÉ ES MERCANTIL Y ESTÁ PROTEGIDO POR LA LEY GENERAL DE TÍTULOS Y OPERACIONES DE CRÉDITO. - - - - - - - 8.35197cm - 6.8587cm - 0cm - 6.65396cm - 5 - - - - - - true - true - - - - - ACEPTO (AMOS) DE CONFORMIDAD - - - - - - - Textbox39 - 8.52836cm - 6.8587cm - 0.6cm - 6.65396cm - 6 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Obligado - - - - - - - Textbox38 - 6.90569cm - 6.8587cm - 0.67938cm - 6.65396cm - 7 - - - 2pt - 2pt - 2pt - 2pt - - - - - Start - - true - 7.49312in - 0.20879in - 3.59384in - 7.78795in - - =iif(Parameters!AplicaPagare.Value="0",True,False) - - - - - true true @@ -824,7 +289,6 @@ 4.36025cm 1.28875in 3.20861in - 1 @@ -1062,7 +526,7 @@ 0.05395in 1.21305in 8.22763in - 2 + 1 @@ -1131,7 +595,7 @@ 0.13011cm 2.1447cm 4.08234cm - 3 + 2 @@ -1432,7 +896,7 @@ 5.03983in 1.62345in 3.24175in - 4 + 3 @@ -1544,7 +1008,7 @@ 13.31398cm 1.42163cm 7.72123cm - 5 + 4 @@ -2203,7 +1667,7 @@ 0.05854in 0.34081in 8.22304in - 6 + 5 @@ -2229,7 +1693,7 @@ 0.14868cm 0.14316cm 20.88652cm - 7 + 6 @@ -2260,7 +1724,7 @@ 15.09838cm 0.14316cm 5.93682cm - 8 + 7 @@ -2297,7 +1761,7 @@ 2.30237in 0.18861in 5.97921in - 9 + 8 @@ -2327,7 +1791,7 @@ 0.13011cm 0.1cm 20.88652cm - 10 + 9 @@ -2358,7 +1822,7 @@ 0.18043cm 0.14316cm 20.85477cm - 11 + 10 @@ -2392,7 +1856,7 @@ 5.62203cm 0.34219cm 9.30316cm - 12 + 11 @@ -2510,7 +1974,7 @@ 15.09838cm 0.48004cm 5.93682cm - 13 + 12 @@ -3004,11 +2468,11 @@ true - 15.53176cm + 14.89676cm 0.13702cm 2.97096cm 20.89818cm - 14 + 13 =Microsoft.VisualBasic.Interaction.IIF(First(Fields!SerieFolio.Value, "DataSet4") <> "", False, True) @@ -3283,7 +2747,7 @@ 0.05854in 0.34081in 2.08542in - 15 + 14 @@ -3329,7 +2793,7 @@ 8.39473cm 1.07794cm 20.85477cm - 16 + 15 @@ -3348,7 +2812,7 @@ 0.15969cm 2.38455cm 3.48217cm - 17 + 16 @@ -3437,7 +2901,7 @@ 4.38884cm 2.05902cm 8.12128cm - 18 + 17 @@ -3449,11 +2913,11 @@ - 14.70114cm + 14.16139cm 14.38124cm 0cm 6.65396cm - 19 + 18 @@ -3480,11 +2944,11 @@ Textbox39 - 14.87753cm + 14.33778cm 14.38124cm - 0.6cm + 0.47784cm 6.65396cm - 20 + 19 @@ -3521,9 +2985,9 @@ Textbox38 13.25486cm 14.38124cm - 0.67938cm + 0.4148cm 6.65396cm - 21 + 20 @@ -3572,7 +3036,7 @@ 0.13011cm 1.21002cm 4.23014cm - 22 + 21 @@ -3583,8 +3047,587 @@ 2pt + + + + + 20.4cm + + + + + 5cm + + + + + + + true + true + + + + + Serie: + + + + + + + + =Parameters!Serie.Value + + + + + + + + Folio: + + + + =Parameters!Folio.Value + + + + + + + Textbox81 + 0.01788in + 4.70028in + 0.18682in + 2.8585in + + + 2pt + 2pt + 2pt + 2pt + + + + Embedded + Logo + Fit + 0.23694in + 1.40934cm + 2.57947cm + 1 + + + + + + true + true + + + + + + + + + Cliente: + + + + =Parameters!ClienteCodigo.Value + + + + - + + + + =Parameters!ClienteNombre.Value + + + + - + + + + =Parameters!ClienteRFC.Value + + + + + + + + + Domicilio: + + + + =Parameters!ClienteDireccion.Value + + + + , + + + + =Parameters!ClienteCiudad.Value + + + + , + + + + =Parameters!ClienteEstado.Value + + + + + + + Textbox36 + 0.55521cm + 3.35769cm + 0.85414cm + 14.87889cm + 2 + + + 2pt + 2pt + 2pt + 2pt + + + + 1.44462cm + 0cm + 20.4cm + 3 + + + + + + true + true + + + + + POR ESTE + + + + PAGARÉ + + + + PROMETO(EMOS), Y ME (NOS) OBLIGO (AMOS) A PAGAR INCONDICIONALMENTE A LA ORDEN DE + + + + BDH BATERIAS DISTRIBUCIONES DE HERMOSILLO SA DE CV + + + + , EN LA CIUDAD DE HERMOSILLO, SONORA, O CUALQUIER OTRA CIUDAD QUE DESIGNE EL TITULAR DEL DOCUMENTO, LA CANTIDAD DE + + + + $ + + + + + + + + =Parameters!Total.Value + + + + *** + + + + SON + + + + =Microsoft.VisualBasic.Strings.UCase(Parameters!ImporteLetra.Value) + + + + *** VALOR QUE RECONOZCO (EMOS) ADEUDARLE OBLIGÁNDOME (NOS) A CUBRIR A SU VENCIMIENTO + + + + =Parameters!Vencimiento.Value + + + + , DE NO PAGARSE CAUSARÍA UN + + + + INTERÉS MORATORIO + + + + DEL 10% POR CIENTO MENSUAL, POR EL TIEMPO QUE PERMANEZCA INSOLUTO EL ADEUDO EXISTENTE, QUEDANDO EXPRESAMENTE CONVENIDO QUE LA FALTA DE PAGO OPORTUNO OCASIONA AL DEUDOR GASTOS DE COBRO JUDICIALES O EXTRAJUDICIALES Y LOS QUE SE OCASIONEN, RENUNCIANDO EL DEUDOR AL FUERO DE SU DOMICILIO QUE PUDIERA CORRESPONDERLE, ESTE PAGARÉ ES MERCANTIL Y ESTÁ PROTEGIDO POR LA LEY GENERAL DE TÍTULOS Y OPERACIONES DE CRÉDITO. + + + + + + + 4.51022cm + 6.8587cm + 0cm + 6.65396cm + 5 + + + + + + true + true + + + + + ACEPTO (AMOS) DE CONFORMIDAD + + + + + + + Textbox39 + 4.43261cm + 6.8587cm + 0.46771cm + 6.65396cm + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Obligado + + + + + + + Textbox38 + 3.66719cm + 6.8587cm + 0.54709cm + 6.65396cm + 7 + + + 2pt + 2pt + 2pt + 2pt + + + + + Start + + true + + =iif(Parameters!AplicaPagare.Value="0",True,False) + + + + + + + + + + + + + + + + + + + + + + DsOC + 17.9352cm + 0.34808cm + 5cm + 20.4cm + 22 + + + 10pt + + - 28.16088cm + 22.9352cm @@ -3594,7 +3637,7 @@ 21.1673cm - 0.63499cm + 0.5327cm true true diff --git a/Empresas/140/Formatos/Salidas.rdlc b/Empresas/140/Formatos/Salidas.rdlc index 647555d66..781193cf7 100644 --- a/Empresas/140/Formatos/Salidas.rdlc +++ b/Empresas/140/Formatos/Salidas.rdlc @@ -253,12 +253,11 @@ - 0.69042cm + 0.47875cm - true true @@ -291,7 +290,6 @@ - true true @@ -323,7 +321,6 @@ - true true @@ -353,7 +350,6 @@ - true true @@ -383,7 +379,6 @@ - true true @@ -443,7 +438,7 @@ DsInventarios 0.17639cm 0.22456cm - 1.11096cm + 0.89929cm 20.39972cm - - - - - 2pt - 2pt - 2pt - 2pt - - true true @@ -629,15 +592,15 @@ - Textbox34 - 1.02789cm - 4.37211cm - 0.95277cm - 8.10916cm - 1 + 1.71608cm + 0.67239cm + 20.62428cm @@ -648,21 +611,6 @@ 2pt - - External - =Parameters!LogoPath.Value - FitProportional - 0.3175cm - 0.19987cm - 1.66316cm - 3.43141cm - 2 - - - - true true @@ -682,11 +630,11 @@ Textbox15 - 2.34504cm - 2.45652cm - 0.6cm - 9.54145cm - 3 + 2.68428cm + 10.74503cm + 0.56824cm + 9.56615cm + 1 @@ -711,11 +659,11 @@ Textbox18 - 3.11789cm - 2.43182cm + 3.42537cm + 10.74503cm 0.6cm - 9.54145cm - 4 + 9.56615cm + 2 @@ -743,11 +691,11 @@ Textbox16 - 3.097cm - 0.26872cm - 0.6cm + 3.43623cm + 8.61368cm + 0.57827cm 2.11724cm - 5 + 3 =IIF(Parameters!FacturadoA.Value = "", True, False) @@ -778,11 +726,11 @@ Textbox14 - 2.34504cm - 0.25631cm - 0.6cm + 2.68428cm + 8.60127cm + 0.56824cm 2.12965cm - 6 + 4 =IIF(Parameters!FacturaProveedor.Value = "", True, False) @@ -820,7 +768,7 @@ 13.63291cm 0.89103cm 4.09693cm - 7 + 5 @@ -856,7 +804,7 @@ 17.72984cm 0.9263cm 2.57165cm - 8 + 6 @@ -884,11 +832,11 @@ Textbox4 - 3.09701cm - 12.65424cm + 3.42537cm + 0.32995cm 0.59999cm 1.80326cm - 9 + 7 @@ -906,9 +854,11 @@ =Parameters!Almacen.Value - + @@ -941,7 +891,6 @@ =Parameters!Fecha.Value @@ -952,11 +901,11 @@ Textbox32 - 3.12876cm - 14.4575cm + 3.42537cm + 2.13321cm 0.58913cm - 5.9022cm - 11 + 6.43631cm + 9 @@ -984,11 +933,11 @@ Textbox3 - 2.34505cm - 12.65424cm - 0.59999cm + 2.70516cm + 0.32995cm + 0.54736cm 1.80326cm - 12 + 10 @@ -1018,11 +967,11 @@ Textbox3 - 1.27306cm + 1.20956cm 13.63291cm 0.47477cm 4.09693cm - 13 + 11 =IIF(Parameters!FolioRelacionado.Value = "",true,false) @@ -1055,11 +1004,11 @@ Textbox31 - 1.27306cm + 1.20956cm 17.72984cm 0.47477cm 2.57165cm - 14 + 12 =IIF(Parameters!FolioRelacionado.Value = "",true,false) @@ -1073,6 +1022,53 @@ 2pt + + Embedded + Logo2 + Fit + 0.1299in + 0.61281in + 1.32508in + 13 + + + + + + true + true + + + + + BDH BATERÍAS DISTRIBUCIONES DE HERMOSILLO S.A. DE C.V. + + + + + + + Textbox2 + 3.83674cm + 1.55733cm + 9.26108cm + 14 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + true + true + true + + + + + Sello Digital del CFDI: + + + + + + + + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + 5.15368in + 0.06752in + 1.41544in + 8.23953in + + + + + + + + + 0.54014in + + + 0.59111in + + + 0.80359in + + + 0.66404in + + + 2.60074in + + + 0.83102in + + + 0.6403in + + + 0.69088in + + + 0.80447in + + + + + 0.19645in + + + + + true + true + + + + + # Cant. + + + + + + + + 2pt + + + + 2pt + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Unidad + + + + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Clave Pr./Se + + + + + + + Textbox29 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Clave U. + + + + + + + Textbox2 + + + + + 2pt + + + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Nombre + + + + + + + Textbox17 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Precio + + + + + + + Textbox53 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Tasa IVA + + + + + + + Textbox21 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Descto. + + + + + + + Textbox23 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + SubTotal + + + + + + + Textbox1 + + + + Black + + 2pt + + + Black + + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.16561in + + + + + true + true + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!UM.Value + + + + + + + UM + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!SATClaveProdServ.Value + + + + + + + SATClaveProdServ + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!SATClaveUM.Value + + + + + + + SATClaveUM + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!PS.Value & IIF(Fields!Obs.Value <> "",System.Environment.NewLine &"Observaciones: ","") & Fields!Obs.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!PU.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!PorcentajeIVA.Value + + + + + + + PorcentajeIVA + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!Descuento.Value + + + + + + + Descuento1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + true + + + + + =Fields!Cantidad.Value * Fields!PU.Value + + + + + + + TiempoEntrega + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DsOC + 1.92778in + 0.09836in + 0.36206in + 8.16629in + 1 + + + + + + true + true + + + + + + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Observaciones.Value + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ELECTRICA SERVEC S DE RL DE CV + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Expedido en Sucursal: + + + + =Parameters!Sucursal.Value + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =UCase(Parameters!TipoDocumento.Value) + + + + + + + Textbox8 + 18.23008cm + 0.96018cm + 2.79101cm + 6 + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =IIF(Parameters!Serie.Value.ToString="",Parameters!Folio.Value,Parameters!Serie.Value & "-" &Parameters!Folio.Value) + + + + + + + Textbox8 + 0.97782cm + 18.23008cm + 0.6cm + 2.79101cm + 7 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha y Hora: + + + + + + + + + =Parameters!Fecha.Value + + + + + + + Textbox8 + 1.57782cm + 18.23008cm + 0.86903cm + 2.79101cm + 8 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + true + + + + + Folio Fiscal: + + + + =Parameters!FolioFiscal.Value + + + + + + + + + Fecha y hora de certificacion: + + + + =Parameters!FechaCertificacion.Value + + + + + + + + + No. de Serie del Certificado del SAT: + + + + =Parameters!SerieCertificadoSAT.Value + + + + + + + Textbox4 + 2.88607cm + 0.28014cm + 1.09007cm + 9.71199cm + 9 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + true + + + + + No. de Serie del Certificado del CSD: + + + + =Parameters!CertificadoContribuyente.Value + + + + + + + =Parameters!CiudadSucursal.Value + + + + + + + + =Parameters!Fecha.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteNombre.Value + + + + + + + + + + + =Parameters!ClienteColonia.Value + + + + + + + + =Parameters!ClienteCiudad.Value + + + + + + + + =Parameters!ClienteEstado.Value + + + + CP + + + + =Parameters!ClienteCP.Value + + + + + + + + =Parameters!ClientePais.Value + + + + + + + + + + + =Parameters!ClienteTelefono.Value + + + + + + + + =iif(Parameters!ClienteContactoMail.Value = "","","Correo: ") + + + + =Parameters!ClienteContactoMail.Value + + + + + + + =Parameters!ClienteRFC.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!CondicionPago.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + Black + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Ord. Compra: + + + + =Parameters!OrdenCompra.Value + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Tipo de Comprobante:I + + + + =UCase(Parameters!TipoDocumento.Value) + + + + ,Moneda: + + + + =Parameters!MonedaAbreviatura.Value + + + + , Uso de CFDI: + + + + =Parameters!UsoCFDI.Value + + + + , Forma de Pago: + + + + =Parameters!FormaPago.Value + + + + , Método de Pago: + + + + =IIF(Parameters!MetodoPago.Value.ToString="","No Identificado",Parameters!MetodoPago.Value) + + + + . + + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + Black + 2pt + 2pt + 2pt + 2pt + + + + + + + 2.88535cm + + + + + 0.48004cm + + + + + true + true + + + + + =Fields!Importe.Value + + + + + + + Importe + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + =Fields!ImpuestoLocal.Value + + + + 2.82569cm + + + true + true + + + + + =IIF(Fields!ImpuestoLocal.Value = "Total",UCase(Fields!ImpuestoLocal.Value),Fields!ImpuestoLocal.Value) + + + + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + DataSet1 + 10.3836cm + 15.31342cm + 0.48004cm + 5.71104cm + 17 + + + + + + true + true + + + + + REVISAR BIEN EL PRODUCTO, UNA VEZ ENTREGADO EL MATERIAL NO SE ACEPTAN DEVOLUCIONES. + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Sucursal Matriz + + + + + + + + + Beneficiario: ELECTRICA SERVEC S DE RL DE CV + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Sucursal Tijuana + + + + + + + + + Beneficiario: ELECTRICA SERVEC S DE RL DE CV + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + Embedded + RFIRMAELECTRONICAEDITABLE + FitProportional + 0.28346cm + 0.51012cm + 1.73059cm + 3.63914cm + 21 + + + + + + true + true + + + + + Cuentas Bancarias + + + + Textbox3 + 7.75847cm + 0.25136cm + 0.53798cm + 18.6975cm + 22 + + + 2pt + 2pt + 2pt + 2pt + + + + + + true + true + + + + + Tipo Relación: + + + + + + + Textbox29 + 0.69848cm + 2.57101cm + 0.41981cm + 6.35221cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!TipoRelacionTexto.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + 2.63922cm + + + 2.27051cm + + + 3.25097cm + + + 7.7847cm + + + + + 0.44125cm + + + + + true + true + + + + + Folio + + + + + + + Textbox10 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Fecha + + + + + + + Textbox12 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Importe + + + + + + + Textbox21 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Folio Fiscal + + + + + + + Textbox11 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.41479cm + + + + + true + true + + + + + =Fields!SerieFolio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Fecha.Value + + + + + + + Fecha + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Importe.Value + + + + + + + Importe1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!FolioFiscal.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSet4 + 1.22386cm + 2.57101cm + 0.85604cm + 15.9454cm + 2 + + + + + + true + true + + + + + VERSION 3.3 + + + + + + + Textbox5 + 2.15724cm + 17.53151cm + 0.52063cm + 3.32021cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + CFDI Relacionados + + + + + + + Textbox5 + 0.03101cm + 0.54004cm + 20.79183cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + true + 16.79845cm + 0.15747cm + 2.67787cm + 20.85172cm + 23 + + =Microsoft.VisualBasic.Interaction.IIF(First(Fields!SerieFolio.Value, "DataSet4") <> "", False, True) + + + + + + + 19.47632cm + + + + + + + Textbox35 + 0.01763cm + 18.52109cm + 0.50624cm + 2.5cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + + + + + =Now() + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Usuario Imprimió: + + + + + + + + =Parameters!UsuarioImprimio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 27.94cm + 21.59cm + 0cm + 0cm + 0.5cm + 0.5cm + 1.27cm + + + . + + + + + - 18.23806cm + 18.23807cm - - - Entrega Almacén (Surtir Mercancia) - - - - -
  • -   -
  • -
    - - - - <%--FILTROS--%> - - - -
    -
    -
    -
      -
    • Cliente: - - - - - - - - - <%----%> -
    • -
    • Serie-Folio: - - - - - - - - - - -
    • -
    -
    -
    - - <%----%> -
    -
    - -
    -
    -
    -
    - - - -
    - -
    - - <%--DATOS DE LA VENTA--%> -
    - - -
    -
    -
    -
    - - Venta a surtir -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    Cliente: - -
    Folio: - - <%----%> -
    Observaciones Grales: - -
    Observaciones Almacén: - -
    Dirección Envío: - - -
    -
    -
    -
    -
    -
    -
    - - - <%--DATOS DEL MOVIMIENTO--%> -
    - - -
    -
    -
    -
    - - Datos del movimiento -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Almacén: - - - -
    Fecha: -
    -
    - - - - - - - - - - - - -
    -
    -
    Guía: - -
    Observaciones: - -
    Transitorio: - -
    - -
    - -
    - -
    - - - -
    -
    - - - - - - - ver detalle de entrega - -
    -
    -
    -
    -
    -
    -
    - -
    - - - - - - - -
    -
    - - <%--PENDIENTES DE SURTIR--%> -
    -
    -
    -
    - - Ventas por surtir -
    -
    -
    -
    -
    -
    - - - - -   - - - - - - - - Sucursal: - - - - - - - - - - - - - - - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - - - <%--ADVERTENCIA--%> -
    -
    -
    - - Información: - -
    -
    -
    - <%--ADVERTENCIA--%> -
    -
    -
    - - Información: - -
    -
    -
    -
    - - - - - - - - - - - - - - -
    - - <%--PERSONAL ENTREGA--%> -
    -
    -
    -
    - - PERSONAL AUTORIZADO PARA ENTREGAS EN ALMACÉN: -
    -
    -
    - - - - - - <%----%> - <%-- - - - - - --%> - - - - - -
    - -
    -
    -
    -
    -
    -
    - -
    - - - -
    -
    -
    - - Salida de Inventario -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - <%--AGREGAR POR CODIGO DE BARRAS--%> - - -
    - -
    -
    - -
    -
    -
    - - - - - - -
    - - - - - - - -
    -
    -
    -
    -
    - - - <%--GV DATOS--%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - -
    -
    -
    - - - - - - -
    -
    - -
    -
    - -
    -
    - - - <%--BOTON GUARDAR--%> - - -
    - -
    -
    - -
    -
    -
    - - - <%--AGREGA POR SERIE--%> - - - - - - - - <%--CANTIDAD ESPECIAL--%> - - - - - - - - - - - <%--CANTIDAD ESPECIAL 2--%> - - - - - - - <%--NUMERO DE GUIA--%> - - - - - - - - - - - -
    - - - - - - - +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntregaAlmacen.aspx.vb" Inherits="Inventarios_EntregaAlmacen" EnableEventValidation="false" %> + + + + + + + + Entrega Almacén (Surtir Mercancia) + + + + +
  • +   +
  • +
    + + + + <%--FILTROS--%> + + + +
    +
    +
    +
      +
    • Cliente: + + + + + + + + + + + + + + + + + <%----%> +
    • +
    • Serie-Folio: + + + + + + + + + + + + + + + + + + +
    • +
    +
    +
    + + <%----%> +
    +
    + +
    +
    +
    +
    + + + +
    + +
    + + <%--DATOS DE LA VENTA--%> +
    + + +
    +
    +
    +
    + + Venta a surtir +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Cliente: + +
    Folio: + + <%----%> +
    Observaciones Grales: + +
    Observaciones Almacén: + +
    Dirección Envío: + + +
    +
    +
    +
    +
    +
    +
    + + + <%--DATOS DEL MOVIMIENTO--%> +
    + + +
    +
    +
    +
    + + Datos del movimiento +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Almacén: + + + +
    Fecha: +
    +
    + + + + + + + + + + + + +
    +
    +
    Guía: + +
    Observaciones: + +
    Transitorio: + +
    + +
    + +
    + +
    + + + +
    +
    + + + + + + + ver detalle de entrega + +
    +
    +
    +
    +
    +
    +
    + +
    + + + + + + + +
    +
    + + <%--PENDIENTES DE SURTIR--%> +
    +
    +
    +
    + + Ventas por surtir +
    +
    +
    +
    +
    +
    + + + + + +   + " style="display: inline-block; margin-right: -20px; width: 70px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +   + <%--
    +
    +
    +
    + " style="display: inline-block; margin-right: -20px; width: 100px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    --%> + Sucursal: + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + + <%--ADVERTENCIA--%> +
    +
    +
    + + Información: + +
    +
    +
    + <%--ADVERTENCIA--%> +
    +
    +
    + + Información: + +
    +
    +
    +
    + + + + + + + + + + + + + + +
    + + <%--PERSONAL ENTREGA--%> +
    +
    +
    +
    + + PERSONAL AUTORIZADO PARA ENTREGAS EN ALMACÉN: +
    +
    +
    + + + + + + <%----%> + <%-- + + + + + --%> + + + + + +
    + +
    +
    +
    +
    +
    +
    + +
    + + + +
    +
    +
    + + Salida de Inventario +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + <%--AGREGAR POR CODIGO DE BARRAS--%> + + +
    + +
    +
    + +
    +
    +
    + + + + + + +
    + + + + + + + +
    +
    +
    +
    +
    + + + <%--GV DATOS--%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + +
    +
    +
    + + + + + + +
    +
    + +
    +
    + +
    +
    + + + <%--BOTON GUARDAR--%> + + +
    + +
    +
    + +
    +
    +
    + + + <%--AGREGA POR SERIE--%> + + + + + + + + <%--CANTIDAD ESPECIAL--%> + + + + + + + + + + + <%--CANTIDAD ESPECIAL 2--%> + + + + + + + <%--NUMERO DE GUIA--%> + + + + + + + + + + + +
    + + + + + + + diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 37c4c7fc8..ec3e16af1 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -159,6 +159,15 @@ Partial Class Inventarios_RecepcionUsados ViewState("TieneSalida") = value End Set End Property + + Private Property DTBCIUsados As DataTable + Get + Return If(IsNothing(ViewState("DTBCIUsados")), Nothing, CType(ViewState("DTBCIUsados"), DataTable)) + End Get + Set(value As DataTable) + ViewState("DTBCIUsados") = value + End Set + End Property Private Property DtBitacora As DataTable Get Return CType(ViewState("DtBitacora"), DataTable) @@ -1488,7 +1497,7 @@ Partial Class Inventarios_RecepcionUsados If CveMovimiento <= 0 Then CveMovimiento = ObjInv.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, CveConcepto, 1, TxtFecha.Text.ToDate, TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, - -1, -1, -1, -1, Modulo:="RU/G") + -1, -1, -1, -1, Recibio:=TxtResponsable.Text.Trim, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="RU/G2") End If ObjInv.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, CostoPromedio, -1, Serie:=Serie) @@ -2391,6 +2400,9 @@ Partial Class Inventarios_RecepcionUsados 'GUARDAR AJUSTES Me.ObjRemisionNC.DtAjustes = TmpDTAjustes + If Me.ObjRemisionNC.DtAjustes IsNot Nothing AndAlso Me.ObjRemisionNC.DtAjustes.Rows.Count > 0 Then + Me.ObjRemisionNC.EsGarantia = True + End If 'VALIDA PROMOCIONES Y EXISTENCIAS Dim ObjVentas As New ClsVentas @@ -2750,7 +2762,8 @@ Partial Class Inventarios_RecepcionUsados ObjRemisionNC.DtMovimientosUsados = DtMovimientos ObjRemisionNC.CveAlmacen = DdlAlmacen.SelectedValue.ToEntero() - ObjRemisionNC.ObservacionesMovimiento = TxtObservaciones.Text + ObjRemisionNC.MovimientoObservaciones = TxtObservaciones.Text + ObjRemisionNC.MovimientoRecibio = TxtResponsable.Text ObjRemisionNC.CveConceptoMovimiento = CveConcepto End Sub @@ -2843,6 +2856,7 @@ Partial Class Inventarios_RecepcionUsados Dim CveMarca As Integer = -1 Dim CveClasificacion As Integer = -1 Dim PrecioSugerido As Decimal = 0 + Dim CveTamanio As Integer = -1 Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") If drPS IsNot Nothing Then @@ -2857,6 +2871,7 @@ Partial Class Inventarios_RecepcionUsados Dim PS As String = drPS("PS").ToString CveMarca = drPS("CveMarca").ToString.ToEntero CveClasificacion = drPS("CveClasificacion").ToString.ToEntero + CveTamanio = drPS("CveTamaño").ToString.ToEntero Dim Arr = PS.Split("-"c) If Arr.Count > 1 Then @@ -2918,6 +2933,19 @@ Partial Class Inventarios_RecepcionUsados 'CvePrecioLista = CvePrecioListaPS End If + DdlBCIAjuste.Items.Clear() + If DTBCIUsados IsNot Nothing AndAlso CveTamanio > 0 Then + DdlBCIAjuste.DataSource = DTBCIUsados.FiltraParametros($"CveTamaño={CveTamanio}") + DdlBCIAjuste.DataBind() + DdlBCIAjuste.Items.Insert(0, New ListItem("Seleccione", "-1")) + If CveTamanio = 16 Then 'motobaterias + DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0")) + End If + 'UPPDatosUsado.Update() ''refresca el RFV + Else + DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0")) + End If + DdlTipoUso.Items.Clear() DdlTipoUso.DataSource = GlobalDTAcumGarantiasMesesTipoUso(UsuarioActual.CveEmpresa, CveMarca) DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -2961,6 +2989,7 @@ Partial Class Inventarios_RecepcionUsados If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then DdlBCIAjuste.DataSource = ObjGral.DtResultados DdlBCIAjuste.Items.Insert(0, New ListItem("Seleccione", "-1")) + DTBCIUsados = ObjGral.DtResultados.Copy() End If ObjGral.Dispose() DdlBCIAjuste.DataBind() diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index d6fc3c6b7..a35765415 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -567,7 +567,7 @@ Partial Class Inventarios_TraspasoAlmacen If CveProducto > 0 Then If TxtnSerie.Visible Then Cantidad = 1 - If TxtnSerie.Text = "" Then + If String.IsNullOrEmpty(TxtnSerie.Text.Trim()) OrElse String.IsNullOrWhiteSpace(TxtnSerie.Text.Trim()) Then Alert("Serie es necesario", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") Exit Sub diff --git a/Site.master b/Site.master index 24da7ea86..4fc0a780b 100644 --- a/Site.master +++ b/Site.master @@ -417,8 +417,7 @@
    - -
    +
    diff --git a/Site.master.vb b/Site.master.vb index 29ac2ad05..45e8ac292 100644 --- a/Site.master.vb +++ b/Site.master.vb @@ -258,7 +258,7 @@ Partial Class Site If UsuarioActual.TienePermisoPagina(392) Then tdProspectos.Visible = True : ImgProspecto.Attributes.Add("onclick", "AbrirVentana('/Prospeccion/PopUpBuscarProspectos.aspx',980,547,'popBuscarProspectos');") - If UsuarioActual.TienePermisoPagina(228) Then tdBExi.Visible = True + If UsuarioActual.TienePermisoPagina(228) OrElse UsuarioActual.TienePermisoPagina(6) Then tdBExi.Visible = True 'Contratos If UsuarioActual.TienePermisoPagina(313) Then TdContratos.Visible = True diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx index af813da4f..5bc99ff65 100644 --- a/Ventas/CatAutorizacionLimites.aspx +++ b/Ventas/CatAutorizacionLimites.aspx @@ -31,14 +31,16 @@ -
    -
    +
    +
    +
    -
    -
      -
    • Estatus: +
      +
      + +
      @@ -46,16 +48,51 @@ -
    • -
    • Cliente: - +
    + +
    - -
  • Vendedor: +
  • + +
    - - +
    +
    +
    +
    +
    @@ -67,15 +104,20 @@ EmptyDataText="No se encontraron autorizaciones" ToolTip="" CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" Width="100%" GridLines="None"> + + + + + + - + - - - + + diff --git a/Ventas/CatAutorizacionLimites.aspx.vb b/Ventas/CatAutorizacionLimites.aspx.vb index ed1e6c027..217082324 100644 --- a/Ventas/CatAutorizacionLimites.aspx.vb +++ b/Ventas/CatAutorizacionLimites.aspx.vb @@ -1,5 +1,4 @@ - -Imports Extensiones +Imports Extensiones Partial Class Ventas_CatAutorizacionLimites Inherits ClsPaginas @@ -24,6 +23,8 @@ Partial Class Ventas_CatAutorizacionLimites #Region "CARGAS" Private Sub CargaCombos() + txtFechaI.Text = Now.AddDays(-1).ToString("dd/MM/yyyy") + txtFechaI.Text = Now.ToString("dd/MM/yyyy") DdlCliente.setEsWebService(True) DdlClienteFiltro.setEsWebService(True) @@ -63,8 +64,12 @@ Partial Class Ventas_CatAutorizacionLimites CveCliente = DdlClienteFiltro.SelectedValue.ToEntero() End If + Dim FechaI, FechaF As Date + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim.ToDate, MinFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim.ToDate, MaxFecha) + Dim ObjGral As New ClsVentas - If ObjGral.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedorFiltro.SelectedValue.ToEntero(), "-1", CveEstatus:=DdlEstatus.SelectedValue.ToEntero()) Then + If ObjGral.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedorFiltro.SelectedValue.ToEntero(), "-1", CveEstatus:=DdlEstatus.SelectedValue.ToEntero(), FechaI:=FechaI, FechaF:=FechaF) Then GvDatos.DataSource = ObjGral.DtResultados End If ObjGral.Dispose() @@ -153,6 +158,12 @@ Partial Class Ventas_CatAutorizacionLimites e.Row.FCLinkButton("LnkAutorizar").Visible = False e.Row.FCLinkButton("LnkRechazar").Visible = False End If + If e.Row.DBCampo("TipoDocumento") = "Ingreso" Then + e.Row.FCLabel("LblTipo").CssClass = "label label-sm label-success" + Else + e.Row.FCLabel("LblTipo").CssClass = "label label-sm label-warning" + End If + 'If e.Row.DBCampo("Estatus") = "True" Then ' e.Row.Cells(1).ForeColor = Drawing.Color.Green ' e.Row.Cells(1).Font.Bold = True @@ -175,7 +186,7 @@ Partial Class Ventas_CatAutorizacionLimites Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero() Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero() Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero() - Dim Importe = gvRow.DataKey("Importe").ToEntero() + Dim Importe = gvRow.DataKey("Importe").ToDecimal() Dim CveEstatusAutorizacion As Integer = 1 Dim ObjVentas As New ClsVentas @@ -192,7 +203,7 @@ Partial Class Ventas_CatAutorizacionLimites Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero() Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero() Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero() - Dim Importe = gvRow.DataKey("Importe").ToEntero() + Dim Importe = gvRow.DataKey("Importe").ToDecimal() Dim CveEstatusAutorizacion As Integer = 3 Dim ObjVentas As New ClsVentas diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index 20fa8f6e1..fc434b7e5 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="Ventas - Clientes" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Clientes.aspx.vb" Inherits="Clientes" %> +<%@ Page Title="Ventas - Clientes" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Clientes.aspx.vb" Inherits="Clientes" ValidateRequest="false" %> <%@ Register Assembly="TimePicker" Namespace="MKB.TimePicker" TagPrefix="cc1" %> <%@ Register Assembly="eWorld.UI" Namespace="eWorld.UI" TagPrefix="ew" %> diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index e26c3d98f..ad071e15d 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -1891,12 +1891,89 @@