From 2b48fcea8863ab11f4d2fdbee0f4d9a384a5e71b Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 25 Feb 2022 15:59:39 -0700 Subject: [PATCH] FolioFechaCacnelacion Inicial, Bancos IE no eliminar movmientos con cancelaciones --- App_Code/ClsGenerales.vb | 89 +++++++++------ App_Code/ClsPaginas.vb | 5 + App_Code/modExtensiones.vb | 6 +- Bancos/IE.aspx.vb | 7 +- General/FolioFechaCancelacion.aspx | 117 ++++++++++++++++++++ General/FolioFechaCancelacion.aspx.vb | 151 ++++++++++++++++++++++++++ 6 files changed, 341 insertions(+), 34 deletions(-) create mode 100644 General/FolioFechaCancelacion.aspx create mode 100644 General/FolioFechaCancelacion.aspx.vb diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 16e26a4a7..6c2279434 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -3608,40 +3608,8 @@ Public Class ClsGenerales #End Region -#Region "IDisposable Support" - ' IDisposable - Protected Overridable Sub Dispose(disposing As Boolean) - If Not Me.disposedValue Then - If disposing Then - ' TODO: dispose managed state (managed objects). - If Not Data Is Nothing Then Data.Dispose() : Data = Nothing - If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing - If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing - If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing - If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() - If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing - - End If - - ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below. - ' TODO: set large fields to null. - End If - Me.disposedValue = True - End Sub - - - - ' This code added by Visual Basic to correctly implement the disposable pattern. - Public Sub Dispose() Implements IDisposable.Dispose - ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. - ConexionClose() - Dispose(True) - GC.SuppressFinalize(Me) - End Sub -#End Region - #Region " P O L I Z A V I R T U A L " @@ -4138,6 +4106,63 @@ Public Class ClsGenerales End Function + + + Public Function GetFolioFechaCancelacion(CveEmpresa As Integer, Tipo As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Gral_FolioFechaCancelacionGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Tipo", SqlDbType.Int).Value = Tipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError($"Ocurrió un error al obtener los datos de fechas de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + +#Region "IDisposable Support" + + + ' IDisposable + Protected Overridable Sub Dispose(disposing As Boolean) + If Not Me.disposedValue Then + If disposing Then + ' TODO: dispose managed state (managed objects). + If Not Data Is Nothing Then Data.Dispose() : Data = Nothing + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing + If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing + If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing + If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() + If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing + + End If + + ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below. + ' TODO: set large fields to null. + End If + Me.disposedValue = True + End Sub + + + + ' This code added by Visual Basic to correctly implement the disposable pattern. + Public Sub Dispose() Implements IDisposable.Dispose + ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. + ConexionClose() + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region + + End Class diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 062a5f89d..85509a859 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4344,6 +4344,11 @@ Public Class ClsPaginas PaginaDict.Add("/General/JAMComparativos.aspx".ToUpper(), 643) PaginaDict.Add("/General/CatMotivoRechazoGuias.aspx".ToUpper(), 729) + PaginaDict.Add("/General/FolioFechaCancelacion.aspx".ToUpper(), -1) + + + + '-------------------------------------------Q U I T A R---------------------------------- #Region "Q U I T A R" diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 7b2ba750a..14b8818a4 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -964,8 +964,12 @@ Namespace Extensiones (Mid(entero, 3, 1) <> "0" And Len(entero) = 8) Or (Mid(entero, 8, 1) = "0" And Mid(entero, 8, 1) = "0" And Mid(entero, 7, 1) = "0" And Mid(entero, 6, 1) = "0" And Mid(entero, 5, 1) = "0" And Mid(entero, 4, 1) = "0" And Len(entero) = 9) Then - If entero.ToString.Length >= 7 And Not Mid(entero, 1, 7) = "0000000" Then + Dim tmp As String = Mid(entero, 2, 6) + If entero.ToString.Length >= 7 And tmp = "000000" Then + If entero.ToString.Length = 7 And tmp = "000000" Then + palabras.Append("de ") + End If Else palabras.Append("mil ") End If diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index c403a4c1e..946dc9f69 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -1189,6 +1189,11 @@ Partial Class Bancos_IE If ObjIE.FechaIngCancelacion.ToShortDateString = "01/01/0001" Then TrFechaIngCancelacion.Visible = False End If + + If ObjIE.CveIECancelacion > 0 Then + CveIECancelacion = ObjIE.CveIECancelacion + End If + UpCancelacion.Update() 'OTROS DATOS - DATOS COMPLEMENTO SUSTITUCION @@ -4805,7 +4810,7 @@ Partial Class Bancos_IE End Sub Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs) Handles LnkEliminar.Click - If CveIECancelado > 0 Then + If CveIECancelado > 0 Or CveIECancelacion > 0 Then Alert("El Movimiento no se puede eliminar porque tiene una cancelación relacionada, se tiene que eliminar primero la cancelación", TipoMensaje.MsgAdvertencia) Else RegistraScript(String.Format("$('#{0}').modal('show');", "divDescripcion")) diff --git a/General/FolioFechaCancelacion.aspx b/General/FolioFechaCancelacion.aspx new file mode 100644 index 000000000..042b403cd --- /dev/null +++ b/General/FolioFechaCancelacion.aspx @@ -0,0 +1,117 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="FolioFechaCancelacion.aspx.vb" Inherits="Generales_FolioFechaCancelacion" EnableEventValidation="false" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + + Folio Fecha Cancelación + + + + + + +
  • + +
  • +
    + + + +
    +
    + + + + + + +
    +
    +
    + + +
    +
    +
    + +
    + +
    + +
    + + Tipo 1 + +
    + + +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + diff --git a/General/FolioFechaCancelacion.aspx.vb b/General/FolioFechaCancelacion.aspx.vb new file mode 100644 index 000000000..ff029dd38 --- /dev/null +++ b/General/FolioFechaCancelacion.aspx.vb @@ -0,0 +1,151 @@ +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