diff --git a/Acarreos/CatChoferes.aspx.vb b/Acarreos/CatChoferes.aspx.vb index b19289490..dfad4ec10 100644 --- a/Acarreos/CatChoferes.aspx.vb +++ b/Acarreos/CatChoferes.aspx.vb @@ -14,7 +14,6 @@ Partial Class Acarreos_CatChoferes CargaDatos() CargaDdlTransportista() - Dim DT As DataTable = GlobalDTColonia(-1) CargaDdls() @@ -23,14 +22,10 @@ Partial Class Acarreos_CatChoferes Private Sub CargaDdls() - - - - DdlEstado.DataSource = GlobalDTEstado(-1).FiltraParametros("ClaveSATPais = 'MEX'") + DdlEstado.DataSource = GlobalDTEstado("MEX") DdlEstado.DataBind() DdlEstado.Items.Insert(0, New ListItem("Seleccione uno", "-1")) - DdlMunicipio.Items.Insert(0, New ListItem("Seleccione Uno", "-1")) DdlLocalidad.Items.Insert(0, New ListItem("Seleccione Una", "-1")) DdlColonia.Items.Insert(0, New ListItem("Seleccione Una", "-1")) @@ -153,10 +148,9 @@ Partial Class Acarreos_CatChoferes DdlLocalidad.DataSource = GlobalDTLocalidad(DdlEstado.SelectedValue.ToEntero, DdlMunicipio.SelectedValue.ToEntero) DdlLocalidad.DataBind() - DdlColonia.DataSource = GlobalDTColonia(GlobalDTMunicipio(GlobalDTEstado("MEX").FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString).FiltraParametros($"CveMunicipio = {DdlMunicipio.SelectedValue.ToEntero}")(0)("ClaveSATMunicipio").ToString).FiltraParametros(If(TxtCP.Text.Trim.Length > 0, $"CP = {TxtCP.Text}", "")) + DdlColonia.DataSource = GlobalDTGralColonias("-1", "-1", "-1", DdlMunicipio.SelectedValue.ToEntero, CodigoPostal:=If(TxtCP.Text.Trim.Length > 0, TxtCP.Text.ToEntero, -1)) DdlColonia.DataBind() - End If DdlLocalidad.Items.Insert(0, New ListItem("Seleccione Uno", "-1")) @@ -282,12 +276,9 @@ Partial Class Acarreos_CatChoferes DdlLocalidad.DataSource = GlobalDTLocalidad(DdlEstado.SelectedValue.ToEntero, DdlMunicipio.SelectedValue.ToEntero) DdlLocalidad.DataBind() - DdlColonia.DataSource = GlobalDTColonia(GlobalDTMunicipio(GlobalDTEstado("MEX").FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString).FiltraParametros($"CveMunicipio = {DdlMunicipio.SelectedValue.ToEntero}")(0)("ClaveSATMunicipio").ToString).FiltraParametros(If(TxtCP.Text.Trim.Length > 0, $"CP = {TxtCP.Text}", "")) + DdlColonia.DataSource = GlobalDTGralColonias("-1", "-1", "-1", DdlMunicipio.SelectedValue.ToEntero, CodigoPostal:=If(TxtCP.Text.Trim.Length > 0, TxtCP.Text.ToEntero, -1)) DdlColonia.DataBind() - - - End If DdlLocalidad.Items.Insert(0, New ListItem("Seleccione Uno", "-1")) @@ -320,12 +311,11 @@ Partial Class Acarreos_CatChoferes Dim CveColonia As Integer = DdlColonia.SelectedValue.ToEntero If CPTxt > 0 And CveColonia > 0 Then - Dim CP As Integer = GlobalDTColonia(-1).FiltroPrimeroValor("CP", $"CveColonia = {CveColonia}") + Dim CP As Integer = GlobalDTGralColonias("-1", "-1", "-1", CveColonia:=CveColonia).FiltroPrimeroValor("CP", "").ToEntero If CPTxt <> CP Then - Alert("El codigo postal selecionado es diferente del codigo postal de la Colonia.", TipoMensaje.MsgAdvertencia) + Alert("El código postal selecionado es diferente del codigo postal de la Colonia.", TipoMensaje.MsgAdvertencia) End If End If - End Sub Protected Sub DdlColonia_SelectedIndexChanged(sender As Object, e As EventArgs) diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb index fd2700c84..71e8e6a3a 100644 --- a/App_Code/CFDITimbre.vb +++ b/App_Code/CFDITimbre.vb @@ -218,16 +218,16 @@ Public Class CFDIComprobante End Property Public Property TipoDocto As String Public Property FormadePago As String - Public Property CondicionesdePago As String + Public Property CondicionesdePago As String = "" Public Property Fecha As Date - Public Property Subtotal As Decimal = 0 + Public Property SubTotal As Decimal = 0 Public Property Descuentos As Decimal = 0 + Public Property Total As Decimal = 0 Public Property MotivoDescuento As String = "" Public Property TipoCambio As String = "1" Public Property Moneda As String = "" Public Property TipoComprobante As String = "" Public Property MetodoPago As String = "" - Public Property Total As Decimal = 0 Public Property LugarExpedicion As String = "" Public Property NumCuentaPago As String = "" Public Property Confirmacion As String = "" @@ -616,9 +616,8 @@ Public Class CFDICartaPorteUbicacion Public Property NumEstacion As String = "" Public Property NombreEstacion As String = "" Public Property NavegacionTrafico As String = "" - Public Property FechaHoraSalida As String = "" + Public Property FechaHoraSalidaLlegada As String = "" Public Property DistanciaRecorrida As Decimal = 0 - Public Property FechaHoraProgLlegada As String Public Property Domicilio As New CFDICartaPorteDomicilio End Class @@ -652,7 +651,11 @@ End Class Public Class CFDICartaPorteMercancias - Public Property PesoBrutoTotal As Double = 0 + Public ReadOnly Property PesoBrutoTotal As Double + Get + Return Mercancias.Sum(Function(item) item.PesoenKg) + End Get + End Property Public Property UnidadPeso As String = "" Public ReadOnly Property PesoNetoTotal As Double Get @@ -706,6 +709,7 @@ Public Class CFDICartaPorteMercanciaTransporta Public Property Cantidad As Decimal = 0 Public Property IDOrigen As String = "" Public Property IDDestino As String = "" + Public Property CvesTransportes As String = "" End Class @@ -744,10 +748,11 @@ End Class Public Class CFDICartaPorteOperador - Public Property RFCOperador As String = "" + Public Property TipoFigura As String = "01" + Public Property RFCFigura As String = "" Public Property NumLicencia As String = "" - Public Property NombreOperador As String = "" - Public Property NumRegidTribOperador As String = "" - Public Property ResidenciaFiscalOperador As String = "" + Public Property NombreFigura As String = "" + Public Property NumRegidTribFigura As String = "" + Public Property ResidenciaFiscalFigura As String = "" Public Property Domicilio As New CFDICartaPorteDomicilio End Class diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index fea44cef7..1ac11fb10 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -2844,11 +2844,13 @@ Public Class ClsGenerales Return Retorno End Function - Public Function GetSATColonia(ClaveSATMunicipio As String) As Boolean + Public Function GetSATColonia(ClaveSATEstado As String, ClaveSATMunicipio As String, ClaveSATColonia As String) As Boolean Dim Retorno As Boolean = False - DataAdapter("Gral_SAT_ColoniaGet") + DataAdapter("PA_Gral_SAT_ColoniaGet") With SqlAdapter.SelectCommand.Parameters + .Add("@ClaveSATEstado", SqlDbType.VarChar).Value = ClaveSATEstado .Add("@ClaveSATMunicipio", SqlDbType.VarChar).Value = ClaveSATMunicipio + .Add("@ClaveSATColonia", SqlDbType.VarChar).Value = ClaveSATColonia End With Try SqlAdapter.Fill(Data) @@ -3613,8 +3615,10 @@ Public Class ClsGenerales #Region "GRAL TIMBRES" - Public Function AddGralTimbre(TipoDocto As String, Serie As String, Folio As Integer, FolioFiscal As String, Fecha As Date, CveUsuario As Integer, CveEmpresa As Integer, - Estatus As Integer, CvePAC As Integer, AplicaCP As Boolean, CveEntregaAlmacen As Integer, CveSubProyectoOrigen As Integer) As Integer + Public Function AddGralTimbre(TipoDocto As String, CveSubProyecto As Integer, Fecha As DateTime, CveUsuario As Integer, CveEmpresa As Integer, + Optional Serie As String = "-1", Optional Folio As Integer = -1, Optional Estatus As Integer = 0, + Optional CveEntregaAlmacen As Integer = -1, + Optional AplicaCP As Boolean = False) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Gral_TimbreAdd") @@ -3624,15 +3628,13 @@ Public Class ClsGenerales .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@Folio", SqlDbType.Int).Value = Folio - .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal - .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Estatus", SqlDbType.Int).Value = Estatus - .Add("@CvePAC", SqlDbType.Int).Value = CvePAC .Add("@AplicaCP", SqlDbType.Bit).Value = AplicaCP .Add("@CveEntregaAlmacen", SqlDbType.Int).Value = CveEntregaAlmacen - .Add("@CveSubProyectoOrigen", SqlDbType.Int).Value = CveSubProyectoOrigen + .Add("@CveSubProyectoOrigen", SqlDbType.Int).Value = CveSubProyecto .Add("@CveTimbre", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@FolioInsertado", SqlDbType.Int).Direction = ParameterDirection.Output @@ -3654,15 +3656,13 @@ Public Class ClsGenerales Return Retorno End Function - Public Function GetGralTimbre(CveTimbre As Integer, TipoDocto As String, Serie As String, Folio As Integer, FechaI As Date, FechaF As Date, Estatus As Integer, CveEmpresa As Integer, CveMovimiento As Integer) As Boolean + Public Function GetGralTimbre(CveTimbre As Integer, TipoDocto As String, FechaI As Date, FechaF As Date, Estatus As Integer, CveEmpresa As Integer, CveMovimiento As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_TimbreGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveTimbre", SqlDbType.Int).Value = CveTimbre .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto - .Add("@Serie", SqlDbType.VarChar).Value = Serie - .Add("@Folio", SqlDbType.Int).Value = Folio .Add("@FechaI", SqlDbType.Date).Value = FechaI .Add("@FechaF", SqlDbType.Date).Value = FechaF .Add("@Estatus", SqlDbType.Int).Value = Estatus @@ -3681,37 +3681,49 @@ Public Class ClsGenerales Return Retorno End Function - Public Function UpdateGralTimbre(CveTimbre As Integer, TipoDocto As String, Serie As String, Folio As Integer, FolioFiscal As String, Fecha As Date, CveUsuario As Integer, CveEmpresa As Integer, - Estatus As Integer, CvePAC As Integer, CvePACCancelacion As Integer, FechaCancelacion As Date, AplicaCP As Boolean, SelloCancelacion As String - ) As Boolean + Public Function UpdateTimbreTimbrado(CveTimbre As Integer, FolioFiscal As String, Fecha As DateTime, CveUsuario As Integer, CveEmpresa As Integer, + CvePAC As Integer) As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_Gral_TimbreUpdate") + DataAdapter("PA_Gral_TimbreTimbrado") With SqlAdapter.SelectCommand.Parameters .Add("@CveTimbre", SqlDbType.Int).Value = CveTimbre - .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto - .Add("@Serie", SqlDbType.VarChar).Value = Serie - .Add("@Folio", SqlDbType.Int).Value = Folio .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal - .Add("@Fecha", SqlDbType.Date).Value = Fecha - .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha .Add("@CvePAC", SqlDbType.Int).Value = CvePAC - .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion - .Add("@FechaCancelacion", SqlDbType.DateTime).Value = FechaCancelacion - .Add("@AplicaCP", SqlDbType.Bit).Value = AplicaCP .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@SelloCancelacion", SqlDbType.VarChar).Value = SelloCancelacion - - End With Try SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió un error al actualizar el timbre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al actualizar el timbrado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + Public Function CancelarTimbreTimbrado(CveTimbre As Integer, FechaCancelacion As DateTime, CvePACCancelacion As Integer, SelloCancelacion As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Gral_TimbreTimbradoCancelar") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveTimbre", SqlDbType.Int).Value = CveTimbre + .Add("@FechaCancelacion", SqlDbType.DateTime).Value = FechaCancelacion + .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion + .Add("@SelloCancelacion", SqlDbType.VarChar).Value = SelloCancelacion + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el timbrado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno End Function @@ -3758,13 +3770,13 @@ Public Class ClsGenerales End Function - Public Function AddInvEntregaAlmacenRuta(CveSubProyectoOrigen As Integer, CveMovimientoAlmacen As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, CveChofer As Integer, CveCamion As Integer, FechaEntrega As Date, Tipo As String, Orden As Integer, Estatus As Integer) As Integer + Public Function AddInvEntregaAlmacenRuta(CveSubProyecto As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, CveMovimientoAlmacen As Integer, CveChofer As Integer, CveCamion As Integer, FechaEntrega As Date, Tipo As String, Orden As Integer, Estatus As Integer) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Inv_EntregaAlmacenRutaAdd") With SqlAdapter.SelectCommand.Parameters - .Add("@CveSubProyectoOrigen", SqlDbType.Int).Value = CveSubProyectoOrigen + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveMovimientoAlmacen", SqlDbType.Int).Value = CveMovimientoAlmacen .Add("@CveDireccionOrigen", SqlDbType.Int).Value = CveDireccionOrigen .Add("@CveDireccionDestino", SqlDbType.Int).Value = CveDireccionDestino diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 54d9be053..89dff6d21 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -1032,7 +1032,7 @@ Public Class ClsNominas Return Retorno End Function - Public Function UpdateEstatusNomNominas(Estatus As Integer, CvePAC As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveNomina As Integer, Optional SubTotal As Double = -1, Optional Descuento As Double = -1, Optional ISR As Double = -1, Optional Total As Double = -1, Optional DiasPagados As Double = -1, Optional isFiniquito As Boolean = False) As Boolean + Public Function UpdateEstatusNomNominas(Estatus As Integer, CvePAC As Integer, FolioFiscal As String, FechaTimbrado As DateTime, FechaCancelacion As DateTime, CveNomina As Integer, Optional SubTotal As Double = -1, Optional Descuento As Double = -1, Optional ISR As Double = -1, Optional Total As Double = -1, Optional DiasPagados As Double = -1, Optional isFiniquito As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Nom_NominasUpdateEstatus") @@ -1042,7 +1042,7 @@ Public Class ClsNominas .Add("@CveEstatusCFDi", SqlDbType.Int).Value = Estatus .Add("@CvePAC", SqlDbType.Int).Value = CvePAC .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal - .Add("@SelloDigitalSAT", SqlDbType.VarChar).Value = SelloSAT + .Add("@FechaTimbrado", SqlDbType.DateTime).Value = FechaTimbrado .Add("@FechaCancelacion", SqlDbType.DateTime).Value = FechaCancelacion .Add("@SubTotal", SqlDbType.Money).Value = SubTotal .Add("@Descuento", SqlDbType.Money).Value = Descuento diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index b8a1e8186..a66b688da 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -372,56 +372,68 @@ Public Class ClsPaginas End Set End Property - Property GlobalDTPais() As DataTable + + Property GlobalDTGralPaises() As DataTable Get - GlobalDTPais = DirectCast(Application("GlobalDTPais"), DataTable) + If Application("GlobalDTGralPaises") Is Nothing Then + Dim ObjGrales As New ClsGenerales + If ObjGrales.GetSATPais() Then Application("GlobalDTGralPaises") = ObjGrales.DtResultados Else Application("GlobalDTGralPaises") = Nothing + ObjGrales.Dispose() + End If + GlobalDTGralPaises = DirectCast(Application("GlobalDTGralPaises"), DataTable) End Get Set(value As DataTable) - Application("GlobalDTPais") = value + Application("GlobalDTGralPaises") = value End Set End Property - - Property GlobalDTEstado(ClaveSATPais As String) As DataTable + Property GlobalDTEstado(ClaveSATPais As String, Optional CvePais As Integer = -1) As DataTable Get - If Application("GlobalDTEstado") Is Nothing Then + Dim AppNombre As String = "GlobalDTEstado" + If Application(AppNombre) Is Nothing Then Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATEstado("-1") Then Application("GlobalDTEstado") = ObjGrales.DtResultados Else Application("GlobalDTEstado") = Nothing + If ObjGrales.GetSATEstado("-1") Then Application(AppNombre) = ObjGrales.DtResultados Else Application(AppNombre) = Nothing ObjGrales.Dispose() End If - If ClaveSATPais <> "-1" Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTEstado"), DataTable), String.Format("ClaveSATPais = '{0}'", ClaveSATPais), "", DataViewRowState.CurrentRows) - GlobalDTEstado = Dv.ToTable - Dv.Dispose() - Else - GlobalDTEstado = DirectCast(Application("GlobalDTEstado"), DataTable) - End If + Dim Filtro As New StringBuilder + Filtro.Append(" 1 = 1 ") + If ClaveSATPais <> "-1" Then Filtro.AppendFormat(" AND ClaveSATPais = '{0}' ", ClaveSATPais) + If CvePais > 0 Then Filtro.AppendFormat(" AND CvePais = {0} ", CvePais) + + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Filtro.ToString, "", DataViewRowState.CurrentRows) + GlobalDTEstado = Dv.ToTable + Dv.Dispose() End Get Set(value As DataTable) - Application("GlobalDTEstado") = value + Dim AppNombre As String = "GlobalDTEstado" + Application(AppNombre) = value End Set End Property - Property GlobalDTMunicipio(ClaveSATEstado As String) As DataTable + Property GlobalDTMunicipio(ClaveSATEstado As String, Optional CveEstado As Integer = -1) As DataTable Get - If Application("GlobalDTMunicipio") Is Nothing Then + + Dim AppNombre As String = "GlobalDTMunicipio" + If Application(AppNombre) Is Nothing Then Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATMunicipio("-1") Then Application("GlobalDTMunicipio") = ObjGrales.DtResultados Else Application("GlobalDTMunicipio") = Nothing + If ObjGrales.GetSATMunicipio("-1") Then Application(AppNombre) = ObjGrales.DtResultados Else Application(AppNombre) = Nothing ObjGrales.Dispose() End If - If ClaveSATEstado <> "-1" Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTMunicipio"), DataTable), String.Format("ClaveSATEstado = '{0}'", ClaveSATEstado), "", DataViewRowState.CurrentRows) - GlobalDTMunicipio = Dv.ToTable - Dv.Dispose() - Else - GlobalDTMunicipio = DirectCast(Application("GlobalDTMunicipio"), DataTable) - End If + Dim Filtro As New StringBuilder + Filtro.Append(" 1 = 1 ") + If ClaveSATEstado <> "-1" Then Filtro.AppendFormat(" AND ClaveSATEstado = '{0}' ", ClaveSATEstado) + If CveEstado > 0 Then Filtro.AppendFormat(" AND CveEstado = {0} ", CveEstado) + + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Filtro.ToString, "", DataViewRowState.CurrentRows) + GlobalDTMunicipio = Dv.ToTable + Dv.Dispose() End Get Set(value As DataTable) - Application("GlobalDTMunicipio") = value + Dim AppNombre As String = "GlobalDTMunicipio" + Application(AppNombre) = value End Set End Property @@ -466,26 +478,34 @@ Public Class ClsPaginas End Property - - Property GlobalDTColonia(ClaveSATMunicipio As String) As DataTable + Property GlobalDTGralColonias(ClaveSATEstado As String, ClaveSATMunicipio As String, ClaveSATColonia As String, + Optional CveMunicipio As Integer = -1, Optional CodigoPostal As Integer = -1, Optional CveColonia As Integer = -1) As DataTable Get - If Application("GlobalDTColonia") Is Nothing Then + Dim AppNombre As String = "GlobalDTGralColonias" + If Application(AppNombre) Is Nothing Then Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATColonia("-1") Then Application("GlobalDTColonia") = ObjGrales.DtResultados Else Application("GlobalDTColonia") = Nothing + If ObjGrales.GetSATColonia("-1", "-1", "-1") Then Application(AppNombre) = ObjGrales.DtResultados Else Application(AppNombre) = Nothing ObjGrales.Dispose() End If - If ClaveSATMunicipio <> "-1" Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTColonia"), DataTable), String.Format("ClaveSATMunicipio = '{0}'", ClaveSATMunicipio), "", DataViewRowState.CurrentRows) - GlobalDTColonia = Dv.ToTable - Dv.Dispose() - Else - GlobalDTColonia = DirectCast(Application("GlobalDTColonia"), DataTable) - End If + Dim Filtro As New StringBuilder + Filtro.Append(" 1 = 1 ") + If ClaveSATEstado <> "-1" Then Filtro.AppendFormat(" AND ClaveSATEstado = '{0}' ", ClaveSATEstado) + If ClaveSATMunicipio <> "-1" Then Filtro.AppendFormat(" AND ClaveSATMunicipio = '{0}' ", ClaveSATMunicipio) + If ClaveSATColonia <> "-1" Then Filtro.AppendFormat(" AND ClaveSATColonia = '{0}' ", ClaveSATColonia) + If CveMunicipio > 0 Then Filtro.AppendFormat(" AND CveMunicipio = {0} ", CveMunicipio) + If CodigoPostal > 0 Then Filtro.AppendFormat(" AND CP = {0} ", CodigoPostal) + If CveColonia > 0 Then Filtro.AppendFormat(" AND CveColonia = {0} ", CveColonia) + + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Filtro.ToString, "", DataViewRowState.CurrentRows) + GlobalDTGralColonias = Dv.ToTable + Dv.Dispose() + End Get Set(value As DataTable) - Application("GlobalDTColonia") = value + Dim AppNombre As String = "GlobalDTGralColonias" + Application(AppNombre) = value End Set End Property @@ -2420,39 +2440,6 @@ Public Class ClsPaginas #End Region #Region "***********************************************************************DT GENERALES**************************************************************************************" - Property GlobalDTGralPaises() As DataTable - Get - GlobalDTGralPaises = DirectCast(Application("GlobalDTGralPaises"), DataTable) - End Get - Set(value As DataTable) - Application("GlobalDTGralPaises") = value - End Set - End Property - Property GlobalDTGralEstados(CvePais As Integer) As DataTable - Get - GlobalDTGralEstados = DirectCast(Application("GlobalDTGralEstados"), DataTable).FiltraParametros(String.Format("CvePais ={0}", CvePais)) - End Get - Set(value As DataTable) - Application("GlobalDTGralEstados") = value - End Set - End Property - Property GlobalDTGralMunicipios(CveEstado As Integer) As DataTable - Get - GlobalDTGralMunicipios = DirectCast(Application("GlobalDTGralMunicipios"), DataTable).FiltraParametros(String.Format("CveEstado ={0}", CveEstado)) - End Get - Set(value As DataTable) - Application("GlobalDTGralMunicipios") = value - End Set - End Property - - Property GlobalDTGralPoblaciones() As DataTable - Get - GlobalDTGralPoblaciones = DirectCast(Application("GlobalDTGralPoblaciones"), DataTable) - End Get - Set(value As DataTable) - Application("GlobalDTGralPoblaciones") = value - End Set - End Property Property GlobalDTGralCategorias(CveEmpresa As Integer) As DataTable Get @@ -6751,7 +6738,7 @@ Public Class ClsPaginas GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) End Try End Sub - Protected Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True) As Byte() + Public Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True) As Byte() Dim retorno As Byte() = Nothing ' Dim ObjVentas As New ClsVentas @@ -6823,12 +6810,9 @@ Public Class ClsPaginas End Try If EsXMLValido Then - Dim TC As Decimal = 1 - Try - TC = XmlDoc.DocumentElement.Attributes("TipoCambio").InnerText.ToDecimal - Catch ex As Exception - TC = 1 - End Try + Dim TC As Decimal = ValorNodoXML(XmlDoc.DocumentElement, "TC").ToDecimal + If TC <= 0 Then TC = 1 + If ValorNodoXML(XmlDoc.DocumentElement, "version") = "3.3" Then Vta.FechaEmision = ValorNodoXML(XmlDoc.DocumentElement, "fecha").ToDate Vta.NoSerieCertificadoContribuyente = ValorNodoXML(XmlDoc.DocumentElement, "NoCertificado") @@ -7424,8 +7408,8 @@ Public Class ClsPaginas RutaFormato = String.Format("{0}Formatos\{1}.rdlc", UsuarioActual.Empresa.Ruta, NombreArchivo) RutaFormatoDefault = String.Format("Empresas\Grales\Formatos\{0}.rdlc", NombreArchivo) - Case "RNC" + Case "RNC" NombreArchivo = "RemisionNC" NombreArchivoDescarga = "RemisionNC" diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index a23c7af68..7f68a1c1b 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -6175,6 +6175,7 @@ Namespace Modelos Public Property DtMovimientosUsados As DataTable Public Property CveAlmacenDevolucion As Integer Public Property CveVenta As Integer + Public Property CveTimbre As Integer Public Property CveEmpresa As Integer Public Property CveSucursal As Integer 'sucursal de la empresa que factura Public Property CveSubProyecto As Integer @@ -6244,7 +6245,7 @@ Namespace Modelos End Property Public Property Inv_CveMovimiento As Integer - Public Property Inv_CveEstatusEntrega As Integer + Public Property Inv_CveEstatusEntrega As Integer = 0 Public Property Inv_EstatusEntrega As String Public Property Inv_ValorInventario As Decimal Public Property Fecha As DateTime @@ -6266,7 +6267,8 @@ Namespace Modelos Public Property EstatusFactura As String Public Property SeTimbro As String Public Property TipoDocto As String - Public Property RefDocto As String + Public Property TipoComprobante As String + Public Property RefDocto As String = "" Public Property RealizarDevolucionAlmacen As Boolean Public Property CveAlmacenDevolucionVenta As Integer @@ -6402,24 +6404,24 @@ Namespace Modelos End Get End Property - Public Property MotivoDescuento As String + Public Property MotivoDescuento As String = "" #Region "Totales" - Public Property SubTotal As Decimal - Public Property Descuento As Decimal - Public Property Amortizacion As Decimal + Public Property SubTotal As Decimal = 0 + Public Property Descuento As Decimal = 0 + Public Property Amortizacion As Decimal = 0 'IVA - Public Property RetIVA As Decimal - Public Property RetISR As Decimal - Public Property IVA As Decimal - Public Property IEPS As Decimal + Public Property RetIVA As Decimal = 0 + Public Property RetISR As Decimal = 0 + Public Property IVA As Decimal = 0 + Public Property IEPS As Decimal = 0 - Public Property Total As Decimal - Public Property Otros As Decimal + Public Property Total As Decimal = 0 + Public Property Otros As Decimal = 0 - Public Property TotalRemNCAplicado As Decimal + Public Property TotalRemNCAplicado As Decimal = 0 #Region "Totales por Tipo de cambio" @@ -6507,32 +6509,31 @@ Namespace Modelos End Property #End Region #End Region - Public Property AtencionA As String - Public Property AtnA As String - Public Property TelefonoGenerico As String - Public Property Det_OrdenCompra As String - Public Property Det_FechaOrdenCompra As String - Public Property Det_ContraRecibo As String - Public Property Observaciones As String + Public Property AtencionA As String = "" + Public Property TelefonoGenerico As String = "" + Public Property Det_OrdenCompra As String = "" + Public Property Det_FechaOrdenCompra As String = "" + Public Property Det_ContraRecibo As String = "" + Public Property Observaciones As String = "" - Public Property Alfa1 As String - Public Property Alfa2 As String - Public Property Alfa3 As String + Public Property Alfa1 As String = "" + Public Property Alfa2 As String = "" + Public Property Alfa3 As String = "" Public Property Fech1 As Date Public Property Fech2 As Date Public Property Fech3 As Date - Public Property Num1 As Double - Public Property Num2 As Double - Public Property Num3 As Double + Public Property Num1 As Double = 0 + Public Property Num2 As Double = 0 + Public Property Num3 As Double = 0 Public Property DiasCredito As Integer Public Property EsDiasCreditoFijo As Boolean - Public Property CveCorte As Integer - Public Property CveMesa As Integer - Public Property NumeroPersonas As Integer + Public Property CveCorte As Integer = -1 + Public Property CveMesa As Integer = -1 + Public Property NumeroPersonas As Integer = 0 Public Property FechaPago As Date @@ -6540,15 +6541,15 @@ Namespace Modelos Public Property CveNCaVincular As Integer Public Property FolioFiscal As String Public Property NoSerieCertificado As String - Public Property SelloCFDi As String - Public Property SelloSAT As String + Public Property SelloCFDi As String = "" + Public Property SelloSAT As String = "" Public Property FechaEmision As Date Public Property FechaCertificacion As Date Public Property NoSerieCertificadoContribuyente As String - Public Property NumeroCuenta As String + Public Property NumeroCuenta As String = "" Public Property CveTipoAmortizacionAnticipo As Integer = -1 - Public Property DescripcionContrato As String - Public Property NumeroDescripcionContrato As String + Public Property DescripcionContrato As String = "" + Public Property NumeroDescripcionContrato As String = "" Public Property CveComplementoTimbrado As Integer = 0 Public Property ComplementoINE As Modelos.ComplementoINE Public Property FordGSDB As String = "" @@ -6646,28 +6647,28 @@ Namespace Modelos End If End Sub - Public Property CveClienteSucursal As Integer + Public Property CveClienteSucursal As Integer = 0 Public Property ClienteSucursal As Modelos.SucursalModel Public Property EnviarA As Modelos.EnviarAModel - Public Property NumeroContrato As String - Public Property PedidoContrato As String - Public Property OrdenCompra As String = "-1" + Public Property NumeroContrato As String = "" + Public Property PedidoContrato As String = "" + Public Property OrdenCompra As String = "" Public Property CveMetodoPago As Integer - Public Property MetodoPago As String - Public Property ClaveMetodoPagoSAT As String + Public Property MetodoPago As String = "" + Public Property ClaveMetodoPagoSAT As String = "" Public Property CveMetodoPago33 As Integer - Public Property MetodoPago33 As String + Public Property MetodoPago33 As String = "" Public Property CveFormaPago33 As Integer - Public Property MetodoPagoSAT33 As String - Public Property FormaPago33 As String - Public Property FormaPagoSAT33 As String + Public Property MetodoPagoSAT33 As String = "" + Public Property FormaPago33 As String = "" + Public Property FormaPagoSAT33 As String = "" Public Property UsoCFDI As String = "" Public Property CveUsoCFDI As Integer Public Property ClaveUsoCFDI As String = "" Public Property CveTipoRelacion As Integer = -1 Public Property CveEstatusFactura As Integer Public Property CveVendedor As Integer - Public Property VendedorCodigo As String + Public Property VendedorCodigo As String = "" Public Property CveSucursalEjecucion As Integer Public Property FechaEjecucion As Date Public Property CveSucursalCobranza As Integer @@ -6675,15 +6676,15 @@ Namespace Modelos Public Property CveSubProyectoCobranza As Integer Public Property CveSubProyectoEjecucion As Integer Public Property CveOS As Integer - Public Property CveContrato As Integer - Public Property CveVentaPadre As Integer - Public Property CvePrePoliza As Integer - Public Property Entrega As String - Public Property TiempoEntrega As String + Public Property CveContrato As Integer = -1 + Public Property CveVentaPadre As Integer = -1 + Public Property CvePrePoliza As Integer = -1 + Public Property Entrega As String = "" + Public Property TiempoEntrega As String = "" Public Property Vigencia As Date Public Property TipoEstatus As Integer Public Property CveCondicionEntrega As Integer - Public Property CondicionEntrega As String + Public Property CondicionEntrega As String = "" Public Property TipoRelacion As String Public Property UUIDRelacionados As List(Of String) @@ -9667,21 +9668,21 @@ Namespace Modelos End Sub Public Property AplicaFEMSA As Boolean = False 'AplicaFEMSA - Public Property FEMSA_NumSociedad As String 'TxtFEMSA_NumSociedad.Text.Trim, - Public Property FEMSA_NumProveedor As String 'TxtFEMSA_NumProveedor.Text.Trim, - Public Property FEMSA_Mail As String 'TxtFEMSA_Mail.Text.Trim + Public Property FEMSA_NumSociedad As String = "" 'TxtFEMSA_NumSociedad.Text.Trim, + Public Property FEMSA_NumProveedor As String = "" 'TxtFEMSA_NumProveedor.Text.Trim, + Public Property FEMSA_Mail As String = "" 'TxtFEMSA_Mail.Text.Trim - Public Property FEMSA_Version As Integer 'TxtFEMSA_Version.Text.ToEntero, ClaseDocto, + Public Property FEMSA_Version As Integer 'TxtFEMSA_Version.Text.ToEntero, ClaseDocto, Public Property FEMSA_NumPedido As Long 'TxtFEMSA_NumPedido.Text.Trim.ToLong, - Public Property FEMSA_NumEntrada As String 'TxtFEMSA_NumEntrada.Text.Trim, - Public Property FEMSA_NumRemision As String 'TxtFEMSA_NumRemision.Text.Trim, - Public Property FEMSA_NumSocio As String 'TxtFEMSA_NumSocio.Text.Trim, - Public Property FEMSA_CentroCosto As String 'TxtFEMSA_CentroCosto.Text.Trim, - Public Property FEMSA_IPeriodoLiquidacion As String 'TxtFEMSA_IPeriodoLiquidacion.Text.Trim, - Public Property FEMSA_FPeriodoLiquidacion As String 'TxtFEMSA_FPeriodoLiquidacion.Text.Trim, - Public Property FEMSA_CodRetencion1 As String 'TxtFEMSA_CodRetencion1.Text.Trim, - Public Property FEMSA_CodRetencion2 As String 'TxtFEMSA_CodRetencion2.Text.Trim, + Public Property FEMSA_NumEntrada As String = "" 'TxtFEMSA_NumEntrada.Text.Trim, + Public Property FEMSA_NumRemision As String = "" 'TxtFEMSA_NumRemision.Text.Trim, + Public Property FEMSA_NumSocio As String = "" 'TxtFEMSA_NumSocio.Text.Trim, + Public Property FEMSA_CentroCosto As String = "" 'TxtFEMSA_CentroCosto.Text.Trim, + Public Property FEMSA_IPeriodoLiquidacion As String = "" 'TxtFEMSA_IPeriodoLiquidacion.Text.Trim, + Public Property FEMSA_FPeriodoLiquidacion As String = "" 'TxtFEMSA_FPeriodoLiquidacion.Text.Trim, + Public Property FEMSA_CodRetencion1 As String = "" 'TxtFEMSA_CodRetencion1.Text.Trim, + Public Property FEMSA_CodRetencion2 As String = "" 'TxtFEMSA_CodRetencion2.Text.Trim, End Class diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index d354d4be3..19d241d77 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -1754,7 +1754,7 @@ Public Class Timbrado If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then Using ObjNomina2 As New ClsNominas() - If ObjNomina2.UpdateEstatusNomNominas(3, UsuarioActual.Empresa.CvePAC, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0) Then + If ObjNomina2.UpdateEstatusNomNominas(3, UsuarioActual.Empresa.CvePAC, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, ObjCFDITimbre.Comprobante.Fecha, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0) Then Retorno = "" Else Retorno = "Error" @@ -2137,16 +2137,16 @@ Public Class Timbrado Dim Carta As CFDICartaPorte = ObjCFDITimbre.Complementos.CartaPorte ''DATOS GENERALES - cfdi.CartaPorte(Carta.TranspInternac, Carta.EntradaSalidaMercancia, "MEX", Carta.ViaEntradaSalida, Carta.TotalDistanciaRecorrida) + 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.IDUbicacion, ubica.NombreRemitenteDestinatario, ubica.NumRegIdTrib, ubica.ResidenciaFiscal, ubica.NumEstacion, ubica.NombreEstacion, ubica.NavegacionTrafico, ubica.FechaHoraSalida, ubica.TipoEstacion, ubica.DistanciaRecorrida) + 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) - '''destino + ''''destino 'cfdi.CartaPorteUbicacion(ubica.TipoEstacion, ubica.DistanciaRecorridaDestino) 'cfdi.CartaPorteDestino(ubica.Destino.IDDestino, ubica.Destino.RFCDestinatario, ubica.Destino.NombreDestinatario, ubica.Destino.NumRegIdTrib, ubica.Destino.ResidenciaFiscal, ubica.Destino.NumEstacion, ubica.Destino.NombreEstacion, ubica.Destino.NavegacionTrafico, ubica.Destino.FechaHoraProgLlegada) ' cfdi.CartaPorteDomicilio(ubica.Destino.Domicilio.Calle, ubica.Destino.Domicilio.NumeroExterior, ubica.Destino.Domicilio.NumeroInterior, ubica.Destino.Domicilio.Colonia, ubica.Destino.Domicilio.Localidad, ubica.Destino.Domicilio.Referencia, ubica.Destino.Domicilio.Municipio, ubica.Destino.Domicilio.Estado, ubica.Destino.Domicilio.Pais, ubica.Destino.Domicilio.CP) @@ -2154,16 +2154,18 @@ Public Class Timbrado 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 + '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 - + End If ' If Carta.FiguraTransporte IsNot Nothing Then @@ -2186,13 +2188,15 @@ Public Class Timbrado 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.CartaPorteOperador(concep.RFCOperador, concep.NumLicencia, concep.NombreOperador, concep.NumRegidTribOperador, concep.ResidenciaFiscalOperador) - ' cfdi.CartaPorteOperadorDomicilio(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) - ' Next - ' 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 @@ -2414,45 +2418,28 @@ Public Class Timbrado swmili = sw.ElapsedMilliseconds sw.Start() - If ObjCFDITimbre.Comprobante.TipoComprobante <> "P" Then + Select Case ObjCFDITimbre.Comprobante.TipoComprobante + Case "N" - '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 - - If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then Using ObjNomina2 As New ClsNominas() - If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0, isFiniquito:=Ventas.Timbre.IStimbreFiniquito) Then + 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 - End If - If ObjCFDITimbre.Comprobante.TipoComprobante = "T" Then + 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 = "" @@ -2460,8 +2447,36 @@ Public Class Timbrado Retorno = "Error" End If End Using - End If - End If + + + 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\") @@ -3047,7 +3062,7 @@ Public Class Timbrado If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then Using ObjNomina2 As New ClsNominas() - If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0) Then + If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, ObjCFDITimbre.Comprobante.Fecha, ObjCFDITimbre.Comprobante.Fecha, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0) Then Retorno = "" Else Retorno = "Error" @@ -3936,10 +3951,10 @@ Public Class Timbrado ComCartaPorte.FiguraTransporte.Operadores = New ProfactCartaPorte.CartaPorteFiguraTransporteOperadoresOperador(Carta.FiguraTransporte.Operadores.Count - 1) {} For Each concep As CFDICartaPorteOperador In Carta.FiguraTransporte.Operadores ComCartaPorte.FiguraTransporte.Operadores(i) = New ProfactCartaPorte.CartaPorteFiguraTransporteOperadoresOperador - ComCartaPorte.FiguraTransporte.Operadores(i).RFCOperador = concep.RFCOperador + ComCartaPorte.FiguraTransporte.Operadores(i).RFCOperador = concep.RFCFigura ComCartaPorte.FiguraTransporte.Operadores(i).NumLicencia = concep.NumLicencia - ComCartaPorte.FiguraTransporte.Operadores(i).NombreOperador = concep.NombreOperador - ComCartaPorte.FiguraTransporte.Operadores(i).NumRegIdTribOperador = concep.NumRegidTribOperador + ComCartaPorte.FiguraTransporte.Operadores(i).NombreOperador = concep.NombreFigura + ComCartaPorte.FiguraTransporte.Operadores(i).NumRegIdTribOperador = concep.NumRegidTribFigura 'OComCartaPorte.FiguraTransporte.Operadores(i)(0) = concep.ResidenciaFiscalOperador 'falta ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio = New ProfactCartaPorte.CartaPorteFiguraTransporteOperadoresOperadorDomicilio() diff --git a/App_Code/Timbres.vb b/App_Code/Timbres.vb new file mode 100644 index 000000000..0c276d71c --- /dev/null +++ b/App_Code/Timbres.vb @@ -0,0 +1,355 @@ +Imports System.Data +Imports Extensiones + +Public Class Timbres + Private _MsgError As StringBuilder + Private _MensajeAlert As StringBuilder + Public Property TieneError As Boolean + Public ReadOnly Property MsgError As String + Get + Return _MsgError.ToString + End Get + End Property + + Public ReadOnly Property MensajeAlert As String + Get + Return _MensajeAlert.ToString + End Get + End Property + + Private Property CveMovimiento As Integer + Private Property UsuarioActual As Usuario + Private Property AplicaCP As Boolean + Private Property FechaSalidaLlegada As Date + + Private Property Serie As String + Private Property Folio As Integer + Private Property CveTimbre As Integer + + Private Property CPCliente As Integer + Public Property ObjFactura As Modelos.Factura + + Public Sub New() + + End Sub + + Public Sub New(TipoDocto As String, tCveTimbre As Integer, tUsuarioActual As Usuario) + _MsgError = New StringBuilder + UsuarioActual = tUsuarioActual + CveTimbre = tCveTimbre + CreaObjetosTraslados(TipoDocto, tCveTimbre) + End Sub + + + Private Sub CreaObjetosTraslados(TipoDocto As String, CveTimbre As Integer) + ObjFactura = New Modelos.Factura + ObjFactura.Version = "3.3" + ObjFactura.CveUsuario = UsuarioActual.CveUsuario + ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa + ObjFactura.UsuarioActual = UsuarioActual + 'ObjFactura.TipoCambio = 1 + ObjFactura.ConvertirPesos = False + ObjFactura.CveMoneda = 1 + ObjFactura.Moneda = "XXX" + ObjFactura.MonedaSAT = "XXX" + ObjFactura.MonedaAbreviatura = "XXX" + ObjFactura.TipoDocto = TipoDocto + ObjFactura.TipoComprobante = "T" + + ObjFactura.Fecha = Now + ObjFactura.FechaPago = Now + ObjFactura.FechaEjecucion = Now + ObjFactura.UsuarioCreo = UsuarioActual.Usuario + ObjFactura.TipoDocumento = "Traspaso" + + + ObjFactura.RFCReceptor = "XAXX010101000" ' RFC empresa traslado , si es entrega RFC Cliente + + ObjFactura.Inv_CveMovimiento = CveMovimiento + ObjFactura.CveTimbre = CveTimbre + + If CveTimbre > 0 AndAlso ObjFactura.TipoComprobante = "T" Then + + ObjFactura.Timbre = PreParaTimbreCartaPorte(ObjFactura) + + End If + + End Sub + + Private Function PreParaTimbreCartaPorte(Obj As Modelos.Factura) As CFDITimbre + Dim Timbre As New CFDITimbre + Timbre.Comprobante.TipoComprobante = "T" + Timbre.Comprobante.Fecha = Obj.Fecha + Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 + Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT + Timbre.Comprobante.SubTotal = Obj.SubTotal + Timbre.Comprobante.Descuentos = Obj.Descuento + Timbre.Comprobante.Moneda = "XXX" + Timbre.Comprobante.TipoCambio = "" ' CONDICIÓN SI LA MONEDA ES 'XXX' + + Timbre.Receptor.RFC = UsuarioActual.Empresa.RFC + Timbre.Receptor.Nombre = UsuarioActual.Empresa.Empresa + Timbre.Receptor.UsoCFDI = "P01" + + + Dim totSubTotal As Decimal = Obj.SubTotal + Dim totIVA As Decimal = Obj.IVA + Dim totRetIVA As Decimal = Obj.RetIVA + Dim totRetISR As Decimal = Obj.RetISR + Dim i As Integer = 1 + + + Timbre.Comprobante.LugarExpedicion = UsuarioActual.Empresa.CP.ToString + + + 'DETALLES + Dim tPS As String = "" + + Dim CartaPorte As New CFDICartaPorte + CartaPorte.TranspInternac = "No" + CartaPorte.EntradaSalidaMercancia = "" + CartaPorte.ViaEntradaSalida = "" + + CartaPorte.Mercancias.UnidadPeso = "KGM" + CartaPorte.Mercancias.CargoporTasacion = 0 + + Dim FI As Date = New Date(1900, 1, 1) + Dim FF As Date = New Date(9999, 1, 1) + + Dim ObjGrales As New ClsGenerales + If ObjGrales.GetGralTimbre(CveTimbre, "-1", FI, FF, 0, UsuarioActual.CveEmpresa, -1) Then + + If ObjGrales.DtResultados.Rows.Count = 1 Then + Dim DtMovimientos As DataTable = Nothing + + Dim drT As DataRow = ObjGrales.DtResultados.Rows(0) + + CveMovimiento = drT("CveMovimientoAlmacen").ToString.ToEntero + FechaSalidaLlegada = drT("FechaEntrega").ToString.ToDate + + ObjFactura.Folio = drT("Folio").ToString.ToEntero + ObjFactura.Serie = drT("Serie").ToString + Timbre.Comprobante.Serie = Obj.Serie + Timbre.Comprobante.Folio = Obj.Folio.ToString + + If ObjGrales.GetGralMovimientosDetalleTimbre(CveTimbre, UsuarioActual.CveEmpresa) Then + DtMovimientos = ObjGrales.DtResultados + Else + TieneError = True + _MsgError.AppendLine("Error al obtener Movimientos") + End If + + ObjFactura.DtDetalle = DtMovimientos + + AplicaCP = Boolean.Parse(drT("AplicaCP").ToString) + + ObjFactura.CveSubProyecto = drT("CveSubProyecto").ToString.ToEntero + + ObjFactura.SetSubProyecto() + ObjFactura.SetSubProyectoMatriz() + + If AplicaCP Then + + CartaPorte.FiguraTransporte.AutoTransporte.PermSCT = drT("TipoPermisoSCT").ToString '"TPAF01" + CartaPorte.FiguraTransporte.AutoTransporte.NumPermisoSCT = drT("NumPermisoSCT").ToString + CartaPorte.FiguraTransporte.AutoTransporte.NombreSeguroResponsabilidadCivil = drT("NombreAseguradora").ToString + CartaPorte.FiguraTransporte.AutoTransporte.PolizaSeguroResponsabilidadCivil = drT("NumPolizaSeguro").ToString + CartaPorte.FiguraTransporte.AutoTransporte.NombreSeguroMedioAmbiente = drT("NombreAseguradoraMedioAmbiente").ToString + CartaPorte.FiguraTransporte.AutoTransporte.PolizaSeguroMedioAmbiente = drT("NumPolizaSeguroMedioAmbiente").ToString + CartaPorte.FiguraTransporte.AutoTransporte.NombreSeguroCarga = drT("NombreAseguradoraCarga").ToString + CartaPorte.FiguraTransporte.AutoTransporte.PolizaSeguroCarga = drT("NumPolizaSeguroCarga").ToString + CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular = drT("ConfigCartaPorte").ToString + CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM = drT("Placa").ToString + CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM = drT("Anio").ToString.ToEntero + + CPCliente = drT("CPCliente").ToString.ToEntero + + + Dim DomOrigen As CFDICartaPorteDomicilio = Nothing + DomOrigen = New CFDICartaPorteDomicilio With {.Calle = drT("DirOriCalle").ToString, + .Colonia = drT("DirOriClaveSATColonia").ToString, + .CP = drT("DirOriCP").ToString, + .Estado = drT("DirOriClaveSATEstado").ToString, + .Pais = drT("DirOriClaveSATPais").ToString, + .Municipio = drT("DIrOriClaveSATMunicipio").ToString, + .Localidad = drT("DirOriClaveSATLocalidad").ToString} + + Dim DomDestino As CFDICartaPorteDomicilio = Nothing + + + DomDestino = New CFDICartaPorteDomicilio With {.Calle = drT("DirDesCalle").ToString, + .Colonia = drT("DirDesClaveSATColonia").ToString, + .CP = drT("DirDesCP").ToString, + .Estado = drT("DirDesClaveSATEstado").ToString, + .Pais = drT("DirDesClaveSATPais").ToString, + .Municipio = drT("DirDesClaveSATMunicipio").ToString, + .Localidad = drT("DirDesClaveSATLocalidad").ToString} + + + Dim Ubica As New CFDICartaPorteUbicacion + Ubica.TipoEstacion = "" + Ubica.DistanciaRecorrida = 1 + Ubica = New CFDICartaPorteUbicacion With {.TipoUbicacion = "Origen", .IDUbicacion = "OR000001", .RFCRemitenteDestinatario = UsuarioActual.Empresa.RFC,'UsuarioActual.Empresa.RFC, + .FechaHoraSalidaLlegada = Now.ToString("yyyy-MM-ddTHH:mm:ss"),' "2021-08-23T11:13:01", + .NombreRemitenteDestinatario = UsuarioActual.Empresa.Empresa, + .Domicilio = DomOrigen} + CartaPorte.Ubicaciones.Add(Ubica) + Ubica = New CFDICartaPorteUbicacion With {.TipoUbicacion = "Destino", .IDUbicacion = "DE000001", .RFCRemitenteDestinatario = UsuarioActual.Empresa.RFC,'UsuarioActual.Empresa.RFC,'"CAMJ841219I33", + .FechaHoraSalidaLlegada = FechaSalidaLlegada.ToString("yyyy-MM-ddT23:59:59"), + .NombreRemitenteDestinatario = UsuarioActual.Empresa.Empresa, + .Domicilio = DomDestino, + .DistanciaRecorrida = 1} + + CartaPorte.Ubicaciones.Add(Ubica) + CartaPorte.FiguraTransporte.ClaveTransporte = "01" + + Dim DomicilioOperador As New CFDICartaPorteDomicilio With {.Calle = drT("FiguraDomicilio").ToString, + .NumeroExterior = drT("FiguraNumeroExterior").ToString, + .NumeroInterior = drT("FiguraNumeroInterior").ToString, + .Colonia = drT("FiguraClaveSATColonia").ToString, + .Municipio = drT("FiguraClaveSATMunicipio").ToString, + .Estado = drT("FiguraClaveSATEstado").ToString, + .CP = drT("FiguraCP").ToString} + + + + CartaPorte.FiguraTransporte.Operadores.Add(New CFDICartaPorteOperador With { + .RFCFigura = drT("FiguraRFC").ToString, + .NombreFigura = drT("FiguraChofer").ToString, + .NumLicencia = drT("FiguraLicencia").ToString, + .NumRegidTribFigura = drT("FiguraNumRegidTribFigura").ToString, + .ResidenciaFiscalFigura = drT("FiguraResidenciaFiscalFigura").ToString, + .Domicilio = DomicilioOperador}) + + + 'concepto único + Dim concepto As New CFDIConceptos With {.Cantidad = 1, + .Descripcion = "Flete", + .ValorUnitario = 0, + .Importe = 0, + .Descuento = 0, + .Unidad = "Servicio", + .ClaveUnidad = "E48", + .ClaveProdServ = "78101802", + .Noidentificacion = "", + .CuentaPredial = ""} + + Timbre.Conceptos.Add(concepto) + + For Each drr As DataRow In Obj.DtDetalle.Rows + + If drr("PS").ToString.Length = 1 Then + tPS = drr("Obs").ToString + Else + If drr("PS").ToString.Length = 0 Then + tPS = "" + Else + tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) + End If + End If + Dim conceptoCarta As New CFDICartaPorteMercancia With { + .BienesTransp = drr("SATClaveProdServ").ToString, + .ClaveSTCC = "", 'para metodo ferroviario + .Cantidad = drr("Cantidad").ToString.ToDecimal, + .Descripción = tPS, + .ClaveUnidad = drr("SATClaveUM").ToString, + .Unidad = drr("UM").ToString, + .Dimensiones = "", + .PesoenKg = drr("PesoKg").ToString.ToDecimal, + .MaterialPeligroso = If(drr("ClaveMaterialPeligroso").ToString <> "", "Sí", "No"), + .ClaveMaterialPeligroso = drr("ClaveMaterialPeligroso").ToString, + .Embalaje = drr("ClaveEmbalaje").ToString, + .DescripEmbalaje = drr("Embalaje").ToString, + .ValorMercancia = drr("PU").ToString.ToDecimal, + .Moneda = "MXN", 'temporal + .FraccionArrancelaria = "", + .UUIDComercioExt = "" + } + + Dim DetalleMercancia As New CFDICartaPorteMercanciaDetalleMercancia With {.PesoNeto = drr("PesoKg").ToString.ToDecimal} + conceptoCarta.DetalleMercancia = DetalleMercancia + + Dim MercanciaTransporta As New CFDICartaPorteMercanciaTransporta With {.Cantidad = drr("Cantidad").ToString.ToDecimal, .IDOrigen = "OR000001", .IDDestino = "DE000001"} + conceptoCarta.MercanciasCantidadTransporta.Add(MercanciaTransporta) + + totSubTotal = totSubTotal - concepto.Importe + CartaPorte.Mercancias.Mercancias.Add(conceptoCarta) + + i += 1 + Next + Timbre.Complementos.CartaPorte = CartaPorte + + Else + '' T R A S L A D O S + + 'DETALLES + + For Each drr As DataRow In Obj.DtDetalle.Rows + + If drr("PS").ToString.Length = 1 Then + tPS = drr("Obs").ToString + Else + If drr("PS").ToString.Length = 0 Then + tPS = "" + Else + tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) + End If + End If + + 'CONDICIONANTE, ESPECIAL + If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" 'LES COMENTAN QUE NO DEBE IR LA ETIQUETA DE LA UNIDAD EN EL PRODUCTO + + Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal, + .Descripcion = tPS, + .ValorUnitario = drr("PU").ToString.ToDecimal, + .Importe = drr("TotalImporte").ToString.ToDecimal, + .Descuento = drr("Descuento").ToString.ToDecimal, + .Unidad = drr("UM").ToString, + .ClaveUnidad = drr("SATClaveUM").ToString, + .ClaveProdServ = drr("SATClaveProdServ").ToString, + .Noidentificacion = drr("Noidentificacion").ToString, + .CuentaPredial = drr("CuentaPredial").ToString} + 'VERIFICA SUMA SUBTOTALES + If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'PROCESO DE AJUSTA DE DECIMALES + concepto.Importe = totSubTotal + End If + totSubTotal = totSubTotal - concepto.Importe + + 'SIEMPRE ESTAMOS AGREGANDO EL IVA + 'concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) + + Timbre.Conceptos.Add(concepto) + i += 1 + Next + + End If + + Else + TieneError = True + _MsgError.AppendLine("Consultar datos de timbrado") + End If + + ObjGrales.Dispose() + + End If + Return Timbre + End Function + Public Function Timbrar() As Boolean + + Dim Respuesta As Boolean = False + + Dim ObjTimbrado As New Timbrado + + If ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then + Respuesta = True + Else + Respuesta = False + _MsgError.AppendLine(ObjTimbrado.MensajeErrorCFDI) + End If + + Return Respuesta + + End Function + + +End Class diff --git a/Bin/GoCfdi.dll b/Bin/GoCfdi.dll index c1d9e7fa4..9ccff8cbe 100644 Binary files a/Bin/GoCfdi.dll and b/Bin/GoCfdi.dll differ diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 2bb063817..5827d865e 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -931,8 +931,8 @@ Partial Class PopUpVerFactura Dim TransporteInternacional As String = "" Dim PermisoSTCC As String = "" Dim NumPermiso As String = "" - Dim Aseguradora As String = "" - Dim NumPolizaSeguro As String = "" + Dim AseguradoraRespCivil As String = "" + Dim NumPolizaSeguroRespCivil As String = "" Dim NombreAseguradoraMedioAmbiente As String = "" Dim NumPolizaSeguroMedioAmbiente As String = "" Dim NombreAseguradoraCarga As String = "" @@ -950,15 +950,17 @@ Partial Class PopUpVerFactura Dim FechaCertificacion As DateTime = Nothing Dim SelloCFDi As String = "" Dim SelloSAT As String = "" + Dim TipoDocto As String = "" Dim ObjInv As New ClsGenerales - If ObjInv.GetGralTimbre(CveTimbre, "-1", "-1", -1, MinFecha, MaxFecha, -1, UsuarioActual.CveEmpresa, -1) Then + If ObjInv.GetGralTimbre(CveTimbre, "-1", MinFecha, MaxFecha, -1, UsuarioActual.CveEmpresa, -1) Then If ObjInv.DtResultados.Rows.Count > 0 Then Dim Dr As DataRow = ObjInv.DtResultados.Rows(0) If Dr IsNot Nothing Then SerieFolio = Dr("SerieFolio").ToString - Telefono = Dr("Telefono").ToString + Telefono = Dr("FiguraTelefono").ToString + TipoDocto = Dr("TipoDocto").ToString End If End If End If @@ -973,6 +975,7 @@ Partial Class PopUpVerFactura Dim DtUbicaciones As New DataTable() DtUbicaciones.Columns.Add(New DataColumn("Distancia", GetType(String))) + DtUbicaciones.Columns.Add(New DataColumn("TipoUbicacion", GetType(String))) DtUbicaciones.Columns.Add(New DataColumn("RFC", GetType(String))) DtUbicaciones.Columns.Add(New DataColumn("Nombre", GetType(String))) DtUbicaciones.Columns.Add(New DataColumn("FechaHoraSalida", GetType(DateTime))) @@ -990,7 +993,7 @@ Partial Class PopUpVerFactura DtOperadores.Columns.Add(New DataColumn("NombreOperador", GetType(String))) Dim XMLDoc As New XmlDocument - Dim Path As String = String.Format("{0}\{1}\{2}\{3}.{4}", UsuarioActual.Empresa.Ruta, "XML", "Tra", String.Format("{0}", SerieFolio), "xml") + Dim Path As String = String.Format("{0}\{1}\{2}\{3}.{4}", UsuarioActual.Empresa.Ruta, "XML", TipoDocto, String.Format("{0}", SerieFolio), "xml") Dim Archivo As New System.IO.FileInfo(Path) If Archivo.Exists Then @@ -1024,6 +1027,7 @@ Partial Class PopUpVerFactura namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal") namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal") namespaces.AddNamespace("cartaporte", "http://www.sat.gob.mx/CartaPorte") + namespaces.AddNamespace("cartaporte20", "http://www.sat.gob.mx/CartaPorte20") Dim nodeComprobante As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Comprobante", Prefijo), namespaces) If nodeComprobante IsNot Nothing Then @@ -1060,40 +1064,42 @@ Partial Class PopUpVerFactura Dim nodeComp As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", Prefijo), namespaces) - Dim nodeCartaPorte As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:CartaPorte", "cartaporte"), namespaces) + Dim nodeCartaPorte As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:CartaPorte", "cartaporte20"), namespaces) If nodeCartaPorte IsNot Nothing Then TransporteInternacional = ValorXML(nodeCartaPorte, "TranspInternac", "") End If - Dim nodeAutotransporteFederal As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:AutotransporteFederal", "cartaporte"), namespaces) + Dim nodeAutotransporteFederal As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:Autotransporte", "cartaporte20"), namespaces) If nodeAutotransporteFederal IsNot Nothing Then PermisoSTCC = ValorXML(nodeAutotransporteFederal, "PermSCT", "") NumPermiso = ValorXML(nodeAutotransporteFederal, "NumPermisoSCT", "") - Aseguradora = ValorXML(nodeAutotransporteFederal, "NombreAseg", "") - NumPolizaSeguro = ValorXML(nodeAutotransporteFederal, "NumPolizaSeguro", "") - - 'Por Definir de donde sale - 'NombreAseguradoraMedioAmbiente = ValorXML(nodeAutotransporteFederal, "", "") - 'NumPolizaSeguroMedioAmbiente = ValorXML(nodeAutotransporteFederal, "", "") - 'NombreAseguradoraCarga = ValorXML(nodeAutotransporteFederal, "", "") - 'NumPolizaSeguroCarga = ValorXML(nodeAutotransporteFederal, "", "") - - End If - Dim nodeIdentificacionVehicular As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:IdentificacionVehicular", "cartaporte"), namespaces) + Dim nodeIdentificacionVehicular As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:IdentificacionVehicular", "cartaporte20"), namespaces) If nodeIdentificacionVehicular IsNot Nothing Then PlacaVM = ValorXML(nodeIdentificacionVehicular, "PlacaVM", "") AnioModeloVM = ValorXML(nodeIdentificacionVehicular, "AnioModeloVM", "") End If - Dim nodeFiguraTransporte As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:FiguraTransporte", "cartaporte"), namespaces) - If nodeFiguraTransporte IsNot Nothing Then - Dim CveTransporte As String = ValorXML(nodeFiguraTransporte, "CveTransporte", "") - MedioTransporte = String.Format("{0} - {1}", CveTransporte, HtTransporte(CveTransporte).ToString()) + Dim nodeSeguros As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:Seguros", "cartaporte20"), namespaces) + If nodeIdentificacionVehicular IsNot Nothing Then + AseguradoraRespCivil = ValorXML(nodeSeguros, "AseguraRespCivil", "") + NumPolizaSeguroRespCivil = ValorXML(nodeSeguros, "PolizaRespCivil", "") + + 'Por Definir de donde sale + NombreAseguradoraMedioAmbiente = ValorXML(nodeSeguros, "AseguraMedAmbiente", "") + NumPolizaSeguroMedioAmbiente = ValorXML(nodeSeguros, "PolizaMedAmbiente", "") + NombreAseguradoraCarga = ValorXML(nodeSeguros, "AseguraCarga", "") + NumPolizaSeguroCarga = ValorXML(nodeSeguros, "PolizaCarga", "") End If - Dim nodeMercancias As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Mercancia", "cartaporte"), namespaces) + 'Dim nodeFiguraTransporte As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:FiguraTransporte", "cartaporte20"), namespaces) + 'If nodeFiguraTransporte IsNot Nothing Then + ' Dim CveTransporte As String = ValorXML(nodeFiguraTransporte, "TipoFigura", "") + ' MedioTransporte = String.Format("{0} - {1}", CveTransporte, HtTransporte(CveTransporte).ToString()) + 'End If + + Dim nodeMercancias As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Mercancia", "cartaporte20"), namespaces) For Each node As XmlNode In nodeMercancias Dim Row As DataRow = DtMercancias.NewRow @@ -1105,45 +1111,44 @@ Partial Class PopUpVerFactura DtMercancias.Rows.Add(Row) Next - Dim nodeOperadores As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Operador", "cartaporte"), namespaces) + Dim nodeOperadores As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:TiposFigura", "cartaporte20"), namespaces) For Each node As XmlNode In nodeOperadores Dim Row As DataRow = DtOperadores.NewRow - Row("RFC") = ValorXML(node, "RFCOperador", "") + Row("RFC") = ValorXML(node, "RFCFigura", "") Row("NumLicencia") = ValorXML(node, "NumLicencia", "") - Row("NombreOperador") = ValorXML(node, "NombreOperador", "") + Row("NombreOperador") = ValorXML(node, "NombreFigura", "") DtOperadores.Rows.Add(Row) Next - Dim nodeUbicaciones As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Ubicacion", "cartaporte"), namespaces) + Dim nodeUbicaciones As XmlNodeList = nodeComp.SelectNodes(String.Format("//{0}:Ubicacion", "cartaporte20"), namespaces) For Each node As XmlNode In nodeUbicaciones Dim Row As DataRow = DtUbicaciones.NewRow Row("Distancia") = ValorXML(node, "DistanciaRecorrida", "") - Dim nodeOrigen = node.ChildNodes.Cast(Of XmlNode).FirstOrDefault(Function(x) x.Name = "cartaporte:Origen") - If nodeOrigen IsNot Nothing Then - Row("RFC") = ValorXML(nodeOrigen, "RFCRemitente", "") - Row("Nombre") = ValorXML(nodeOrigen, "NombreRemitente", "") - Row("FechaHoraSalida") = ValorXML(nodeOrigen, "FechaHoraSalida", "").ToDateTime() - End If + Row("TipoUbicacion") = ValorXML(node, "TipoUbicacion", "") + Row("FechaHoraSalida") = ValorXML(node, "FechaHoraSalidaLlegada", "") + Row("RFC") = ValorXML(node, "RFCRemitenteDestinatario", "") + Row("Nombre") = ValorXML(node, "NombreRemitenteDestinatario", "") - Dim nodeDestino = node.ChildNodes.Cast(Of XmlNode).FirstOrDefault(Function(x) x.Name = "cartaporte:Destino") 'node.SelectSingleNode(String.Format("//{0}:Destino", "cartaporte"), namespaces) - If nodeDestino IsNot Nothing Then - Row("RFC") = ValorXML(nodeDestino, "RFCDestinatario", "") - Row("Nombre") = ValorXML(nodeDestino, "NombreDestinatario", "") - Row("FechaHoraSalida") = ValorXML(nodeDestino, "FechaHoraProgLlegada", "").ToDateTime() - End If - - Dim nodeDomicilio = node.ChildNodes.Cast(Of XmlNode).FirstOrDefault(Function(x) x.Name = "cartaporte:Domicilio") 'node.SelectSingleNode(String.Format("//{0}:Domicilio", "cartaporte"), namespaces) + Dim nodeDomicilio = node.ChildNodes.Cast(Of XmlNode).FirstOrDefault(Function(x) x.Name = "cartaporte20:Domicilio") 'node.SelectSingleNode(String.Format("//{0}:Domicilio", "cartaporte"), namespaces) If nodeDomicilio IsNot Nothing Then + + Dim Estado As String = "" + Dim Municipio As String = "" + Dim Colonia As String = "" Dim calle = ValorXML(nodeDomicilio, "Calle", "") - Dim Estado = ValorXML(nodeDomicilio, "Estado", "") - Dim Pais = ValorXML(nodeDomicilio, "MEX", "") Dim CP = ValorXML(nodeDomicilio, "CodigoPostal", "") - Row("Direccion") = String.Format("{0} ,{1},{2}. CP {3}", calle, Estado, Pais, CP) + Dim dr As DataRow = GlobalDTGralColonias(ValorXML(nodeDomicilio, "Estado", ""), ValorXML(nodeDomicilio, "Municipio", ""), ValorXML(nodeDomicilio, "Colonia", "")).FiltroPrimero("") + If dr IsNot Nothing Then + Estado = dr("NombreEstado").ToString + Municipio = dr("NombreMunicipio").ToString + Colonia = dr("NombreAsentamiento").ToString + End If + Row("Direccion") = String.Format("{0} Col.{1},{2},{3}. CP {4}", calle, Colonia, Municipio, Estado, CP) End If DtUbicaciones.Rows.Add(Row) @@ -1197,8 +1202,8 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("PermisoSTCC", PermisoSTCC)) params.Add(New ReportParameter("NumPermiso", NumPermiso)) - params.Add(New ReportParameter("Aseguradora", Aseguradora)) - params.Add(New ReportParameter("NumPoliza", NumPolizaSeguro)) + params.Add(New ReportParameter("Aseguradora", AseguradoraRespCivil)) + params.Add(New ReportParameter("NumPoliza", NumPolizaSeguroRespCivil)) params.Add(New ReportParameter("NombreAseguradoraMedioAmbiente", NombreAseguradoraMedioAmbiente)) params.Add(New ReportParameter("NumPolizaSeguroMedioAmbiente", NumPolizaSeguroMedioAmbiente)) @@ -1246,7 +1251,7 @@ Partial Class PopUpVerFactura rds4.Value = DtOperadores lrds.Add(rds4) - ImprimirPDF("Empresas/Grales/Formatos/CartaPorteTimbrado.rdlc", lrds, params, String.Format("Carta Porte -{0}", Now.ToDateTime.ToShortDateString)) + ImprimirPDF("Empresas/Grales/Formatos/CartaPorteTimbrado.rdlc", lrds, params, SerieFolio) End If End If End Sub @@ -1256,7 +1261,7 @@ Partial Class PopUpVerFactura #Region "OP = 'DesXmlTra' - IMPRIME XML TRASLADO" Private Sub DescargaXMLTraslado(Parametros As Hashtable) - If Parametros("CVEMOVIMIENTO") IsNot Nothing AndAlso Parametros("CVEMOVIMIENTO").ToString.ToEntero > 0 Then + If Parametros("TIPODOCTO") IsNot Nothing AndAlso Parametros("TIPODOCTO").ToString <> "" Then Dim Exten As String = If(Parametros("EXT").ToString.ToLower = "xml", "xml", "pdf") Dim Path As String = String.Format("{0}\{1}\{2}\{3}.{4}", UsuarioActual.Empresa.Ruta, Parametros("EXT").ToString, Parametros("TIPODOCTO").ToString, Parametros("FOLIO").ToString, Exten) Dim Archivo As New System.IO.FileInfo(Path) @@ -1280,29 +1285,32 @@ Partial Class PopUpVerFactura #Region "OP = 'DesPdfTra' - IMPRIME PDF TRASLADO" Private Sub DescargaPDFTraslado(Parametros As Hashtable) - If Parametros("CVEMOVIMIENTO") IsNot Nothing AndAlso Parametros("CVEMOVIMIENTO").ToString.ToEntero > 0 Then + If Parametros("TIPODOCTO") IsNot Nothing AndAlso Parametros("TIPODOCTO").ToString <> "" Then Dim Exten As String = If(Parametros("EXT").ToString.ToLower = "xml", "xml", "pdf") Dim Path As String = String.Format("{0}\{1}\{2}\{3}.{4}", UsuarioActual.Empresa.Ruta, Parametros("EXT").ToString, Parametros("TIPODOCTO").ToString, Parametros("FOLIO").ToString, Exten) Dim Archivo As New System.IO.FileInfo(Path) - + Dim cvetimbre As Integer = Parametros("CVETIMBRE").ToString.ToEntero + If Archivo.Exists Then DescargarArchivoPDFTraslado(Archivo, Path) Else If Exten = "pdf" Then - GeneraPDFFactura(Parametros("CVEMOVIMIENTO").ToString.ToEntero) + Dim ObjTimbres As New Timbres("Rec", cvetimbre, UsuarioActual) + + GeneraPDFFactura(ObjTimbres.ObjFactura) Archivo = New System.IO.FileInfo(Path) If Archivo.Exists Then DescargarArchivoPDFTraslado(Archivo, Path) End If - End If - End If + End If + End If Archivo = Nothing End If End Sub Private Sub DescargarArchivoPDFTraslado(Archivo As System.IO.FileInfo, path As String) HttpContext.Current.Response.Clear() HttpContext.Current.Response.ClearContent() - HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = "xml", "application/xml", "application/pdf") + HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = "xml", "text/xml", "application/pdf") HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name)) HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) HttpContext.Current.Response.TransmitFile(path) @@ -1310,9 +1318,9 @@ Partial Class PopUpVerFactura HttpContext.Current.Response.End() End Sub - Private Sub GeneraPDFFactura(CveMovimiento As Integer) + Private Sub GeneraPDFFactura(ObjFactura As Modelos.Factura) Try - Dim objFactura = CreaObjetosTraslado(CveMovimiento) + ' Dim objFactura = CreaObjetosTraslado(CveMovimiento) If objFactura IsNot Nothing Then PdfFactura(objFactura) objFactura.Dispose() diff --git a/Compras/Proveedores.aspx.vb b/Compras/Proveedores.aspx.vb index 0d721b704..8763f2b39 100644 --- a/Compras/Proveedores.aspx.vb +++ b/Compras/Proveedores.aspx.vb @@ -1482,7 +1482,7 @@ Partial Class Compras_Proveedores DdlCveClasificacionProveedor.Items.Insert(0, New ListItem("Sin Clasificación", "0")) End Sub Private Sub CargaDIOTPais() - DdlDIOTPais.DataSource = GlobalDTPais() + DdlDIOTPais.DataSource = GlobalDTGralPaises() DdlDIOTPais.DataBind() DdlDIOTPais.Items.Insert(0, New ListItem("-", "0")) End Sub diff --git a/General/RepEntregaAlmacenRuta.aspx b/General/RepEntregaAlmacenRuta.aspx index 522992dcc..f177f0868 100644 --- a/General/RepEntregaAlmacenRuta.aspx +++ b/General/RepEntregaAlmacenRuta.aspx @@ -99,7 +99,7 @@ " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> @@ -111,8 +111,7 @@ - - + @@ -125,7 +124,7 @@ - + @@ -147,8 +146,7 @@ -