2783 lines
142 KiB
VB.net
2783 lines
142 KiB
VB.net
Option Explicit On
|
||
Option Strict On
|
||
|
||
Imports System.Data
|
||
Imports Extensiones
|
||
Imports System.IO
|
||
Imports Ionic.Zip
|
||
Imports Microsoft.Reporting.WebForms
|
||
|
||
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
|
||
#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 = Date.Now.ToShortDateString
|
||
txtFechaF.Text = Date.Now.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).FiltraParametros("UsaLayout = 1")
|
||
DdlCuenta.DataBind()
|
||
UpFiltros.Update()
|
||
|
||
DdlCuentaReportes.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).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 Movimientos = 0
|
||
Dim Importe = 0.0
|
||
|
||
For Each dr As DataRow In DTPendientes.Rows
|
||
|
||
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
|
||
Movimientos += 1
|
||
Importe += dr("Abonado").ToString.ToDouble
|
||
End If
|
||
Next
|
||
|
||
LbNumeroAltas.Text = Altas.ToString
|
||
LbNumeroInterbancarias.Text = Interbancarias.ToString
|
||
LbNumeroBancomer.Text = Bancomer.ToString
|
||
|
||
LbNumeroMovimientos.Text = Movimientos.ToString
|
||
LbImporteMovimientos.Text = Importe.ToString.FormatoNumero
|
||
|
||
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, Date.Now.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) As Boolean
|
||
'If Not System.IO.Directory.Exists(String.Format("{0}Layout", UsuarioActual.Empresa.Ruta)) Then
|
||
' Alert("Ocurrio un error al crear el registro del archivo.", TipoMensaje.MsgError)
|
||
' Return False
|
||
'End If
|
||
|
||
DirectoryExistsCreate(String.Format("{0}Layout", UsuarioActual.Empresa.Ruta))
|
||
|
||
NombreArchivo = String.Format("{2}{1}{0}.txt", UsuarioActual.CveUsuario, Date.Now.ToString("yyyyMMdd-HH-mm"), If(Tipo = 1, "LAYOUTPAGO", "LAYOUTALTA"))
|
||
|
||
Dim path As String = String.Format("{0}Layout\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo)
|
||
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()
|
||
|
||
Return True
|
||
End Function
|
||
Private Function GuardaTXT() As Boolean
|
||
Dim Retorno = True
|
||
Try
|
||
Dim Ruta = ""
|
||
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 " 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 <> Date.Now.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 = 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 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 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
|
||
|
||
AltaProveedores(1)
|
||
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 = 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 = 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 = ""
|
||
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 = 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), DateTime.Now().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), DateTime.Now().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 = 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 = 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 = 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 = ""
|
||
|
||
'todas las palabras menos las 2 ultimas forman parte del nombre
|
||
For index = 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), DateTime.Now().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, DateTime.Now().ToString("yyyyMMdd")))
|
||
|
||
HeaderTexto &= String.Format("{0}{1}", IdentificadoUsuario, DateTime.Now().ToString("yyyyMMdd")).PadRight(20)
|
||
'Campos #6-8 del Header
|
||
HeaderTexto &= String.Format("00").PadRight(586)
|
||
Dim HeaderLength = 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
|
||
|
||
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
|
||
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 = 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 = System.IO.Directory.Exists(path)
|
||
If Not exists Then
|
||
System.IO.Directory.CreateDirectory(path)
|
||
End If
|
||
|
||
Dim CveIEs = ""
|
||
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(Date.Now, Date.Now, 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, Date.Now) Then
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
'GUARDAMOS EL ENVIO SI NO ES REGENERACION
|
||
Else
|
||
Dim CveLayoutEnvio = ObjBancos.AddLayoutEnvios(NombreArchivo, Date.Now, 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 = 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 = 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 = 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), DateTime.Now.ToString("yyyy-MM-dd"), "0001-01-01", Observaciones.PadRight(700), Vacio.PadRight(52))
|
||
TotalAcumulado += Importe.ToDouble
|
||
|
||
|
||
|
||
''LLENA DTPAGOS PARA REPORTE
|
||
Dim Row = 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), DateTime.Now().ToString("yyyy-MM-dd"))
|
||
'Campo #5 del Header
|
||
HeaderTexto &= String.Format("P{0}{1}", DateTime.Now().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 = 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() = Texto.Split(CChar(vbCrLf))
|
||
|
||
'Alert(TextoArreglo.Length.ToString)
|
||
|
||
'LEE LINEA POR LINEA
|
||
Dim RespuestaHeader = "", RespuestaDetalle = "", RespuestaTrailer = "", CveCuentasDeposito = ""
|
||
CreaDtAlta()
|
||
Dim ObjGrales As New ClsGenerales
|
||
Dim Row As DataRow = Nothing
|
||
Dim TipoCuentaDeposito = ""
|
||
|
||
For i = 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() = RespuestaDetalle.Split(CChar(vbCrLf))
|
||
|
||
'DIVIDE TRAILER
|
||
Dim Trailer() = 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 = 1
|
||
Dim Style = ""
|
||
Dim TotalExitos = 0, TotalFracasos = 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 = False
|
||
ObjIE.IniciaTransacSQL()
|
||
Dim ArrayCuentasDeposito() = CveCuentasDeposito.Split(","c)
|
||
|
||
For index = 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
|
||
|
||
'ELIMINA TXT
|
||
My.Computer.FileSystem.DeleteFile(NombreArchivo)
|
||
|
||
RecargaDatos()
|
||
|
||
End Sub
|
||
#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 = False
|
||
Dim TextoErrorArchivo = "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() = Texto.Split(CChar(vbCrLf))
|
||
|
||
'INICIALIZA VARIABLES
|
||
Dim ObjBancos As New ClsBancos
|
||
Dim RespuestaHeader = "", RespuestaDetalle = "", RespuestaTrailer = "", Proveedor = "", CuentaAbono = "", Estatus = "", CveIEs = "", EstatusIEs = "", FechaMovto = "", Correos = ""
|
||
Dim Row As DataRow = Nothing
|
||
Dim Convenio = ""
|
||
CreaDtPago()
|
||
|
||
'LEE LINEA POR LINEA
|
||
For i = 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() = 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() = 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 = 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 = False
|
||
ObjIE.IniciaTransacSQL()
|
||
Dim ArrayCveIEs() = CveIEs.Split(","c)
|
||
Dim ArrayEstatusIEs() = EstatusIEs.Split(","c)
|
||
Dim ArrayFechasMovto() = FechaMovto.Split(","c)
|
||
Dim ArrayCorreos() = 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 = 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 CorreosMovto() = ArrayCorreos(index).Split(";"c)
|
||
'For index2 = 0 To CorreosMovto.Length - 1
|
||
' If CorreosMovto(index2).Length > 5 Then
|
||
' End If
|
||
'Next
|
||
|
||
Dim Param As New List(Of String)
|
||
|
||
Param.Add(ArrayCorreos(index)) 'Para
|
||
Param.Add("Notificación de Pago") 'Asunto
|
||
|
||
Param.Add(GeneraCorreo2(DtPago.Rows(index), ObjIE, ArrayCveIEs(index).ToEntero)) 'Body
|
||
|
||
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 Not ObjIE.CancelarBancos_IE(UsuarioActual.CveUsuario, ArrayCveIEs(index).ToEntero, False, -1, -1) 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
|
||
|
||
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
|
||
|
||
'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 = 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 = 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 = ""
|
||
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 = 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), DateTime.Now().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), DateTime.Now().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 = 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), DateTime.Now().ToString("yyyy-MM-dd"))
|
||
'Campo #5 del Header
|
||
HeaderTexto &= String.Format("{0}{1}", UsuarioActual.CveUsuario, DateTime.Now().ToString("yyyyMMdd")).PadRight(20)
|
||
'Campos #6-8 del Header
|
||
HeaderTexto &= String.Format("00").PadRight(586)
|
||
Dim HeaderLength = 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 = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
|
||
Dim FechaF = 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
|
||
AltaProveedores(2)
|
||
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 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> ", Date.Now.ToLongDateString, Date.Now.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 = ""
|
||
If UsuarioActual.Empresa.Funcionalidad(520) = "1" Then
|
||
Textov33 = "Favor de emitir complemento de pago de los siguientes documentos"
|
||
End If
|
||
|
||
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(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||
|
||
|
||
'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
|
||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||
|
||
If Imagen.Exists Then
|
||
params.Add(New ReportParameter("LogoPath", logouri))
|
||
Else
|
||
params.Add(New ReportParameter("LogoPath", ""))
|
||
End If
|
||
|
||
|
||
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", DateTime.Now.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(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||
|
||
'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
|
||
|
||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||
|
||
If Imagen.Exists Then
|
||
params.Add(New ReportParameter("LogoPath", logouri))
|
||
Else
|
||
params.Add(New ReportParameter("LogoPath", ""))
|
||
End If
|
||
|
||
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", DateTime.Now.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(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||
|
||
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
|
||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||
|
||
If Imagen.Exists Then
|
||
params.Add(New ReportParameter("LogoPath", logouri))
|
||
Else
|
||
params.Add(New ReportParameter("LogoPath", ""))
|
||
End If
|
||
|
||
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", DateTime.Now.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
|
||
|
||
|
||
|
||
End Class
|