Inicio PS por caducar y RSCO Por Vencer, Avance descarga Ingresos
This commit is contained in:
@@ -852,6 +852,11 @@ Partial Class Compras_ReembolsosComprobaciones
|
||||
ConceptoContableRetIVAAcreditable = 249
|
||||
CveFunc = 313
|
||||
CveFuncAcreditable = 314
|
||||
Case 5
|
||||
ConceptoContableRetIVAXAcreditar = 285
|
||||
ConceptoContableRetIVAAcreditable = 286
|
||||
CveFunc = 578
|
||||
CveFuncAcreditable = 578
|
||||
End Select
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
||||
|
||||
@@ -59,10 +59,10 @@
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkCFDiMasivo" runat="server" ToolTip="Validación Masiva de CFDi"><i class="fa fa-list-ul"></i> Validación Masiva</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="lbDescargar" runat="server"><%--<img src="/Metronic/assets/global/img/portlet-reload-icon.png" />--%><i class="fa fa-download"></i>
|
||||
<%-- <li>
|
||||
<asp:LinkButton ID="lbDescargar" runat="server"><i class="fa fa-download"></i>
|
||||
Descarga Facturas SAT</asp:LinkButton>
|
||||
</li>
|
||||
</li>--%>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkShowSolicitudes" OnClick="LnkShowSolicitudes_Click" runat="server">Solicitudes SAT</asp:LinkButton>
|
||||
</li>
|
||||
|
||||
@@ -6,6 +6,10 @@ Imports System.Diagnostics
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports System.IO.Compression
|
||||
Imports System.Net.Http
|
||||
Imports System.Net.Http.Headers
|
||||
Imports System.Threading
|
||||
Imports System.Threading.Tasks
|
||||
Imports System.Xml
|
||||
Imports ADSistemaLibrary.SatXml
|
||||
Imports ADSistemaLibrary.SatXml.XmlSatCFDI
|
||||
@@ -760,7 +764,7 @@ Partial Class Compras_eFacturas
|
||||
If UsuarioActual.Sesion("eFact-Proveedor").ToString <> "" Then TxtProveedor.Text = UsuarioActual.Sesion("eFact-Proveedor").ToString.Trim
|
||||
If UsuarioActual.Sesion("eFact-FI").ToString <> "" Then txtFechaI.Text = UsuarioActual.Sesion("eFact-FI").ToString.Trim
|
||||
If UsuarioActual.Sesion("eFact-FF").ToString <> "" Then txtFechaF.Text = UsuarioActual.Sesion("eFact-FF").ToString.Trim
|
||||
If UsuarioActual.CveUsuario = 100 Then lbDescargar.Visible = True
|
||||
'If UsuarioActual.CveUsuario = 100 Then lbDescargar.Visible = True
|
||||
|
||||
'If UsuarioActual.TienePermisoProceso(81) Then GvD.Columns(11).Visible = True : GvD.Columns(12).Visible = True
|
||||
'If UsuarioActual.TienePermisoProceso(206) Then GvD.Columns(10).Visible = False
|
||||
@@ -2575,9 +2579,9 @@ Partial Class Compras_eFacturas
|
||||
|
||||
Using nom As ClsNominas = New ClsNominas()
|
||||
Continuar = nom.SolicitudesAdd(idSolicitudCFDI, idSolicitudMetadata, estatus, observaciones, fechaInicio, fechaFin, cveUsuarioIng, cveEmpresa, 2)
|
||||
'Dim api = New GeneralesAPI()
|
||||
'api.GeneraSolicitud()
|
||||
'api.VerificaSolicitudesNominas()
|
||||
Dim api = New GeneralesAPIeFacturas()
|
||||
api.GeneraSolicitud()
|
||||
api.VerificaSolicitudesNominas()
|
||||
End Using
|
||||
|
||||
If Continuar Then
|
||||
@@ -2590,99 +2594,71 @@ Partial Class Compras_eFacturas
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkverificarSolicitudes_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
'Dim api = New GeneralesAPI()
|
||||
'api.GeneraSolicitud()
|
||||
'api.VerificaSolicitudesNominas()
|
||||
Dim api = New GeneralesAPIeFacturas()
|
||||
api.GeneraSolicitud()
|
||||
api.VerificaSolicitudesNominas()
|
||||
cargasolicitudes()
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "D E S C A R G A R - F A C T U R A "
|
||||
Protected Sub lbDescargar_Click(sender As Object, e As EventArgs) Handles lbDescargar.Click
|
||||
'Protected Sub lbDescargar_Click(sender As Object, e As EventArgs) Handles lbDescargar.Click
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
' Dim Retorno As Boolean = False
|
||||
|
||||
Dim ObjProcess As Process = Nothing
|
||||
Dim Mensajes As String = ""
|
||||
Dim error1 As Boolean = False
|
||||
Dim CountProcesados As Integer = 0
|
||||
' Dim ObjProcess As Process = Nothing
|
||||
' Dim Mensajes As String = ""
|
||||
' Dim error1 As Boolean = False
|
||||
' Dim CountProcesados As Integer = 0
|
||||
|
||||
|
||||
|
||||
Try
|
||||
ObjProcess = New Process()
|
||||
ObjProcess.StartInfo.RedirectStandardOutput = True
|
||||
ObjProcess.StartInfo.FileName = Ejecutable
|
||||
ObjProcess.StartInfo.Arguments = $"--mod dsat2 --cveemp {UsuarioActual.CveEmpresa} --rfc {UsuarioActual.Empresa.RFC} --ciec {UsuarioActual.Empresa.CIEC} --razon {UsuarioActual.Empresa.Empresa} --fi {txtFechaI.Text} --ff {txtFechaF.Text}"
|
||||
ObjProcess.StartInfo.UseShellExecute = False
|
||||
ObjProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
|
||||
ObjProcess.Start()
|
||||
' Try
|
||||
' ObjProcess = New Process()
|
||||
' ObjProcess.StartInfo.RedirectStandardOutput = True
|
||||
' ObjProcess.StartInfo.FileName = Ejecutable
|
||||
' ObjProcess.StartInfo.Arguments = $"--mod dsat2 --cveemp {UsuarioActual.CveEmpresa} --rfc {UsuarioActual.Empresa.RFC} --ciec {UsuarioActual.Empresa.CIEC} --razon {UsuarioActual.Empresa.Empresa} --fi {txtFechaI.Text} --ff {txtFechaF.Text}"
|
||||
' ObjProcess.StartInfo.UseShellExecute = False
|
||||
' ObjProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
|
||||
' ObjProcess.Start()
|
||||
|
||||
|
||||
Dim myStreamReader As StreamReader = ObjProcess.StandardOutput
|
||||
' Dim myStreamReader As StreamReader = ObjProcess.StandardOutput
|
||||
|
||||
'Read the standard output of the spawned process.
|
||||
Mensajes = myStreamReader.ReadLine()
|
||||
If Mensajes.Length > 0 Then
|
||||
' 'Read the standard output of the spawned process.
|
||||
' Mensajes = myStreamReader.ReadLine()
|
||||
' If Mensajes.Length > 0 Then
|
||||
|
||||
Dim msgs As String() = Mensajes.Split("|"c)
|
||||
Dim NFacturas As Integer = 0
|
||||
' Dim msgs As String() = Mensajes.Split("|"c)
|
||||
' Dim NFacturas As Integer = 0
|
||||
|
||||
If msgs.Length >= 2 Then
|
||||
Try
|
||||
NFacturas = msgs(0).ToEntero
|
||||
CountProcesados = msgs(0).ToEntero
|
||||
Mensajes = $"La actualización se realizó correctamente. <br> Facturas agregadas: { NFacturas }"
|
||||
Catch ex As Exception
|
||||
NFacturas = 0
|
||||
Mensajes = "La actualización se realizó correctamente"
|
||||
End Try
|
||||
Else
|
||||
Mensajes = "La descarga se realizó correctamente"
|
||||
End If
|
||||
End If
|
||||
ObjProcess.WaitForExit()
|
||||
ObjProcess.Close()
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
error1 = True
|
||||
OnError("Ocurrió un error al ejecutar el actualizador.", ex)
|
||||
End Try
|
||||
' If msgs.Length >= 2 Then
|
||||
' Try
|
||||
' NFacturas = msgs(0).ToEntero
|
||||
' CountProcesados = msgs(0).ToEntero
|
||||
' Mensajes = $"La actualización se realizó correctamente. <br> Facturas agregadas: { NFacturas }"
|
||||
' Catch ex As Exception
|
||||
' NFacturas = 0
|
||||
' Mensajes = "La actualización se realizó correctamente"
|
||||
' End Try
|
||||
' Else
|
||||
' Mensajes = "La descarga se realizó correctamente"
|
||||
' End If
|
||||
' End If
|
||||
' ObjProcess.WaitForExit()
|
||||
' ObjProcess.Close()
|
||||
' Retorno = True
|
||||
' Catch ex As Exception
|
||||
' error1 = True
|
||||
' OnError("Ocurrió un error al ejecutar el actualizador.", ex)
|
||||
' End Try
|
||||
|
||||
If Retorno Then CargaDatos()
|
||||
' If Retorno Then CargaDatos()
|
||||
|
||||
|
||||
|
||||
|
||||
'Dim Retorno As Boolean = False
|
||||
''Codigo anterior no borrar puede hacer el paro
|
||||
|
||||
'Dim ObjProcess As Process = Nothing
|
||||
'Dim Mensajes As String = ""
|
||||
'Dim EjecutableUtilerias = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Utilerias\UtileriasAD.exe")
|
||||
'Dim Folder = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas\")
|
||||
'Dim error1 As Boolean = False
|
||||
'Dim en As New CultureInfo("en-US")
|
||||
'Dim fechai = txtFechaI.Text.Trim.ToDate.ToString("d", en)
|
||||
'Dim fechaf = txtFechaF.Text.Trim.ToDate.ToString("d", en)
|
||||
'Try
|
||||
' ObjProcess = New Process()
|
||||
' ObjProcess.StartInfo.RedirectStandardOutput = True
|
||||
' ObjProcess.StartInfo.FileName = EjecutableUtilerias
|
||||
' ObjProcess.StartInfo.Verb = "runas"
|
||||
' ObjProcess.StartInfo.Arguments = $"{UsuarioActual.CveEmpresa} {Folder} 1 {fechai} {fechaf}"
|
||||
' ObjProcess.StartInfo.UseShellExecute = False
|
||||
' ObjProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
|
||||
' ObjProcess.Start()
|
||||
' ObjProcess.WaitForExit()
|
||||
' ObjProcess.Close()
|
||||
'Catch ex As Exception
|
||||
' error1 = True
|
||||
' OnError("Ocurrió un error al ejecutar el actualizador.", ex)
|
||||
'End Try
|
||||
|
||||
'' ProcesaBuzon()
|
||||
|
||||
End Sub
|
||||
'End Sub
|
||||
|
||||
|
||||
'Private Sub ProcesaBuzon()
|
||||
@@ -4626,18 +4602,123 @@ End Class
|
||||
|
||||
|
||||
|
||||
Public Class GeneralesAPI
|
||||
Inherits ADSNetLibrary.Helpers.Conexiones.SIGAPI.BaseSIGAPI
|
||||
Public Class GeneralesAPIeFacturas
|
||||
|
||||
Inherits ADSNetLibraryzdE.HelpersE.ConexionesE.SIGAPIE.BaseSIGAPIeFacturas
|
||||
|
||||
Public Sub New(ByVal Optional domainApi As String = "http://localhost:4001/", ByVal Optional token As String = "")
|
||||
MyBase.New(domainApi, token)
|
||||
End Sub
|
||||
|
||||
Public Function GeneraSolicitud() As Object
|
||||
Return getData(Of Object)("GeneraSolicitud", Nothing, ADSNetLibrary.Helpers.Conexiones.SIGAPI.requestMethod.[GET], False)
|
||||
Return getData(Of Object)("GeneraSolicitud", Nothing, ADSNetLibraryzdE.HelpersE.ConexionesE.SIGAPIE.requestMethod.[GET], False)
|
||||
End Function
|
||||
|
||||
Public Function VerificaSolicitudesNominas() As Object
|
||||
Return getData(Of Object)("VerificaSolicitudesNominas", Nothing, ADSNetLibrary.Helpers.Conexiones.SIGAPI.requestMethod.[GET], False)
|
||||
Return getData(Of Object)("VerificaSolicitudesNominas", Nothing, ADSNetLibraryzdE.HelpersE.ConexionesE.SIGAPIE.requestMethod.[GET], False)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
Namespace ADSNetLibraryzdE.HelpersE.ConexionesE.SIGAPIE
|
||||
Public Enum requestMethod
|
||||
POST = 1
|
||||
[GET] = 2
|
||||
End Enum
|
||||
|
||||
Public Class BaseSIGAPIeFacturas
|
||||
Private Const tituloLog As String = "ADSNetLibrary.Helpers.Conexiones.SIGAPI"
|
||||
Public domainApi As String
|
||||
Public authorization As String
|
||||
Protected RouteController As String = ""
|
||||
Protected FullRoute As String = ""
|
||||
|
||||
Public Function GetRoutbyclass() As String
|
||||
Dim classname As String = Me.[GetType]().Name
|
||||
Return classname.Substring(0, classname.Length - 12)
|
||||
End Function
|
||||
|
||||
Public Function GetRoute(ByVal path As String) As String
|
||||
If String.IsNullOrEmpty(FullRoute) Then
|
||||
Return String.Format("api/{0}/{1}", (If(String.IsNullOrEmpty(RouteController), GetRoutbyclass(), RouteController)), path)
|
||||
Else
|
||||
Return String.Format("{0}{1}", FullRoute, path)
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Sub New(ByVal domainApi As String, ByVal Optional authorization As String = Nothing, ByVal Optional fullRoute As String = Nothing)
|
||||
If String.IsNullOrEmpty(domainApi) Then
|
||||
domainApi = "http://localhost:4001/"
|
||||
End If
|
||||
|
||||
Me.authorization = authorization
|
||||
Me.domainApi = domainApi
|
||||
Me.FullRoute = fullRoute
|
||||
End Sub
|
||||
|
||||
Public Async Function getDataAsync(Of T As {Class, New})(ByVal path As String, ByVal requestobject As Object, ByVal Optional reqmet As requestMethod = requestMethod.POST, ByVal Optional needauthorization As Boolean = True, ByVal Optional isfullpath As Boolean = False) As Task(Of T)
|
||||
Dim objreturn As T = Nothing
|
||||
|
||||
Using client As HttpClient = New HttpClient()
|
||||
client.BaseAddress = New Uri(domainApi)
|
||||
client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json"))
|
||||
|
||||
If needauthorization Then
|
||||
client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", authorization)
|
||||
End If
|
||||
|
||||
client.Timeout = TimeSpan.FromMinutes(15)
|
||||
Dim response As HttpResponseMessage = New HttpResponseMessage()
|
||||
Dim strjsonreq = Newtonsoft.Json.JsonConvert.SerializeObject(requestobject)
|
||||
Dim content As StringContent = New StringContent(strjsonreq, Encoding.UTF8, "application/json")
|
||||
Dim route As String = If(isfullpath, path, GetRoute(path))
|
||||
|
||||
Try
|
||||
|
||||
Select Case reqmet
|
||||
Case requestMethod.POST
|
||||
response = Await client.PostAsync(route, content)
|
||||
Case requestMethod.[GET]
|
||||
response = Await client.GetAsync(route)
|
||||
End Select
|
||||
|
||||
If response.IsSuccessStatusCode Then
|
||||
Dim jsondata As String = Await response.Content.ReadAsStringAsync()
|
||||
Dim settings As Newtonsoft.Json.JsonSerializerSettings = New Newtonsoft.Json.JsonSerializerSettings With {
|
||||
.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
|
||||
.MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore
|
||||
}
|
||||
objreturn = Newtonsoft.Json.JsonConvert.DeserializeObject(Of T)(jsondata, settings)
|
||||
Else
|
||||
End If
|
||||
|
||||
Catch e As Exception
|
||||
End Try
|
||||
End Using
|
||||
|
||||
Return objreturn
|
||||
End Function
|
||||
|
||||
Public Function getData(Of T As {Class, New})(ByVal path As String, ByVal requestobject As Object, ByVal Optional reqmet As requestMethod = requestMethod.POST, ByVal Optional needauthorization As Boolean = True, ByVal Optional isfullpath As Boolean = False) As T
|
||||
Return AsyncHelper.RunSync(Of T)(Function() getDataAsync(Of T)(path, requestobject, reqmet, needauthorization, isfullpath))
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Friend Module AsyncHelper
|
||||
Private ReadOnly _myTaskFactory As TaskFactory = New TaskFactory(CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.[Default])
|
||||
|
||||
Function RunSync(Of TResult)(ByVal func As Func(Of Task(Of TResult))) As TResult
|
||||
|
||||
'Return AsyncHelper._myTaskFactory.StartNew(Of Task(Of TResult))(func).Unwrap(Of TResult)().GetAwaiter().GetResult()
|
||||
Return AsyncHelper._myTaskFactory.StartNew(Of Task(Of TResult))(func).Unwrap().GetAwaiter().GetResult()
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Sub RunSync(ByVal func As Func(Of Task))
|
||||
AsyncHelper._myTaskFactory.StartNew(Of Task)(func).Unwrap().GetAwaiter().GetResult()
|
||||
End Sub
|
||||
End Module
|
||||
End Namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user