Files
SIG/General/FolioFechaCancelacion.aspx.vb

152 lines
3.8 KiB
VB.net

Imports System.Data
Imports Extensiones
Partial Class Generales_FolioFechaCancelacion
Inherits ClsPaginas
Private Property CveCamion As Integer
Get
If ViewState("CveCamion") Is Nothing Then
Return -1
Else
Return ViewState("CveCamion").ToString().ToEntero()
End If
End Get
Set(ByVal value As Integer)
ViewState("CveCamion") = value
End Set
End Property
Private Sub Generales_FolioFechaCancelacion_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CargaCombos()
'CargaDatos()
End If
End Sub
Public Sub CargaDatos()
LnkExportarExcel.Visible = False
Dim DT_Temp As New DataTable
Dim ObjGeenrales As New ClsGenerales
If ObjGeenrales.GetFolioFechaCancelacion(DdlEmpresa.SelectedValue.ToEntero, DdlTipo.SelectedValue.ToEntero) Then
DT_Temp = ObjGeenrales.DtResultados
If DT_Temp.Rows.Count > 0 Then
LnkExportarExcel.Visible = True
End If
Else
DT_Temp = Nothing
End If
ObjGeenrales.Dispose()
If DT_Temp IsNot Nothing Then
DT_Temp.Columns.Add("FechaCancelacion", GetType(Date))
'DT_Temp = DT_Temp.FiltraParametros("CvePACCancelacion = 4")
DT_Temp.AcceptChanges()
For Each DRow As DataRow In DT_Temp.Rows
Dim CancelacionAcuse As String = ""
Dim CancelacionState As Integer = 0
Dim CancelacionFecha As Date = Now
Dim Consula As Boolean = False
Dim solicitud As New WSGF.Service1SoapClient
Dim resp As New WSGF.StructXml()
Try
resp = solicitud.GetAcuse(DRow("RFCEmisor").ToString, "rene.molina@adsistemas.mx", "rene2018", DRow("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)
CancelacionAcuse = xmlDoc.GetElementsByTagName("SignatureValue")(0).InnerText
CancelacionFecha = xmlDoc.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate
DRow("FechaCancelacion") = CancelacionFecha
Consula = True
Else
CancelacionAcuse = resp.Descripcion
Consula = False
End If
Catch ex As Exception
End Try
solicitud = Nothing
Next
DT_Temp.AcceptChanges()
Else
GvDatos.DataSource = Nothing
End If
If DT_Temp IsNot Nothing Then
GvDatos.DataSource = DT_Temp
End If
GvDatos.DataBind()
UpDatos.Update()
UpAcciones.Update()
'ObtenerAcuse
End Sub
Private Sub CargaCombos()
DdlEmpresa.DataSource = GlobalDTEmpresas
DdlEmpresa.DataBind()
DdlEmpresa.Items.Insert(0, New ListItem("Todas", "-1"))
End Sub
Protected Sub BtnBuscar_Click(sender As Object, e As EventArgs)
CargaDatos()
End Sub
Protected Sub LnkExportarExcel_Click(sender As Object, e As EventArgs)
GvDatos.ExportToExcel2("ReporteCancelaciones.xlsx")
End Sub
End Class