4393 lines
229 KiB
VB.net
4393 lines
229 KiB
VB.net
Option Explicit On
|
||
Option Strict On
|
||
|
||
Imports System
|
||
Imports System.Collections
|
||
Imports System.Collections.Generic
|
||
Imports System.Data
|
||
Imports System.IO
|
||
Imports System.Runtime.Remoting
|
||
Imports AjaxControlToolkit.AsyncFileUpload.Constants
|
||
Imports Extensiones
|
||
Imports Ionic.Zip
|
||
Imports Microsoft.Extensions.Primitives
|
||
Imports Microsoft.Reporting.WebForms
|
||
Imports Stimulsoft.Base
|
||
|
||
|
||
Partial Class Bancos_PagoElectronico
|
||
Inherits ClsPaginas
|
||
Private Shared missing As Object = System.Reflection.Missing.Value
|
||
|
||
#Region "PROPIEDADES"
|
||
Private Property HeaderTexto As String
|
||
Get
|
||
Return ViewState("HeaderTexto").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("HeaderTexto") = value
|
||
End Set
|
||
End Property
|
||
Private Property DetalleTexto As String
|
||
Get
|
||
Return ViewState("DetalleTexto").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("DetalleTexto") = value
|
||
End Set
|
||
End Property
|
||
Private Property TrailerTexto As String
|
||
Get
|
||
Return ViewState("TrailerTexto").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("TrailerTexto") = value
|
||
End Set
|
||
End Property
|
||
Private Property TextoCompleto As String
|
||
Get
|
||
Return ViewState("TextoCompleto").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("TextoCompleto") = value
|
||
End Set
|
||
End Property
|
||
Private Property Vacio As String
|
||
Get
|
||
Return ViewState("Vacio").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("Vacio") = value
|
||
End Set
|
||
End Property
|
||
Private Property NombreArchivo As String
|
||
Get
|
||
Return ViewState("NombreArchivo").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("NombreArchivo") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTPendientes As DataTable
|
||
Get
|
||
Return CType(ViewState("DTPendientes"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTPendientes") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTProveedores As DataTable
|
||
Get
|
||
Return CType(ViewState("DTProveedores"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTProveedores") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTFyE As DataTable
|
||
Get
|
||
Return CType(ViewState("DTFyE"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTFyE") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTReportes As DataTable
|
||
Get
|
||
Return CType(ViewState("DTReportes"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTReportes") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTPendienteActual As DataTable
|
||
Get
|
||
Return CType(ViewState("DTPendienteActual"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTPendienteActual") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTEnviadas As DataTable
|
||
Get
|
||
Return CType(ViewState("DTEnviadas"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTEnviadas") = value
|
||
End Set
|
||
End Property
|
||
Private ReadOnly Property PadCeros As Char
|
||
Get
|
||
Return "0"c
|
||
End Get
|
||
End Property
|
||
Private Property TotalAcumulado As Double
|
||
Get
|
||
Return ViewState("TotalAcumulado").ToString.ToDouble
|
||
End Get
|
||
Set(value As Double)
|
||
ViewState("TotalAcumulado") = value
|
||
End Set
|
||
End Property
|
||
Private Property CveCuenta As Integer
|
||
Get
|
||
Return ViewState("CveCuenta").ToString.ToEntero
|
||
End Get
|
||
Set(value As Integer)
|
||
ViewState("CveCuenta") = value
|
||
End Set
|
||
End Property
|
||
Private Property DtPago As DataTable
|
||
Get
|
||
Return CType(ViewState("DtPago"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DtPago") = value
|
||
End Set
|
||
End Property
|
||
Private Property DtAlta As DataTable
|
||
Get
|
||
Return CType(ViewState("DtAlta"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DtAlta") = value
|
||
End Set
|
||
End Property
|
||
Private Property CorreoNotificacionesEmpresa As String
|
||
Get
|
||
Return ViewState("CorreoNotificacionesEmpresa").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("CorreoNotificacionesEmpresa") = value
|
||
End Set
|
||
End Property
|
||
Private Property TipoMasiva As Integer
|
||
Get
|
||
Return ViewState("TipoMasiva").ToString.ToEntero
|
||
End Get
|
||
Set(value As Integer)
|
||
ViewState("TipoMasiva") = value
|
||
End Set
|
||
End Property
|
||
|
||
Private Property DT_PagosReporte As DataTable
|
||
Get
|
||
If ViewState("DT_PagosReporte") Is Nothing Then
|
||
ViewState("DT_PagosReporte") = New DataTable
|
||
End If
|
||
Return CType(ViewState("DT_PagosReporte"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DT_PagosReporte") = value
|
||
End Set
|
||
End Property
|
||
|
||
ReadOnly Property OpBancos As Integer
|
||
Get
|
||
Dim OpBanco As Integer = -1
|
||
If (DdlCuenta.SelectedItem.Text.ToUpper.Contains("BANCOMER") OrElse DdlCuenta.SelectedItem.Text.ToUpper.Contains("BBVA")) Then
|
||
OpBanco = 1
|
||
End If
|
||
|
||
If DdlCuenta.SelectedItem.Text.ToUpper.Contains("BAJIO") Then
|
||
OpBanco = 2
|
||
End If
|
||
|
||
If DdlCuenta.SelectedItem.Text.ToUpper.Contains("SCOTIA") Then
|
||
OpBanco = 3
|
||
End If
|
||
|
||
Return OpBanco
|
||
|
||
End Get
|
||
|
||
End Property
|
||
#End Region
|
||
|
||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||
If Not IsPostBack Then
|
||
ViewState("NombreArchivo") = ""
|
||
ViewState("HeaderTexto") = ""
|
||
ViewState("DetalleTexto") = ""
|
||
ViewState("TrailerTexto") = ""
|
||
ViewState("Vacio") = ""
|
||
ViewState("TotalAcumulado") = 0
|
||
CveCuenta = -1
|
||
TipoMasiva = 1
|
||
|
||
txtFechaI.Text = NowADS().ToShortDateString
|
||
txtFechaF.Text = NowADS().ToShortDateString
|
||
|
||
CargaCuentas()
|
||
CargaProveedores()
|
||
InicializaDatosGenerales()
|
||
|
||
|
||
End If
|
||
End Sub
|
||
|
||
|
||
|
||
|
||
#Region " C A R G A - D A T O S "
|
||
Private Sub CargaCuentas()
|
||
DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("UsaLayout = 1")
|
||
DdlCuenta.DataBind()
|
||
UpFiltros.Update()
|
||
|
||
DdlCuentaReportes.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("UsaLayout = 1")
|
||
DdlCuentaReportes.DataBind()
|
||
UpFiltrosReporte.Update()
|
||
End Sub
|
||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||
CveCuenta = DdlCuenta.SelectedValue.ToEntero
|
||
CargaDatos()
|
||
End Sub
|
||
Private Sub CargaDatos()
|
||
|
||
'Carga datos en DT´s
|
||
Dim ObjBancos As New ClsBancos
|
||
If ObjBancos.GetLayoutPagos(CveCuenta, -1, DdlTipoGeneracion.SelectedValue) Then
|
||
DTPendientes = ObjBancos.DtResultados
|
||
Else
|
||
DTPendientes = Nothing
|
||
End If
|
||
|
||
If ObjBancos.GetLayoutPagosEnviados(CveCuenta, 1, DdlTipoGeneracion.SelectedValue, "-1", "-1") Then
|
||
DTEnviadas = ObjBancos.DtResultados
|
||
Else
|
||
DTEnviadas = Nothing
|
||
End If
|
||
ObjBancos.Dispose()
|
||
|
||
|
||
'Carga GvPendientes
|
||
If DTPendientes IsNot Nothing AndAlso DTPendientes.Rows.Count > 0 Then
|
||
GvPendientes.DataSource = DTPendientes
|
||
End If
|
||
GvPendientes.DataBind()
|
||
|
||
'Carga GvEnviadas
|
||
If DTEnviadas IsNot Nothing AndAlso DTEnviadas.Rows.Count > 0 Then
|
||
GvEnviadas.DataSource = DTEnviadas
|
||
End If
|
||
GvEnviadas.DataBind()
|
||
|
||
UpGVDatos.Update()
|
||
|
||
If DTPendientes IsNot Nothing AndAlso DTPendientes.Rows.Count > 0 Then
|
||
CargaDatosInformativos()
|
||
End If
|
||
|
||
End Sub
|
||
Private Sub CargaDatosInformativos()
|
||
Dim Altas = 0
|
||
Dim Interbancarias = 0
|
||
Dim Bancomer = 0
|
||
Dim Scotia = 0
|
||
|
||
Dim Movimientos = 0
|
||
Dim Importe = 0.0
|
||
|
||
|
||
|
||
For Each dr As DataRow In DTPendientes.Rows
|
||
|
||
|
||
If OpBancos = 1 Then
|
||
If dr("EstatusCtaDeposito").ToString <> "True" Then
|
||
Continue For
|
||
End If
|
||
|
||
If dr("CveCuentaDeposito").ToString <> "" And dr("EstatusPagoElectronico").ToString <> "True" And dr("AltaCuenta").ToString = "1" Then
|
||
'
|
||
ElseIf dr("CveCuentaDeposito").ToString.ToEntero > 0 Then
|
||
Movimientos += 1
|
||
Importe += dr("Abonado").ToString.ToDouble
|
||
End If
|
||
End If
|
||
|
||
If OpBancos = 3 Then
|
||
|
||
If dr("EstatusCtaDeposito").ToString <> "True" Then
|
||
Continue For
|
||
End If
|
||
|
||
If dr("CveCuentaDeposito").ToString <> "" And ((dr("EstatusPagoElectronicoScotia").ToString <> "True" Or dr("FechaEliminacion").ToString.ToDate < NowADS())) And dr("AltaCuenta").ToString = "1" Then
|
||
'
|
||
ElseIf dr("CveCuentaDeposito").ToString.ToEntero > 0 Then
|
||
Movimientos += 1
|
||
Importe += dr("Abonado").ToString.ToDouble
|
||
End If
|
||
|
||
|
||
End If
|
||
Next
|
||
|
||
|
||
'Inicio Bloque es para contar las altas de cuentas
|
||
Dim DTPendientesTmp As DataTable = DTPendientes.FiltraParametros("", "",
|
||
{"CLABEDestino", "CLABE", "CveBanco", "CveCuentaDeposito", "EstatusCtaDeposito", "EstatusPagoElectronico", "EstatusPagoElectronicoScotia", "AltaCuenta", "BancoNombre", "FechaEliminacion"}
|
||
)
|
||
For Each dr As DataRow In DTPendientesTmp.Rows
|
||
|
||
If OpBancos = 1 Then
|
||
If dr("EstatusCtaDeposito").ToString <> "True" Then
|
||
Continue For
|
||
End If
|
||
|
||
If dr("CveCuentaDeposito").ToString <> "" And dr("EstatusPagoElectronico").ToString <> "True" And dr("AltaCuenta").ToString = "1" Then
|
||
Altas += 1
|
||
If dr("BancoNombre").ToString.ToUpper.Contains("BANCOMER") OrElse dr("BancoNombre").ToString.ToUpper.Contains("BBVA") Then
|
||
Bancomer += 1
|
||
Else
|
||
Interbancarias += 1
|
||
End If
|
||
|
||
ElseIf dr("CveCuentaDeposito").ToString.ToEntero > 0 Then
|
||
'
|
||
End If
|
||
End If
|
||
|
||
If OpBancos = 3 Then
|
||
|
||
If dr("EstatusCtaDeposito").ToString <> "True" Then
|
||
Continue For
|
||
End If
|
||
|
||
If dr("CveCuentaDeposito").ToString <> "" And ((dr("EstatusPagoElectronicoScotia").ToString <> "True" Or dr("FechaEliminacion").ToString.ToDate < NowADS())) And dr("AltaCuenta").ToString = "1" Then
|
||
Altas += 1
|
||
If dr("BancoNombre").ToString.ToUpper.Contains("SCOTIA") Then
|
||
Scotia += 1
|
||
Else
|
||
Interbancarias += 1
|
||
End If
|
||
|
||
ElseIf dr("CveCuentaDeposito").ToString.ToEntero > 0 Then
|
||
'
|
||
End If
|
||
|
||
|
||
End If
|
||
Next
|
||
''Fin Bloque es para contar las altas de cuentas
|
||
|
||
|
||
|
||
LbNumeroAltas.Text = Altas.ToString
|
||
LbNumeroInterbancarias.Text = Interbancarias.ToString
|
||
LbNumeroBancomer.Text = Bancomer.ToString
|
||
LbNumeroScotia.Text = Scotia.ToString
|
||
|
||
LbNumeroMovimientos.Text = Movimientos.ToString
|
||
LbImporteMovimientos.Text = Importe.ToString.FormatoNumero
|
||
|
||
UpComandosGeneracion.Update()
|
||
|
||
VistaComandoGeneracion()
|
||
|
||
End Sub
|
||
|
||
Sub VistaComandoGeneracion()
|
||
TRNumBancomer.Visible = False
|
||
TRNumScotia.Visible = False
|
||
|
||
TRNumBancomer.Visible = True
|
||
If OpBancos = 1 Then
|
||
TRNumBancomer.Visible = True
|
||
End If
|
||
|
||
If OpBancos = 3 Then
|
||
TRNumScotia.Visible = True
|
||
End If
|
||
|
||
UpComandosGeneracion.Update()
|
||
End Sub
|
||
|
||
#End Region
|
||
|
||
#Region " DATOS GENERALES LAYOUT "
|
||
Private Sub InicializaDatosGenerales()
|
||
|
||
If UsuarioActual.CveEmpresa = 66 Then
|
||
CorreoNotificacionesEmpresa = "pagos@gluyasconstrucciones.com"
|
||
ElseIf UsuarioActual.CveEmpresa = 13 Then
|
||
CorreoNotificacionesEmpresa = "signotificaciones@adssistemas.mx"
|
||
Else
|
||
CorreoNotificacionesEmpresa = "signotificaciones@adssistemas.mx"
|
||
End If
|
||
|
||
End Sub
|
||
#End Region
|
||
|
||
#Region " GENERA Y DESCARGA ARCHIVO (TXT) "
|
||
Protected Sub CrearTXT()
|
||
Dim path As String = Server.MapPath(String.Format("~/Empresas/{0}/Layout/{1}.txt", UsuarioActual.CveEmpresa, NombreArchivo))
|
||
' Create or overwrite the file.
|
||
Dim fs As FileStream = File.Create(path)
|
||
|
||
' Add text to the file.
|
||
Dim info As Byte() = New UTF8Encoding(True).GetBytes(TextoCompleto)
|
||
fs.Write(info, 0, info.Length)
|
||
fs.Close()
|
||
End Sub
|
||
Private Sub DescargarArchivo()
|
||
With HttpContext.Current.Response
|
||
.Clear()
|
||
.Buffer = True
|
||
.ContentType = "textplain"
|
||
.AddHeader("Content-Disposition", String.Format("attachment;filename={0}{1}.txt", NombreArchivo, NowADS().ToString("ddMMyyyy")))
|
||
.Charset = "UTF-8"
|
||
.ContentEncoding = Encoding.Default
|
||
.Write(TextoCompleto)
|
||
.Flush()
|
||
.End()
|
||
End With
|
||
End Sub
|
||
Private Sub DescargaZip()
|
||
Dim path As String = Server.MapPath(String.Format("~/Empresas/{0}/Layout/", UsuarioActual.CveEmpresa))
|
||
Response.Clear()
|
||
Dim ElZip As ZipFile = New ZipFile()
|
||
Using ElZip
|
||
ElZip.AddDirectory(path)
|
||
ElZip.Save(Response.OutputStream)
|
||
End Using
|
||
Response.AddHeader("Content-Disposition", "attachment; filename=LayoutPagos.zip")
|
||
Response.ContentType = "application/zip"
|
||
Response.End()
|
||
End Sub
|
||
Private Function CreaArchivo(Tipo As Integer, Optional MismoBanco As Boolean = True, Optional ByRef NombreArchivoEnviado As String = "") As Boolean
|
||
|
||
|
||
System.Threading.Thread.Sleep(1000) 'Un segundo de diferencia Para dIferentes tipos de bancos
|
||
|
||
DirectoryExistsCreate(String.Format("{0}Layout", UsuarioActual.Empresa.Ruta))
|
||
|
||
'NombreArchivo = String.Format("{2}{1}{0}.txt", UsuarioActual.CveUsuario, NowADS().ToString("yyyyMMdd-HH-mm-ss"), If(Tipo = 1, "LAYOUTPAGO", "LAYOUTALTA"))
|
||
|
||
If Tipo = 1 Then
|
||
NombreArchivo = String.Format("{2}{1}{0}.txt", UsuarioActual.CveUsuario, NowADS().ToString("yyyyMMdd-HH-mm-ss"), "LAYOUTPAGO")
|
||
Else
|
||
NombreArchivo = String.Format("{2}{1}{0}{3}.txt", UsuarioActual.CveUsuario, NowADS().ToString("yyyyMMdd-HH-mm-ss"), "LAYOUTALTA", If(MismoBanco, "BANCOMER", "INTERBANCARIO"))
|
||
End If
|
||
|
||
If NombreArchivoEnviado.Length > 0 Then
|
||
NombreArchivo = NombreArchivoEnviado
|
||
Else
|
||
NombreArchivoEnviado = NombreArchivo
|
||
End If
|
||
|
||
Dim path As String = String.Format("{0}Layout\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo)
|
||
|
||
If File.Exists(path) Then
|
||
File.Delete(path)
|
||
End If
|
||
|
||
Dim fs As FileStream = File.Create(path)
|
||
|
||
Dim info As Byte() = New UTF8Encoding(True).GetBytes(TextoCompleto)
|
||
fs.Write(info, 0, info.Length)
|
||
fs.Close()
|
||
|
||
Return True
|
||
|
||
End Function
|
||
Private Function GuardaTXT() As Boolean
|
||
Dim Retorno As Boolean = True
|
||
Try
|
||
Dim Ruta As String = ""
|
||
Dim FileName As String = Path.GetFileName(FUTxt.PostedFile.FileName)
|
||
NombreArchivo = FileName
|
||
Dim Extension As String = Path.GetExtension(FUTxt.PostedFile.FileName)
|
||
Dim FolderPath As String = String.Format("{0}Empresas\", Request.ApplicationPath)
|
||
Dim FilePath As String = Server.MapPath(FolderPath + FileName)
|
||
FUTxt.SaveAs(FilePath)
|
||
NombreArchivo = FilePath
|
||
Catch ex As Exception
|
||
Retorno = False
|
||
End Try
|
||
|
||
Return Retorno
|
||
End Function
|
||
#End Region
|
||
|
||
#Region "LAYOUT SCOTIABANK"
|
||
|
||
'====================================================================
|
||
' GenerarLayoutPagosScotia
|
||
'====================================================================
|
||
Private Sub AltaProveedoresScotia(
|
||
Optional ByVal DtPendientesTemp As DataTable = Nothing,
|
||
Optional ByVal NumeroConvenio As String = "00000", ' 5 dígitos
|
||
Optional ByVal SistemaCentral As String = "001", ' 3 dígitos
|
||
Optional ByVal TipoArchivo As String = "EE", ' 2 digitos (define tu propio código)
|
||
Optional ByVal Secuencia As Integer = 1, ' 3 dígitos, consecutivo del día
|
||
Optional ByVal MovimientoDefault As Char = "P"c ' P =pago, cambia si usas A/C/B
|
||
)
|
||
|
||
'------------------- Constantes de layout -------------------
|
||
Dim LARGO_REGISTRO As Integer = 140
|
||
Dim Cero As Char = "0"c
|
||
Dim Space As Char = " "c
|
||
|
||
Dim NumeroArchivo As Integer = 1 ' ajústalo si manejas consecutivo diario
|
||
Dim FechaArchivo As Date = NowADS().Date
|
||
|
||
If DtPendientesTemp Is Nothing Then DtPendientesTemp = DTPendientes.Copy
|
||
DtPendientesTemp.CaseSensitive = False
|
||
|
||
DtPendientesTemp = DtPendientesTemp.FiltraParametros("", "",
|
||
{"CLABEDestino", "CLABE", "CveBanco", "CveCuentaDeposito", "EstatusCtaDeposito", "EstatusPagoElectronico", "EstatusPagoElectronicoScotia", "AltaCuenta", "BancoNombre", "FechaEliminacion", "ConvenioPagoElectronico"}
|
||
)
|
||
|
||
If DtPendientesTemp.Rows.Count = 0 Then
|
||
Alert("No hay datos pendientes para generar el Layout de ScotiaBank.", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
End If
|
||
|
||
'------------------- Acumulados para el trailer -------------
|
||
Dim Altas As Integer = 0, Cambios As Integer = 0
|
||
Dim Bajas As Integer = 0, Consultas As Integer = 0
|
||
'------------------- Acumulados para el trailer -------------
|
||
|
||
'------------------- ConvenioPagoElectronico = "0000000" ' 5 dígitos
|
||
NumeroConvenio = DtPendientesTemp.Rows(0)("ConvenioPagoElectronico").ToString
|
||
|
||
If NumeroConvenio.Trim.Length = 0 Then
|
||
Alert("El campo NumeroConvenio (ConvenioPagoElectronico) no está definido en los datos de la cuenta.", TipoMensaje.MsgAdvertencia)
|
||
End If
|
||
|
||
Dim sb As New StringBuilder
|
||
|
||
'=============================================================
|
||
' 1) HEADER (140 )
|
||
'=============================================================
|
||
'Dim hoy As Date = Now.Date
|
||
'Dim hora As String = Now.ToString("HHmmss")
|
||
|
||
Dim Header As New StringBuilder()
|
||
Header.Append(TipoArchivo.PadRight(2, Space)) 'TIPO ARCHIVO (2)
|
||
Header.Append("HA") 'TIPO REGISTRO (2)
|
||
Header.Append("JDF") 'SISTEMA-CENTRAL (3)
|
||
Header.Append(NumeroConvenio.PadLeft(7, Cero)) 'NUMERO DE CONTRATO (7) ' ocupa 5 dígitos pero en el layout se usa 7
|
||
Header.Append(NowADS.ToString("yyyyMMdd")) 'FECHA-SOLICITUD (8)
|
||
Header.Append("001") 'SECUENCIA (3)
|
||
Header.Append("M") 'MANTENIMIENTO-O-CONSULTA (1)
|
||
Header.Append(" ".PadLeft(8, Space)) 'FECHA GENERACIÓN ARCHIVO (8) *** Respusta de ScotiaBank ***
|
||
Header.Append(" ".PadLeft(6, Space)) 'Hora GENERACIÓN ARCHIVO (6) *** Respusta de ScotiaBank ***
|
||
Header.Append(" ".PadLeft(3, Space)) 'CÓDIGO-RESPUESTA (3) *** Respusta de ScotiaBank ***
|
||
Header.Append(" ".PadLeft(97, Space)) 'FILLER (97)
|
||
|
||
sb.AppendLine(Header.ToString)
|
||
|
||
'=============================================================
|
||
' 2) DETALLES (140 )
|
||
'=============================================================
|
||
Dim SBErrores As New StringBuilder
|
||
For Each dr As DataRow In DtPendientesTemp.Rows
|
||
|
||
Dim registro As New StringBuilder()
|
||
Dim esError As Boolean = False
|
||
|
||
'---- Datos base tomados de DTPendientes ------------------
|
||
|
||
Dim CuentaDestino As String = ""
|
||
Dim cuentaDigitos As String = dr("CLABEDestino").ToString.Trim
|
||
Dim Clabe As String = dr("CLABE").ToString.Trim
|
||
Dim limite As String = (9000000000 * 100D).ToString("F0")
|
||
Dim banco As String = dr("CveBanco").ToString.PadLeft(3, Cero)
|
||
|
||
If cuentaDigitos.Length = 11 AndAlso banco = "044" Then
|
||
CuentaDestino = cuentaDigitos
|
||
ElseIf Clabe.Length = 18 Then
|
||
CuentaDestino = Clabe
|
||
Else
|
||
CuentaDestino = Clabe
|
||
SBErrores.Append($"Cuenta {CuentaDestino} debe tener 11 o 18 dígitos.<br>")
|
||
esError = True
|
||
End If
|
||
|
||
If banco.Length <> 3 OrElse Not IsNumeric(banco) OrElse banco = "000" Then
|
||
SBErrores.Append($"Cuenta {CuentaDestino} código {banco} no es un banco válido. Debe ser numérico de 3 dígitos.<br>")
|
||
esError = True
|
||
End If
|
||
|
||
Dim CveCuentaDeposito As String = dr("CveCuentaDeposito").ToString
|
||
|
||
'Dim movimiento As Char = If(dr.Table.Columns.Contains("Movimiento"),
|
||
' dr("Movimiento").ToString.FirstOrDefault(), MovimientoDefault)
|
||
|
||
Dim CVETIPOCUENTA As String = If(CuentaDestino.Length = 18, "09", "01")
|
||
|
||
|
||
'---- TIPO DE REGISTRO ------------------
|
||
|
||
'ANEXO E de ScotiaBank
|
||
'DA = DETALLE ALTA DE DATOS DE CUENTA Y LIMITE RELACIONADO
|
||
'DC = DETALLE CAMBIOS DE DATOS DE CUENTA Y LIMITE RELACIONADO
|
||
'DB = DETALLE BAJA DE DATOS DE CUENTA Y LIMITE RELACIONADO
|
||
'DQ = DETALLE CONSULTA DE DATOS DE CUENTA Y LIMITE RELACIONADO
|
||
'DR = DETALLE RESPUESTA *** Respusta de ScotiaBank ***
|
||
|
||
Dim TipoRegistro As String = "DA" ' Por default es D (Alta), cambia a C si es cambio o baja
|
||
'---- TIPO DE REGISTRO ------------------
|
||
|
||
'---- Construcción del registro ---------------------------
|
||
registro.Append(TipoArchivo.PadRight(2, Space)) 'TIPO ARCHIVO (2)
|
||
registro.Append(TipoRegistro) 'TIPO REGISTRO (2)
|
||
registro.Append("A") 'CVE-MOVIMIENTO-CUENTA (1)
|
||
registro.Append(CVETIPOCUENTA) 'CVE-TIPO - CUENTA (2)
|
||
registro.Append("00") 'CVE-MONEDA - CUENTA (2) 00 Pesps 01 Dollares
|
||
registro.Append(banco) 'NUM-banco - CUENTA (3)
|
||
registro.Append(CuentaDestino.PadLeft(20, Cero)) 'NUM-CUENTA (20)
|
||
registro.Append(NowADS.AddDays(364).ToString("yyyyMMdd")) 'FECHA DE ELIMINACIÓN (8)
|
||
registro.Append(CveCuentaDeposito.PadRight(50, Space)) 'DESCRIPCIÓN (50)
|
||
registro.Append(limite.PadLeft(17, Cero)) 'LIMITE-POR-TRANSACCIÓN (17)
|
||
registro.Append("04") 'TIPO DE PAGO (2)
|
||
registro.Append(" ") 'CÓDIGO-RESPUESTA (3) CÓDIGO DE RESPUESTA DE REG. "D*", ANEXO 'C' *** Respusta de ScotiaBank ***
|
||
registro.Append(" ".PadLeft(28, Space)) 'FILLER (28)
|
||
|
||
If registro.Length = LARGO_REGISTRO AndAlso Not esError Then
|
||
sb.AppendLine(registro.ToString)
|
||
Select Case TipoRegistro
|
||
Case "DA"
|
||
Altas = Altas + 1
|
||
Case "DC"
|
||
Cambios = Cambios + 1
|
||
Case "DB"
|
||
Bajas = Bajas + 1
|
||
Case "DQ"
|
||
Consultas = Consultas + 1
|
||
Case Else
|
||
esError = True
|
||
End Select
|
||
End If
|
||
Next
|
||
|
||
'=============================================================
|
||
' 3) TRAILER (PIE) (140)
|
||
'=============================================================
|
||
Dim trailer As New StringBuilder()
|
||
|
||
|
||
trailer.Append(TipoArchivo.PadRight(2, Space)) 'TIPO DE ARCHIVO (2)
|
||
trailer.Append("TA") 'TIPO DE REGISTRO (2)
|
||
trailer.Append(Altas.ToString.PadLeft(8, Cero)) 'CANTIDAD DE MOVIMIENTOS ALTAS (8)
|
||
trailer.Append(Cambios.ToString.PadLeft(8, Cero)) 'CANTIDAD DE MOVIMIENTOS CAMBIOS (8)
|
||
trailer.Append(Bajas.ToString.PadLeft(8, Cero)) 'CANTIDAD DE MOVIMIENTOS BAJAS (8)
|
||
trailer.Append(Consultas.ToString.PadLeft(8, Cero)) 'CANTIDAD DE CONSULTAS (8)
|
||
'MOVIMIENTOS ACEPTADOS
|
||
trailer.Append("0".PadLeft(8, Cero)) 'CANTIDAD DE MOVIMIENTOS ALTAS (8) *** Respusta de ScotiaBank ***
|
||
trailer.Append("0".PadLeft(8, Cero)) 'CANTIDAD DE MOVIMIENTOS CAMBIOS (8) *** Respusta de ScotiaBank ***
|
||
trailer.Append("0".PadLeft(8, Cero)) 'CANTIDAD DE MOVIMIENTOS BAJAS (8) *** Respusta de ScotiaBank ***
|
||
trailer.Append("0".PadLeft(8, Cero)) 'CANTIDAD DE CONSULTAS (8) *** Respusta de ScotiaBank ***
|
||
'MOVIMIENTOS RECHAZADOS
|
||
trailer.Append("0".PadLeft(8, Cero)) 'CANTIDAD DE MOVIMIENTOS ALTAS (8) *** Respusta de ScotiaBank ***
|
||
trailer.Append("0".PadLeft(8, Cero)) 'CANTIDAD DE MOVIMIENTOS CAMBIOS (8) *** Respusta de ScotiaBank ***
|
||
trailer.Append("0".PadLeft(8, Cero)) 'CANTIDAD DE MOVIMIENTOS BAJAS (8) *** Respusta de ScotiaBank ***
|
||
trailer.Append("0".PadLeft(8, Cero)) 'CANTIDAD DE CONSULTAS (8) *** Respusta de ScotiaBank ***
|
||
trailer.Append("0".PadLeft(3, Cero)) 'CÓDIGO-RESPUESTA (3) *** Respusta de ScotiaBank ***
|
||
trailer.Append("0".PadLeft(3, Cero)) 'CÓDIGO-RESPUESTA - Archivo (3) *** Respusta de ScotiaBank ***
|
||
trailer.Append(" ".PadLeft(34, Space)) 'FILLER (34)
|
||
|
||
sb.Append(trailer.ToString)
|
||
|
||
'------------------- Crear archivo y mostrar descargas ------------------
|
||
TextoCompleto = sb.ToString
|
||
If sb.Length = 0 Then
|
||
Alert("No se generó ningún registro válido para Bajío.", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
End If
|
||
|
||
|
||
|
||
If SBErrores.Length > 0 Then
|
||
Alert("Errores encontrados al generar el layout de ScotiaBank:<br>" & SBErrores.ToString, TipoMensaje.MsgAdvertencia)
|
||
Else
|
||
Dim NombreArchivoEnviado As String = $"altacuentasScotia_{FechaArchivo:ddMMyyyy}_{NumeroArchivo:D3}.txt"
|
||
|
||
If CreaArchivo(2, True, NombreArchivoEnviado) Then
|
||
DVDescargaPagos.Visible = False
|
||
DVDescargaReporte.Visible = False
|
||
LblCuentas.Text = "Cuentas Bajio"
|
||
'NombreArchivoBancomer = "" 'No usamos estos para scotia
|
||
'NombreArchivoInterbancario = ""
|
||
'NombreArchivoCIE = ""
|
||
NombreArchivo = NombreArchivoEnviado
|
||
DVDescargaCuentas1.Visible = True
|
||
LnkDescargaCuentas1.Text = NombreArchivo
|
||
RegistraScript("$('#ModalDescarga').modal({ backdrop: 'static', keyboard: false});")
|
||
UpModalDescarga.Update()
|
||
End If
|
||
End If
|
||
|
||
|
||
|
||
CargaDatos()
|
||
|
||
End Sub
|
||
|
||
'---------------------------------------------------------------
|
||
' Limpia y normaliza texto para Scotia (solo A-Z,0-9,espacio)
|
||
'---------------------------------------------------------------
|
||
Private Function LimpiarTextoScotia(txt As String, largo As Integer) As String
|
||
Dim clean = New String(txt _
|
||
.Normalize(System.Text.NormalizationForm.FormD) _
|
||
.Where(Function(ch) Char.IsLetterOrDigit(ch) OrElse ch = " "c) _
|
||
.ToArray()) _
|
||
.ToUpperInvariant()
|
||
Return clean.PadRight(largo).Substring(0, largo)
|
||
End Function
|
||
|
||
|
||
'====================================================================
|
||
' GeneraPagoScotiaBank – Layout Pagos Scotiabank (For Each, método único)
|
||
'====================================================================
|
||
' ▸ Genera un archivo de pagos masivos para Scotiabank (Archivo de intercambio EE).
|
||
' ▸ Registros y longitudes exactas:
|
||
' • HA, HB, DA, TB, TA → 370 caracteres
|
||
' • DM (correo) → 104 caracteres
|
||
' ▸ Se permite partición por bloques (TamanoBloque), pero todo dentro de un
|
||
' mismo método para claridad. Sólo se complementa con LimpiarTextoScotia().
|
||
'====================================================================
|
||
|
||
Public Sub GeneraPagoScotiaBank(ByVal DTPendientes As DataTable, InsertaEnDB As Boolean)
|
||
|
||
Dim TamanoBloque As Integer = 500 ' pagos por bloque
|
||
|
||
Dim ErrorLayout As Boolean = False
|
||
|
||
'------------------- VALIDACIONES BÁSICAS ---------------------------
|
||
If DTPendientes Is Nothing OrElse DTPendientes.Rows.Count = 0 Then
|
||
Alert("No hay datos pendientes para generar el Layout de ScotiaBank.", TipoMensaje.MsgAdvertencia)
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
Dim CuentaCargo As String = DTPendientes.Rows(0)("CLABEOrigen").ToString
|
||
If CuentaCargo.Length <> 11 Then
|
||
Alert("El campo CuentaCargo debe ser numérico de 11 dígitos.", TipoMensaje.MsgAdvertencia)
|
||
ErrorLayout = True
|
||
|
||
End If
|
||
|
||
Dim NumeroConvenio As String = DTPendientes.Rows(0)("ConvenioPagoElectronico").ToString
|
||
If NumeroConvenio.Trim.Length = 0 Then
|
||
Alert("El campo NumeroConvenio (ConvenioPagoElectronico) no está definido en los datos de la cuenta.", TipoMensaje.MsgAdvertencia)
|
||
ErrorLayout = True
|
||
|
||
End If
|
||
|
||
If NumeroConvenio.Length <> 5 Then
|
||
Alert("El campo NumeroConvenio debe ser numérico de 5 dígitos.", TipoMensaje.MsgAdvertencia)
|
||
ErrorLayout = True
|
||
|
||
End If
|
||
|
||
|
||
'------------------- ACUMULADORES -----------------------------------
|
||
Dim sb As New StringBuilder()
|
||
Dim totalPagos As Integer = 0
|
||
Dim totalImporte As Decimal = 0D
|
||
Dim pagosBloque As Integer = 0
|
||
Dim importeBloque As Decimal = 0D
|
||
Dim numBloque As Integer = 0
|
||
|
||
Dim SPACE As Char = " "c
|
||
Dim CERO As Char = "0"c
|
||
|
||
'------------------- HEADER ARCHIVO (HA) ----------------------------
|
||
Dim ha As New StringBuilder()
|
||
ha.Append("EE") ' 1‑2 Tipo Archivo
|
||
ha.Append("HA") ' 3‑4 Tipo Registro
|
||
ha.Append(NumeroConvenio.PadLeft(5, "0"c)) ' 5‑9 Nº Convenio
|
||
ha.Append("01") ' 10‑11 Secuencia fija "01"
|
||
ha.Append("00000000") ' 12‑19 Fecha generación
|
||
ha.Append("00000000") ' 20‑27 Fecha inicial (opcional)
|
||
ha.Append("00000000") ' 28‑35 Fecha final (opcional)
|
||
ha.Append("000") ' 36‑38 Código status "000"
|
||
ha.Append(" ".PadLeft(332, SPACE)) ' 39‑370 FILLER (espacios)
|
||
|
||
sb.AppendLine(ha.ToString())
|
||
|
||
'------------------- RECORRIDO DETALLES -----------------------------
|
||
Dim SBErrores As StringBuilder = New StringBuilder()
|
||
'Dim esError As Boolean = False
|
||
Dim idx As Integer = 0
|
||
|
||
Dim hb As New StringBuilder()
|
||
hb.Append("EE") ' 1‑2
|
||
hb.Append("HB") ' 3‑4
|
||
hb.Append("00") ' 5‑6 Moneda cuenta cargo (00=MXN)
|
||
hb.Append("0000") ' 7‑10 Uso futuro = ceros
|
||
hb.Append(CuentaCargo) ' 11‑21 Cuenta cargo (11)
|
||
hb.Append("0000000001") ' 22‑31 Referencia de cargo? (ejemplo)
|
||
hb.Append("000") ' 32‑34 Codigo del registro
|
||
hb.Append(" ".PadLeft(336, SPACE)) ' 35‑370 FILLER espacios
|
||
|
||
sb.AppendLine(hb.ToString())
|
||
|
||
For Each dr As DataRow In DTPendientes.Rows
|
||
|
||
''--- ¿Inicia BLOQUE? (HB) ---------------------------------------
|
||
'If idx Mod TamanoBloque = 0 Then
|
||
' numBloque += 1
|
||
' pagosBloque = 0
|
||
' importeBloque = 0D
|
||
|
||
' Dim hb As New StringBuilder(New String(" "c, 370))
|
||
' hb.Append("EE") ' 1‑2
|
||
' hb.Append("HB") ' 3‑4
|
||
' hb.Append("00") ' 5‑6 Moneda cuenta cargo (00=MXN)
|
||
' hb.Append("0000") ' 7‑10 Uso futuro = ceros
|
||
' hb.Append(CuentaCargo) ' 11‑21 Cuenta cargo (11)
|
||
' hb.Append("0000000001") ' 22‑31 Referencia de cargo? (ejemplo)
|
||
' hb.Append("000") ' 32‑34 Codigo del registro
|
||
' hb.Append(" ".PadLeft(336, SPACE)) ' 35‑370 FILLER espacios
|
||
|
||
' sb.AppendLine(hb.ToString())
|
||
'End If
|
||
|
||
'----------- DETALLE ALTA (DA) ----------------------------------
|
||
Dim importe As Decimal = 0D
|
||
If Not Decimal.TryParse(Convert.ToString(dr("Importe")), importe) Then
|
||
'Alert($"Importe inválido en fila {idx + 1}", TipoMensaje.MsgAdvertencia)
|
||
SBErrores.Append($"Importe inválido en fila {idx + 1}")
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
If importe <= 0D Then
|
||
Alert($"Importe debe ser mayor a 0 en fila {idx + 1}", TipoMensaje.MsgAdvertencia)
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
Dim importeInt As String = CDec(Math.Round(importe * 100).ToEntero).ToString().PadLeft(15, CERO) ' 2 dec.
|
||
|
||
Dim fechaAplicacion As String = NowADS.ToString("yyyyMMdd")
|
||
Dim cveBenef As String = LimpiarTextoScotia(Convert.ToString(dr("CveProveedor"))).PadRight(20)
|
||
Dim rfc As String = LimpiarTextoScotia(Convert.ToString(dr("RFC"))).PadRight(13)
|
||
Dim nombreBen As String = LimpiarTextoScotia(Convert.ToString(dr("RazonSocial"))).PadRight(40)
|
||
Dim CveIE As Integer = dr("CveIE").ToString.ToEntero
|
||
Dim referenciaPago As String = CveIE.ToString.PadLeft(16, CERO) 'If(dr.Table.Columns.Contains("Referencia"), LimpiarTextoScotia(Convert.ToString(dr("Referencia"))).PadLeft(16, "0"c), New String("0"c, 16))
|
||
|
||
Dim CuentaDestino As String = ""
|
||
Dim cuentaDigitos As String = Convert.ToString(dr("CLABEDestino"))
|
||
Dim clabe As String = Convert.ToString(dr("CLABE"))
|
||
Dim CveBanco As String = dr("CveBanco").ToString.PadLeft(3, CERO)
|
||
|
||
|
||
If cuentaDigitos.Length = 11 AndAlso CveBanco = "044" Then
|
||
CuentaDestino = cuentaDigitos
|
||
ElseIf clabe.Length = 18 Then
|
||
CuentaDestino = clabe
|
||
Else
|
||
CuentaDestino = clabe
|
||
SBErrores.Append($"Cuenta {CuentaDestino} debe tener 11 o 18 dígitos.<br>")
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
|
||
Dim TipoCuenta As String = If(CuentaDestino.Length = 18, "9", "1") ' 09=18 dígitos, 01=11 dígitos
|
||
|
||
CuentaDestino = CuentaDestino.PadLeft(20, CERO)
|
||
|
||
|
||
|
||
If CveBanco = "000" Then
|
||
Alert($"CveBanco inválida en fila {idx + 1}. Debe ser numérico de 3 dígitos.", TipoMensaje.MsgAdvertencia)
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
Dim ConceptoPago As String = dr("Observaciones").ToString.Trim
|
||
|
||
If ConceptoPago.Length > 50 Then
|
||
ConceptoPago = ConceptoPago.Substring(0, 50) ' Limitar a 50 caracteres
|
||
End If
|
||
ConceptoPago = ConceptoPago.PadRight(50, SPACE)
|
||
|
||
Dim da As New StringBuilder()
|
||
da.Append("EE") ' 1‑2
|
||
da.Append("DA") ' 3‑4
|
||
da.Append("04") ' 5‑6 Tipo movimiento (04=SPEI)
|
||
da.Append("00") ' 7‑8 Moneda pago (00=MXN)
|
||
da.Append(importeInt) ' 9‑23 Importe (15)
|
||
da.Append(fechaAplicacion) ' 24‑31
|
||
da.Append("03") ' 32‑33 Servicio‑concepto (03)
|
||
da.Append(cveBenef) ' 34‑53
|
||
da.Append(rfc) ' 54‑66
|
||
da.Append(nombreBen) ' 67‑106
|
||
da.Append(referenciaPago) ' 107‑122
|
||
da.Append("00000") ' 123‑127 Plaza pago (ceros)
|
||
da.Append("00000") ' 128‑132 Sucursal pago (ceros)
|
||
|
||
da.Append(CuentaDestino) ' 133‑152 clabe destino (ceros)
|
||
da.Append("00000") ' 153‑157 PAIS (ceros)
|
||
da.Append("".PadLeft(40, SPACE)) ' 158‑197 Ciudad espacio (espacios en blanco)
|
||
da.Append(TipoCuenta) ' 198-198 Tipo cuenta
|
||
da.Append(SPACE) ' 199-199 digito intercambio
|
||
da.Append("00000") ' 200-204 plaza cuenta banco
|
||
da.Append("044") ' 205-207 num banco emisor (044=ScotiaBank)
|
||
da.Append(CveBanco) ' 208-210 num banco receptor (044=ScotiaBank)
|
||
|
||
da.Append("001") ' 211-213 dias vigencia
|
||
da.Append(ConceptoPago) ' 214-263 Concepto pago
|
||
da.Append("".PadLeft(60, SPACE)) '264-283 CAMPO-USO-EMPRESA-1
|
||
' 284-303 CAMPO-USO - Empresa - 2
|
||
' 304-323 CAMPO-USO - Empresa - 3
|
||
da.Append("".PadLeft(41, CERO)) ' 324-326 CODIGO-STATUS - REGISTRO NUM 3
|
||
' 327-327 CVE-CAMBIO - INST NUM 1
|
||
' 328-330 CODIGO-STATUS - CAMBIO - INST NUM 3
|
||
' 331-338 FECHA DE PAGO (Pago en ventanilla) NUM 8
|
||
' 339-343 PLAZA DE PAGO (Pago en ventanilla) NUM 5
|
||
' 344-348 SUCURSAL DE PAGO (Pago en ventanilla) NUM 5
|
||
' 349-364 FOLIO-UNICO NUM 16
|
||
sb.AppendLine(da.ToString())
|
||
|
||
'----------- DETALLE MAIL (DM) 104 -------------------------
|
||
|
||
Dim correo As String = dr("Correo").ToString.Trim
|
||
If correo.Trim.Length = 0 Then
|
||
SBErrores.Append($"Email no definido en fila {idx + 1}. Debe ser un correo electrónico válido.<br>")
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
Dim dm As New StringBuilder()
|
||
dm.Append("EE") ' 1‑2 Tipo archivoz
|
||
dm.Append("DM") ' 3‑4 Tipo registro
|
||
dm.Append(correo.PadRight(100)) ' 5‑104 Email + filler
|
||
da.Append("".PadLeft(34, CERO)) ' 105-138 Uso Futuro
|
||
da.Append("".PadLeft(30, SPACE)) ' 139-168 Clave de Rastreo llenar con espacios en blanco
|
||
da.Append("".PadLeft(20, SPACE)) ' 169-188 Referencia de Abono Banxico
|
||
dm.Append(" ") ' 189-190 Tipo de Operación anexo G
|
||
da.Append("".PadLeft(232, SPACE)) ' 191-370 FILLER
|
||
|
||
|
||
sb.AppendLine(dm.ToString())
|
||
|
||
'----------- ACUMULADORES ---------------------------------------
|
||
totalPagos += 1
|
||
totalImporte += importe
|
||
pagosBloque += 1
|
||
importeBloque += importe
|
||
|
||
'----------- ¿CIERRA BLOQUE? (TB) -------------------------------
|
||
Dim bloqueCompleto As Boolean = (pagosBloque = TamanoBloque)
|
||
Dim ultimoRegistro As Boolean = (idx = DTPendientes.Rows.Count - 1)
|
||
idx += 1
|
||
Next
|
||
|
||
'If bloqueCompleto OrElse ultimoRegistro Then
|
||
Dim tb As New StringBuilder()
|
||
tb.Append("EE") ' 1‑2
|
||
tb.Append("TB") ' 3‑4
|
||
tb.Append(pagosBloque.ToString().PadLeft(7, CERO)) ' 5‑11 Cnt altas
|
||
tb.Append((importeBloque * 100).ToEntero.ToString().PadLeft(17, CERO)) ' 12‑28 Importe altas
|
||
tb.Append("".PadLeft(7, CERO)) ' 29‑35 Cnt bajas
|
||
tb.Append("".PadLeft(17, CERO)) ' 36‑52 Importe bajas
|
||
tb.Append("".PadLeft(195, CERO))
|
||
' 53-59 CANTIDAD DE MOVIMIENTOS ALTAS
|
||
' 60-76 IMPORTE DE MOVIMIENTOS ALTAS
|
||
' 77-83 CANTIDAD DE MOVIMIENTOS BAJAS
|
||
' 84-100 IMPORTE DE MOVIMIENTOS BAJAS
|
||
' 101-107 CANTIDAD DE MOVIMIENTOS ALTAS
|
||
' 108-124 IMPORTE DE MOVIMIENTOS ALTAS
|
||
' 125-131 CANTIDAD DE MOVIMIENTOS BAJAS
|
||
' 132-148 IMPORTE DE MOVIMIENTOS BAJAS
|
||
' 149-155 CANTIDAD DE MOVIMIENTOS PAGADOS
|
||
' 156-172 IMPORTE DE MOVIMIENTOS PAGADOS
|
||
' 173-179 CANTIDAD DE MOVIMIENTOS DEVUELTOS
|
||
' 180-196 IMPORTE DE MOVIMIENTOS DEVUELTOS
|
||
' 197-203 CANTIDAD DE MOVIMIENTOS RECH
|
||
' 204-220 IMPORTE DE MOVIMIENTOS RECH
|
||
' 221-227 CANTIDAD DE MOVIMIENTOS BAJA
|
||
' 228-244 IMPORTE DE MOVIMIENTOS BAJA
|
||
' 245-247 CODIGO-STATUS-REGISTRO
|
||
tb.Append("".PadLeft(123, SPACE)) ' 248-370 FILLER (espacios)
|
||
sb.AppendLine(tb.ToString())
|
||
'End If
|
||
|
||
'------------------- TRAILER ARCHIVO (TA) ---------------------------
|
||
Dim ta As New StringBuilder()
|
||
ta.Append("EE") ' 1‑2
|
||
ta.Append("TA") ' 3‑4
|
||
ta.Append(totalPagos.ToString().PadLeft(7, CERO)) ' 5‑11
|
||
ta.Append((totalImporte * 100).ToEntero.ToString().PadLeft(17, CERO)) ' 12‑28
|
||
ta.Append("".PadLeft(7, CERO)) ' 29‑35 Cnt bajas
|
||
ta.Append("".PadLeft(17, CERO)) ' 36‑52 Importe bajas
|
||
ta.Append("".PadLeft(198, CERO))
|
||
' 53-59 CANTIDAD DE MOVIMIENTOS ALTAS
|
||
' 60-76 IMPORTE DE MOVIMIENTOS ALTAS
|
||
' 77-83 CANTIDAD DE MOVIMIENTOS BAJAS
|
||
' 84-100 IMPORTE DE MOVIMIENTOS BAJAS
|
||
' 101-107 CANTIDAD DE MOVIMIENTOS ALTAS
|
||
' 108-124 IMPORTE DE MOVIMIENTOS ALTAS
|
||
' 125-131 IMPORTE DE MOVIMIENTOS BAJAS
|
||
' 132-148 MOVIMIENTOS PAGADOS
|
||
' 149-155 IMPORTE DE MOVIMIENTOS PAGADOS
|
||
' 156-172 MOVIMIENTOS DEVUELTOS
|
||
' 173-179 IMPORTE DE MOVIMIENTOS DEVUELTOS
|
||
' 180-196 MOVIMIENTOS RECHAZADOS
|
||
' 197-203 CANTIDAD DE MOVIMIENTOS RECH
|
||
' 204-220 IMPORTE DE MOVIMIENTOS RECH
|
||
' 221-227 CANTIDAD DE MOVIMIENTOS BAJA
|
||
' 228-244 IMPORTE DE MOVIMIENTOS BAJA
|
||
' 245-247 CODIGO-STATUS-REGISTRO
|
||
' 248-250 CODIGO-STATUS-ARCHIVO
|
||
|
||
ta.Append("".PadLeft(120, SPACE))
|
||
|
||
sb.Append(ta.ToString())
|
||
|
||
'------------------- ESCRIBIR ARCHIVO -------------------------------
|
||
'File.WriteAllText(RutaArchivo, sb.ToString(), Encoding.ASCII)
|
||
|
||
|
||
Dim NombreArchivo As String = $"pagos_{NowADS.ToString("ddMMyyyy")}_001.txt"
|
||
'"pagos_03062025_001.txt"
|
||
|
||
If InsertaEnDB Then
|
||
|
||
Dim ObjBancos As New ClsBancos
|
||
ObjBancos.IniciaTransacSQL()
|
||
|
||
Dim CveLayoutEnvio As Integer = ObjBancos.AddLayoutEnvios(NombreArchivo, NowADS(), CveCuenta, PorGrupos:=True)
|
||
|
||
If CveLayoutEnvio > 0 Then
|
||
For Each dr As DataRow In DTPendientes.Rows
|
||
If dr("CveProveedor").ToString <> "" Or dr("CvePersonal").ToString <> "" Then
|
||
If Not ObjBancos.AddLayoutEnviosDetalle(CveLayoutEnvio, dr("CveIE").ToString.ToEntero, dr("CveProveedor").ToString.ToEntero, dr("CvePersonal").ToString.ToEntero, 1, "Observaciones") Then
|
||
ErrorLayout = True
|
||
Exit For
|
||
End If
|
||
End If
|
||
Next
|
||
Else
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
If ErrorLayout Then
|
||
ObjBancos.RollBack()
|
||
ObjBancos.Dispose()
|
||
Else
|
||
ObjBancos.Commit()
|
||
ObjBancos.Dispose()
|
||
End If
|
||
|
||
End If
|
||
|
||
Dim path As String = String.Format("{0}Layout\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo)
|
||
Dim pathDirectorio As String = String.Format("{0}Layout\", UsuarioActual.Empresa.Ruta)
|
||
|
||
If File.Exists(path) Then
|
||
File.Delete(path)
|
||
End If
|
||
|
||
If Not Directory.Exists(pathDirectorio) Then
|
||
Directory.CreateDirectory(pathDirectorio)
|
||
End If
|
||
|
||
Dim Texto As String = sb.ToString
|
||
|
||
Dim fs As FileStream = File.Create(path)
|
||
Dim info As Byte() = New UTF8Encoding(True).GetBytes(Texto)
|
||
fs.Write(info, 0, info.Length)
|
||
fs.Close()
|
||
|
||
|
||
If ErrorLayout = False And totalPagos > 0 Then
|
||
|
||
Dim Mensaje As New StringBuilder
|
||
|
||
Mensaje.Append("Descarga Layout<br>")
|
||
|
||
'If NombreArchivo.Length > 0 Then
|
||
' NombreArchivoPago = NombreArchivoEnviado
|
||
'End If
|
||
|
||
'If NombreArchivoPago.Trim.Length > 0 Then
|
||
' Mensaje.Append($"Pagos Descarga <a class='Texto' href='../Empresas/{UsuarioActual.CveEmpresa}/Layout/{NombreArchivoPago}' download> {NombreArchivoPago}<a> <br><br>")
|
||
'End If
|
||
|
||
If NombreArchivo.Length > 0 Then
|
||
|
||
DVDescargaPagos.Visible = True
|
||
DVDescargaCuentas1.Visible = False
|
||
'DVDescargaCuentas2.Visible = False
|
||
'DVDescargaCuentas3.Visible = False
|
||
DVDescargaReporte.Visible = True
|
||
|
||
DT_PagosReporte = DTPendientes.Copy
|
||
|
||
LnkDescarga.Text = NombreArchivo
|
||
RegistraScript("$('#ModalDescarga').modal({ backdrop: 'static', keyboard: false});")
|
||
UpModalDescarga.Update()
|
||
|
||
End If
|
||
|
||
CargaDatos()
|
||
Else
|
||
Alert($"Errores detectados <br>{SBErrores.ToString}", TipoMensaje.MsgAdvertencia)
|
||
End If
|
||
|
||
|
||
End Sub
|
||
|
||
'====================================================================
|
||
' Limpia texto: A‑Z, 0‑9, «@» y «.» (UpperCase) – el resto se descarta
|
||
'====================================================================
|
||
Private Function LimpiarTextoScotia(ByVal valor As String) As String
|
||
Dim sb As New StringBuilder()
|
||
For Each ch As Char In If(valor, String.Empty).ToUpperInvariant()
|
||
If Char.IsLetterOrDigit(ch) OrElse ch = "@"c OrElse ch = "."c Then sb.Append(ch)
|
||
Next
|
||
Return sb.ToString()
|
||
End Function
|
||
|
||
|
||
|
||
|
||
|
||
''====================================================================
|
||
'' GeneraPagoScotiaBank – Layout Pagos Scotiabank
|
||
''====================================================================
|
||
'' ▸ Genera un archivo de pagos masivos para Scotiabank (Archivo de intercambio EE).
|
||
'' ▸ Registros y longitudes exactas:
|
||
'' • HA, HB, DA, TB, TA → 370 caracteres
|
||
'' • DM (correo) → 104 caracteres
|
||
'' ▸ Se permite partición por bloques (TamanoBloque), pero todo dentro de un
|
||
'' mismo método para claridad. Sólo se complementa con LimpiarTextoScotia().
|
||
''====================================================================
|
||
|
||
'Public Sub GeneraPagoScotiaBank(
|
||
' ByVal DTPendientes As DataTable,
|
||
' ByVal RutaArchivo As String,
|
||
' Optional ByVal NumeroConvenio As String = "12345", _ ' 5 dígitos
|
||
' Optional ByVal CuentaCargo As String = "11987654321", _ ' 11 dígitos
|
||
' Optional ByVal TamanoBloque As Integer = 500 _ ' pagos por bloque
|
||
')
|
||
|
||
' '------------------- VALIDACIONES BÁSICAS ---------------------------
|
||
' If DTPendientes Is Nothing OrElse DTPendientes.Rows.Count = 0 Then
|
||
' Alert("No hay datos pendientes para generar el Layout de ScotiaBank.", TipoMensaje.MsgAdvertencia)
|
||
' End If
|
||
|
||
' '------------------- ConvenioPagoElectronico = "0000000" ' 7 dígitos
|
||
' NumeroConvenio = DTPendientes.Rows(0)("ConvenioPagoElectronico").ToString
|
||
' If NumeroConvenio.Trim.Length = 0 Then
|
||
' Alert("El campo NumeroConvenio (ConvenioPagoElectronico) no está definido en los datos de la cuenta.", TipoMensaje.MsgAdvertencia)
|
||
' Exit Sub
|
||
' End If
|
||
|
||
' If NumeroConvenio.Length <> 5 Then
|
||
' Alert("El campo NumeroConvenio debe ser numérico de 5 dígitos.", TipoMensaje.MsgAdvertencia)
|
||
' Exit Sub
|
||
' End If
|
||
|
||
|
||
' If CuentaCargo.Length <> 11 Then
|
||
' Alert("El campo CuentaCargo debe ser numérico de 11 dígitos.", TipoMensaje.MsgAdvertencia)
|
||
' Exit Sub
|
||
' End If
|
||
|
||
|
||
|
||
|
||
' '------------------- ACUMULADORES -----------------------------------
|
||
' Dim sb As New StringBuilder()
|
||
' Dim totalPagos As Integer = 0
|
||
' Dim totalImporte As Decimal = 0D
|
||
' Dim pagosBloque As Integer = 0
|
||
' Dim importeBloque As Decimal = 0D
|
||
' Dim numBloque As Integer = 0
|
||
|
||
' '------------------- HEADER ARCHIVO (HA) ----------------------------
|
||
' Dim ha As New StringBuilder(New String(" "c, 370))
|
||
' ha.Insert(0, "EE") ' 1‑2 Tipo Archivo
|
||
' ha.Insert(2, "HA") ' 3‑4 Tipo Registro
|
||
' ha.Insert(4, NumeroConvenio.PadLeft(5, "0"c)) ' 5‑9 Nº Convenio
|
||
' ha.Insert(9, "01") ' 10‑11 Secuencia fija "01"
|
||
' Dim fechaHoy As String = Date.Now.ToString("yyyyMMdd")
|
||
' ha.Insert(11, fechaHoy) ' 12‑19 Fecha generación
|
||
' ha.Insert(19, "00000000") ' 20‑27 Fecha inicial (opcional)
|
||
' ha.Insert(27, "00000000") ' 28‑35 Fecha final (opcional)
|
||
' ha.Insert(35, "000") ' 36‑38 Código status "000"
|
||
' ' 39‑370 FILLER (espacios) ya está
|
||
' sb.AppendLine(ha.ToString())
|
||
|
||
' '------------------- RECORRIDO DETALLES -----------------------------
|
||
' Dim idx As Integer = 0
|
||
' For Each dr As DataRow In DTPendientes.Rows
|
||
|
||
' '--- ¿Inicia BLOQUE? (HB) ---------------------------------------
|
||
' If idx Mod TamanoBloque = 0 Then
|
||
' numBloque += 1
|
||
' pagosBloque = 0
|
||
' importeBloque = 0D
|
||
|
||
' Dim hb As New StringBuilder(New String(" "c, 370))
|
||
' hb.Insert(0, "EE") ' 1‑2
|
||
' hb.Insert(2, "HB") ' 3‑4
|
||
' hb.Insert(4, "00") ' 5‑6 Moneda cuenta cargo (00=MXN)
|
||
' hb.Insert(6, "0000") ' 7‑10 Uso futuro = ceros
|
||
' hb.Insert(10, CuentaCargo) ' 11‑21 Cuenta cargo (11)
|
||
' hb.Insert(21, "0000000001") ' 22‑31 Referencia Empresa (ejemplo)
|
||
' hb.Insert(31, "000") ' 32‑34 Status registro
|
||
' ' 35‑370 FILLER espacios
|
||
' sb.AppendLine(hb.ToString())
|
||
' End If
|
||
|
||
' '----------- DETALLE ALTA (DA) ----------------------------------
|
||
' Dim importe As Decimal = 0D
|
||
' If Not Decimal.TryParse(Convert.ToString(dr("Importe")), importe) Then _
|
||
' Throw New ArgumentException($"Importe inválido en fila {idx + 1}")
|
||
' If importe <= 0D Then _
|
||
' Throw New ArgumentException($"Importe ≤ 0 en fila {idx + 1}")
|
||
|
||
' Dim importeInt As String = CDec(Math.Round(importe * 100)).ToString().PadLeft(15, "0"c) ' 2 dec.
|
||
|
||
' Dim fechaAplicacion As String = Date.Now.ToString("yyyyMMdd")
|
||
' Dim cveBenef As String = LimpiarTextoScotia(Convert.ToString(dr("CveProveedor")), 20).PadRight(20)
|
||
' Dim rfc As String = LimpiarTextoScotia(Convert.ToString(dr("RFC")), 13).PadRight(13)
|
||
' Dim nombreBen As String = LimpiarTextoScotia(Convert.ToString(dr("RazonSocial")), 40).PadRight(40)
|
||
' Dim referenciaPago As String = If(dr.Table.Columns.Contains("Referencia"),
|
||
' LimpiarTextoScotia(Convert.ToString(dr("Referencia")), 16).PadLeft(16, "0"c),
|
||
' New String("0"c, 16))
|
||
' Dim clabe As String = Convert.ToString(dr("CLABEDestino"))
|
||
' If String.IsNullOrWhiteSpace(clabe) Then clabe = Convert.ToString(dr("CLABE"))
|
||
' clabe = clabe.PadLeft(18, "0"c)
|
||
|
||
' Dim da As New StringBuilder(New String(" "c, 370))
|
||
' da.Insert(0, "EE") ' 1‑2
|
||
' da.Insert(2, "DA") ' 3‑4
|
||
' da.Insert(4, "04") ' 5‑6 Tipo movimiento (04=SPEI)
|
||
' da.Insert(6, "00") ' 7‑8 Moneda pago (00=MXN)
|
||
' da.Insert(8, importeInt) ' 9‑23 Importe (15)
|
||
' da.Insert(23, fechaAplicacion) ' 24‑31
|
||
' da.Insert(31, "03") ' 32‑33 Servicio‑concepto (03)
|
||
' da.Insert(33, cveBenef) ' 34‑53
|
||
' da.Insert(53, rfc) ' 54‑66
|
||
' da.Insert(66, nombreBen) ' 67‑106
|
||
' da.Insert(106, referenciaPago) ' 107‑122
|
||
' da.Insert(122, "00000") ' 123‑127 Plaza pago (ceros)
|
||
' da.Insert(127, "00000") ' 128‑132 Sucursal pago (ceros)
|
||
' da.Insert(132, New String("0"c, 34)) ' 133‑166 Uso futuro (ceros)
|
||
' da.Insert(166, New String(" "c, 30)) ' 167‑196 Clave rastreo (espacios)
|
||
' da.Insert(196, New String("0"c, 20)) ' 197‑216 Referencia Banxico (ceros)
|
||
' da.Insert(216, "01") ' 217‑218 Tipo operación (01 default)
|
||
' ' 219‑370 FILLER espacios
|
||
' sb.AppendLine(da.ToString())
|
||
|
||
' '----------- DETALLE MAIL (DM) 104 bytes -------------------------
|
||
' Dim correo As String = If(dr.Table.Columns.Contains("Email"),
|
||
' LimpiarTextoScotia(Convert.ToString(dr("Email")), 100), "")
|
||
' Dim dm As New StringBuilder(New String(" "c, 104))
|
||
' dm.Insert(0, "EE") ' 1‑2 Tipo archivo
|
||
' dm.Insert(2, "DM") ' 3‑4 Tipo registro
|
||
' dm.Insert(4, correo.PadRight(100)) ' 5‑104 Email + filler
|
||
' sb.AppendLine(dm.ToString())
|
||
|
||
' '----------- ACUMULADORES ---------------------------------------
|
||
' totalPagos += 1
|
||
' totalImporte += importe
|
||
' pagosBloque += 1
|
||
' importeBloque += importe
|
||
|
||
' '----------- ¿CIERRA BLOQUE? (TB) -------------------------------
|
||
' Dim bloqueCompleto As Boolean = (pagosBloque = TamanoBloque)
|
||
' Dim ultimoRegistro As Boolean = (idx = DTPendientes.Rows.Count - 1)
|
||
|
||
' If bloqueCompleto OrElse ultimoRegistro Then
|
||
' Dim tb As New StringBuilder(New String(" "c, 370))
|
||
' tb.Insert(0, "EE") ' 1‑2
|
||
' tb.Insert(2, "TB") ' 3‑4
|
||
' tb.Insert(4, pagosBloque.ToString().PadLeft(7, "0"c)) ' 5‑11 Cnt altas
|
||
' tb.Insert(11, (importeBloque * 100).ToString().PadLeft(17, "0"c)) ' 12‑28 Importe altas
|
||
' ' 29‑370 resto de contadores a cero / espacios
|
||
' tb.Insert(28, New String("0"c, 342))
|
||
' sb.AppendLine(tb.ToString())
|
||
' End If
|
||
|
||
' idx += 1
|
||
' Next
|
||
|
||
' '------------------- TRAILER ARCHIVO (TA) ---------------------------
|
||
' Dim ta As New StringBuilder(New String(" "c, 370))
|
||
' ta.Insert(0, "EE") ' 1‑2
|
||
' ta.Insert(2, "TA") ' 3‑4
|
||
' ta.Insert(4, totalPagos.ToString().PadLeft(7, "0"c)) ' 5‑11
|
||
' ta.Insert(11, (totalImporte * 100).ToString().PadLeft(17, "0"c)) ' 12‑28
|
||
' ta.Insert(28, New String("0"c, 342)) ' resto filler
|
||
' sb.AppendLine(ta.ToString())
|
||
|
||
' '------------------- ESCRIBIR ARCHIVO -------------------------------
|
||
' File.WriteAllText(RutaArchivo, sb.ToString(), Encoding.ASCII)
|
||
'End Sub
|
||
|
||
|
||
Protected Sub LnkDescarga_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim FileName As String = NombreArchivo
|
||
Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivo}"
|
||
|
||
'If NombreArchivo.Length = 0 Then
|
||
If OpBancos = 3 Then
|
||
FileName = LnkDescarga.Text
|
||
FilePath = $"{UsuarioActual.Empresa.Ruta}Layout\{ LnkDescarga.Text}"
|
||
End If
|
||
|
||
'End If
|
||
|
||
Response.Clear()
|
||
Response.ContentType = "application/octet-stream"
|
||
Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
|
||
Response.TransmitFile(FilePath)
|
||
Response.End()
|
||
|
||
End Sub
|
||
|
||
Protected Sub LnkDescargaCuentas1_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim FileName As String = NombreArchivo
|
||
Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivo}"
|
||
|
||
If DdlCuenta.SelectedItem.Text.ToUpper.Contains("BAJIO") Or DdlCuenta.SelectedItem.Text.ToUpper.Contains("SCOTIA") Then
|
||
FileName = LnkDescargaCuentas1.Text
|
||
FilePath = $"{UsuarioActual.Empresa.Ruta}Layout\{LnkDescargaCuentas1.Text}"
|
||
End If
|
||
|
||
Response.Clear()
|
||
Response.ContentType = "application/octet-stream"
|
||
Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
|
||
Response.TransmitFile(FilePath)
|
||
Response.End()
|
||
|
||
End Sub
|
||
|
||
|
||
|
||
Protected Sub LnkDescargaReporte_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta))
|
||
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
||
|
||
DT_PagosReporte = DT_PagosReporte.FiltraParametros("EstatusPagoElectronicoGrupos = 'True' AND EstatusCtaDeposito > 0").Copy()
|
||
|
||
Dim params As New List(Of ReportParameter)
|
||
|
||
If Archivo.Exists Then
|
||
ImprimirPDF(String.Format("{0}Formatos\LayoutPagoProveedor.rdlc", UsuarioActual.Empresa.Ruta), DtPago, params, "LayoutPagoProveedor", RDSName:="DSPagoElectronicoV2")
|
||
Else
|
||
|
||
|
||
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
||
|
||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||
params.Add(New ReportParameter("Direccion", UsuarioActual.Empresa.Direccion))
|
||
params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
|
||
params.Add(New ReportParameter("FechaImpresion", NowADS().ToString("dd/MM/yyyy")))
|
||
|
||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||
params.Add(New ReportParameter("Titulo", "Reporte Pago Proveedor Layout"))
|
||
|
||
ImprimirPDF("Empresas/Grales/Formatos/LayoutPagoProveedor.rdlc", DT_PagosReporte, params, "LayoutPagoProveedor", RDSName:="DSPagoElectronicoV2")
|
||
End If
|
||
|
||
|
||
|
||
End Sub
|
||
'Protected Sub LnkDescargaCuentas2_Click(sender As Object, e As EventArgs)
|
||
' Dim FileName As String = NombreArchivoInterbancario
|
||
' Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivoInterbancario}"
|
||
' Response.Clear()
|
||
' Response.ContentType = "application/octet-stream"
|
||
' Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
|
||
' Response.TransmitFile(FilePath)
|
||
' Response.End()
|
||
'End Sub
|
||
|
||
'Protected Sub LnkDescargaCuentas3_Click(sender As Object, e As EventArgs)
|
||
|
||
' Dim FileName As String = NombreArchivoCIE
|
||
' Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivoCIE}"
|
||
' Response.Clear()
|
||
' Response.ContentType = "application/octet-stream"
|
||
' Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
|
||
' Response.TransmitFile(FilePath)
|
||
' Response.End()
|
||
'End Sub
|
||
|
||
#End Region
|
||
|
||
|
||
#Region " TAB PRINCIPAL "
|
||
|
||
Protected Sub GvPendientes_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||
|
||
'Colorea GV
|
||
If e.Row.DBCampo("RazonSocial").ToString = "" Then
|
||
e.Row.BackColor = Drawing.Color.WhiteSmoke
|
||
Else
|
||
If e.Row.DBCampo("EstatusPagoElectronico").ToString <> "True" Then
|
||
e.Row.BackColor = Drawing.Color.LightSalmon
|
||
e.Row.ToolTip = "Cuenta Deposito aun sin dar de Alta."
|
||
End If
|
||
|
||
If e.Row.DBCampo("CveProveedor").ToString.ToEntero > 0 Then
|
||
e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
|
||
Else
|
||
e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal"))
|
||
End If
|
||
|
||
End If
|
||
|
||
If Not e.Row.DBCampo("CveCuentaDeposito").ToString.ToEntero > 0 Then
|
||
e.Row.Cells(0).BackColor = Drawing.Color.Red
|
||
e.Row.ToolTip = "Sin Cuenta Deposito asignada"
|
||
End If
|
||
|
||
If e.Row.DBCampo("EstatusCtaDeposito").ToString = "False" Then
|
||
e.Row.Cells(0).BackColor = Drawing.Color.Red
|
||
e.Row.ToolTip = "Cuenta Deposito INACTIVA"
|
||
End If
|
||
|
||
e.Row.FCHyperLink("HLImporte").NavigateUrl = String.Format("IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
|
||
|
||
End If
|
||
End Sub
|
||
Protected Sub GvEnviadas_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||
'Colorea GV
|
||
If e.Row.DBCampo("CveIE").ToString = "" Then
|
||
e.Row.BackColor = Drawing.Color.LightGray
|
||
|
||
|
||
'Si la fecha de generacion del archivo es diferente de hoy activamos el boton REGENERAR
|
||
'If e.Row.DBCampo("Fecha").ToDate.ToShortDateString <> NowADS().ToShortDateString Then
|
||
' e.Row.FCLinkButton("LBRegenerar").Visible = True
|
||
'End If
|
||
If DTEnviadas.MAX("FueConciliado", String.Format("CveLayoutEnvio = {0}", e.Row.DBCampo("CveLayoutEnvio"))).ToEntero > 0 Then
|
||
e.Row.ToolTip = "El movimiento no se puede regenerar ya que alguno de sus movimientos ya fue conciliado"
|
||
Else
|
||
e.Row.FCLinkButton("LBRegenerar").Visible = True
|
||
End If
|
||
|
||
Else
|
||
|
||
If e.Row.DBCampo("FueConciliado") = "1" Then
|
||
e.Row.ForeColor = Drawing.Color.Red
|
||
e.Row.ToolTip = "Este movimiento ya fue conciliado."
|
||
End If
|
||
|
||
If e.Row.DBCampo("CveProveedor").ToString.ToEntero > 0 Then
|
||
e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
|
||
Else
|
||
e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal"))
|
||
End If
|
||
e.Row.FCHyperLink("HLDetalle").NavigateUrl = String.Format("IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
|
||
End If
|
||
End If
|
||
End Sub
|
||
Protected Sub LBRegenerar_Click(sender As Object, e As EventArgs)
|
||
Dim CveBLE As Integer = CType(sender, LinkButton).CommandArgument.ToEntero
|
||
Dim DtRegenerar As New DataTable
|
||
|
||
Dim ObjBancos As New ClsBancos
|
||
If ObjBancos.GetLayoutPagos(CveCuenta, CveBLE, "-1") Then
|
||
DtRegenerar = ObjBancos.DtResultados
|
||
Else
|
||
DtRegenerar = Nothing
|
||
End If
|
||
ObjBancos.Dispose()
|
||
|
||
If OpBancos = 1 Then
|
||
If DtRegenerar IsNot Nothing Then
|
||
GeneraPago(DtRegenerar, CveBLE)
|
||
Else
|
||
Alert("Ocurrió un error al obtener los datos para generar el archivo. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||
End If
|
||
End If
|
||
|
||
If OpBancos = 3 Then
|
||
If DtRegenerar IsNot Nothing Then
|
||
GeneraPagoScotiaBank(DtRegenerar, False)
|
||
Else
|
||
Alert("Ocurrió un error al obtener los datos para generar el archivo. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||
End If
|
||
End If
|
||
|
||
|
||
End Sub
|
||
|
||
#End Region
|
||
|
||
|
||
|
||
'RECARGA DATOS
|
||
#Region " RECARGA DATOS "
|
||
|
||
Private Sub RecargaDatos()
|
||
CargaDatos()
|
||
TipoMasiva = 1
|
||
DdlTipoCargaMasiva.SelectedValueExist("1")
|
||
CargaProveedores()
|
||
End Sub
|
||
|
||
#End Region
|
||
|
||
|
||
|
||
'ARMA Y GENERA TXT'S
|
||
#Region "ALTA PROVEEDORES"
|
||
Protected Sub BtnAltas_Click(sender As Object, e As EventArgs)
|
||
|
||
If Not DdlCuenta.SelectedValue.ToEntero > 0 Then
|
||
Alert("Primero debe seleccionar una Cuenta", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
End If
|
||
|
||
If OpBancos = 1 Then
|
||
AltaProveedores(1)
|
||
ElseIf OpBancos = 2 Then
|
||
'AltaProveedoresBajio()
|
||
ElseIf OpBancos = 3 Then
|
||
Dim fechaHoy As String = DateTime.Today.ToString("MM/dd/yyyy")
|
||
AltaProveedoresScotia(DTPendientes.FiltraParametros($" EstatusPagoElectronicoScotia = False OR FechaEliminacion < #{fechaHoy}#"))
|
||
End If
|
||
|
||
End Sub
|
||
Private Sub AltaProveedores(TipoAlta As Integer)
|
||
Dim DtTemp As DataTable = Nothing
|
||
CreaDtAlta()
|
||
|
||
|
||
'TIPO ALTA
|
||
'1 = Alta comun
|
||
'2 = Alta masiva
|
||
If TipoAlta = 1 Then
|
||
If DTPendientes Is Nothing OrElse DTPendientes.FiltraParametros("EstatusCtaDeposito = 'True'").Rows.Count <= 0 Then
|
||
Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
Else
|
||
DtTemp = DTPendientes.FiltraParametros("EstatusCtaDeposito = 'True'").Copy
|
||
End If
|
||
ElseIf TipoAlta = 2 Then
|
||
If DTProveedores Is Nothing OrElse DTProveedores.Rows.Count <= 0 Then
|
||
Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
Else
|
||
DtTemp = DTProveedores.Copy
|
||
End If
|
||
ElseIf TipoAlta = 3 Then
|
||
If DTFyE Is Nothing OrElse DTFyE.Rows.Count <= 0 Then
|
||
Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
Else
|
||
DtTemp = DTProveedores.Copy
|
||
End If
|
||
End If
|
||
|
||
'REINICIA PROPIEDAS
|
||
HeaderTexto = ""
|
||
DetalleTexto = ""
|
||
TrailerTexto = ""
|
||
TotalAcumulado = 0
|
||
|
||
''VALIDA CUENTAS DEPOSITOS
|
||
Dim ErrorCuenta As Boolean = False
|
||
Dim ProveedoresError As StringBuilder = New StringBuilder
|
||
ProveedoresError.AppendFormat("<table width='600px'><thead><tr><td width='300px'>Proveedor</td><td width='150px'>Cuenta</td><td width='150px'>Error</td></tr></thead><tbody>")
|
||
Dim TotalDetalles As Integer = 0
|
||
Dim EsBancomer As Boolean = False
|
||
For Each gvr As DataRow In DtTemp.Rows
|
||
If gvr("CveCuentaDeposito").ToString <> "" AndAlso gvr("EstatusPagoElectronico").ToString <> "True" AndAlso gvr("AltaCuenta").ToString = "1" Then
|
||
DTPendienteActual = DtTemp.FiltraParametros(String.Format("CveCuentaDeposito = {0}", gvr("CveCuentaDeposito").ToString))
|
||
ErrorCuenta = False
|
||
EsBancomer = False
|
||
|
||
If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then
|
||
EsBancomer = True
|
||
End If
|
||
|
||
''COMENTADO PARA PERMITIR ENTRADA DE UNA CUENTA A PROVEEDOR, 22 DE SEPTIEMBRE, ISRAEL PIÑA
|
||
'If Not ErrorCuenta Then
|
||
' If EsBancomer AndAlso (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso Not DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then
|
||
' ProveedoresError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>CLABE NO PERTENECE A BANCOMER</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
' ErrorCuenta = True
|
||
' End If
|
||
'End If
|
||
|
||
''CLABE SIEMPRE OBLIGATORIA CUANDO NO ES BANCOMER CON CIE
|
||
'If (DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And Not EsBancomer) Or (EsBancomer And TxtConvenioCIE.Text.Trim.Length <> 6 And DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18) Then
|
||
' Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||
' Exit Sub
|
||
'End If
|
||
|
||
'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER
|
||
If Not ErrorCuenta Then
|
||
If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And DTPendienteActual(0)("CLABE").ToString.Trim.Length = 0 And Not EsBancomer Then
|
||
ProveedoresError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>CLABE ES OBLIGATORIA</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10
|
||
If Not ErrorCuenta Then
|
||
If DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 10 AndAlso EsBancomer Then
|
||
ProveedoresError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>NUMERO DE CUENTA CON FORMATO INCORRECTO</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18
|
||
If Not ErrorCuenta Then
|
||
If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 Then
|
||
ProveedoresError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>CLABE CON FORMATO INCORRECTO</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
'SI CIE TIENE ALGO DEBE TENER REFERENCIA OBLIGATORIA
|
||
If Not ErrorCuenta Then
|
||
If DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0 And DTPendienteActual(0)("Referencia").ToString.Trim.Length < 3 Then
|
||
ProveedoresError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>CIE CON FORMATO INCORRECTO</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA"
|
||
If Not ErrorCuenta Then
|
||
If EsBancomer AndAlso Not (DTPendienteActual(0)("Cuenta").ToString.Trim.Length = 10 Or DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0) Then
|
||
ProveedoresError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>CUENTA BANCOMER SIN CUENTA O CIE</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
|
||
'DTPendienteActual(0)("").ToString
|
||
|
||
'VALDIACION ANTIGUA
|
||
'If Not (DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER")) Then
|
||
' If Not DTPendienteActual(0)("CLABE").ToString.Length = 18 Then
|
||
' ProveedoresError.AppendFormat("Proveedor: {0}", DTPendienteActual(0)("RazonSocial").ToString)
|
||
' ErrorCuenta = True
|
||
' End If
|
||
'End If
|
||
|
||
If Not ErrorCuenta Then
|
||
If TotalDetalles > 0 Then
|
||
DetalleTexto &= vbCrLf
|
||
End If
|
||
CrearDetalle()
|
||
TotalDetalles += 1
|
||
End If
|
||
|
||
End If
|
||
Next
|
||
ProveedoresError.AppendFormat("</tbody></table>")
|
||
|
||
|
||
If TotalDetalles > 0 Then
|
||
FormarTexto(TotalDetalles)
|
||
CreaArchivo(2)
|
||
|
||
Dim Descargas As New StringBuilder()
|
||
Descargas.AppendFormat("<li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?File={0}"" target='_blank'>TXT</a></li>", NombreArchivo)
|
||
'Descargas.AppendFormat("<li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?REPORTE=S"" target='_blank'>Reporte</a></li>", NombreArchivo)
|
||
Descargas.AppendFormat("<li><a href=""#"" class=""Texto"" onclick=""fncg();"">Descargar Reporte</a></li>", NombreArchivo)
|
||
|
||
|
||
Dim TextoErrorProveedores As String = ""
|
||
If ProveedoresError.Length > 160 Then TextoErrorProveedores = String.Format("<br /><br /><br />Proveedores con Error: <br/><br/>------------------------------------------------------------------<br/>{0}<br /><br />", ProveedoresError.ToString)
|
||
|
||
Alert(String.Format("<br />El Layout fue creado satisfactoriamente.{1}<br />Descargas:<ul>{0}</ul>", Descargas, TextoErrorProveedores), TipoMensaje.MsgInformacion)
|
||
|
||
'NombreArchivo = "LayoutAltaProveedores"
|
||
'DescargarArchivo()
|
||
Else
|
||
Alert("No hay proveedores que dar de alta", TipoMensaje.MsgInformacion)
|
||
End If
|
||
|
||
End Sub
|
||
Protected Sub CrearDetalle()
|
||
Dim Resultado As Boolean = True
|
||
Dim CuentaDeposito As String = ""
|
||
Dim TipoCuentaDeposito As String = ""
|
||
Dim TipoCuenta As String = ""
|
||
|
||
''''' LLENADO DE DETALLE
|
||
'Campos #1-4 del Detalle
|
||
DetalleTexto &= String.Format("DA{0}N ", DTPendienteActual(0)("CveCuentaDeposito").ToString.ToUpper.PadLeft(30, PadCeros))
|
||
|
||
'Banco BBVA
|
||
If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Then
|
||
'Llenamos datos de BBVA
|
||
'Campo #5-7 del detalle
|
||
|
||
'Busca que cuenta sera la asignada para el proveedor
|
||
If DTPendienteActual(0)("CIE").ToString <> "" Then
|
||
CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros))
|
||
TipoCuenta = "50"
|
||
TipoCuentaDeposito = "CIE"
|
||
ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then
|
||
CuentaDeposito = DTPendienteActual(0)("Cuenta").ToString
|
||
TipoCuenta = "99"
|
||
TipoCuentaDeposito = "Cuenta"
|
||
ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then
|
||
CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
|
||
TipoCuenta = "40"
|
||
TipoCuentaDeposito = "CLABE"
|
||
End If
|
||
|
||
|
||
DetalleTexto &= String.Format("{0}{1}{2}", DTPendienteActual(0)("Abreviatura").ToString, TipoCuenta, CuentaDeposito.PadLeft(35, PadCeros))
|
||
|
||
'Llenamos en blanco datos de otros bancos
|
||
'Campos 8-17 del detalle --- 64 de otros bancos y 45 para FILLER --- Fecha de Alta
|
||
DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(109), NowADS().ToString("yyyy-MM-dd"))
|
||
|
||
|
||
'Otros Bancos NACIONAL!!
|
||
Else
|
||
|
||
CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
|
||
TipoCuentaDeposito = "CLABE"
|
||
|
||
'Llenamos en blanco datos de BBVA
|
||
DetalleTexto &= Vacio.PadRight(40)
|
||
|
||
'Llenamos datos de otros bancos
|
||
'Campos 8- 17 del detalle --- 44 de otros bancos --- 20 de internacional --- 45 Filler -- Fecha de Alta
|
||
DetalleTexto &= String.Format("{0}40{1}{2}{3}{4}{5}", DTPendienteActual(0)("Abreviatura").ToString, DTPendienteActual(0)("CLABE").ToString.PadLeft(35, PadCeros), DTPendienteActual(0)("CLABE").ToString.Substring(0, 3).PadLeft(4, PadCeros), Vacio.PadRight(20), Vacio.PadRight(45), NowADS().ToString("yyyy-MM-dd"))
|
||
End If
|
||
|
||
'Llenamos datos de Tipo de Persona - Fisica o Moral
|
||
TipoPersona()
|
||
|
||
'Campos 27-32 --- Fillers --- datos de otros bancos (internacional)
|
||
DetalleTexto &= Vacio.PadLeft(153)
|
||
|
||
'Campos 33-36 --- Datos de confirmacion
|
||
DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), CorreoNotificacionesEmpresa.ToUpper.PadRight(50))
|
||
|
||
'If DTPendienteActual(0)("ContactoMail").ToString.Length > 0 Then
|
||
' 'DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), DTPendienteActual(0)("ContactoMail").ToString.ToUpper.PadRight(50))
|
||
'ElseIf DTPendienteActual(0)("ContactoMail").ToString.Length <= 0 Then
|
||
' DetalleTexto &= String.Format("{0}00{1}", Vacio.PadRight(40), Vacio.PadRight(50))
|
||
'End If
|
||
|
||
'Campos 37-39 -- FILLER
|
||
DetalleTexto &= String.Format("00{0}", Vacio.PadRight(38))
|
||
|
||
|
||
''LLENA DT PARA REPORTE
|
||
Dim Row As DataRow = DtAlta.NewRow()
|
||
Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString
|
||
Row("Banco") = DTPendienteActual(0)("BancoNombre").ToString
|
||
Row("TipoCuenta") = TipoCuentaDeposito
|
||
Row("Cuenta") = String.Format("{0}", CuentaDeposito)
|
||
DtAlta.Rows.Add(Row)
|
||
End Sub
|
||
|
||
Protected Sub TipoPersona()
|
||
'Persona Moral
|
||
If DTPendienteActual(0)("RFC").ToString.Length = 12 Then
|
||
Dim fecha As String = DTPendienteActual(0)("FechaIng").ToString
|
||
Dim NombreProveedor As String = DTPendienteActual(0)("RazonSocial").ToString.Replace("‚"c, Vacio).Replace("‚"c, Vacio).ToUpper.PadRight(50)
|
||
NombreProveedor = If(NombreProveedor.Length > 50, NombreProveedor.Substring(0, 50), NombreProveedor)
|
||
|
||
'Campo 18-20 del detalle
|
||
DetalleTexto &= String.Format("M{0}{1}-{2}-{3}", NombreProveedor, fecha.Substring(6, 4), fecha.Substring(3, 2), fecha.Substring(0, 2))
|
||
'Campo 21-26 del detalle --- 10 FILLER - 70 de TipoPersona FISICA - 14 de RFC
|
||
DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(80), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14))
|
||
|
||
'Persona Fisica
|
||
ElseIf DTPendienteActual(0)("RFC").ToString.Length = 13 Then
|
||
|
||
|
||
If DTPendienteActual(0)("Tipo").ToString = "FyE" Then
|
||
|
||
'Llenamos datos de Tipo de Persona - Fisica nombres Primer apellido Segundo apellido
|
||
DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), DTPendienteActual(0)("Nombres").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("APaterno").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("AMaterno").ToString.PadRight(20).Substring(0, 20))
|
||
|
||
'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC
|
||
DetalleTexto &= String.Format("{0}{1}", DTPendienteActual(0)("FechaNacimiento").ToString.ToDate.ToString("yyyy-MM-dd"), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14))
|
||
|
||
Else
|
||
|
||
'Obtener nombre
|
||
Dim Nombre() As String = Split(DTPendienteActual(0)("RazonSocial").ToString.Replace(",", ""))
|
||
|
||
'Campo 18-24 del detalle --- 60 Tipo Persona Moral --- 10 Filler -- Datos Persona Fisica
|
||
If Nombre.Length = 2 Then
|
||
DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), Nombre(0).PadRight(20).Substring(0, 20), Nombre(1).PadRight(20).Substring(0, 20), Vacio.PadRight(20).Substring(0, 20))
|
||
ElseIf Nombre.Length = 3 Then
|
||
DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), Nombre(0).PadRight(20), Nombre(1).PadRight(20).Substring(0, 20), Nombre(2).PadRight(20).Substring(0, 20))
|
||
ElseIf Nombre.Length = 4 Then
|
||
DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), (Nombre(0) & " " & Nombre(1)).PadRight(20).Substring(0, 20), Nombre(2).PadRight(20).Substring(0, 20), Nombre(3).PadRight(20).Substring(0, 20))
|
||
ElseIf Nombre.Length > 4 Then
|
||
|
||
Dim NombreComplejo As New List(Of String)
|
||
|
||
'ignoramos cualquier palabra del nombre que tenga un length igual o menor a 2
|
||
For index As Integer = 0 To Nombre.Length - 1
|
||
If Nombre(index).Length > 2 Then
|
||
NombreComplejo.Add(Nombre(index))
|
||
End If
|
||
Next
|
||
|
||
If NombreComplejo.Count = 2 Then
|
||
DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), NombreComplejo.Item(0).PadRight(20).Substring(0, 20), NombreComplejo.Item(1).PadRight(20).Substring(0, 20), Vacio.PadRight(20).Substring(0, 20))
|
||
ElseIf NombreComplejo.Count = 3 Then
|
||
DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), NombreComplejo.Item(0).PadRight(20), NombreComplejo.Item(1).PadRight(20).Substring(0, 20), NombreComplejo.Item(2).PadRight(20).Substring(0, 20))
|
||
ElseIf NombreComplejo.Count = 4 Then
|
||
DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), (NombreComplejo.Item(0) & " " & NombreComplejo.Item(1)).PadRight(20).Substring(0, 20), NombreComplejo.Item(2).PadRight(20).Substring(0, 20), NombreComplejo.Item(3).PadRight(20).Substring(0, 20))
|
||
ElseIf NombreComplejo.Count > 4 Then
|
||
Dim Nombres As String = ""
|
||
|
||
'todas las palabras menos las 2 ultimas forman parte del nombre
|
||
For index As Integer = 0 To NombreComplejo.Count - 3
|
||
If Nombres <> "" Then Nombres += " "
|
||
Nombres += NombreComplejo.Item(index)
|
||
Next
|
||
DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), Nombres.PadRight(20).Substring(0, 20), NombreComplejo.Item(NombreComplejo.Count - 2).PadRight(20).Substring(0, 20), NombreComplejo.Item(NombreComplejo.Count - 1).PadRight(20).Substring(0, 20))
|
||
|
||
End If
|
||
|
||
End If
|
||
|
||
'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC
|
||
Dim fecha As String = DTPendienteActual(0)("RFC").ToString.Substring(4, 6)
|
||
DetalleTexto &= String.Format("19{0}-{1}-{2}{3}", fecha.Substring(0, 2), fecha.Substring(2, 2), fecha.Substring(4, 2), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14))
|
||
|
||
End If
|
||
|
||
|
||
Else
|
||
'Alert("Hola")
|
||
End If
|
||
End Sub
|
||
Protected Sub FormarTexto(Registros As Integer)
|
||
'''''' LLENADO HEADER
|
||
Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString
|
||
'Campos #1-4 del Header
|
||
HeaderTexto = String.Format("H{0}{1}GRUPO01 ", convenio.PadLeft(9, PadCeros), NowADS().ToString("yyyy-MM-dd"))
|
||
'Campo #5 del Header
|
||
|
||
Dim IdentificadoUsuario As String = UsuarioActual.Usuario.Replace(" ", "").Replace(".", "").Replace("@", "").Replace("/", "").Replace("\", "").Replace("-", "").Replace("&", "").Replace(",", "").Replace("+", "").Replace("_", "").ToUpper.Trim
|
||
IdentificadoUsuario = If(IdentificadoUsuario.Length > 12, IdentificadoUsuario.Substring(0, 12), IdentificadoUsuario)
|
||
' Dim Identificado As String = String.Format("{0}{1}", UsuarioActual.Usuario, NowADS().ToString("yyyyMMdd")))
|
||
|
||
HeaderTexto &= String.Format("{0}{1}", IdentificadoUsuario, NowADS().ToString("yyyyMMdd")).PadRight(20)
|
||
'Campos #6-8 del Header
|
||
HeaderTexto &= String.Format("00").PadRight(586)
|
||
Dim HeaderLength As Integer = HeaderTexto.Length
|
||
|
||
''''' LLENADO DE TRAILER
|
||
TrailerTexto = String.Format("T{0}{1}{2}", Registros.ToString.PadLeft(10, PadCeros), Vacio.PadRight(50, PadCeros), Vacio.PadRight(575))
|
||
|
||
''''' ARMADO DEL TEXTO COMPLETO
|
||
TextoCompleto = String.Format("{1}{0}{2}{0}{3}{0}", vbCrLf, HeaderTexto, DetalleTexto, TrailerTexto)
|
||
'TxtAltas.Text = TextoCompleto
|
||
End Sub
|
||
|
||
#End Region
|
||
|
||
#Region "PAGO PROVEEDORES"
|
||
Protected Sub BtnPagos_Click(sender As Object, e As EventArgs)
|
||
|
||
If Not DdlCuenta.SelectedValue.ToEntero > 0 Then
|
||
Alert("Primero debe seleccionar una Cuenta", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
End If
|
||
|
||
'GeneraPago
|
||
|
||
|
||
If OpBancos = 1 Then
|
||
If DTPendientes.FiltraParametros("EstatusPagoElectronico = 'True' AND EstatusCtaDeposito = 'True'") IsNot Nothing Then
|
||
GeneraPago(DTPendientes.FiltraParametros("EstatusPagoElectronico > 0 AND EstatusCtaDeposito > 0"), -1)
|
||
Else
|
||
Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia)
|
||
End If
|
||
ElseIf OpBancos = 2 Then
|
||
|
||
ElseIf OpBancos = 3 Then
|
||
If DTPendientes.FiltraParametros("EstatusPagoElectronicoScotia = 'True' AND EstatusCtaDeposito = 'True'") IsNot Nothing AndAlso
|
||
DTPendientes.FiltraParametros("EstatusPagoElectronicoScotia = 'True' AND EstatusCtaDeposito = 'True'").Rows.Count > 0 Then
|
||
GeneraPagoScotiaBank(DTPendientes.FiltraParametros("EstatusPagoElectronicoScotia = 'True' AND EstatusCtaDeposito = 'True'"), True)
|
||
Else
|
||
Alert("No hay registros para generar pagos en ScotiaBank", TipoMensaje.MsgAdvertencia)
|
||
End If
|
||
End If
|
||
|
||
|
||
End Sub
|
||
Private Sub GeneraPago(DTTemp As DataTable, CveBLE As Integer)
|
||
If DTTemp.Rows.Count <= 0 Then
|
||
Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
End If
|
||
|
||
'For Each gvr As DataRow In DTTemp.Rows
|
||
' If gvr("EstatusPagoElectronico").ToString.ToEntero <= 0 Then
|
||
' Alert("Los proveedores tienen que estar dados de alta. Primero de alta a los proveedores")
|
||
' Exit Sub
|
||
' End If
|
||
'Next
|
||
|
||
'Comprobamos la cuenta deposito y moneda de las cuentas deposito
|
||
For Each dr As DataRow In DTTemp.Rows
|
||
If dr("BancoNombre").ToString = "" Then
|
||
Alert(String.Format("El Pago <b>'{0}'</b> no tiene Cuenta Deposito Asociada.", dr("Observaciones")), TipoMensaje.MsgError)
|
||
Exit Sub
|
||
End If
|
||
|
||
If dr("MonedaCtaDeposito").ToString = "" Or dr("MonedaCtaDeposito").ToString.ToEntero <= 0 Then
|
||
Alert(String.Format("La cuenta deposito <b>'{0}'</b> del proveedor <b>'{1}'</b> no tiene Moneda especificada.", dr("CuentaDeposito"), dr("RazonSocial")), TipoMensaje.MsgError)
|
||
Exit Sub
|
||
End If
|
||
Next
|
||
|
||
'Excluimos los registros que no tengan cuenta deposito dada de alta
|
||
'DTTemp = DTTemp.FiltraParametros("EstatusPagoElectronico = 0")
|
||
|
||
HeaderTexto = ""
|
||
DetalleTexto = ""
|
||
TrailerTexto = ""
|
||
TotalAcumulado = 0
|
||
|
||
'Insertar en LayoutEnvios
|
||
Dim ObjBancos As New ClsBancos
|
||
ObjBancos.IniciaTransacSQL()
|
||
Dim ErrorLayout As Boolean = False
|
||
|
||
Dim TotalDetalles As Integer = 0
|
||
|
||
'CREA CARPETA SI NO EXISTE
|
||
Dim path As String = Server.MapPath(String.Format("~/Empresas/{0}/Layout/", UsuarioActual.CveEmpresa))
|
||
Dim exists As Boolean = System.IO.Directory.Exists(path)
|
||
If Not exists Then
|
||
System.IO.Directory.CreateDirectory(path)
|
||
End If
|
||
|
||
Dim CveIEs As String = ""
|
||
CreaDtPago()
|
||
|
||
For Each gvr As DataRow In DTTemp.Rows
|
||
If gvr("CveCuentaDeposito").ToString <> "" Then
|
||
DTPendienteActual = DTTemp.FiltraParametros(String.Format("CveIE = {0}", gvr("CveIE").ToString))
|
||
|
||
'ACTUALIZA FECHADOCUMENTO DEL IE
|
||
'If CveBLE > 0 Then
|
||
' ObjBancos.UpdateBancos_IE(NowADS(), NowADS(), DTPendienteActual(0)("CveIE").ToString.ToEntero)
|
||
'End If
|
||
|
||
If TotalDetalles > 0 Then
|
||
DetalleTexto &= vbCrLf
|
||
End If
|
||
CrearDetallePagos()
|
||
TotalDetalles += 1
|
||
End If
|
||
Next
|
||
|
||
FormarTextoPagos(TotalDetalles, TotalAcumulado.ToString.FormatoNumero.Replace(",", "").Replace(".", ""))
|
||
CreaArchivo(1)
|
||
|
||
If CveBLE > 0 Then
|
||
'ACTUALIZAMOS EL ENVIO SI ES REGENERACION
|
||
If Not ObjBancos.UpdateLayoutEnvios(CveBLE, NowADS()) Then
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
'GUARDAMOS EL ENVIO SI NO ES REGENERACION
|
||
Else
|
||
Dim CveLayoutEnvio As Integer = ObjBancos.AddLayoutEnvios(NombreArchivo, NowADS(), CveCuenta)
|
||
|
||
If CveLayoutEnvio > 0 Then
|
||
For Each dr As DataRow In DTTemp.Rows
|
||
If dr("CveProveedor").ToString <> "" Or dr("CvePersonal").ToString <> "" Then
|
||
If Not ObjBancos.AddLayoutEnviosDetalle(CveLayoutEnvio, dr("CveIE").ToString.ToEntero, dr("CveProveedor").ToString.ToEntero, dr("CvePersonal").ToString.ToEntero, 1, "Observaciones") Then
|
||
ErrorLayout = True
|
||
End If
|
||
End If
|
||
Next
|
||
Else
|
||
ErrorLayout = True
|
||
End If
|
||
End If
|
||
|
||
|
||
|
||
If Not ErrorLayout Then
|
||
ObjBancos.Commit()
|
||
ObjBancos.Dispose()
|
||
|
||
|
||
Dim Des As String = String.Format("{0}Layout\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo)
|
||
Dim Descargas As New StringBuilder()
|
||
Descargas.AppendFormat("<li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?File={0}"" target='_blank'>TXT</a></li>", NombreArchivo)
|
||
' Descargas.AppendFormat("<li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?REPORTE=S"" target='_blank'>Reporte</a></li>", NombreArchivo)
|
||
Descargas.AppendFormat("<li><a href=""#"" class=""Texto"" onclick=""fncp();"">Descargar Reporte</a></li>", NombreArchivo)
|
||
|
||
Alert(String.Format("<br />El Layout fue creado satisfactoriamente.<br /><br /><br />Descargas:<ul>{0}</ul>", Descargas), TipoMensaje.MsgInformacion)
|
||
'Alert("El Layout fue creado satisfactoriamente")
|
||
Else
|
||
ObjBancos.RollBack()
|
||
ObjBancos.Dispose()
|
||
Alert("Ocurrio un problema al registrar la creacion del Layout. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||
End If
|
||
|
||
End Sub
|
||
Protected Sub CrearDetallePagos()
|
||
'Dim Resultado = True
|
||
Dim Importe As String = DTPendienteActual(0)("Abonado").ToString ' importe
|
||
Dim Divisa As String = DTPendienteActual(0)("Abreviatura").ToString.ToUpper
|
||
'Dim Factura As String = "FAC-123456".Replace("-", " ")
|
||
Dim Referencia As String = ""
|
||
|
||
Dim Observaciones As String = DTPendienteActual(0)("Observaciones").ToString.Replace(":", "").Replace("-", " ").Replace(",", "").Replace(vbCrLf, " ").ToUpper
|
||
|
||
''PARA DETECTAR SI ES CIE
|
||
Dim CuentaDeposito As String
|
||
Dim CodigoOperacion As String = "2"
|
||
|
||
'Busca que cuenta sera la asignada para el proveedor
|
||
If DTPendienteActual(0)("CIE").ToString.Length >= 4 Then
|
||
CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros))
|
||
CodigoOperacion = "3"
|
||
Referencia = If(DTPendienteActual(0)("Referencia").ToString = "", "0", DTPendienteActual(0)("Referencia").ToString) 'String.Format("CVEIE{0}", DTPendienteActual(0)("CveIE").ToString).ToUpper 'cveIE
|
||
Else
|
||
Referencia = Observaciones.Replace(" ", "")
|
||
Referencia = If(Referencia.Length > 20, Referencia.Substring(0, 20), Referencia)
|
||
Referencia = If(Referencia.Length = 0, "PAGO", Referencia)
|
||
End If
|
||
|
||
|
||
''CLAVE DE REGISTRO PARA CONTROL PROPIO ADSISTEMAS -- orita se esta guardando en el campo #9
|
||
Dim Cve As String = String.Format("CVEIE{0}", DTPendienteActual(0)("CveIE").ToString).ToUpper 'cveIE
|
||
|
||
|
||
''''' LLENADO DE DETALLE
|
||
'Campos #1-6 del Detalle
|
||
DetalleTexto &= String.Format("DAP{0}{1}PDA", Referencia.PadRight(20), DTPendienteActual(0)("CveCuentaDeposito").ToString.PadLeft(30, PadCeros))
|
||
|
||
'Pago a cuenta BBVA
|
||
If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Then
|
||
'Campos 7-24 del Detalle
|
||
'CVE IE EN CAMPO 9 - VIEJO
|
||
'DetalleTexto &= String.Format("{0}{1}{2}{3}N{4}", CodigoOperacion, Vacio.PadLeft(20, PadCeros), Cve.PadRight(15), Vacio.PadRight(139), Vacio.PadRight(187))
|
||
DetalleTexto &= String.Format("{0}{1}{2}{3}{4}N{5}", CodigoOperacion, Vacio.PadLeft(20, PadCeros), Vacio.PadRight(40), Cve.PadRight(37), Vacio.PadRight(77), Vacio.PadRight(187))
|
||
Else
|
||
Dim ReferenciaNumerica As String = "0" 'DTPendienteActual(0)("Referencia").ToString
|
||
Dim Motivo As String = "Pago de facturas"
|
||
|
||
'Campos 7-24 del Detalle
|
||
'CVE IE EN CAMPO 9 - VIELO
|
||
'DetalleTexto &= String.Format("6{0}{1}{2}{3}{4}N{5}", Vacio.PadRight(20, PadCeros), Cve.PadRight(15), ReferenciaNumerica.PadRight(25), Motivo.ToUpper.PadRight(37), Vacio.PadRight(77), Vacio.PadRight(187))
|
||
DetalleTexto &= String.Format("6{0}{1}{2}{3}{4}N{5}", Vacio.PadRight(20, PadCeros), Vacio.PadRight(15), ReferenciaNumerica.PadRight(25), Cve.PadRight(37), Vacio.PadRight(77), Vacio.PadRight(187))
|
||
End If
|
||
|
||
'OBTENEMOS EL CORREO DEL PROVEEDOR
|
||
Dim Correo As String = CorreoNotificacionesEmpresa.ToUpper.PadRight(50)
|
||
'Correo = If(Correo.Length > 0, Correo.ToUpper.PadRight(50), Vacio.PadRight(50))
|
||
|
||
'Campos 24-50 del Detalle 0 1 2 3 4 5 6 7 8 9
|
||
DetalleTexto &= String.Format("{0}{1}FA{2}{3}01{4}N{5}{6}{7}{7}{7}{6}N {7}700{8}{9}{7}", Divisa, Vacio.PadLeft(20), Importe.FormatoNumero.Replace(",", "").Replace(".", "").PadLeft(15, PadCeros), Vacio.PadRight(15, PadCeros), Correo, Vacio.PadRight(12, PadCeros), NowADS().ToString("yyyy-MM-dd"), "0001-01-01", Observaciones.PadRight(700), Vacio.PadRight(52))
|
||
TotalAcumulado += Importe.ToDouble
|
||
|
||
''LLENA DTPAGOS PARA REPORTE
|
||
Dim Row As DataRow = DtPago.NewRow()
|
||
Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString
|
||
|
||
If DTPendienteActual(0)("CIE").ToString <> "" Then
|
||
Row("Cuenta") = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros))
|
||
ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then
|
||
Row("Cuenta") = DTPendienteActual(0)("Cuenta").ToString
|
||
ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then
|
||
Row("Cuenta") = DTPendienteActual(0)("CLABE").ToString
|
||
End If
|
||
|
||
Row("Importe") = Importe
|
||
Row("Moneda") = DTPendienteActual(0)("Abreviatura").ToString.ToUpper
|
||
Row("Observaciones") = DTPendienteActual(0)("Observaciones").ToString
|
||
DtPago.Rows.Add(Row)
|
||
|
||
End Sub
|
||
Protected Sub FormarTextoPagos(Registros As Integer, Total As String)
|
||
Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString
|
||
|
||
'''''' LLENADO HEADER
|
||
'Campos #1-4 del Header
|
||
HeaderTexto = String.Format("H{0}{1}01", convenio.PadLeft(9, PadCeros), NowADS().ToString("yyyy-MM-dd"))
|
||
'Campo #5 del Header
|
||
HeaderTexto &= String.Format("P{0}{1}", NowADS().ToString("s").Replace("-", "").Replace(":", ""), Vacio.PadRight(14))
|
||
'Campos #6-11 del Header
|
||
HeaderTexto &= String.Format("00").PadRight(1314)
|
||
|
||
|
||
''''' LLENADO DE TRAILER
|
||
TrailerTexto = String.Format("T{0}{1}{2}{3}", Registros.ToString.PadLeft(10, PadCeros), Total.PadLeft(15, PadCeros), Vacio.PadRight(225, PadCeros), Vacio.PadRight(1115))
|
||
|
||
|
||
''''' ARMADO DEL TEXTO COMPLETO
|
||
TextoCompleto = String.Format("{1}{0}{2}{0}{3}{0}", vbCrLf, HeaderTexto, DetalleTexto, TrailerTexto)
|
||
|
||
End Sub
|
||
#End Region
|
||
|
||
#Region "CARGA ALTA PROVEEDORES"
|
||
Private Sub CreaDtAlta()
|
||
|
||
DtAlta = New DataTable
|
||
DtAlta.Columns.Add("CveProveedor", GetType(String))
|
||
|
||
DtAlta.Columns.Add("Proveedor", GetType(String))
|
||
DtAlta.Columns.Add("Banco", GetType(String))
|
||
DtAlta.Columns.Add("TipoCuenta", GetType(String))
|
||
DtAlta.Columns.Add("Cuenta", GetType(String))
|
||
DtAlta.Columns.Add("Estatus", GetType(String))
|
||
|
||
DtAlta.Columns.Add("MensajeAdicional", GetType(String))
|
||
DtAlta.Columns.Add("Moneda", GetType(String))
|
||
|
||
End Sub
|
||
|
||
|
||
Protected Sub BtnCargarAlta_Click(sender As Object, e As EventArgs)
|
||
Dim ErrorArchivo As Boolean = False
|
||
|
||
If FUTxt.HasFile Then
|
||
If Not GuardaTXT() Then
|
||
Alert("Ocurrio un error al cargar el archivo", TipoMensaje.MsgError)
|
||
Exit Sub
|
||
End If
|
||
Else
|
||
Alert("No tiene ningun archivo", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
End If
|
||
|
||
|
||
'LEE TXT
|
||
Dim Texto As String
|
||
|
||
Dim sr As New System.IO.StreamReader(NombreArchivo)
|
||
Texto = sr.ReadToEnd()
|
||
sr.Close()
|
||
|
||
Dim TextoArreglo As String() = Texto.Split(CChar(vbCrLf))
|
||
|
||
If OpBancos = 1 Then
|
||
'Alert(TextoArreglo.Length.ToString)
|
||
|
||
'LEE LINEA POR LINEA
|
||
Dim RespuestaHeader As String = "", RespuestaDetalle As String = "", RespuestaTrailer As String = "", CveCuentasDeposito As String = ""
|
||
CreaDtAlta()
|
||
Dim ObjGrales As New ClsGenerales
|
||
Dim Row As DataRow = Nothing
|
||
Dim TipoCuentaDeposito As String = ""
|
||
|
||
For i As Integer = 0 To TextoArreglo.Length - 1 Step 1
|
||
'Valida que el primer renglon sea el HEADER
|
||
If i = 0 Then
|
||
If TextoArreglo(i).Substring(0, 1) <> "H" Then
|
||
ErrorArchivo = True
|
||
Exit For
|
||
Else
|
||
RespuestaHeader = TextoArreglo(i).Substring(50, 2)
|
||
End If
|
||
Else
|
||
'LEE DETALLE
|
||
If TextoArreglo(i).Length > 1 Then
|
||
If TextoArreglo(i).Substring(1, 1) = "D" Then
|
||
|
||
'If i > 1 Then
|
||
' RespuestaDetalle += vbCrLf
|
||
'End If
|
||
|
||
'RespuestaDetalle += String.Format("<td>{0}</td><td>{1}</td>", If(TextoArreglo(i).Substring(197, 1) = "M", TextoArreglo(i).Substring(198, 50).Trim, TextoArreglo(i).Substring(268, 60).Trim), (TextoArreglo(i).Substring(599, 30)))
|
||
|
||
''Guardo CveCuentaDeposito cuando la operacion salio exitosa para actualizar en la DB
|
||
If TextoArreglo(i).Substring(597, 2) = "00" Or TextoArreglo(i).Substring(597, 2) = "34" Then
|
||
CveCuentasDeposito += If(CveCuentasDeposito <> "", ",", "")
|
||
CveCuentasDeposito += TextoArreglo(i).Substring(3, 30).ToEntero.ToString
|
||
End If
|
||
|
||
|
||
''LLENA DT PARA REPORTE
|
||
Row = DtAlta.NewRow()
|
||
|
||
Row("Proveedor") = If(TextoArreglo(i).Substring(197, 1) = "M", TextoArreglo(i).Substring(198, 50).Trim, TextoArreglo(i).Substring(268, 60).Trim)
|
||
|
||
'BANCO
|
||
If ObjGrales.GetCuentasDepositos(CveCuentaDeposito:=TextoArreglo(i).Substring(3, 30).ToEntero) Then
|
||
If ObjGrales.DtResultados.Rows.Count = 1 Then
|
||
Row("Banco") = ObjGrales.DtResultados.Rows(0)("BancoNombre").ToString
|
||
Else
|
||
ErrorArchivo = True
|
||
Exit For
|
||
End If
|
||
Else
|
||
ErrorArchivo = True
|
||
Exit For
|
||
End If
|
||
|
||
'CUENTA
|
||
If TextoArreglo(i).Substring(41, 2).Trim <> "" Then
|
||
Row("Cuenta") = String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c))
|
||
ElseIf TextoArreglo(i).Substring(81, 2).Trim <> "" Then
|
||
Row("Cuenta") = String.Format("{0}", TextoArreglo(i).Substring(83, 35).TrimStart("0"c))
|
||
Row("TipoCuenta") = "CLABE"
|
||
Else
|
||
ErrorArchivo = True
|
||
Exit For
|
||
End If
|
||
|
||
'TIPO CUENTA
|
||
If Row("TipoCuenta").ToString = "" Then
|
||
If String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 8 Then
|
||
Row("TipoCuenta") = "CIE"
|
||
ElseIf String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 10 Or String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 9 Then
|
||
Row("TipoCuenta") = "Cuenta"
|
||
ElseIf String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 18 Then
|
||
Row("TipoCuenta") = "CLABE"
|
||
End If
|
||
End If
|
||
|
||
Row("Estatus") = TextoArreglo(i).Substring(599, 30)
|
||
|
||
DtAlta.Rows.Add(Row)
|
||
|
||
''LLENA PARA ALERT
|
||
'If i > 1 Then
|
||
' RespuestaDetalle += vbCrLf
|
||
'End If
|
||
|
||
'RespuestaDetalle += String.Format("<td>{0}</td><td>{1}</td>", If(TextoArreglo(i).Substring(197, 1) = "M", TextoArreglo(i).Substring(198, 50).Trim, TextoArreglo(i).Substring(268, 60).Trim), (TextoArreglo(i).Substring(599, 30)))
|
||
|
||
|
||
'LEE TRAILER
|
||
ElseIf TextoArreglo(i).Substring(1, 1) = "T" Then
|
||
RespuestaTrailer = TextoArreglo(i).Substring(32, 10)
|
||
RespuestaTrailer += vbCrLf
|
||
RespuestaTrailer += TextoArreglo(i).Substring(42, 10)
|
||
RespuestaTrailer += vbCrLf
|
||
RespuestaTrailer += TextoArreglo(i).Substring(52, 10)
|
||
Exit For
|
||
Else
|
||
ErrorArchivo = True
|
||
Exit For
|
||
End If
|
||
End If
|
||
End If
|
||
Next
|
||
ObjGrales.Dispose()
|
||
|
||
|
||
Dim Respuesta As New StringBuilder
|
||
'LEE ARCHIVO
|
||
If Not ErrorArchivo Then
|
||
'TRADUCE CODIGO RESPUESTA HEADER
|
||
If RespuestaHeader = "01" Then
|
||
RespuestaHeader = "ACEPTADO TOTAL"
|
||
ElseIf RespuestaHeader = "02" Then
|
||
RespuestaHeader = "ACEPTADO PARCIAL"
|
||
ElseIf RespuestaHeader = "03" Then
|
||
RespuestaHeader = "RECHAZADO"
|
||
End If
|
||
|
||
'DIVIDE DETALLE
|
||
Dim Detalle As String() = RespuestaDetalle.Split(CChar(vbCrLf))
|
||
|
||
'DIVIDE TRAILER
|
||
Dim Trailer As String() = RespuestaTrailer.Split(CChar(vbCrLf))
|
||
|
||
'ARMADO DE RESPUESTA
|
||
Respuesta.AppendFormat("<br/>Resumen de respuesta: {0} <br/>", RespuestaHeader)
|
||
Respuesta.AppendFormat("Numero de movimientos: {0} <br/><br/><br/>", DtAlta.Rows.Count)
|
||
Respuesta.Append("------------------------------ Detalle de los movimientos ------------------------------ <br/> ")
|
||
|
||
Respuesta.Append("<table width='810px'><thead><tr><td width='30px' align='center'>#</td><td width='200px'>Proveedor</td><td width='200px'>Banco</td><td width='80px'>Tipo Cuenta</td><td width='100px'>Cuenta</td><td width='200px'>Estatus</td></tr></thead><tbody>")
|
||
'For i = 0 To Detalle.Length - 1
|
||
' Respuesta.AppendFormat("<tr><td align='center'>{0}</td>{1}</tr>", i + 1, Detalle(i).Trim)
|
||
'Next
|
||
Dim i As Integer = 1
|
||
Dim Style As String = ""
|
||
Dim TotalExitos As Integer = 0, TotalFracasos As Integer = 0
|
||
For Each dr As DataRow In DtAlta.Rows
|
||
|
||
If dr("estatus").ToString.Trim.Contiene("OPERACION EXITOSA", "ALTA TERCERO EXITOSO") Then
|
||
Style = ""
|
||
TotalExitos += 1
|
||
Else
|
||
Style = "style=""background-color:#FF5F5F;"" "
|
||
TotalFracasos += 1
|
||
End If
|
||
|
||
Respuesta.AppendFormat("<tr {6}><td align='center'>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>", i, dr("Proveedor"), dr("Banco"), dr("TipoCuenta"), dr("Cuenta"), dr("estatus"), Style)
|
||
i += 1
|
||
Next
|
||
|
||
Respuesta.Append("</tbody></table> ------------------------------------------------------------------------------------- <br/>")
|
||
|
||
Respuesta.AppendFormat("Total de movimientos exitosos: {0} <br/>", TotalExitos)
|
||
Respuesta.AppendFormat("Total de movimientos NO exitosos: {0} <br/>", TotalFracasos)
|
||
|
||
'LEE DESDE EL LAYOUT
|
||
'Respuesta.AppendFormat("Total de altas rechazadas: {0} <br/>", Trailer(0).ToString.ToEntero)
|
||
'Respuesta.AppendFormat("Total de bajas rechazadas: {0} <br/>", Trailer(1).ToString.ToEntero)
|
||
'Respuesta.AppendFormat("Total de cambios rechazados: {0} <br/>", Trailer(2).ToString.ToEntero)
|
||
|
||
End If
|
||
|
||
If Not ErrorArchivo Then
|
||
|
||
If CveCuentasDeposito <> "" Then
|
||
Dim ObjIE As New ClsBancos
|
||
Dim ErrorDB As Boolean = False
|
||
ObjIE.IniciaTransacSQL()
|
||
Dim ArrayCuentasDeposito As String() = CveCuentasDeposito.Split(","c)
|
||
|
||
For index As Integer = 0 To ArrayCuentasDeposito.Length - 1
|
||
If Not ObjIE.UpdateCuentaDepositoPagoElectronico(ArrayCuentasDeposito(index).ToEntero) Then
|
||
ErrorDB = True
|
||
End If
|
||
Next
|
||
|
||
If Not ErrorDB Then
|
||
ObjIE.Commit()
|
||
Respuesta.Append("<br/><br/>NOTA: El archivo se analizo correctamente y se efectuaron todos los cambios en el sistema.")
|
||
'Respuesta.AppendFormat("<br/><a class=""Texto"" href=""/Temp/Reporte.pdf"" target='_blank'>Descargar reporte</a>", NombreArchivo)
|
||
Respuesta.AppendFormat("<li><a class=""Texto"" onclick=""fncg();"">Descargar Reporte</a></li>", NombreArchivo)
|
||
|
||
Alert(Respuesta.ToString, TipoMensaje.MsgInformacion)
|
||
Else
|
||
ObjIE.RollBack()
|
||
Respuesta.Append("<br/><br/>NOTA: El archivo se analizo correctamente pero ocurrio un problema al efectuar los cambios en el sistema. Por favor vuelta a intentar.")
|
||
Alert(Respuesta.ToString, TipoMensaje.MsgError)
|
||
End If
|
||
|
||
ObjIE.Dispose()
|
||
Else
|
||
Respuesta.AppendFormat("<br/><br/>NOTA: El archivo se analizo correctamente pero ningun movimiento fue exitoso.")
|
||
'Respuesta.AppendFormat("<br/><a class=""Texto"" href=""/Temp/Reporte.pdf"" target='_blank'>Descargar reporte</a>", NombreArchivo)
|
||
Respuesta.AppendFormat("<li><a class=""Texto"" onclick=""fncg();"">Descargar Reporte</a></li>", NombreArchivo)
|
||
|
||
Alert(Respuesta.ToString, TipoMensaje.MsgAdvertencia)
|
||
End If
|
||
|
||
Else
|
||
Alert("Ocurrio un problema al leer el archivo. Por favor revise que el archivo sea el correcto e intente de nuevo.", TipoMensaje.MsgError)
|
||
End If
|
||
End If
|
||
|
||
|
||
If OpBancos = 3 Then
|
||
|
||
TextoArreglo = File.ReadAllLines(path:=NombreArchivo) ' Texto.Split(CChar(vbCrLf))
|
||
|
||
Dim SBCuentasAltas As New StringBuilder
|
||
Dim SBErrores As New StringBuilder
|
||
Dim ErrorArchivoScotia As Boolean = False
|
||
|
||
Dim H As String = TextoArreglo(0)
|
||
|
||
If Not TextoArreglo.Length >= 3 Then
|
||
Alert("El archivo no tiene el formato correcto, debe tener al menos 3 lineas (Header, Detalle y Trailer)")
|
||
Exit Sub
|
||
End If
|
||
|
||
If H.Length <> 140 Then
|
||
Alert("LA logitud del de la cabecera es incorrecta")
|
||
Exit Sub
|
||
End If
|
||
|
||
Dim TipoArchivo As String = H.Substring(0, 2).ToUpper
|
||
|
||
If TipoArchivo <> "SP" Then
|
||
Alert($"El archivo no es un archivo de respuesta, inicia con codigo {TipoArchivo}")
|
||
End If
|
||
|
||
Dim HCodigo As String = H.Substring(40, 3)
|
||
If HCodigo <> "000" And HCodigo <> " " Then
|
||
SBErrores.Append($"EL codigo de la cabecera es incorrecto {HCodigo} - {AltaCuentaScotiaCodigoRespuestaAnexoC(HCodigo)}.</br>")
|
||
ErrorArchivoScotia = True
|
||
End If
|
||
|
||
Dim ObjBancos As New ClsBancos
|
||
ObjBancos.IniciaTransacSQL()
|
||
|
||
For i As Integer = 1 To TextoArreglo.Length - 2 Step 1
|
||
|
||
Dim Linea As String = TextoArreglo(i)
|
||
|
||
If Linea.Length = 140 Then
|
||
|
||
Dim CodigoRespuesta As String = Linea.Substring(109, 3)
|
||
Dim DTipoArchivo As String = Linea.Substring(0, 2)
|
||
Dim Cuenta As String = Linea.Substring(12, 20)
|
||
|
||
Dim FechaEliminacion As Date = Date.ParseExact(Linea.Substring(32, 8), "yyyyMMdd", Globalization.CultureInfo.InvariantCulture)
|
||
|
||
If DTipoArchivo <> "SP" Then
|
||
SBErrores.Append($"Error Linea {i} el tipo de archivo no es un archivo de respuesta (SP), inicia con codigo {DTipoArchivo}.</br>")
|
||
ErrorArchivoScotia = True
|
||
End If
|
||
|
||
If CodigoRespuesta = "000" Or CodigoRespuesta = " " Then
|
||
|
||
Dim CveCuentaDeposito As Integer = Linea.Substring(40, 50).Trim.ToEntero
|
||
|
||
If CveCuentaDeposito > 0 Then
|
||
|
||
If ObjBancos.UpdateCuentaDepositoPagoElectronico(CveCuentaDeposito, Opcion:=3, FechaEliminacion:=FechaEliminacion) Then
|
||
SBCuentasAltas.Append($"Cuenta: {Cuenta} registrada correctamente.</br>")
|
||
Else
|
||
ErrorArchivoScotia = True
|
||
End If
|
||
Else
|
||
SBErrores.Append($"Error Linea {i} Cve: {CveCuentaDeposito} cuenta: {Cuenta} no encontrada.</br>")
|
||
ErrorArchivoScotia = True
|
||
End If
|
||
Else
|
||
SBErrores.Append($"Error Linea {i} cuenta no dada de alta codigo {CodigoRespuesta} - {AltaCuentaScotiaCodigoRespuestaAnexoC(CodigoRespuesta)}.</br>")
|
||
ErrorArchivoScotia = True
|
||
End If
|
||
Else
|
||
SBErrores.Append($"Error en logitud de la linea {i} es incorrecta, </br>")
|
||
ErrorArchivoScotia = True
|
||
End If
|
||
|
||
Next
|
||
|
||
If ErrorArchivoScotia Then
|
||
ObjBancos.RollBack()
|
||
Alert($"El archivo presento errores en su procesamiento({SBErrores.Length}). Correctos {SBCuentasAltas.Length} cuentas.</br>Altas:</br>{SBCuentasAltas.ToString}.<br> <br>Errores:<br> {SBErrores.ToString}", TipoMensaje.MsgAdvertencia)
|
||
Else
|
||
ObjBancos.Commit()
|
||
Alert($"El archivo se analizo correctamente y se efectuaron todos los cambios en el sistema. cuentas procesadas: </BR>{SBCuentasAltas.ToString}", TipoMensaje.MsgInformacion)
|
||
End If
|
||
|
||
|
||
|
||
|
||
ObjBancos.Dispose()
|
||
|
||
End If
|
||
|
||
|
||
|
||
'ELIMINA TXT
|
||
My.Computer.FileSystem.DeleteFile(NombreArchivo)
|
||
|
||
RecargaDatos()
|
||
|
||
End Sub
|
||
|
||
|
||
Public Function AltaCuentaScotiaCodigoRespuestaAnexoC(ByVal codigo As String) As String
|
||
Select Case codigo
|
||
Case "002" : Return "NO EXISTE NOMBRE DE APLICACION EN EL NOMBRE DE ARCHIVO"
|
||
Case "003" : Return "EL NUM DE CONTRATO EN EL NOMBRE DE ARCHIVO NO ES NUMERICO"
|
||
Case "004" : Return "EL NUMERO DE CONTRATO EN EL NOMBRE DE ARCHIVO ES CERO"
|
||
Case "005" : Return "EL NUM DE SECUENCIA EN NOMBRE DE ARCHIVO NO ES NUMERICO"
|
||
Case "006" : Return "EL NUMERO DE SECUENCIA EN EL NOMBRE DE ARCHIVO ES CERO"
|
||
Case "007" : Return "LA CLAVE DE ARCHIVO ES INVALIDA"
|
||
Case "008" : Return "LA CLAVE DE REGISTRO ES INVALIDA"
|
||
Case "009" : Return "NO EXISTE NOMBRE DE APLICACION EN EL REGISTRO HA"
|
||
Case "010" : Return "EL NOMBRE DE APLICACION NO CORRESPONDE AL ARCHIVO"
|
||
Case "011" : Return "EL NUMERO DE CONTRATO EN EL REGISTRO HA NO ES NUMERICO"
|
||
Case "012" : Return "EL NUMERO DE CONTRATO EN EL REGISTRO HA ES CERO"
|
||
Case "013" : Return "EL NUMERO DE CONTRATO NO CORRESPONDE AL ARCHIVO"
|
||
Case "014" : Return "EL CONTRATO NO EXISTE"
|
||
Case "015" : Return "EL NUMERO DE SECUENCIA EN EL REGISTRO HA NO ES NUMERICO"
|
||
Case "016" : Return "EL NUMERO DE SECUENCIA EN EL REGISTRO HA ES CERO"
|
||
Case "017" : Return "EL NUMERO DE SECUENCIA NO CORRESPONDE AL ARCHIVO"
|
||
Case "018" : Return "EL MOVIMIENTO CUENTA ES UN DATO OBLIGATORIO"
|
||
Case "019" : Return "EL MOVIMIENTO CUENTA DEBE SER A"
|
||
Case "020" : Return "EL NUMERO DE BANCO NO ES NUMERICO"
|
||
Case "021" : Return "EL NUMERO DE BANCO NO EXISTE EN EL CATALOGO"
|
||
Case "022" : Return "EL TIPO DE CUENTA ES INVALIDO PARA ESE BANCO"
|
||
Case "023" : Return "EL TIPO DE CUENTA NO ES NUMERICO"
|
||
Case "024" : Return "LA MONEDA DE LA CUENTA NO ES NUMERICO"
|
||
Case "025" : Return "LA MONEDA DE LA CUENTA NO TIENE UN VALOR PERMITIDO"
|
||
Case "026" : Return "LA FECHA DE DE VIGENCIA NO ES NUMERICA"
|
||
Case "027" : Return "LA FECHA DE VIGENCIA ESTA FUERA DE RANGO"
|
||
Case "028" : Return "EL IMPORTE LIMITE ES NO NUMERICO"
|
||
Case "029" : Return "EL NUMERO DE ALTAS SOLICITADAS NO ES NUMERICO"
|
||
Case "030" : Return "EL NUMERO DE CAMBIOS SOLICITADOS NO ES NUMERICO"
|
||
Case "031" : Return "EL NUMERO DE BAJAS SOLICITADAS NO ES NUMERICO"
|
||
Case "032" : Return "EL NUMERO DE CONSULTAS SOLICITADAS NO ES NUMERICO"
|
||
Case "033" : Return "EL NUMERO DE ALTAS SOLICITADAS NO COINCIDE"
|
||
Case "034" : Return "EL NUMERO DE CAMBIOS SOLICITADOS NO COINCIDE"
|
||
Case "035" : Return "EL NUMERO DE BAJAS SOLICITADAS NO COINCIDE"
|
||
Case "036" : Return "EL NUMERO DE CONSULTAS SOLICITADAS NO COINCIDE"
|
||
Case "037" : Return "ARCHIVO RECHAZADO POR MOVIMIENTOS RECHAZADOS"
|
||
Case "038" : Return "ARCHIVO RECHAZADO POR NO EXISTIR MOVIMIENTOS CORRECTOS"
|
||
Case "039" : Return "EL NUMERO DE CUENTA NO ES NUMERICO"
|
||
Case "040" : Return "EL NUMERO DE CUENTA NO CERO"
|
||
Case "041" : Return "EL NUMERO DE CUENTA NO EXISTE"
|
||
Case "042" : Return "EL NUMERO DE CUENTA NO PERTENECE A ESE BANCO"
|
||
Case "043" : Return "LA PLAZA ABM NO EXISTE"
|
||
Case "044" : Return "EL DIGITO VERIFICADOR DE LA CLABE NO CORRESPONDE"
|
||
Case "045" : Return "LA CUENTA NO ESTA ACTIVA"
|
||
Case "046" : Return "LA CUENTA YA EXISTE"
|
||
Case "047" : Return "LA CUENTA NO EXISTE"
|
||
Case "048" : Return "EL TIPO DE CUENTA NO ES NUMERICO"
|
||
Case "049" : Return "EL TIPO DE CUENTA NO TIENE UN VALOR PERMITIDO"
|
||
Case "050" : Return "EL IMPORTE LIMITE ES CERO"
|
||
Case "051" : Return "NO EXISTE LA CLAVE DE MANTEMIMIENTO/CONSULTA"
|
||
Case "052" : Return "LA CLAVE DE MANT/CONS NO TIENE UN VALOR PERMITIDO"
|
||
Case "053" : Return "TIPO DE REGISTRO NO VALIDO PARA ARCHIVO DE CONSULTA"
|
||
Case Else : Return "CÓDIGO DESCONOCIDO"
|
||
End Select
|
||
End Function
|
||
|
||
|
||
Public Function PagosScotiaCodigoRespuestaAnexoC(ByVal codigo As String) As String
|
||
codigo = codigo.PadLeft(3, "0"c)
|
||
Select Case codigo
|
||
Case "000" : Return "NO ERROR (OK)"
|
||
Case "001" : Return "FIN DE ARCHIVO"
|
||
Case "002" : Return "ARCHIVO NO ENCONTRADO"
|
||
Case "003" : Return "LECTURA: REGISTRO NO UNICO"
|
||
Case "006" : Return "ERROR FUERA DE CATEGORIAS DE CICS"
|
||
Case "007" : Return "COMANDOS EN ORDEN ILOGICO"
|
||
Case "008" : Return "NO SE TIENE AUTORIZACION"
|
||
Case "009" : Return "MISMO BANCO PROGRAMADO - VALIDACION DE ESTRUCTURA Y ESTATUS (INACTIVO, CANCELADO)"
|
||
Case "010" : Return "ARCHIVO NO ABIERTO"
|
||
Case "011" : Return "TEF - VALIDACION DE ESTRUCTURA (ERRONEA)"
|
||
Case "012" : Return "SPEI - VALIDACION DE ESTRUCTURA (ERRONEA)"
|
||
Case "013" : Return "ERROR DE I/O NO CUBIERTO POR CICS"
|
||
Case "014" : Return "LONGITUD DE REGISTRO ERRONEA"
|
||
Case "015" : Return "ARCHIVO NO DISPONIBLE"
|
||
Case "016" : Return "ESCRITURA: REGISTRO DUPLICADO"
|
||
Case "017" : Return "NO HAY ESPACIO EN EL DISPOSITIVO PARA ADICIONAR REGISTRO"
|
||
Case "019" : Return "OTRO ERROR DE I/O"
|
||
Case "020" : Return "DATO NO NUMERICO"
|
||
Case "021" : Return "DATO REQUERIDO (SI LA OPERACIÓN ES SPID CONTACTE A SU EJECUTIVO DE RELACIÓN PARA REVISAR LA DIRECCION REGISTRADA)"
|
||
Case "022" : Return "VALOR FUERA DE RANGO"
|
||
Case "023" : Return "DATO NO COINCIDE CON NOMBRE DE ARCHIVO"
|
||
Case "024" : Return "ERROR EN SECUENCIA DE REGISTROS"
|
||
Case "025" : Return "NO EXISTE CONTRATO"
|
||
Case "026" : Return "NO EXISTE PLAZA"
|
||
Case "027" : Return "NO EXISTE SUCURSAL"
|
||
Case "028" : Return "NO EXISTE CUENTA"
|
||
Case "029" : Return "CUENTA NO ACTIVA"
|
||
Case "030" : Return "CUENTA NO RELACIONADA AL CONTRATO"
|
||
Case "031" : Return "NO EXISTE BANCO"
|
||
Case "032" : Return "MONEDA INVALIDA PARA ESE PRODUCTO"
|
||
Case "033" : Return "ERROR EN CIFRA DE CONTROL"
|
||
Case "034" : Return "ARCHIVO RECHAZADO POR REGISTROS RECHAZADOS"
|
||
Case "035" : Return "PAGO DUPLICADO"
|
||
Case "036" : Return "NO EXISTE PAGO"
|
||
Case "037" : Return "ARCHIVO NO PENDIENTE DE VALIDACION"
|
||
Case "038" : Return "CONTRATO NO ACTIVO"
|
||
Case "039" : Return "ARCHIVO RECHAZADO POR QUE NO TIENE REGISTROS CORRECTOS"
|
||
Case "040" : Return "MONEDA DE REGISTRO DETALLE DIFERENTE A MONEDA DE CUENTA DE CARGO"
|
||
Case "041" : Return "FECHA INHABIL"
|
||
Case "042" : Return "FECHA DE APLICACION INVALIDA PARA ESE TIPO DE PAGO"
|
||
Case "043" : Return "NUMERO DE BANCO INVALIDO PARA ESE TIPO DE PAGO"
|
||
Case "044" : Return "HORARIO SUCURSAL NO DISPONIBLE"
|
||
Case "045" : Return "IMPORTE SUPERIOR AL PERMITIDO SPEI"
|
||
Case "046" : Return "LA CUENTA DE ABONO NO ESTA REGISTRADA EN LA BASE DE DATOS DEL BANCO PARA ESE CONTRATO"
|
||
Case "047" : Return "IMPORTE SUPERIOR AL AUTORIZADO POR EL CLIENTE PARA ESA CUENTA DE ABONO"
|
||
Case "048" : Return "FECHA DE CONSTITUCION ERRONEA"
|
||
Case "049" : Return "TIPO DE CUENTA INVALIDA SPID"
|
||
Case "050" : Return "SPID ES SOLO PARA PERSONAS MORALES"
|
||
Case "051" : Return "ERROR AL HACER REGISTRO EN TOTALES"
|
||
Case "052" : Return "ERROR AL HACER CARGO A CHEQUES"
|
||
Case "053" : Return "EL MOVIMIENTO NO ESTA PENDIENTE DE PAGO"
|
||
Case "054" : Return "ERROR AL REVERSAR CARGO A CHEQUES"
|
||
Case "055" : Return "SU TRANSACCIÓN NO PUEDE SER PROCESADA EN ESTE MOMENTO CONTACTE A SU EJECUTIVO DE RELACIÓN (CLAVE 99)."
|
||
Case "056" : Return "EL CERTIFICADO DE SU FIEL NO ES VIGENTE. FAVOR DE SOLICITAR A SU EJECUTIVO LA ACTUALIZACIÓN PARA PODER OPERAR SPID."
|
||
Case "057" : Return "SU TRANSACCIÓN NO PUEDE SER PROCESADA EN ESTE MOMENTO CONTACTE A SU EJECUTIVO DE RELACIÓN (CLAVE 88)."
|
||
Case "058" : Return "EL MONTO DE LA OPERACIÓN SOBREPASA EL DISPONIBLE PARA ESTE BENEFICIARIO."
|
||
Case "059" : Return "TRANSACCION SPID DEVUELTA"
|
||
Case "060" : Return "PAGO NO DISPONIBLE EN HORARIO EXTENDIDO"
|
||
Case "061" : Return "INSUFICIENCIA DE FONDOS"
|
||
Case "062" : Return "CAMBIO A ABONO EN CUENTA DE DEVOLUCIONES"
|
||
Case "063" : Return "CAMBIO A PAGO EN VENTANILLA EFECTIVO"
|
||
Case "064" : Return "CAMBIO A CHEQUE DE CAJA AL BENEFICIARIO EN VENTANILLA"
|
||
Case "065" : Return "CAMBIO A CHEQUE DE CAJA CENTRAL AL BENEFICIARIO"
|
||
Case "066" : Return "CAMBIO A CHEQUE DE CAJA CENTRAL A LA EMPRESA POR TOTAL"
|
||
Case "067" : Return "CAMBIO A CHEQUE DE CAJA CENTRAL A LA EMPRESA POR DETALLE"
|
||
Case "068" : Return "CAMBIO ORIGINADO POR UN PAGO EN VENTANILLA"
|
||
Case "069" : Return "CAMBIO ORIGINADO POR UN ABONO A CHEQUES"
|
||
Case "070" : Return "CAMBIO ORIGINADO POR UN ABONO A AHORROS"
|
||
Case "071" : Return "CAMBIO ORIGINADO POR UN DEPOSITO INTERBANCARIO"
|
||
Case "072" : Return "CAMBIO ORIGINADO POR UN MOVIMIENTO DE TRANSFERENCIA DE FONDOS"
|
||
Case "073" : Return "BAJA RECHAZADA POR PAGO EN LINEA"
|
||
Case "074" : Return "DEVOLUCION GLOBAL POR RECHAZOS"
|
||
Case "075" : Return "DEVOLUCION GLOBAL POR VENCIMIENTO DE VIGENCIAS"
|
||
Case "076" : Return "DEVOLUCION GLOBAL POR BAJAS SOLICITADAS"
|
||
Case "077" : Return "HORARIO DE OPERACIÓN NO DISPONIBLE SPID"
|
||
Case "078" : Return "EL ABONO EXCEDE EL MÁXIMO PERMITIDO A LA CUENTA"
|
||
Case Else : Return "CÓDIGO DESCONOCIDO"
|
||
End Select
|
||
End Function
|
||
|
||
|
||
|
||
|
||
#End Region
|
||
|
||
#Region "CARGA PAGO PROVEEDORES"
|
||
Private Sub CreaDtPago()
|
||
|
||
DtPago = New DataTable
|
||
DtPago.Columns.Add("NumeroConvenio", GetType(String))
|
||
DtPago.Columns.Add("ClaveProveedor", GetType(String))
|
||
DtPago.Columns.Add("ReferenciaPago", GetType(String))
|
||
DtPago.Columns.Add("TipoPago", GetType(String))
|
||
|
||
DtPago.Columns.Add("Proveedor", GetType(String))
|
||
DtPago.Columns.Add("Cuenta", GetType(String))
|
||
DtPago.Columns.Add("Importe", GetType(Decimal))
|
||
DtPago.Columns.Add("Moneda", GetType(String))
|
||
DtPago.Columns.Add("Observaciones", GetType(String))
|
||
|
||
DtPago.Columns.Add("FechaOperacion", GetType(String))
|
||
|
||
End Sub
|
||
|
||
|
||
Protected Sub BtnCargarPago_Click(sender As Object, e As System.EventArgs)
|
||
Dim ErrorArchivo As Boolean = False
|
||
Dim TextoErrorArchivo As String = "Ocurrió un problema al leer el archivo, por favor revise que el archivo sea el correcto e intente de nuevo."
|
||
|
||
If FUTxt.HasFile Then
|
||
If Not GuardaTXT() Then
|
||
Alert("Ocurrio un error al cargar el archivo", TipoMensaje.MsgError)
|
||
Exit Sub
|
||
End If
|
||
Else
|
||
Alert("No tiene ningun archivo", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
End If
|
||
|
||
|
||
'LEE TXT
|
||
Dim Texto As String
|
||
Dim sr As New System.IO.StreamReader(NombreArchivo)
|
||
Texto = sr.ReadToEnd()
|
||
sr.Close()
|
||
Dim TextoArreglo As String() = Texto.Split(CChar(vbCrLf))
|
||
|
||
If OpBancos = 1 Then
|
||
'INICIALIZA VARIABLES
|
||
Dim ObjBancos As New ClsBancos
|
||
Dim RespuestaHeader As String = "", RespuestaDetalle As String = "", RespuestaTrailer As String = "", Proveedor As String = "", CuentaAbono As String = "", Estatus As String = "", CveIEs As String = "", EstatusIEs As String = "", FechaMovto As String = "", Correos As String = ""
|
||
Dim Row As DataRow = Nothing
|
||
Dim Convenio As String = ""
|
||
CreaDtPago()
|
||
|
||
'LEE LINEA POR LINEA
|
||
For i As Integer = 0 To TextoArreglo.Length - 1
|
||
'Valida que el primer renglon sea el HEADER
|
||
If i = 0 Then
|
||
If TextoArreglo(i).Substring(0, 1) <> "H" Then
|
||
ErrorArchivo = True
|
||
Exit For
|
||
Else
|
||
' Codigo de respuesta | Cuenta cargo
|
||
RespuestaHeader = String.Format("{0}|{1}", TextoArreglo(i).Substring(52, 2), TextoArreglo(i).Substring(77, 35))
|
||
Convenio = TextoArreglo(i).Substring(2, 9)
|
||
End If
|
||
Else
|
||
If TextoArreglo(i).Length > 1 Then
|
||
|
||
'LEE DETALLE
|
||
If TextoArreglo(i).Substring(1, 1) = "D" Then
|
||
If i > 1 Then
|
||
RespuestaDetalle += vbCrLf
|
||
End If
|
||
|
||
'TRUENA PORQUE AHORA ES LA CVECUENTADEPOSITO
|
||
'Proveedor = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveProveedor = {0}", TextoArreglo(i).Substring(24, 30).ToEntero)).Rows(0)("RazonSocial").ToString
|
||
|
||
Correos += If(Correos <> "", "|", "")
|
||
|
||
If ObjBancos.GetProveedorCuentaDeposito(TextoArreglo(i).Substring(24, 30).ToDouble.ToEntero) Then
|
||
If ObjBancos.DtResultados.Rows.Count > 0 Then
|
||
|
||
Proveedor = ObjBancos.DtResultados.Rows(0)("RazonSocial").ToString
|
||
|
||
'Correos += If(TextoArreglo(i).Substring(477, 50).Trim = "", "-1", TextoArreglo(i).Substring(477, 50).Trim)
|
||
Correos += String.Format("{0};{1}", ObjBancos.DtResultados.Rows(0)("NotificarA").ToString, ObjBancos.DtResultados.Rows(0)("ContactoMailCobranza").ToString)
|
||
|
||
|
||
''SELECCIONA CUENTA ABONO PARA CORREO
|
||
Select Case TextoArreglo(i).Substring(57, 1).ToEntero
|
||
Case 1
|
||
CuentaAbono = "NO APLICA"
|
||
Case 2
|
||
CuentaAbono = If(ObjBancos.DtResultados.Rows(0)("Cuenta").ToString <> "", ObjBancos.DtResultados.Rows(0)("Cuenta").ToString, ObjBancos.DtResultados.Rows(0)("CLABE").ToString)
|
||
Case 3
|
||
CuentaAbono = ObjBancos.DtResultados.Rows(0)("CIE").ToString
|
||
Case 4
|
||
CuentaAbono = ObjBancos.DtResultados.Rows(0)("SWIFT").ToString
|
||
Case 5, 6, 7
|
||
CuentaAbono = ObjBancos.DtResultados.Rows(0)("CLABE").ToString
|
||
End Select
|
||
|
||
Else
|
||
Proveedor = "PROVEEDOR NO ENCONTRADO"
|
||
End If
|
||
Else
|
||
Proveedor = "PROVEEDOR NO ENCONTRADO"
|
||
End If
|
||
|
||
Estatus = If(TextoArreglo(i).Substring(1325, 2) = "00", "OPERACION EXITOSA: ", "OPERACION FALLIDA: ")
|
||
' Proveedor | Importe | Descripcion estatus
|
||
RespuestaDetalle += String.Format("<td>{0}</td><td align='right'>{1}.{2} </td><td></td><td align='center'>{5}</td><td>{3}{4}</td>", Proveedor, TextoArreglo(i).Substring(445, 13).ToDouble.ToEntero, TextoArreglo(i).Substring(458, 2).ToEntero, Estatus, TextoArreglo(i).Substring(1327, 30), TextoArreglo(i).Substring(420, 3))
|
||
|
||
''Guardo CveIE cuando la operacion salio exitosa para actualizar en la DB el IE
|
||
'If TextoArreglo(i).Substring(1325, 2) = "00" Then
|
||
CveIEs += If(CveIEs <> "", ",", "")
|
||
'VIEJO IE EN CAMPO 9
|
||
'CveIEs += TextoArreglo(i).Substring(83, 10).Trim
|
||
CveIEs += TextoArreglo(i).Substring(123, 32).Trim
|
||
|
||
'SI VIENE SIN RESPUESTA ES ERROR DE ARCHIVO
|
||
If TextoArreglo(i).Substring(1325, 2).Trim = "" Then
|
||
ErrorArchivo = True
|
||
TextoErrorArchivo = "El archivo que se intento procesar no es de respuesta. Por favor verifique cargar el archivo correcto."
|
||
Exit For
|
||
End If
|
||
|
||
EstatusIEs += If(EstatusIEs <> "", ",", "")
|
||
EstatusIEs += If(TextoArreglo(i).Substring(1325, 2) = "00", "2", "3")
|
||
|
||
FechaMovto += If(FechaMovto <> "", ",", "")
|
||
FechaMovto += TextoArreglo(i).Substring(540, 10)
|
||
|
||
'If Proveedor = "PROVEEDOR NO ENCONTRADO" Or CuentaAbono = "" Then
|
||
' Continue For
|
||
'End If
|
||
|
||
|
||
''LLENA DTPAGOS PARA CORREO
|
||
Row = DtPago.NewRow()
|
||
Row("NumeroConvenio") = Convenio
|
||
Row("ClaveProveedor") = TextoArreglo(i).Substring(24, 30)
|
||
Row("Proveedor") = Proveedor
|
||
Row("ReferenciaPago") = TextoArreglo(i).Substring(4, 20)
|
||
Row("Cuenta") = CuentaAbono
|
||
|
||
Select Case TextoArreglo(i).Substring(57, 1).ToEntero
|
||
Case 1
|
||
Row("TipoPago") = "1 .- ABONO EN VENTANILLA"
|
||
Case 2
|
||
Row("TipoPago") = "2 .- ABONO A CUENTAS BANCOMER"
|
||
Case 3
|
||
Row("TipoPago") = "3 .- ABONO A CONVENIO CIE"
|
||
Case 4
|
||
Row("TipoPago") = "4 .- ABONO A CUENTA INTERNACIONAL VIA SWIFT"
|
||
Case 5
|
||
Row("TipoPago") = "5 .- ABONO A CUENTA INTERBANCARIA DIA SIGUIENTE"
|
||
Case 6
|
||
Row("TipoPago") = "6 .- ABONO A CUENTA INTERBANCARIA MISMO DIA"
|
||
Case 7
|
||
Row("TipoPago") = "7 .- ABONO A CUENTA INTERNACIONAL VIA ACH"
|
||
End Select
|
||
|
||
Try
|
||
Row("Cuenta") = If(Row("Cuenta").ToString = "", String.Format("******{0}", CuentaAbono.Substring(CuentaAbono.Length - 4, 4)), Row("Cuenta").ToString)
|
||
Catch ex As Exception
|
||
Row("Cuenta") = "******"
|
||
End Try
|
||
|
||
Row("Importe") = String.Format("{0}.{1}", TextoArreglo(i).Substring(445, 13), TextoArreglo(i).Substring(458, 2)).ToDecimal.ToString
|
||
Row("FechaOperacion") = TextoArreglo(i).Substring(540, 10)
|
||
Row("Observaciones") = TextoArreglo(i).Substring(605, 700).Trim
|
||
DtPago.Rows.Add(Row)
|
||
|
||
'End If
|
||
|
||
'LEE TRAILER
|
||
ElseIf TextoArreglo(i).Substring(1, 1) = "T" Then
|
||
|
||
'PARA BCOM, YA QUE TRUNCA EL STRING CUANDO SOLO ES MXP
|
||
If TextoArreglo(i).Length < 1367 Then
|
||
TextoArreglo(i) = TextoArreglo(i).PadRight(1367)
|
||
End If
|
||
|
||
RespuestaTrailer += "------------------------------------------------------------ RESUMEN ------------------------------------------------------------"
|
||
RespuestaTrailer += String.Format("<table width='500px'><thead><tr><td width='300px'>Concepto</td><td width='100px'>Pesos (MXP)</td><td width='100px'>Dolares (USD)</td></tr></thead><tbody>")
|
||
RespuestaTrailer += String.Format("<tr><td>Total registros rechazados:</td><td>{0}</td><td>{1}</td></tr>", TextoArreglo(i).Substring(77, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(327, 10).ToDouble.ToEntero.ToString)
|
||
RespuestaTrailer += String.Format("<tr><td>Total Importe rechazado: $:</td></td><td>{0}.{1}</td><td>{2}.{3}</td></tr>", TextoArreglo(i).Substring(87, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(100, 2).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(337, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(350, 2).ToDouble.ToEntero.ToString)
|
||
RespuestaTrailer += String.Format("<tr><td>Total registros aceptados:</td><td>{0}</td><td>{1}</td></tr>", TextoArreglo(i).Substring(177, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(302, 10).ToDouble.ToEntero.ToString)
|
||
RespuestaTrailer += String.Format("<tr><td>Total Importe aceptado $:</td></td><td>{0}.{1}</td><td>{2}.{3}</td></tr></tbody></table>", TextoArreglo(i).Substring(187, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(200, 2).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(312, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(325, 2).ToDouble.ToEntero.ToString)
|
||
|
||
'RespuestaTrailer += String.Format("Total registros rechazados: {1}{0} Total Importe rechazado: $ {2}.{3}{0} Total registros aceptados: {4}{0} Total Importe aceptado: $ {5}.{6}{0}", "<br/>", TextoArreglo(i).Substring(77, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(87, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(100, 2).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(177, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(187, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(200, 2).ToEntero.ToString)
|
||
Else
|
||
ErrorArchivo = True
|
||
Exit For
|
||
End If
|
||
End If
|
||
End If
|
||
Next
|
||
|
||
ObjBancos.Dispose()
|
||
|
||
Dim Respuesta As New StringBuilder
|
||
If Not ErrorArchivo Then
|
||
|
||
'DIVIDE HEADER
|
||
Dim Header As String() = RespuestaHeader.Split(CChar("|"))
|
||
'TRADUCE CODIGO RESPUESTA HEADER
|
||
If Header(0) = "01" Then
|
||
RespuestaHeader = "ACEPTADO TOTAL"
|
||
ElseIf Header(0) = "02" Then
|
||
RespuestaHeader = "ACEPTADO PARCIAL"
|
||
ElseIf Header(0) = "03" Then
|
||
RespuestaHeader = "RECHAZADO"
|
||
End If
|
||
RespuestaHeader += String.Format("<br/>Cuenta Cargo: {0}", Header(1))
|
||
|
||
'DIVIDE DETALLE
|
||
Dim Detalle As String() = RespuestaDetalle.Split(CChar(vbCrLf))
|
||
|
||
'ARMADO DE RESPUESTA
|
||
Respuesta.AppendFormat("<br/>Resumen de respuesta: {0}<br/>", RespuestaHeader)
|
||
Respuesta.AppendFormat("Numero de movimientos: {0} <br/><br/>", Detalle.Length.ToString)
|
||
Respuesta.Append("----------------------------------------------------- Detalle de los movimientos -------------------------------------------------- <br/> ")
|
||
Respuesta.Append("<table width='700px'><thead><tr><td width='30px' align='center'>#</td><td width='200px'>Proveedor</td><td width='50px'>Importe($)</td><td width='10px'></td><td width='30px' align='center'>Moneda</td><td width='300px'>Estatus</td></tr></thead><tbody>")
|
||
For i As Integer = 0 To Detalle.Length - 1
|
||
Respuesta.AppendFormat("<tr><td align='center'>{0}</td>{1}</tr>", i + 1, Detalle(i).Trim)
|
||
Next
|
||
Respuesta.Append("</tbody></table> ---------------------------------------------------------------------------------------------------------------------- <br/>")
|
||
Respuesta.AppendFormat(RespuestaTrailer)
|
||
|
||
|
||
End If
|
||
|
||
If Not ErrorArchivo Then
|
||
If CveIEs <> "" Then
|
||
Dim ObjIE As New ClsBancos
|
||
Dim ErrorDB As Boolean = False
|
||
ObjIE.IniciaTransacSQL()
|
||
Dim ArrayCveIEs As String() = CveIEs.Split(","c)
|
||
Dim ArrayEstatusIEs As String() = EstatusIEs.Split(","c)
|
||
Dim ArrayFechasMovto As String() = FechaMovto.Split(","c)
|
||
Dim ArrayCorreos As String() = Correos.Split("|"c)
|
||
|
||
Dim ArregloHilos As New Generic.List(Of System.Threading.Thread)
|
||
Dim ArregloParametros As New Generic.List(Of List(Of String))
|
||
|
||
For index As Integer = 0 To ArrayCveIEs.Length - 1
|
||
If ObjIE.UpdatePagoElectronicoCarga(ArrayCveIEs(index).ToEntero, ArrayEstatusIEs(index).ToEntero) Then
|
||
|
||
'Cuando salio exitoso actualizamos el IE
|
||
If ArrayEstatusIEs(index).ToEntero = 2 Then
|
||
If ObjIE.UpdateIEPagoElectronico(ArrayCveIEs(index).ToEntero, ArrayFechasMovto(index).ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then 'DESPROGRAMA LAS COMPRAS RELACIONADAS EN ESTE PA
|
||
|
||
'Cambiamos estatus notificación
|
||
If ObjIE.UpdateBancos_IENotificaciones(2, "-1", "-1", ArrayCveIEs(index).ToEntero) Then
|
||
|
||
'Obtenemos los correos del movimiento
|
||
If ArrayCorreos(index) <> "-1" Or ArrayCorreos(index) <> "" Then
|
||
|
||
|
||
|
||
Dim Param As New List(Of String)
|
||
|
||
Param.Add(ArrayCveIEs(index).ToString)
|
||
Param.Add(ArrayCorreos(index)) 'Para
|
||
'Param.Add("Notificación de Pago") 'Asunto
|
||
'Param.Add(GeneraCorreo2(DtPago.Rows(index), ObjIE, ArrayCveIEs(index).ToEntero)) 'Body
|
||
|
||
' EnviarCorreoNotificacion()
|
||
'Dim Hilo As New Threading.Thread(AddressOf MandaCorreo)
|
||
'ArregloHilos.Add(Hilo)
|
||
|
||
ArregloParametros.Add(Param)
|
||
|
||
End If
|
||
Else
|
||
ErrorDB = True
|
||
End If
|
||
|
||
Else
|
||
ErrorDB = True
|
||
End If
|
||
Else
|
||
|
||
'Cuando salio NO exitoso cancelamos el IE
|
||
If ObjIE.CancelarBancos_IE(UsuarioActual.CveUsuario, ArrayCveIEs(index).ToEntero, False, -1, -1) <= 0 Then
|
||
ErrorDB = True
|
||
End If
|
||
End If
|
||
|
||
Else
|
||
ErrorDB = True
|
||
End If
|
||
Next
|
||
|
||
If Not ErrorDB Then
|
||
ObjIE.Commit()
|
||
'ObjIE.RollBack()
|
||
|
||
''EMPIEZA A ENVIAR CORREO POR HILOS
|
||
'For index = 0 To ArregloHilos.Count - 1
|
||
' ArregloHilos(index).Start(ArregloParametros(index))
|
||
'Next
|
||
|
||
For Each ObjParametros As Object In ArregloParametros
|
||
|
||
Dim Parametros As List(Of String) = DirectCast(ObjParametros, List(Of String))
|
||
|
||
Dim CveIENotificar As Integer = Parametros(0).ToEntero
|
||
Dim NotificarA As String = Parametros(1)
|
||
|
||
EnviarCorreoNotificacion(CveIENotificar, NotificarA, "", UsuarioActual, False)
|
||
|
||
Next
|
||
Respuesta.Append("<br/><br/>NOTA: El archivo se analizo correctamente y se efectuaron todos los cambios en el sistema.")
|
||
Alert(Respuesta.ToString, TipoMensaje.MsgInformacion)
|
||
|
||
CargaDatos()
|
||
Else
|
||
ObjIE.RollBack()
|
||
Respuesta.Append("<br/><br/>NOTA: El archivo se analizo correctamente pero ocurrió un problema al efectuar los cambios en el sistema. Por favor vuelva a intentar.")
|
||
Alert(Respuesta.ToString, TipoMensaje.MsgError)
|
||
End If
|
||
|
||
ObjIE.Dispose()
|
||
Else
|
||
Respuesta.AppendFormat("<br/><br/>NOTA: El archivo se analizo correctamente pero ningun movimiento fue exitoso.")
|
||
Alert(Respuesta.ToString, TipoMensaje.MsgAdvertencia)
|
||
End If
|
||
Else
|
||
Alert(TextoErrorArchivo, TipoMensaje.MsgError)
|
||
End If
|
||
|
||
End If
|
||
|
||
If OpBancos = 2 Then
|
||
|
||
End If
|
||
|
||
If OpBancos = 3 Then
|
||
|
||
TextoArreglo = File.ReadAllLines(NombreArchivo) 'Texto.Split(CChar(vbCrLf))
|
||
|
||
Dim CveIES As List(Of Integer) = New List(Of Integer)
|
||
Dim LienasCount As Integer = TextoArreglo.Length
|
||
Dim SBErrores As New StringBuilder
|
||
Dim SBPagosAplicados As New StringBuilder
|
||
Dim ErrorArchivoScotia As Boolean = False
|
||
|
||
If Not LienasCount >= 6 Then
|
||
Alert("El archivo no es un archivo de respuesta valido, debe tener al menos 6 lineas.", TipoMensaje.MsgError)
|
||
Exit Sub
|
||
End If
|
||
|
||
Dim Header As String = TextoArreglo(0)
|
||
Dim HCodigo As String = TextoArreglo(0).Substring(35, 3).Trim
|
||
Dim HTipoArchivo As String = TextoArreglo(0).Substring(0, 3).Trim
|
||
If HTipoArchivo <> "SVH" Then
|
||
Alert("El archivo no es un archivo de respuesta, debe tener un encabezado con SVH.", TipoMensaje.MsgError)
|
||
Exit Sub
|
||
End If
|
||
If Header.Length <> 370 Then
|
||
Alert("El archivo no es un archivo de respuesta, debe tener un encabezado con una longitud de 370 caracteres.", TipoMensaje.MsgError)
|
||
Exit Sub
|
||
End If
|
||
|
||
|
||
Dim ListaPagoScotiaDetalle As New List(Of ClsPagoScotiaDetalle)
|
||
|
||
For x As Integer = 2 To TextoArreglo.Length - 3 Step 2
|
||
|
||
Dim PagoScotiaDetalle As New ClsPagoScotiaDetalle
|
||
|
||
Dim LineaDetalle As String = TextoArreglo(x)
|
||
Dim CodigoRespuestaDetalle As String = LineaDetalle.Substring(323, 3)
|
||
Dim Correo As String = TextoArreglo(x + 1).Substring(4, 100).Trim
|
||
Dim CveIE As Integer = LineaDetalle.Substring(106, 16).Trim.ToEntero 'Referencia del pago
|
||
|
||
If LineaDetalle.Length <> 370 Then
|
||
SBErrores.Append($"Error en la linea {x} - La longitud de la linea debe ser de 370 caracteres.</br>")
|
||
ErrorArchivoScotia = True
|
||
Continue For
|
||
End If
|
||
|
||
If CodigoRespuestaDetalle = "000" Then
|
||
'ok
|
||
Else
|
||
SBErrores.Append($"Error en la linea {x} Codigo de respuesta {CodigoRespuestaDetalle} - {PagosScotiaCodigoRespuestaAnexoC(CodigoRespuestaDetalle)}.</br>")
|
||
ErrorArchivoScotia = True
|
||
End If
|
||
|
||
|
||
Dim FechaAplicacion As Date = Date.ParseExact(LineaDetalle.Substring(23, 8).Trim, "yyyyMMdd", Globalization.CultureInfo.InvariantCulture)
|
||
|
||
PagoScotiaDetalle.CodigoRespuesta = CodigoRespuestaDetalle
|
||
PagoScotiaDetalle.Correo = Correo
|
||
PagoScotiaDetalle.OK = If(CodigoRespuestaDetalle = "000", True, False)
|
||
PagoScotiaDetalle.FechaAplicacion = FechaAplicacion
|
||
PagoScotiaDetalle.Importe = String.Format("{0}.{1}", LineaDetalle.Substring(8, 13).Trim, LineaDetalle.Substring(21, 2).Trim).ToDecimal
|
||
|
||
|
||
If PagoScotiaDetalle.OK Then
|
||
PagoScotiaDetalle.ErrorRechazo = ""
|
||
Else
|
||
PagoScotiaDetalle.ErrorRechazo = PagosScotiaCodigoRespuestaAnexoC(CodigoRespuestaDetalle)
|
||
End If
|
||
|
||
PagoScotiaDetalle.CveIE = CveIE
|
||
|
||
|
||
ListaPagoScotiaDetalle.Add(PagoScotiaDetalle)
|
||
|
||
Next
|
||
|
||
'Aceptados
|
||
'CANTIDAD DE MOVIMIENTOS ALTAS NUM 7 53 59
|
||
'IMPORTE DE MOVIMIENTOS ALTAS NUM 17 2 60 76
|
||
|
||
'Rechazaados
|
||
'CANTIDAD DE MOVIMIENTOS ALTAS NUM 7 101 107
|
||
'IMPORTE DE MOVIMIENTOS ALTAS NUM 17 2 108 124
|
||
|
||
Dim Trailer As String = TextoArreglo(LienasCount - 1)
|
||
Dim TAceptadosCantidad As Integer = Trailer.Substring(52, 7).ToEntero
|
||
Dim TImporteAceptados As Decimal = String.Format("{0}.{1}", Trailer.Substring(59, 15), Trailer.Substring(74, 2)).ToDecimal
|
||
|
||
Dim TRechazadosCantidad As Integer = Trailer.Substring(100, 7).ToEntero
|
||
Dim TImporteRechazados As Decimal = String.Format("{0}.{1}", Trailer.Substring(107, 15), Trailer.Substring(122, 2)).ToDecimal
|
||
Dim objIE As New ClsBancos
|
||
|
||
Dim Respuesta As New StringBuilder
|
||
Respuesta.AppendFormat("<br/>Resumen de respuesta: {0}<br/>", PagosScotiaCodigoRespuestaAnexoC(HCodigo))
|
||
Respuesta.AppendFormat("Numero de movimientos aceptados: {0} <br/>", TAceptadosCantidad.ToString)
|
||
Respuesta.AppendFormat("Importe aceptados: {0} <br/>", TImporteAceptados.ToString("C2"))
|
||
Respuesta.AppendFormat("Numero de movimientos rechazados: {0} <br/>", TRechazadosCantidad.ToString)
|
||
Respuesta.AppendFormat("Importe rechazados: {0} <br/>", TImporteRechazados.ToString("C2"))
|
||
|
||
|
||
objIE.IniciaTransacSQL()
|
||
Dim ErrorDB As Boolean = False
|
||
|
||
For Each PagoScotiaDetalle As ClsPagoScotiaDetalle In ListaPagoScotiaDetalle
|
||
If PagoScotiaDetalle.OK Then
|
||
'Actualiza el IE
|
||
If objIE.UpdatePagoElectronicoCarga(PagoScotiaDetalle.CveIE, If(PagoScotiaDetalle.OK, 2, 3)) Then
|
||
'Actualiza el IE como pagado
|
||
If objIE.UpdateIEPagoElectronico(PagoScotiaDetalle.CveIE, PagoScotiaDetalle.FechaAplicacion, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
|
||
'Cambiamos estatus notificación
|
||
If objIE.UpdateBancos_IENotificaciones(2, "-1", "-1", PagoScotiaDetalle.CveIE) Then
|
||
'Envia correo de notificación si tiene correo
|
||
If PagoScotiaDetalle.Correo <> "" AndAlso PagoScotiaDetalle.Correo <> "-1" Then
|
||
'EnviarCorreoNotificacion(PagoScotiaDetalle.CveIE, PagoScotiaDetalle.Correo, "", UsuarioActual, False)
|
||
End If
|
||
Else
|
||
ErrorDB = True
|
||
End If
|
||
Else
|
||
ErrorDB = True
|
||
End If
|
||
Else
|
||
ErrorDB = True
|
||
End If
|
||
Else
|
||
'Cancela el IE por error de pago
|
||
If objIE.CancelarBancos_IE(UsuarioActual.CveUsuario, PagoScotiaDetalle.CveIE, False, -1, -1) <= 0 Then
|
||
ErrorDB = True
|
||
End If
|
||
End If
|
||
Next
|
||
|
||
'For index As Integer = 0 To ArrayCveIEs.Length - 1
|
||
' If ObjIE.UpdatePagoElectronicoCarga(ArrayCveIEs(index).ToEntero, ArrayEstatusIEs(index).ToEntero) Then
|
||
|
||
' 'Cuando salio exitoso actualizamos el IE
|
||
' If ArrayEstatusIEs(index).ToEntero = 2 Then
|
||
' If ObjIE.UpdateIEPagoElectronico(ArrayCveIEs(index).ToEntero, ArrayFechasMovto(index).ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then 'DESPROGRAMA LAS COMPRAS RELACIONADAS EN ESTE PA
|
||
|
||
' 'Cambiamos estatus notificación
|
||
' If ObjIE.UpdateBancos_IENotificaciones(2, "-1", "-1", ArrayCveIEs(index).ToEntero) Then
|
||
|
||
' 'Obtenemos los correos del movimiento
|
||
' If ArrayCorreos(index) <> "-1" Or ArrayCorreos(index) <> "" Then
|
||
|
||
|
||
|
||
' Dim Param As New List(Of String)
|
||
|
||
' Param.Add(ArrayCveIEs(index).ToString)
|
||
' Param.Add(ArrayCorreos(index)) 'Para
|
||
' 'Param.Add("Notificación de Pago") 'Asunto
|
||
' 'Param.Add(GeneraCorreo2(DtPago.Rows(index), ObjIE, ArrayCveIEs(index).ToEntero)) 'Body
|
||
|
||
' ' EnviarCorreoNotificacion()
|
||
' 'Dim Hilo As New Threading.Thread(AddressOf MandaCorreo)
|
||
' 'ArregloHilos.Add(Hilo)
|
||
|
||
' ArregloParametros.Add(Param)
|
||
|
||
' End If
|
||
' Else
|
||
' ErrorDB = True
|
||
' End If
|
||
|
||
' Else
|
||
' ErrorDB = True
|
||
' End If
|
||
' Else
|
||
|
||
' 'Cuando salio NO exitoso cancelamos el IE
|
||
' If ObjIE.CancelarBancos_IE(UsuarioActual.CveUsuario, ArrayCveIEs(index).ToEntero, False, -1, -1) <= 0 Then
|
||
' ErrorDB = True
|
||
' End If
|
||
' End If
|
||
|
||
' Else
|
||
' ErrorDB = True
|
||
' End If
|
||
'Next
|
||
|
||
|
||
If Not ErrorDB Then
|
||
objIE.Commit()
|
||
|
||
Try
|
||
For Each PagoScotiaDetalle As ClsPagoScotiaDetalle In ListaPagoScotiaDetalle
|
||
If PagoScotiaDetalle.OK Then
|
||
EnviarCorreoNotificacion(PagoScotiaDetalle.CveIE, PagoScotiaDetalle.Correo, "", UsuarioActual, False)
|
||
End If
|
||
Next
|
||
Catch ex As Exception
|
||
Alert("Ocurrió un error al enviar los correos de notificación.", TipoMensaje.MsgAdvertencia)
|
||
End Try
|
||
|
||
|
||
Alert(Respuesta.ToString, TipoMensaje.MsgInformacion)
|
||
|
||
Else
|
||
Alert("Ocurrió un error al procesar el archivo.", TipoMensaje.MsgAdvertencia)
|
||
objIE.RollBack()
|
||
End If
|
||
|
||
End If
|
||
|
||
|
||
|
||
'ELIMINA TXT
|
||
My.Computer.FileSystem.DeleteFile(NombreArchivo)
|
||
|
||
RecargaDatos()
|
||
|
||
End Sub
|
||
#End Region
|
||
|
||
|
||
|
||
'FUNCIONARIO O EMPLEADO
|
||
#Region " ALTA FUNCIONARIO "
|
||
Private Sub CargaFyE()
|
||
Dim ObjBancos As New ClsBancos
|
||
|
||
If ObjBancos.GetLayoutFyE(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||
DTFyE = ObjBancos.DtResultados.FiltraParametros("LEN(RFC) In (13)")
|
||
Else
|
||
DTFyE = Nothing
|
||
End If
|
||
ObjBancos.Dispose()
|
||
|
||
If DTFyE.Rows.Count > 0 Then
|
||
GvProveedores.DataSource = DTFyE
|
||
End If
|
||
GvProveedores.DataBind()
|
||
|
||
UpProveedores.Update()
|
||
End Sub
|
||
Private Sub GeneraAltaFyE()
|
||
Dim DtTemp As DataTable = Nothing
|
||
|
||
'REINICIA PROPIEDAS
|
||
HeaderTexto = ""
|
||
DetalleTexto = ""
|
||
TrailerTexto = ""
|
||
TotalAcumulado = 0
|
||
CreaDtAlta()
|
||
|
||
DtTemp = DTFyE
|
||
|
||
''VALIDA CUENTAS DEPOSITOS
|
||
Dim ErrorCuenta As Boolean = False
|
||
Dim FyEError As StringBuilder = New StringBuilder
|
||
FyEError.AppendFormat("<table width='600px'><thead><tr><td width='300px'>Personal</td><td width='150px'>Cuenta</td><td width='150px'>Error</td></tr></thead><tbody>")
|
||
|
||
Dim TotalDetalles As Integer = 0
|
||
Dim EsBancomer As Boolean = False
|
||
For Each gvr As DataRow In DtTemp.Rows
|
||
If gvr("CvePersonal").ToString <> "" AndAlso gvr("EstatusPagoElectronico").ToString <> "True" AndAlso gvr("AltaCuenta").ToString = "1" Then
|
||
DTPendienteActual = DtTemp.FiltraParametros(String.Format("CveCuentaDeposito = {0}", gvr("CveCuentaDeposito").ToString))
|
||
ErrorCuenta = False
|
||
EsBancomer = False
|
||
|
||
If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then
|
||
EsBancomer = True
|
||
End If
|
||
|
||
'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER
|
||
If Not ErrorCuenta Then
|
||
If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And DTPendienteActual(0)("CLABE").ToString.Trim.Length = 0 And Not EsBancomer Then
|
||
FyEError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>CLABE ES OBLIGATORIA</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10
|
||
If Not ErrorCuenta Then
|
||
If DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 10 AndAlso EsBancomer Then
|
||
FyEError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>NUMERO DE CUENTA CON FORMATO INCORRECTO</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18
|
||
If Not ErrorCuenta Then
|
||
If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 Then
|
||
FyEError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>CLABE CON FORMATO INCORRECTO</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
'SI CIE TIENE ALGO DEBE TENER REFERENCIA OBLIGATORIA
|
||
If Not ErrorCuenta Then
|
||
If DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0 And DTPendienteActual(0)("Referencia").ToString.Trim.Length < 3 Then
|
||
FyEError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>CIE CON FORMATO INCORRECTO</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA"
|
||
If Not ErrorCuenta Then
|
||
If EsBancomer AndAlso Not (DTPendienteActual(0)("Cuenta").ToString.Trim.Length = 10 Or DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0) Then
|
||
FyEError.AppendFormat("<tr><td>{0}</td><td>{1}</td><td>CUENTA BANCOMER SIN CUENTA O CIE</td></tr>", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
|
||
ErrorCuenta = True
|
||
End If
|
||
End If
|
||
|
||
If Not ErrorCuenta Then
|
||
If TotalDetalles > 0 Then
|
||
DetalleTexto &= vbCrLf
|
||
End If
|
||
GeneraAltaDetalleFyE()
|
||
TotalDetalles += 1
|
||
End If
|
||
|
||
End If
|
||
Next
|
||
FyEError.AppendFormat("</tbody></table>")
|
||
|
||
|
||
If TotalDetalles > 0 Then
|
||
FormarTextoAltaFyE(TotalDetalles)
|
||
CreaArchivo(2)
|
||
|
||
Dim Descargas As New StringBuilder()
|
||
Descargas.AppendFormat("<li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?File={0}"" target='_blank'>TXT</a></li>", NombreArchivo)
|
||
'Descargas.AppendFormat("<li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?REPORTE=S"" target='_blank'>Reporte</a></li>", NombreArchivo)
|
||
Descargas.AppendFormat("<li><a href=""#"" class=""Texto"" onclick=""fncg();"">Descargar Reporte</a></li>", NombreArchivo)
|
||
|
||
|
||
Dim TextoErrorProveedores As String = ""
|
||
If FyEError.Length > 160 Then TextoErrorProveedores = String.Format("<br /><br /><br />Proveedores con Error: <br/><br/>------------------------------------------------------------------<br/>{0}<br /><br />", FyEError.ToString)
|
||
|
||
Alert(String.Format("<br />El Layout fue creado satisfactoriamente.{1}<br />Descargas:<ul>{0}</ul>", Descargas, TextoErrorProveedores), TipoMensaje.MsgInformacion)
|
||
|
||
'NombreArchivo = "LayoutAltaProveedores"
|
||
'DescargarArchivo()
|
||
Else
|
||
Alert("No hay proveedores que dar de alta", TipoMensaje.MsgInformacion)
|
||
End If
|
||
|
||
|
||
End Sub
|
||
Private Sub GeneraAltaDetalleFyE()
|
||
Dim Resultado As Boolean = True
|
||
Dim CuentaDeposito As String = ""
|
||
Dim TipoCuentaDeposito As String = ""
|
||
Dim TipoCuenta As String = ""
|
||
|
||
''''' LLENADO DE DETALLE
|
||
'Campos #1-4 del Detalle
|
||
DetalleTexto &= String.Format("DA{0}N ", DTPendienteActual(0)("CveCuentaDeposito").ToString.ToUpper.PadLeft(30, PadCeros))
|
||
|
||
'Banco BBVA
|
||
If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Then
|
||
'Llenamos datos de BBVA
|
||
'Campo #5-7 del detalle
|
||
|
||
'Busca que cuenta sera la asignada para el proveedor
|
||
If DTPendienteActual(0)("CIE").ToString <> "" Then
|
||
CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros))
|
||
TipoCuenta = "50"
|
||
TipoCuentaDeposito = "CIE"
|
||
ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then
|
||
CuentaDeposito = DTPendienteActual(0)("Cuenta").ToString
|
||
TipoCuenta = "99"
|
||
TipoCuentaDeposito = "Cuenta"
|
||
ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then
|
||
CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
|
||
TipoCuenta = "40"
|
||
TipoCuentaDeposito = "CLABE"
|
||
End If
|
||
|
||
|
||
DetalleTexto &= String.Format("{0}{1}{2}", DTPendienteActual(0)("Abreviatura").ToString, TipoCuenta, CuentaDeposito.PadLeft(35, PadCeros))
|
||
|
||
'Llenamos en blanco datos de otros bancos
|
||
'Campos 8-17 del detalle --- 64 de otros bancos y 45 para FILLER --- Fecha de Alta
|
||
DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(109), NowADS().ToString("yyyy-MM-dd"))
|
||
|
||
|
||
'Otros Bancos NACIONAL!!
|
||
Else
|
||
|
||
CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
|
||
TipoCuentaDeposito = "CLABE"
|
||
|
||
'Llenamos en blanco datos de BBVA
|
||
DetalleTexto &= Vacio.PadRight(40)
|
||
|
||
'Llenamos datos de otros bancos
|
||
'Campos 8- 17 del detalle --- 44 de otros bancos --- 20 de internacional --- 45 Filler -- Fecha de Alta
|
||
DetalleTexto &= String.Format("{0}40{1}{2}{3}{4}{5}", DTPendienteActual(0)("Abreviatura").ToString, DTPendienteActual(0)("CLABE").ToString.PadLeft(35, PadCeros), DTPendienteActual(0)("CLABE").ToString.Substring(0, 3).PadLeft(4, PadCeros), Vacio.PadRight(20), Vacio.PadRight(45), NowADS().ToString("yyyy-MM-dd"))
|
||
End If
|
||
|
||
'Llenamos datos de Tipo de Persona - Fisica
|
||
' nombres Primer apellido Segundo apellido
|
||
DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), DTPendienteActual(0)("Nombres").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("APaterno").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("AMaterno").ToString.PadRight(20).Substring(0, 20))
|
||
|
||
'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC
|
||
DetalleTexto &= String.Format("{0}{1}", DTPendienteActual(0)("FechaNacimiento").ToString.ToDate.ToString("yyyy-MM-dd"), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14))
|
||
|
||
'Campos 27-32 --- Fillers --- datos de otros bancos (internacional)
|
||
DetalleTexto &= Vacio.PadLeft(153)
|
||
|
||
'Campos 33-36 --- Datos de confirmacion
|
||
DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), CorreoNotificacionesEmpresa.ToUpper.PadRight(50))
|
||
|
||
'If DTPendienteActual(0)("ContactoMail").ToString.Length > 0 Then
|
||
' 'DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), DTPendienteActual(0)("ContactoMail").ToString.ToUpper.PadRight(50))
|
||
'ElseIf DTPendienteActual(0)("ContactoMail").ToString.Length <= 0 Then
|
||
' DetalleTexto &= String.Format("{0}00{1}", Vacio.PadRight(40), Vacio.PadRight(50))
|
||
'End If
|
||
|
||
'Campos 37-39 -- FILLER
|
||
DetalleTexto &= String.Format("00{0}", Vacio.PadRight(38))
|
||
|
||
''LLENA DT PARA REPORTE
|
||
Dim Row As DataRow = DtAlta.NewRow()
|
||
Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString
|
||
Row("Banco") = DTPendienteActual(0)("BancoNombre").ToString
|
||
Row("TipoCuenta") = TipoCuentaDeposito
|
||
Row("Cuenta") = String.Format("{0}", CuentaDeposito)
|
||
DtAlta.Rows.Add(Row)
|
||
End Sub
|
||
Protected Sub FormarTextoAltaFyE(Registros As Integer)
|
||
'''''' LLENADO HEADER
|
||
Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString
|
||
'Campos #1-4 del Header
|
||
HeaderTexto = String.Format("H{0}{1}GRUPO01 ", convenio.PadLeft(9, PadCeros), NowADS().ToString("yyyy-MM-dd"))
|
||
'Campo #5 del Header
|
||
HeaderTexto &= String.Format("{0}{1}", UsuarioActual.CveUsuario, NowADS().ToString("yyyyMMdd")).PadRight(20)
|
||
'Campos #6-8 del Header
|
||
HeaderTexto &= String.Format("00").PadRight(586)
|
||
Dim HeaderLength As Integer = HeaderTexto.Length
|
||
|
||
''''' LLENADO DE TRAILER
|
||
TrailerTexto = String.Format("T{0}{1}{2}", Registros.ToString.PadLeft(10, PadCeros), Vacio.PadRight(50, PadCeros), Vacio.PadRight(575))
|
||
|
||
''''' ARMADO DEL TEXTO COMPLETO
|
||
TextoCompleto = String.Format("{1}{0}{2}{0}{3}{0}", vbCrLf, HeaderTexto, DetalleTexto, TrailerTexto)
|
||
'TxtAltas.Text = TextoCompleto
|
||
End Sub
|
||
#End Region
|
||
|
||
|
||
'TABS
|
||
#Region "R E P O R T E S"
|
||
Protected Sub BtnConsultarReportes_Click(sender As Object, e As EventArgs)
|
||
CargaReporte()
|
||
End Sub
|
||
|
||
Private Sub CargaReporte()
|
||
Dim ObjBancos As New ClsBancos
|
||
Dim FechaI As String = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
|
||
Dim FechaF As String = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
|
||
|
||
If ObjBancos.GetLayoutPagosEnviados(DdlCuentaReportes.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, DdlTipoReportes.SelectedValue, FechaI, DateAdd(DateInterval.Day, 1, FechaF.ToDate).ToShortDateString) Then
|
||
DTReportes = ObjBancos.DtResultados
|
||
Else
|
||
DTReportes = Nothing
|
||
End If
|
||
ObjBancos.Dispose()
|
||
|
||
If DTReportes.Rows.Count > 0 Then
|
||
GvReportes.DataSource = DTReportes
|
||
End If
|
||
GvReportes.DataBind()
|
||
|
||
UpDatosReportes.Update()
|
||
|
||
End Sub
|
||
|
||
Protected Sub GvReportes_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||
|
||
'Colorea GV
|
||
If e.Row.DBCampo("CveProveedor").ToString = "" Then
|
||
e.Row.BackColor = Drawing.Color.LightGray
|
||
Else
|
||
e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
|
||
End If
|
||
End If
|
||
End Sub
|
||
|
||
|
||
#End Region
|
||
|
||
|
||
#Region "C A R G A - M A S I V A"
|
||
Protected Sub BtnCargaMasiva_Click(sender As Object, e As EventArgs)
|
||
If DdlTipoCargaMasiva.SelectedValue.ToEntero = 1 Then
|
||
TipoMasiva = 1
|
||
GvProveedores.Columns(0).HeaderText = "Proveedor"
|
||
CargaProveedores()
|
||
BtnGenerarProveedores.Text = "Generar Layout Alta Proveedores"
|
||
Else
|
||
TipoMasiva = 2
|
||
GvProveedores.Columns(0).HeaderText = "Funcionario"
|
||
CargaFyE()
|
||
BtnGenerarProveedores.Text = "Generar Layout Alta Funcionarios"
|
||
End If
|
||
End Sub
|
||
Protected Sub BtnGenerarProveedores_Click(sender As Object, e As EventArgs)
|
||
|
||
If Not DdlCuenta.SelectedValue.ToEntero > 0 Then
|
||
Alert("Primero debe seleccionar una Cuenta", TipoMensaje.MsgAdvertencia)
|
||
Exit Sub
|
||
End If
|
||
|
||
If TipoMasiva = 1 Then
|
||
|
||
If OpBancos = 1 Then
|
||
AltaProveedores(2)
|
||
End If
|
||
|
||
If OpBancos = 2 Then
|
||
'
|
||
End If
|
||
|
||
If OpBancos = 3 Then
|
||
AltaProveedoresScotia(DTProveedores)
|
||
End If
|
||
|
||
|
||
Else
|
||
GeneraAltaFyE()
|
||
End If
|
||
|
||
End Sub
|
||
Private Sub CargaProveedores()
|
||
Dim ObjBancos As New ClsBancos
|
||
|
||
If ObjBancos.GetLayoutProveedores(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||
DTProveedores = ObjBancos.DtResultados.FiltraParametros("LEN(RFC) IN (12,13)")
|
||
Else
|
||
DTProveedores = Nothing
|
||
End If
|
||
ObjBancos.Dispose()
|
||
|
||
If DTProveedores.Rows.Count > 0 Then
|
||
GvProveedores.DataSource = DTProveedores
|
||
End If
|
||
GvProveedores.DataBind()
|
||
|
||
UpProveedores.Update()
|
||
End Sub
|
||
Protected Sub GvProveedores_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||
If TipoMasiva = 1 Then
|
||
e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
|
||
Else
|
||
e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal"))
|
||
End If
|
||
End If
|
||
|
||
|
||
|
||
End Sub
|
||
#End Region
|
||
|
||
|
||
|
||
'CORREO
|
||
#Region " GENERA Y MANDA CORREO "
|
||
|
||
Private Sub EnviarCorreoNotificacion(CveIENotificar As Integer, CorreoNotificarA As String, CopiaPara As String, UsuarioActualNotificar As Usuario, MostarAlert As Boolean)
|
||
|
||
Try
|
||
Dim Hilo As New Threading.Thread(Sub() EnviarCorreoNotifiMandaCorreocacionHilo(CveIENotificar, CorreoNotificarA, CopiaPara, UsuarioActualNotificar))
|
||
Hilo.Start()
|
||
|
||
If MostarAlert Then
|
||
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
|
||
If MostarAlert Then
|
||
Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError)
|
||
End If
|
||
|
||
End Try
|
||
|
||
End Sub
|
||
|
||
Private Sub EnviarCorreoNotifiMandaCorreocacionHilo(CveIENotificar As Integer, CorreoNotificarA As String, CopiaPara As String, UsuarioActualNotificar As Usuario)
|
||
|
||
Try
|
||
Dim ObjBancos As New ClsBancos()
|
||
|
||
|
||
If ObjBancos.NotificacionPago(CveIENotificar, CorreoNotificarA, CopiaPara, UsuarioActualNotificar) Then
|
||
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
||
Else
|
||
Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError)
|
||
End If
|
||
|
||
ObjBancos.Dispose()
|
||
|
||
Catch ex As Exception
|
||
GuardaLog("Error al enviar notificación de pago PagoElectronico --> " & ex.StackTrace.ToString)
|
||
End Try
|
||
|
||
|
||
|
||
End Sub
|
||
|
||
|
||
'Private Sub MandaCorreo(data As Object)
|
||
' Dim Parametros As List(Of String) = DirectCast(data, List(Of String))
|
||
|
||
' Dim Mail As New ClsSisMail()
|
||
' Dim Para As String = Parametros(0)
|
||
' Dim Asunto As String = Parametros(1)
|
||
' Dim Body As String = Parametros(2)
|
||
|
||
' 'NO SE OCUPAN
|
||
' 'Dim CveIE As Integer = Parametros(3).ToEntero
|
||
' 'Dim CveTipoTransaccion As Integer = Parametros(4).ToEntero
|
||
' 'Dim Estatus As Integer = If(CveTipoTransaccion = 2, 2, 1) ' cuando es transferencia, no lo pasa por entregar
|
||
|
||
' 'Mail.MandaCorreo(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body)
|
||
' Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body)
|
||
'End Sub
|
||
|
||
'Private Function GeneraCorreo(CveIE As Integer, objIE As ClsBancos) As String
|
||
' Dim strBody As New StringBuilder
|
||
|
||
' If objIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then
|
||
' strBody.Append("<html xmlns=""http: //www.w3.org/1999/xhtml""> ")
|
||
' strBody.Append("<head> ")
|
||
' strBody.Append(" <style type=""text/css""> ")
|
||
' strBody.Append(" body ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" margin:0px; ")
|
||
' strBody.Append(" padding:0px 0px 0px 0px; ")
|
||
' strBody.Append(" font-family: Verdana, Arial, Helvetica, sans-serif; ")
|
||
' strBody.Append(" font-size: 10px; ")
|
||
' strBody.Append(" background-color:#F0F0F0; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" a.Texto ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" font-size:11px; ")
|
||
' strBody.Append(" background-color:#F7F6F3; ")
|
||
' strBody.Append(" text-decoration:none; ")
|
||
' strBody.Append(" font-weight:bold; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .Texto ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" background-color:#F7F6F3; color:Black; font-family:Verdana; font-size:10px; text-align:center; vertical-align:middle; height:20px;")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .TextoAlterno ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" background-color:White; color:Black; font-family:Verdana; font-size:10px; text-align:center; ")
|
||
' strBody.Append(" vertical-align:middle; height:20px;")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .BarraIdentidad ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" color:#FFFFFF; ")
|
||
' strBody.Append(" background:#F0F0F0; ")
|
||
' strBody.Append(" font-weight:bold; ")
|
||
' strBody.Append(" font-size:19px; ")
|
||
' strBody.Append(" font-style:oblique; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .Titulos ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" background-color: Gray;")
|
||
' strBody.Append(" color:White; ")
|
||
' strBody.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
|
||
' strBody.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
|
||
' strBody.Append(" text-decoration:none; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .Verde {color: #00CC00;} ")
|
||
' strBody.Append(" .Negro {color: #000000;} ")
|
||
' strBody.Append(" .Rojo {color: #FF0000;} ")
|
||
' strBody.Append(" </style> ")
|
||
' strBody.Append("</head> ")
|
||
' strBody.Append("<body> ")
|
||
' strBody.AppendFormat("<div id='C_div' style='width: 600px'>")
|
||
' strBody.AppendFormat(" <fieldset>")
|
||
' strBody.AppendFormat(" <legend><b>{0}</b></legend>", UsuarioActual.Empresa.Empresa)
|
||
' strBody.AppendFormat(" <table class='TextoG' border='0' cellpadding='0' cellspacing='0' width='100%'>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td style='width:100px'>{0}</td>", UsuarioActual.Empresa.Direccion)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td>Col. {0}</td>", UsuarioActual.Empresa.Colonia)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td>{0}, {1}, C.P.{2}</td>", UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td>RFC {0}</td>", UsuarioActual.Empresa.RFC)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" </table>")
|
||
' strBody.AppendFormat(" </fieldset>")
|
||
' strBody.AppendFormat("</div><br/><br/>")
|
||
|
||
' strBody.AppendFormat("<div style='width: 600px'>")
|
||
' strBody.AppendFormat(" <fieldset>")
|
||
' strBody.AppendFormat(" <legend><b> </b></legend>")
|
||
' strBody.AppendFormat(" <table class='TextoG' style='width:100%'>")
|
||
|
||
' If objIE.CveTipoTransaccion = 1 Then ' cuando es cheque
|
||
' strBody.Append(" <tr style=""height: 22px""> ")
|
||
' strBody.Append(" <td>Usted puede pasar a recorger el cheque en las oficinas administrativas.</td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' End If
|
||
|
||
' If objIE.CveTipoTransaccion = 2 Then ' cuando es transf
|
||
' strBody.Append(" <tr style=""height: 22px""> ")
|
||
' strBody.Append(" <td>Se notifica el envío de transferencia de pago.</td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' End If
|
||
|
||
' strBody.Append(" <tr style=""height: 22px""> ")
|
||
' strBody.AppendFormat(" <td> </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" </table> ")
|
||
' strBody.Append(" </div> ")
|
||
|
||
|
||
' strBody.AppendFormat("<div style='width: 600px'>")
|
||
' strBody.AppendFormat(" <table style='width:100%'>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td style='vertical-align: top'>")
|
||
' strBody.AppendFormat(" <fieldset>")
|
||
' strBody.AppendFormat(" <legend>Beneficiario:<b>{0}</b> </legend>", objIE.PagueseA)
|
||
' strBody.AppendFormat(" <table width='100%'>")
|
||
' strBody.AppendFormat(" <tr style='background-color: gray; color: White; font-family: Verdana; font-size: 10px; text-align: center; vertical-align: middle; font-weight: bold; height: 20px; text-decoration: none;'>")
|
||
' strBody.AppendFormat(" <th scope='col' style='width: 50%'></th>")
|
||
' strBody.AppendFormat(" <th scope='col' style='width: 50%'></th>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Movimiento:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>Transferencia Bancaria</td>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Banco:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", objIE.Banco)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Fecha:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", objIE.FechaDocumento.ToString("dd/MM/yyyy"))
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Importe:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>$ {0} {1}</td>", objIE.Importe.FormatoNumero, objIE.Moneda)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Observaciones:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", objIE.Observaciones)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td colspan='2'>")
|
||
' strBody.AppendFormat(" <hr />")
|
||
' strBody.AppendFormat(" </td>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" </table>")
|
||
' strBody.AppendFormat(" </fieldset>")
|
||
' strBody.AppendFormat(" </td>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" </table>")
|
||
' strBody.AppendFormat("</div>")
|
||
|
||
|
||
|
||
' strBody.Append(" <div> Favor de no responder a este correo. </div> ")
|
||
|
||
' strBody.Append("</body></html>")
|
||
' End If
|
||
|
||
' Return strBody.ToString
|
||
'End Function
|
||
|
||
#End Region
|
||
|
||
#Region " GENERA CORREO 2"
|
||
|
||
'Private Function GeneraCorreo2(Dr As DataRow, ByRef ObjIE As ClsBancos, CveIE As Integer) As String
|
||
' Dim strBody As New StringBuilder
|
||
|
||
|
||
' strBody.Append(" <html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns:m='http://schemas.microsoft.com/office/2004/12/omml' xmlns='http://www.w3.org/TR/REC-html40'> ")
|
||
' strBody.Append(" <head> ")
|
||
' strBody.Append(" <meta http-equiv=Content-Type content='text/html; charset=utf-8'> ")
|
||
' strBody.Append(" <meta name=Generator content='Microsoft Word 15 (filtered medium)'> ")
|
||
' strBody.Append(" <!--[if !mso]><style>v\:* {behavior:url(#default#VML);} ")
|
||
' strBody.Append(" o\:* {behavior:url(#default#VML);} ")
|
||
' strBody.Append(" w\:* {behavior:url(#default#VML);} ")
|
||
' strBody.Append(" .shape {behavior:url(#default#VML);} ")
|
||
' strBody.Append(" </style><![endif]--> ")
|
||
' strBody.Append(" <style> ")
|
||
' strBody.Append(" <!-- ")
|
||
' strBody.Append(" /* Font Definitions */ ")
|
||
' strBody.Append(" @font-face ")
|
||
' strBody.Append(" {font-family:'Cambria Math'; ")
|
||
' strBody.Append(" panose-1:2 4 5 3 5 4 6 3 2 4;} ")
|
||
' strBody.Append(" @font-face ")
|
||
' strBody.Append(" {font-family:Calibri; ")
|
||
' strBody.Append(" panose-1:2 15 5 2 2 2 4 3 2 4;} ")
|
||
' strBody.Append(" @font-face ")
|
||
' strBody.Append(" {font-family:tahoma; ")
|
||
' strBody.Append(" panose-1:2 11 6 4 3 5 4 4 2 4;} ")
|
||
' strBody.Append(" /* Style Definitions */ ")
|
||
' strBody.Append(" p.MsoNormal, li.MsoNormal, div.MsoNormal ")
|
||
' strBody.Append(" {margin:0cm; ")
|
||
' strBody.Append(" margin-bottom:.0001pt; ")
|
||
' strBody.Append(" font-size:12.0pt; ")
|
||
' strBody.Append(" font-family:'Times New Roman',serif;} ")
|
||
' strBody.Append(" a:link, span.MsoHyperlink ")
|
||
' strBody.Append(" {mso-style-priority:99; ")
|
||
' strBody.Append(" color:blue; ")
|
||
' strBody.Append(" text-decoration:underline;} ")
|
||
' strBody.Append(" a:visited, span.MsoHyperlinkFollowed ")
|
||
' strBody.Append(" {mso-style-priority:99; ")
|
||
' strBody.Append(" color:purple; ")
|
||
' strBody.Append(" text-decoration:underline;} ")
|
||
' strBody.Append(" p ")
|
||
' strBody.Append(" {mso-style-priority:99; ")
|
||
' strBody.Append(" mso-margin-top-alt:auto; ")
|
||
' strBody.Append(" margin-right:0cm; ")
|
||
' strBody.Append(" mso-margin-bottom-alt:auto; ")
|
||
' strBody.Append(" margin-left:0cm; ")
|
||
' strBody.Append(" font-size:12.0pt; ")
|
||
' strBody.Append(" font-family:'Times New Roman',serif;} ")
|
||
' strBody.Append(" span.EstiloCorreo18 ")
|
||
' strBody.Append(" {mso-style-type:personal; ")
|
||
' strBody.Append(" font-family:'Calibri',sans-serif; ")
|
||
' strBody.Append(" color:#1F497D;} ")
|
||
' strBody.Append(" span.EstiloCorreo19 ")
|
||
' strBody.Append(" {mso-style-type:personal-reply; ")
|
||
' strBody.Append(" font-family:'Calibri',sans-serif; ")
|
||
' strBody.Append(" color:#1F497D;} ")
|
||
' strBody.Append(" .MsoChpDefault ")
|
||
' strBody.Append(" {mso-style-type:export-only; ")
|
||
' strBody.Append(" font-size:10.0pt;} ")
|
||
' strBody.Append(" @page WordSection1 ")
|
||
' strBody.Append(" {size:612.0pt 792.0pt; ")
|
||
' strBody.Append(" margin:70.85pt 3.0cm 70.85pt 3.0cm;} ")
|
||
' strBody.Append(" div.WordSection1 ")
|
||
' strBody.Append(" {page:WordSection1;} ")
|
||
' strBody.Append(" --> ")
|
||
|
||
' strBody.Append(" .demo { ")
|
||
' strBody.Append(" border:1px solid #A6A6A6; ")
|
||
' strBody.Append(" border-collapse:collapse; ")
|
||
' strBody.Append(" padding:5px; ")
|
||
' strBody.Append(" font-size:12px; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .demo th { ")
|
||
' strBody.Append(" border:1px solid #A6A6A6; ")
|
||
' strBody.Append(" padding:5px; ")
|
||
' strBody.Append(" background:#C3C3C3; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .demo td { ")
|
||
' strBody.Append(" border:1px solid #A6A6A6; ")
|
||
' strBody.Append(" padding:5px; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" Table caption{")
|
||
' strBody.Append(" font-size: 20px;")
|
||
' strBody.Append(" }")
|
||
|
||
|
||
' strBody.Append(" </style> ")
|
||
' strBody.Append(" <!--[if gte mso 9]><xml> <o: shapedefaults v:ext='edit' spidmax='1027' /> </xml><![endif]--> ")
|
||
' strBody.Append(" <!--[if gte mso 9]><xml> <o:shapelayout v:ext='edit'> <o:idmap v:ext='edit' data='1' /> </o:shapelayout></xml><![endif]--> ")
|
||
' strBody.Append(" </head> ")
|
||
' strBody.Append(" <body lang=ES-MX link=blue vlink=purple> ")
|
||
' strBody.Append(" <div class=WordSection1> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
|
||
|
||
' 'strBody.Append(" <b><span lang=ES style=""font-size:10.0pt;font-family:'Tahoma',sans-serif"">De:</span></b><span lang=ES style=""font-size:10.0pt;font-family:'Tahoma',sans-serif""> Bancomer.com [<a href='#' target='_blank'>mailto:alertatdu@serviciobancomer.com</a>] <br> ")
|
||
|
||
' strBody.Append(" </div style=""width:100%;""> ")
|
||
' strBody.AppendFormat(" <img border=0 src='{0}Imagenes/Publico/header.png'> ", UrlSitio)
|
||
' strBody.Append(" <div> ")
|
||
|
||
|
||
' strBody.AppendFormat(" <b>Enviado el:</b> {0} {1}<br> ", NowADS().ToLongDateString, NowADS().ToShortTimeString)
|
||
' strBody.AppendFormat(" <b>Para:</b><a href='mailto:{0}' target='_blank'>{0}</a><br> ", If(UsuarioActual.CveEmpresa = 66, "PAGOS@GLUYASCONSTRUCCIONES.COM", ""))
|
||
' strBody.Append(" <b>Asunto:</b> CONFIRMACION SIT DISPERSION</span><span lang=ES><o:p></o:p></span> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span lang=ES> <o:p></o:p></span> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" <div> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <span lang=ES style=""font-size:10.5pt;font-family:'Courier New';color:#000099""><img border=0 id='_x0000_i1025' src='{0}Imagenes/Publico/comun_logo.gif'></span><span lang=ES><o:p></o:p></span> ", UrlSitio)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </div> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span lang=ES style=""font-size:10.5pt;font-family:'Courier New';color:#000099""> </span><span lang=ES><o:p></o:p></span> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" <p class=MsoNormal align=center style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-align:center""> ")
|
||
' strBody.Append(" <b><span lang=ES style=""font-size:10.5pt;font-family:'Courier New';color:black"">Confirmación de pago realizado bajo las siguientes condiciones:</span></b><span lang=ES><o:p></o:p></span> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width=667 style=""width:500.25pt;background:white;border:none;border-bottom:solid black 1.0pt""> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">NOMBRE DEL CLIENTE: </span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:black"">{0}</span></b><o:p></o:p> ", UsuarioActual.Empresa.Empresa)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">NÚMERO DE CONVENIO:</span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:black"">{0}</span></b><o:p></o:p> ", Dr("NumeroConvenio").ToString)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">CLAVE DEL PROVEEDOR:</span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:black"">{0}</span></b><o:p></o:p> ", Dr("ClaveProveedor").ToString)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">NOMBRE DEL PROVEEDOR/TERCERO:</span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:black"">{0}</span></b><o:p></o:p> ", Dr("Proveedor").ToString)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">REFERENCIA DEL PAGO:</span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:black"">{0}</span></b><o:p></o:p> ", Dr("ReferenciaPago").ToString)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">TIPO DE PAGO:</span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:black"">{0}</span></b><o:p></o:p> ", Dr("TipoPago").ToString)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">CUENTA DE ABONO:</span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:black"">{0}</span></b><o:p></o:p> ", Dr("Cuenta").ToString)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">IMPORTE DEL PAGO:</span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:#009EE5"">${0}</span></b><b><span style=""font-size:10.5pt;font-family:'Courier New';color:black""> </span></b><o:p></o:p> ", Dr("Importe").ToString.FormatoNumero)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">FECHA DE OPERACIÓN</span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:black"">{0}</span></b><o:p></o:p> ", Dr("FechaOperacion").ToString)
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" <tr style=""height:17.25pt""> ")
|
||
' strBody.Append(" <td width=253 style=""width:189.75pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <span style=""font-size:10.5pt;font-family:'Courier New';color:black"">MENSAJE ADICIONAL:</span><o:p></o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" <td width=406 nowrap style=""width:304.5pt;border:none;border-bottom:solid windowtext 1.0pt;padding:.75pt .75pt .75pt .75pt;height:17.25pt""> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.AppendFormat(" <b><span style=""font-size:10.5pt;font-family:'Courier New';color:black"">{0}</span></b><o:p></o:p> ", Dr("Observaciones").ToString.PadRight(70, " "c).Replace(" ", " "))
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" </table> ")
|
||
|
||
|
||
|
||
' strBody.Append(" </div style=""width:100%;""> ")
|
||
' strBody.AppendFormat(" <img border=0 src='{0}Imagenes/Publico/footer.png'> ", UrlSitio)
|
||
' strBody.Append(" <div> ")
|
||
|
||
|
||
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;margin-bottom:12.0pt""> ")
|
||
' strBody.Append(" <span lang=ES style=""font-size:10.5pt;font-family:'Courier New';color:#000099""> </span><span lang=ES><o:p></o:p></span> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" <p class=MsoNormal> ")
|
||
' strBody.Append(" <o:p> </o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" <p class=MsoNormal> ")
|
||
' strBody.Append(" <o:p> </o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" <p class=MsoNormal> ")
|
||
' strBody.Append(" <o:p> </o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
' strBody.Append(" <p class=MsoNormal style=""mso-margin-top-alt:auto;mso-margin-bottom-alt:auto""> ")
|
||
' strBody.Append(" <o:p> </o:p> ")
|
||
' strBody.Append(" </p> ")
|
||
|
||
|
||
' If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then
|
||
' If ObjIE.DtResultados.Rows.Count > 0 Then
|
||
' Dim dtMovs As DataTable
|
||
|
||
' Dim Mov As New ClsContabilidad
|
||
' If Mov.GetPrePolizasDetalle(-1, CveIE) Then
|
||
' dtMovs = Mov.DtResultados.FiltraParametros("CveConceptoContable IN (17)")
|
||
|
||
' strBody.Append(" <table class=""demo""> ")
|
||
' strBody.Append(" <caption>Listado de facturas pagadas</caption> ")
|
||
|
||
' strBody.Append(" <thead> ")
|
||
' strBody.Append(" <tr> ")
|
||
' strBody.Append(" <th style=""width:150px"">Factura</td> ")
|
||
' strBody.Append(" <th style=""width:80px"">Fecha</td> ")
|
||
' strBody.Append(" <th style=""width:100px"">Original</td> ")
|
||
' strBody.Append(" <th style=""width:100px"">Abonado</td> ")
|
||
' strBody.Append(" <th style=""width:100px"">Nota Crédito</td> ")
|
||
' strBody.Append(" <th style=""width:100px"">Saldo</td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" </thead> ")
|
||
' strBody.Append(" <tbody> ")
|
||
|
||
' For Each Dr2 As DataRow In dtMovs.Rows
|
||
' strBody.Append(" <tr> ")
|
||
' strBody.Append($" <td style=""width:150px;text-align:left;"">{Dr2("SerieFolio")}</td> ")
|
||
' strBody.Append($" <td style=""width:80px;text-align:center;"">{Dr2("FechaCompra").ToString.ToDate.ToShortDateString}</td> ")
|
||
' strBody.Append($" <td style=""width:100px;text-align:right;"">{Dr2("Total").ToString.ToDouble.FormatoNumero}</td> ")
|
||
' strBody.Append($" <td style=""width:100px;text-align:right;"">{Dr2("Importe").ToString.ToDouble.FormatoNumero}</td> ")
|
||
' strBody.Append($" <td style=""width:100px;text-align:right;"">{Dr2("ImporteNC").ToString.ToDouble.FormatoNumero}</td> ")
|
||
' strBody.Append($" <td style=""width:100px;text-align:right;"">{Dr2("Saldo").ToString.ToDouble.FormatoNumero}</td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' Next
|
||
|
||
' strBody.Append(" </tbody> ")
|
||
' strBody.Append(" </table> ")
|
||
|
||
' strBody.Append(" </div> ")
|
||
' strBody.Append(" </body> ")
|
||
' strBody.Append(" </html> ")
|
||
|
||
' End If
|
||
' Mov.Dispose()
|
||
|
||
' End If
|
||
' End If
|
||
|
||
' Return strBody.ToString
|
||
'End Function
|
||
|
||
|
||
|
||
'Private Function GeneraCorreo(CveIE As Integer) As String
|
||
|
||
' Dim strBody As New StringBuilder
|
||
' Dim objIE As New ClsBancos
|
||
|
||
' If objIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then
|
||
' strBody.Append("<html xmlns=""http://www.w3.org/1999/xhtml""> ")
|
||
' strBody.Append("<head> ")
|
||
' strBody.Append(" <style type=""text/css""> ")
|
||
' strBody.Append(" body ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" margin:0px; ")
|
||
' strBody.Append(" padding:0px 0px 0px 0px; ")
|
||
' strBody.Append(" font-family: Verdana, Arial, Helvetica, sans-serif; ")
|
||
' strBody.Append(" font-size: 10px; ")
|
||
' strBody.Append(" background-color:#F0F0F0; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" a.Texto ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" font-size:11px; ")
|
||
' strBody.Append(" background-color:#F7F6F3; ")
|
||
' strBody.Append(" text-decoration:none; ")
|
||
' strBody.Append(" font-weight:bold; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .Texto ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" background-color:#F7F6F3; color:Black; font-family:Verdana; font-size:10px; text-align:center; vertical-align:middle; height:20px;")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .TextoAlterno ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" background-color:White; color:Black; font-family:Verdana; font-size:10px; text-align:center; ")
|
||
' strBody.Append(" vertical-align:middle; height:20px;")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .BarraIdentidad ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" color:#FFFFFF; ")
|
||
' strBody.Append(" background:#F0F0F0; ")
|
||
' strBody.Append(" font-weight:bold; ")
|
||
' strBody.Append(" font-size:19px; ")
|
||
' strBody.Append(" font-style:oblique; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .Titulos ")
|
||
' strBody.Append(" { ")
|
||
' strBody.Append(" background-color: Gray;")
|
||
' strBody.Append(" color:White; ")
|
||
' strBody.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
|
||
' strBody.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
|
||
' strBody.Append(" text-decoration:none; ")
|
||
' strBody.Append(" } ")
|
||
' strBody.Append(" .Verde {color: #00CC00;} ")
|
||
' strBody.Append(" .Negro {color: #000000;} ")
|
||
' strBody.Append(" .Rojo {color: #FF0000;} ")
|
||
' strBody.Append(" </style> ")
|
||
' strBody.Append("</head> ")
|
||
' strBody.Append("<body> ")
|
||
' strBody.AppendFormat("<div id='C_div' style='width: 600px'>")
|
||
' strBody.AppendFormat(" <fieldset>")
|
||
' strBody.AppendFormat(" <legend><b>{0}</b></legend>", UsuarioActual.Empresa.Empresa)
|
||
' strBody.AppendFormat(" <table class='TextoG' border='0' cellpadding='0' cellspacing='0' width='100%'>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td style='width:100px'>{0}</td>", UsuarioActual.Empresa.Direccion)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td>Col. {0}</td>", UsuarioActual.Empresa.Colonia)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td>{0}, {1}, C.P.{2}</td>", UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td>RFC {0}</td>", UsuarioActual.Empresa.RFC)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" </table>")
|
||
' strBody.AppendFormat(" </fieldset>")
|
||
' strBody.AppendFormat("</div><br/><br/>")
|
||
|
||
' strBody.AppendFormat("<div style='width: 600px'>")
|
||
' strBody.AppendFormat(" <fieldset>")
|
||
' strBody.AppendFormat(" <legend><b> </b></legend>")
|
||
' strBody.AppendFormat(" <table class='TextoG' style='width:100%'>")
|
||
|
||
' If objIE.CveTipoTransaccion = 1 Then ' cuando es cheque
|
||
' strBody.Append(" <tr style=""height: 22px""> ")
|
||
' strBody.Append(" <td>Favor de pasar a nuestras oficinas por el cheque con la siguientes instrucciones.</td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' End If
|
||
|
||
' If objIE.CveTipoTransaccion = 2 Then ' cuando es transf
|
||
' strBody.Append(" <tr style=""height: 22px""> ")
|
||
' strBody.Append(" <td>Notificación de transferencia de pago realizada.</td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' End If
|
||
|
||
' strBody.Append(" <tr style=""height: 22px""> ")
|
||
' strBody.AppendFormat(" <td> </td> ")
|
||
' strBody.Append(" </tr> ")
|
||
' strBody.Append(" </table> ")
|
||
' strBody.AppendFormat(" </fieldset>")
|
||
' strBody.Append(" </div> ")
|
||
|
||
|
||
' strBody.AppendFormat("<div style='width: 600px'>")
|
||
' strBody.AppendFormat(" <table style='width:100%'>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td style='vertical-align: top'>")
|
||
' strBody.AppendFormat(" <fieldset>")
|
||
' strBody.AppendFormat(" <legend>Beneficiario:<b>{0}</b> </legend>", objIE.PagueseA)
|
||
' strBody.AppendFormat(" <table width='100%'>")
|
||
' strBody.AppendFormat(" <tr style='background-color: gray; color: White; font-family: Verdana; font-size: 10px; text-align: center; vertical-align: middle; font-weight: bold; height: 20px; text-decoration: none;'>")
|
||
' strBody.AppendFormat(" <th scope='col' style='width:150px;'></th>")
|
||
' strBody.AppendFormat(" <th scope='col' style='width:450px;'></th>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Movimiento:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", objIE.TipoTransaccion)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Banco:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", objIE.Banco)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Cuenta:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", objIE.NumCuenta)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' If objIE.CuentaDepositado.ToString <> "" Then
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Cuenta Destino:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", objIE.CuentaDepositado)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' End If
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Fecha:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", objIE.FechaDocumento.ToString("dd/MM/yyyy"))
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Importe:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>$ {0} {1}</td>", objIE.Importe.FormatoNumero, objIE.Moneda)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>Observaciones:</td>")
|
||
' strBody.AppendFormat(" <td style='text-align: left'>{0}</td>", objIE.Observaciones)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td colspan='2'>")
|
||
' strBody.AppendFormat(" <hr />")
|
||
' strBody.AppendFormat(" </td>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" </table>")
|
||
' strBody.AppendFormat(" </fieldset>")
|
||
' strBody.AppendFormat(" </td>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" </table>")
|
||
' strBody.AppendFormat("</div>")
|
||
|
||
|
||
' 'MOVIMIENTOS CHEQUE
|
||
' If objIE.GetBancosIEMovimientos(CveIE, UsuarioActual.CveEmpresa) Then
|
||
' Dim Textov33 As String = ""
|
||
|
||
' Textov33 = "Favor de emitir complemento de pago de los siguientes documentos"
|
||
|
||
|
||
' strBody.AppendFormat("<div style='width: 1000px'>")
|
||
' strBody.AppendFormat(" <table style='width:1000px'>")
|
||
' strBody.AppendFormat(" <tr>")
|
||
' strBody.AppendFormat(" <td style='vertical-align: top'>")
|
||
' strBody.AppendFormat(" <fieldset>")
|
||
' strBody.AppendFormat(" <legend><b>Documentos abonados o pagados <br/>{0}</b> </legend>", Textov33)
|
||
' strBody.AppendFormat(" <table width='1000px'>")
|
||
' strBody.AppendFormat(" <tr style='background-color: gray; color: White; font-family: Verdana; font-size: 10px; text-align: center; vertical-align: middle; font-weight: bold; height: 20px; text-decoration: none;'>")
|
||
' strBody.AppendFormat(" <th scope='col' style='width: 10%'>Fecha</th>")
|
||
' strBody.AppendFormat(" <th scope='col' style='width: 20%'>Factura</th>")
|
||
' strBody.AppendFormat(" <th scope='col' style='width: 20%'>Importe ($)</th>")
|
||
' strBody.AppendFormat(" <th scope='col' style='width: 40%'>Folio Fiscal</th>")
|
||
' strBody.AppendFormat(" <th scope='col' style='width: 15%'>NC Aplicadas</th>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
|
||
|
||
' For Each dr As DataRow In objIE.DtResultados.FiltraParametros("CveConceptoContable IN (17) AND CveCompra > 0").Rows
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td>{0}</td>", dr("Fecha").ToString.ToDate.ToShortDateString())
|
||
' strBody.AppendFormat(" <td>{0}</td>", dr("SerieFolio").ToString)
|
||
' strBody.AppendFormat(" <td style='text-align: right'>$ {0}</td>", dr("Importe").ToString.FormatoNumero)
|
||
' strBody.AppendFormat(" <td>{0}</td>", dr("FolioFiscal"))
|
||
' strBody.AppendFormat(" <td>{0}</td>", dr("ImporteNC").ToString.FormatoNumero)
|
||
' strBody.AppendFormat(" </tr>")
|
||
' Next
|
||
|
||
|
||
' strBody.AppendFormat(" <tr class='Texto'>")
|
||
' strBody.AppendFormat(" <td colspan='5'>")
|
||
' strBody.AppendFormat(" <hr />")
|
||
' strBody.AppendFormat(" </td>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" </table>")
|
||
' strBody.AppendFormat(" </fieldset>")
|
||
' strBody.AppendFormat(" </td>")
|
||
' strBody.AppendFormat(" </tr>")
|
||
' strBody.AppendFormat(" </table>")
|
||
' strBody.AppendFormat("</div>")
|
||
' End If
|
||
|
||
' strBody.Append(" <div> Favor de no responder a este correo. </div> ")
|
||
|
||
' strBody.Append("</body></html>")
|
||
' End If
|
||
|
||
' objIE.Dispose()
|
||
' Return strBody.ToString
|
||
'End Function
|
||
|
||
|
||
#End Region
|
||
|
||
|
||
|
||
|
||
|
||
#Region " IMPRIMIR "
|
||
Protected Sub BtnReporteAltaCarga_Click(sender As Object, e As EventArgs)
|
||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta))
|
||
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
||
|
||
|
||
'Estatus visible
|
||
Dim params As New List(Of ReportParameter)
|
||
params.Add(New ReportParameter("MostrarEstatus", "True"))
|
||
|
||
If Archivo.Exists Then
|
||
'ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/LayoutAltaProveedor.rdlc", DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
|
||
ImprimirPDF(String.Format("{0}Formatos\LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta), DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
|
||
Else
|
||
|
||
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
||
|
||
|
||
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
|
||
params.Add(New ReportParameter("Direccion", UsuarioActual.Empresa.Direccion))
|
||
params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
|
||
params.Add(New ReportParameter("FechaImpresion", NowADS().ToString("dd/MM/yyyy")))
|
||
|
||
|
||
ImprimirPDF("Empresas/Grales/Formatos/LayoutAltaProveedor.rdlc", DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
|
||
End If
|
||
End Sub
|
||
Protected Sub BtnReporteAltaGenera_Click(sender As Object, e As EventArgs)
|
||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta))
|
||
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
||
|
||
'Estatus no visible
|
||
Dim params As New List(Of ReportParameter)
|
||
params.Add(New ReportParameter("MostrarEstatus", "False"))
|
||
|
||
If Archivo.Exists Then
|
||
ImprimirPDF(String.Format("{0}Formatos\LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta), DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
|
||
Else
|
||
|
||
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
||
|
||
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
|
||
params.Add(New ReportParameter("Direccion", UsuarioActual.Empresa.Direccion))
|
||
params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
|
||
params.Add(New ReportParameter("FechaImpresion", NowADS().ToString("dd/MM/yyyy")))
|
||
ImprimirPDF("Empresas/Grales/Formatos/LayoutAltaProveedor.rdlc", DtAlta, params, "LayoutAltaProveedor", RDSName:="DsPagoElectronico")
|
||
End If
|
||
|
||
End Sub
|
||
Protected Sub BtnReportePago_Click(sender As Object, e As EventArgs)
|
||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta))
|
||
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
||
|
||
Dim params As New List(Of ReportParameter)
|
||
|
||
|
||
If Archivo.Exists Then
|
||
ImprimirPDF(String.Format("{0}Formatos\LayoutPagoProveedor.rdlc", UsuarioActual.Empresa.Ruta), DtPago, params, "LayoutPagoProveedor", RDSName:="DSPagoElectronicoV2")
|
||
Else
|
||
|
||
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
||
|
||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||
params.Add(New ReportParameter("Direccion", UsuarioActual.Empresa.Direccion))
|
||
params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
|
||
params.Add(New ReportParameter("FechaImpresion", NowADS().ToString("dd/MM/yyyy")))
|
||
|
||
|
||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||
params.Add(New ReportParameter("Titulo", "Reporte Pago Proveedor Layout"))
|
||
|
||
ImprimirPDF("Empresas/Grales/Formatos/LayoutPagoProveedor.rdlc", DtPago, params, "LayoutPagoProveedor", RDSName:="DSPagoElectronicoV2")
|
||
End If
|
||
|
||
End Sub
|
||
#End Region
|
||
|
||
|
||
'NO QUITAR, SE OCUPA PARA EXPORTAR PDF
|
||
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
||
Return
|
||
End Sub
|
||
|
||
|
||
|
||
Friend Class ClsPagoScotiaDetalle
|
||
|
||
Public Property CodigoRespuesta As String
|
||
Public Property OK As Boolean
|
||
Public Property Correo As String
|
||
Public Property CveIE As Integer
|
||
Public Property ErrorRechazo As String
|
||
Public Property FechaAplicacion As Date
|
||
Public Property Importe As Decimal
|
||
|
||
Public Sub New()
|
||
|
||
End Sub
|
||
|
||
End Class
|
||
|
||
|
||
End Class
|