From cdbf62acedb656e22d96c9f0a9c07b9a0f770fbd Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Fri, 12 Jun 2020 20:50:52 -0700 Subject: [PATCH] Pago Electronico Grupos 2020-06-12 --- App_Code/ClsGenerales.vb | 4 +- App_Code/ClsMovimientos.vb | 5 +- App_Code/Thalamus.vb | 179 ++ Bancos/IE.aspx.vb | 33 + Bancos/PagoElectronicoGrupos.aspx | 98 +- Bancos/PagoElectronicoGrupos.aspx.vb | 538 +++- Bancos/PopIECompras.aspx.vb | 35 +- Bancos/ProveedoresAbonar.aspx.vb | 59 +- .../Grales/Formatos/LayoutPagoProveedor.rdlc | 2220 +++++++++-------- Tareas/Thalamus.asmx | 1 + 10 files changed, 1974 insertions(+), 1198 deletions(-) create mode 100644 App_Code/Thalamus.vb create mode 100644 Tareas/Thalamus.asmx diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 2db192a9c..15c86b2c2 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -1506,7 +1506,7 @@ Public Class ClsGenerales Return Retorno End Function - Public Function UpdateCuentasDepositosEstatusPagoElectronicoGrupos(CveCuentaDeposito As Integer, EstatusPagoElectronicoGrupos As Boolean) As Boolean + Public Function UpdateCuentasDepositosEstatusPagoElectronicoGrupos(CveCuentaDeposito As Integer, EstatusPagoElectronicoGrupos As Boolean, CveSATBanco As Integer, BBVAAlias As String) As Boolean Dim Retorno As Boolean = False @@ -1515,6 +1515,8 @@ Public Class ClsGenerales With SqlAdapter.SelectCommand.Parameters .Add("@CveCuentaDeposito", SqlDbType.VarChar).Value = CveCuentaDeposito .Add("@EstatusPagoElectronicoGrupos", SqlDbType.Bit).Value = EstatusPagoElectronicoGrupos + .Add("@CveSATBanco", SqlDbType.Int).Value = CveSATBanco + .Add("@BBVAAlias", SqlDbType.VarChar).Value = BBVAAlias End With diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index fe4714eff..7849671d9 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -542,7 +542,10 @@ Public Class ClsMovimientos End With - Try + + Try + SqlAdapter.SelectCommand.CommandTimeout = 0 + SqlAdapter.Fill(Data) Retorno = True Catch ex As SqlException diff --git a/App_Code/Thalamus.vb b/App_Code/Thalamus.vb new file mode 100644 index 000000000..575b897b8 --- /dev/null +++ b/App_Code/Thalamus.vb @@ -0,0 +1,179 @@ +Imports System.IO +Imports System.Net +Imports System.Web +Imports System.Web.Services +Imports System.Web.Services.Protocols +Imports Extensiones.ModExtensiones +Imports GemBox.Spreadsheet +Imports System.Data + +' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. +' _ + + _ + _ +Public Class Thalamus + Inherits System.Web.Services.WebService + + + Public Function GenerarArchivos(CveEmpresa As Integer) As Boolean + + Dim RutaArchivoVentas As String = $"C:\Temp\Ventas{Now.ToString("yyyyMMdd")}.xlsx" + + Dim DTVentas As New DataTable + DTVentas.Columns.Add("systemId") + DTVentas.Columns.Add("Branch") + DTVentas.Columns.Add("Code") + DTVentas.Columns.Add("Sale Date") + DTVentas.Columns.Add("Quantity") + DTVentas.Columns.Add("Amount") + DTVentas.Columns.Add("Transaction ID") + + + For x = 0 To 50 + Dim dr As DataRow = DTVentas.NewRow + + dr(0) = $"systemId {x}" + dr(1) = $"Branch {x}" + dr(2) = $"{x}" + dr(3) = $"{Now.ToString("yyyy-MM-dd")}" + dr(4) = $"{x}" + dr(5) = $"{x}.00" + dr(6) = $"{x}" + + DTVentas.Rows.Add(dr) + + Next + + SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet()) + + Dim workbook = New ExcelFile + Dim worksheet = workbook.Worksheets.Add("Ventas") + + worksheet.InsertDataTable(DTVentas, + New InsertDataTableOptions() With + { + .ColumnHeaders = True, + .StartRow = 0 + }) + + workbook.Save(RutaArchivoVentas) + + Dim FTPServer As String = "ftp://127.0.0.1/" + Dim TFPUsr As String = "Toor" + Dim FTPPass As String = "agj-3500" + + + Dim FInfo As New FileInfo(RutaArchivoVentas) + + + Dim Carga As Boolean = CargarArchivos(FInfo.FullName, FTPServer, TFPUsr, FTPPass) + If Carga Then + Carga = VerificarArchivo(FInfo.Name, FInfo.Length, FTPServer, TFPUsr, FTPPass) + End If + + + + Return Carga + + End Function + + Private Function CargarArchivos(RutaArchivo As String, FTPServer As String, FTPUsr As String, FTPPass As String) As Boolean + + Dim Respuesta As Boolean + + Dim FInfo As New FileInfo(RutaArchivo) + + If FInfo.Exists Then + + Dim request As FtpWebRequest = DirectCast(WebRequest.Create($"{FTPServer}/{FInfo.Name}"), FtpWebRequest) + request.Method = WebRequestMethods.Ftp.UploadFile + + Dim tamanio As Integer = 1024 + Dim buffer As Byte() = New Byte(tamanio) {} + Dim byteRead As Integer = 0 + + Dim Conected As Boolean = False + + + + request.Credentials = New NetworkCredential(FTPUsr, FTPPass) + + Try + request.GetResponse() + Conected = True + Catch ex As Exception + + End Try + + + If Conected Then + + Dim ftpStream As Stream + Dim f As FileStream + + ftpStream = request.GetRequestStream + f = File.OpenRead(FInfo.FullName) + + Try + Do + byteRead = f.Read(buffer, 0, tamanio) + ftpStream.Write(buffer, 0, byteRead) + + Loop While byteRead <> 0 + + Respuesta = True + 'validar si existe archivo si coincide en tamaño + Catch ex As Exception + Respuesta = False + End Try + + + If f IsNot Nothing Then + f.Close() + End If + + If ftpStream IsNot Nothing Then + ftpStream.Close() + End If + + Else + Respuesta = False + 'no se conecto al ftp probablemente credenciales erroneas + End If + Else + Respuesta = False + 'El archivo no existe en el disco local + End If + + Return Respuesta + + End Function + + Private Function VerificarArchivo(Archivo As String, Tamanio As Long, FTPServer As String, FTPUsr As String, FTPPass As String) As Boolean + + Dim Respuesta As Boolean = False + + Dim reqSize As FtpWebRequest = DirectCast(FtpWebRequest.Create(New Uri(FTPServer & Archivo)), FtpWebRequest) + reqSize.Credentials = New NetworkCredential(FTPUsr, FTPPass) + reqSize.Method = WebRequestMethods.Ftp.GetFileSize + reqSize.UseBinary = True + + Dim loginresponse As FtpWebResponse = DirectCast(reqSize.GetResponse(), FtpWebResponse) + Dim respSize As FtpWebResponse = DirectCast(reqSize.GetResponse(), FtpWebResponse) + respSize = DirectCast(reqSize.GetResponse(), FtpWebResponse) + Dim size As Long = respSize.ContentLength + + respSize.Close() + + + If Tamanio = size Then + Respuesta = True + End If + + Return Respuesta + + + End Function + +End Class \ No newline at end of file diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 25ce1b6b2..c8a70dd0d 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -4653,6 +4653,26 @@ Partial Class Bancos_IE Alert("El Beneficiario no tiene una cuenta activa en BBVA, dela de alta o seleccione otro método de pago", TipoMensaje.MsgAdvertencia) End If + ElseIf DdlTipoTransaccion.SelectedValue = "17" Then + + + If Dep.DtResultados.Rows.Count > 0 Then + + DdlCuentaDeposito.DataSource = Dep.DtResultados + trCuentaDeposito.Visible = True + BtnGuardar.ToolTip = "" + + Else + + BtnGuardar.Enabled = False + Alert("El proveedor no tiene cuentas deposito.", TipoMensaje.MsgAdvertencia) + BtnGuardar.ToolTip = "El proveedor no tiene cuentas deposito" + + End If + + + UpGuardar.Update() + Else DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("Estatus ='True'") If Dep.DtResultados.Rows.Count > 0 Then @@ -4663,6 +4683,19 @@ Partial Class Bancos_IE End If + Else + + If DdlTipoTransaccion.SelectedValue.Contiene("9", "17") Then + + BtnGuardar.Enabled = False + Alert("El proveedor no tiene cuentas deposito.", TipoMensaje.MsgAdvertencia) + BtnGuardar.ToolTip = "El proveedor no tiene cuentas deposito" + Else + trCuentaDeposito.Visible = True + BtnGuardar.Enabled = True + End If + + UpGuardar.Update() End If diff --git a/Bancos/PagoElectronicoGrupos.aspx b/Bancos/PagoElectronicoGrupos.aspx index b82c69218..a79a95981 100644 --- a/Bancos/PagoElectronicoGrupos.aspx +++ b/Bancos/PagoElectronicoGrupos.aspx @@ -11,6 +11,9 @@ Pago Electrónico + + + @@ -255,6 +258,17 @@ + + + + + + + + + <%----%> @@ -480,6 +494,15 @@
  • Cuenta
  • + +
  • Tipo: + + + + + + +
  • Estatus @@ -556,7 +579,7 @@ @@ -682,7 +705,7 @@