3326 lines
138 KiB
VB.net
3326 lines
138 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_PagoElectronicoGrupos
|
||
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 DT_PagosReporte As DataTable
|
||
Get
|
||
Return CType(ViewState("DT_PagosReporte"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DT_PagosReporte") = value
|
||
End Set
|
||
End Property
|
||
|
||
|
||
|
||
Private Property DTAltasPendientes As DataTable
|
||
Get
|
||
Return CType(ViewState("DTAltasPendientes"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTAltasPendientes") = value
|
||
End Set
|
||
End Property
|
||
|
||
Private Property DTProveedores As DataTable
|
||
Get
|
||
Return CType(ViewState("DTProveedores"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTProveedores") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTFyE As DataTable
|
||
Get
|
||
Return CType(ViewState("DTFyE"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTFyE") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTReportes As DataTable
|
||
Get
|
||
Return CType(ViewState("DTReportes"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTReportes") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTPendienteActual As DataTable
|
||
Get
|
||
Return CType(ViewState("DTPendienteActual"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTPendienteActual") = value
|
||
End Set
|
||
End Property
|
||
Private Property DTEnviadas As DataTable
|
||
Get
|
||
Return CType(ViewState("DTEnviadas"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTEnviadas") = value
|
||
End Set
|
||
End Property
|
||
Private ReadOnly Property PadCeros As Char
|
||
Get
|
||
Return "0"c
|
||
End Get
|
||
End Property
|
||
Private Property TotalAcumulado As Double
|
||
Get
|
||
Return ViewState("TotalAcumulado").ToString.ToDouble
|
||
End Get
|
||
Set(value As Double)
|
||
ViewState("TotalAcumulado") = value
|
||
End Set
|
||
End Property
|
||
Private Property CveCuenta As Integer
|
||
Get
|
||
Return ViewState("CveCuenta").ToString.ToEntero
|
||
End Get
|
||
Set(value As Integer)
|
||
ViewState("CveCuenta") = value
|
||
End Set
|
||
End Property
|
||
Private Property DtPago As DataTable
|
||
Get
|
||
Return CType(ViewState("DtPago"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DtPago") = value
|
||
End Set
|
||
End Property
|
||
Private Property DtAlta As DataTable
|
||
Get
|
||
Return CType(ViewState("DtAlta"), DataTable)
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DtAlta") = value
|
||
End Set
|
||
End Property
|
||
Private Property CorreoNotificacionesEmpresa As String
|
||
Get
|
||
Return ViewState("CorreoNotificacionesEmpresa").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("CorreoNotificacionesEmpresa") = value
|
||
End Set
|
||
End Property
|
||
Private Property TipoMasiva As Integer
|
||
Get
|
||
Return ViewState("TipoMasiva").ToString.ToEntero
|
||
End Get
|
||
Set(value As Integer)
|
||
ViewState("TipoMasiva") = value
|
||
End Set
|
||
End Property
|
||
|
||
Private Property NombreArchivoBancomer As String
|
||
Get
|
||
Return ViewState("NombreArchivoBancomer").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("NombreArchivoBancomer") = value
|
||
End Set
|
||
End Property
|
||
|
||
Private Property NombreArchivoInterbancario As String
|
||
Get
|
||
Return ViewState("NombreArchivoInterbancario").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("NombreArchivoInterbancario") = value
|
||
End Set
|
||
End Property
|
||
|
||
|
||
Private Property NombreArchivoCIE As String
|
||
Get
|
||
Return ViewState("NombreArchivoCIE").ToString
|
||
End Get
|
||
Set(value As String)
|
||
ViewState("NombreArchivoCIE") = value
|
||
End Set
|
||
End Property
|
||
|
||
Property DTSATBancos As DataTable
|
||
Get
|
||
If ViewState("DTSATBancos") Is Nothing Then
|
||
Return New DataTable
|
||
Else
|
||
Return DirectCast(ViewState("DTSATBancos"), DataTable)
|
||
End If
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTSATBancos") = value
|
||
End Set
|
||
End Property
|
||
|
||
|
||
Property CveIEPagoActual As Integer
|
||
Get
|
||
If ViewState("CveIEPagoActual") Is Nothing Then
|
||
Return -1
|
||
Else
|
||
Return ViewState("CveIEPagoActual").ToString.ToEntero
|
||
End If
|
||
End Get
|
||
Set(value As Integer)
|
||
ViewState("CveIEPagoActual") = value
|
||
End Set
|
||
End Property
|
||
|
||
Property CveLayoutEnvioDetalleActual As Integer
|
||
Get
|
||
If ViewState("CveLayoutEnvioDetalleActual") Is Nothing Then
|
||
Return -1
|
||
Else
|
||
Return ViewState("CveLayoutEnvioDetalleActual").ToString.ToEntero
|
||
End If
|
||
End Get
|
||
Set(value As Integer)
|
||
ViewState("CveLayoutEnvioDetalleActual") = value
|
||
End Set
|
||
End Property
|
||
|
||
Property GvIndexActual As Integer
|
||
Get
|
||
If ViewState("GvIndexActual") Is Nothing Then
|
||
Return -1
|
||
Else
|
||
Return ViewState("GvIndexActual").ToString.ToEntero
|
||
End If
|
||
End Get
|
||
Set(value As Integer)
|
||
ViewState("GvIndexActual") = value
|
||
End Set
|
||
|
||
End Property
|
||
|
||
|
||
Property DTFoliosPrefijos As DataTable
|
||
Get
|
||
If ViewState("DTFoliosPrefijos") Is Nothing Then
|
||
Crate_DTFoliosPrefijos()
|
||
Return DirectCast(ViewState("DTFoliosPrefijos"), DataTable)
|
||
Else
|
||
Return DirectCast(ViewState("DTFoliosPrefijos"), DataTable)
|
||
End If
|
||
End Get
|
||
Set(value As DataTable)
|
||
ViewState("DTFoliosPrefijos") = 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
|
||
|
||
|
||
Private Sub Crate_DTFoliosPrefijos()
|
||
|
||
Dim DTFolios As New DataTable
|
||
DTFolios.Columns.Add("CveIE", GetType(Integer))
|
||
DTFolios.Columns.Add("Folio", GetType(String))
|
||
DTFolios.AcceptChanges()
|
||
|
||
ViewState("DTFoliosPrefijos") = DTFolios.Copy
|
||
|
||
|
||
|
||
End Sub
|
||
|
||
|
||
#Region " C A R G A - D A T O S "
|
||
Private Sub CargaCuentas()
|
||
DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("UsaLayoutGrupos = 1")
|
||
DdlCuenta.DataBind()
|
||
UpFiltros.Update()
|
||
|
||
DdlCuentaReportes.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("UsaLayoutGrupos = 1")
|
||
DdlCuentaReportes.DataBind()
|
||
UpFiltrosReporte.Update()
|
||
|
||
|
||
DdlCuentaEnviados.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("UsaLayoutGrupos = 1")
|
||
DdlCuentaEnviados.DataBind()
|
||
UpFiltroEnviados.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, PorGrupos:=True) Then
|
||
DTPendientes = ObjBancos.DtResultados
|
||
Else
|
||
DTPendientes = Nothing
|
||
End If
|
||
|
||
|
||
|
||
ObjBancos.Dispose()
|
||
|
||
|
||
|
||
If DTPendientes IsNot Nothing AndAlso DTPendientes.Rows.Count > 0 Then
|
||
CargaDatosInformativos()
|
||
Else
|
||
LbNumeroMovimientos.Text = "0"
|
||
LbImporteMovimientos.Text = "0"
|
||
UpComandosGeneracion.Update()
|
||
End If
|
||
|
||
|
||
'Carga GvPendientes
|
||
If DTPendientes IsNot Nothing AndAlso DTPendientes.Rows.Count > 0 Then
|
||
GvPendientes.DataSource = DTPendientes
|
||
End If
|
||
|
||
GvPendientes.DataBind()
|
||
UpEnviados.Update()
|
||
|
||
UpGVDatos.Update()
|
||
|
||
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("EstatusPagoElectronicoGrupos").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
|
||
|
||
LnkNumeroAltas.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, Optional MismoBanco As Boolean = True, Optional ByRef NombreArchivoEnviado As String = "") As Boolean
|
||
|
||
|
||
System.Threading.Thread.Sleep(1000) 'Un segundo de diferencia Para doferentes tipos de bancos
|
||
|
||
DirectoryExistsCreate(String.Format("{0}Layout", UsuarioActual.Empresa.Ruta))
|
||
|
||
NombreArchivo = String.Format("{2}{1}{0}.txt", UsuarioActual.CveUsuario, Date.Now.ToString("yyyyMMdd-HH-mm-ss"), If(Tipo = 1, "LAYOUTPAGO", "LAYOUTALTA"))
|
||
|
||
If Tipo = 1 Then
|
||
NombreArchivo = String.Format("{2}{1}{0}.txt", UsuarioActual.CveUsuario, Date.Now.ToString("yyyyMMdd-HH-mm-ss"), "LAYOUTPAGO")
|
||
Else
|
||
NombreArchivo = String.Format("{2}{1}{0}{3}.txt", UsuarioActual.CveUsuario, Date.Now.ToString("yyyyMMdd-HH-mm-ss"), "LAYOUTALTA", If(MismoBanco, "BANCOMER", "INTERBANCARIO"))
|
||
End If
|
||
|
||
If NombreArchivoEnviado.Length > 0 Then
|
||
NombreArchivo = NombreArchivoEnviado
|
||
Else
|
||
NombreArchivoEnviado = NombreArchivo
|
||
End If
|
||
|
||
Dim path As String = String.Format("{0}Layout\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo)
|
||
|
||
If File.Exists(path) Then
|
||
|
||
File.Delete(path)
|
||
|
||
End If
|
||
|
||
Dim fs As FileStream = File.Create(path)
|
||
|
||
' 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
|
||
|
||
Dim LnkAyuda As LinkButton = e.Row.FCLinkButton("LnkAyuda")
|
||
|
||
'Colorea GV
|
||
If e.Row.DBCampo("RazonSocial").ToString = "" Then
|
||
e.Row.BackColor = Drawing.Color.WhiteSmoke
|
||
Else
|
||
If e.Row.DBCampo("EstatusPagoElectronicoGrupos").ToString <> "True" Then
|
||
|
||
'e.Row.BackColor = Drawing.Color.LightSalmon
|
||
e.Row.ToolTip = "Cuenta Deposito aun sin dar de Alta."
|
||
|
||
LnkAyuda.Attributes.Add("data-content", "Cuenta Deposito aún sin dar de Alta.")
|
||
LnkAyuda.Visible = True
|
||
|
||
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"
|
||
|
||
LnkAyuda.Attributes.Add("data-content", "Sin Cuenta Deposito asignada")
|
||
LnkAyuda.Visible = True
|
||
|
||
|
||
|
||
End If
|
||
|
||
If e.Row.DBCampo("EstatusCtaDeposito").ToString = "False" Then
|
||
'e.Row.Cells(0).BackColor = Drawing.Color.Red
|
||
e.Row.ToolTip = "Cuenta Deposito INACTIVA"
|
||
LnkAyuda.Attributes.Add("data-content", "Cuenta Deposito INACTIVA")
|
||
LnkAyuda.Visible = True
|
||
|
||
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
|
||
|
||
|
||
e.Row.FCLabel("LblArchivo").Visible = True
|
||
e.Row.FCLabel("LblArchivo").Text = e.Row.DataKey("Archivo")
|
||
|
||
'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
|
||
|
||
|
||
e.Row.FCTextBox("TxtFolio").Visible = False
|
||
e.Row.FCLinkButton("ImgUpload").Visible = False
|
||
e.Row.FCLinkButton("LnkGvCancelar").Visible = False
|
||
e.Row.FCLinkButton("LnkGvConfirmar").Visible = False
|
||
|
||
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"))
|
||
|
||
|
||
If e.Row.DataKey("Estatus").ToEntero.contiene(2, 3) Then
|
||
|
||
e.Row.FCLinkButton("ImgUpload").Visible = False
|
||
e.Row.FCLinkButton("LnkGvCancelar").Visible = False
|
||
e.Row.FCLinkButton("LnkGvConfirmar").Visible = False
|
||
e.Row.FCTextBox("TxtFolio").Visible = False
|
||
|
||
End If
|
||
|
||
End If
|
||
|
||
|
||
|
||
End If
|
||
|
||
End Sub
|
||
Protected Sub LBRegenerar_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||
|
||
Dim CveBLE = CType(sender, LinkButton).CommandArgument.ToEntero
|
||
Dim DtRegenerar As New DataTable
|
||
|
||
Dim NombreDelArchivo As String = GvRow.DataKey("Archivo")
|
||
|
||
Dim ObjBancos As New ClsBancos
|
||
If ObjBancos.GetLayoutPagos(DdlCuentaEnviados.SelectedValue.ToEntero, CveBLE, "-1", PorGrupos:=True) Then
|
||
DtRegenerar = ObjBancos.DtResultados
|
||
Else
|
||
DtRegenerar = Nothing
|
||
End If
|
||
ObjBancos.Dispose()
|
||
|
||
If DtRegenerar IsNot Nothing Then
|
||
GeneraPago(DtRegenerar, False, NombreDelArchivo)
|
||
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()
|
||
End Sub
|
||
|
||
Private Sub AltaProveedores(Optional DtCuentasPendientesTemp As DataTable = Nothing)
|
||
|
||
NombreArchivoBancomer = ""
|
||
NombreArchivoInterbancario = ""
|
||
NombreArchivoCIE = ""
|
||
|
||
DVDescargaCuentas1.Visible = False
|
||
DVDescargaCuentas2.Visible = False
|
||
DVDescargaCuentas3.Visible = False
|
||
|
||
NombreArchivo = ""
|
||
|
||
Dim RegistrosAltaBancomer As New StringBuilder
|
||
Dim RegistrosAltaBancomerCIE As New StringBuilder
|
||
Dim RegistrosAltaInterbancario As New StringBuilder
|
||
Dim SBErrores As New StringBuilder
|
||
|
||
|
||
|
||
Dim CeroRelleno As Char = "0"c
|
||
Dim EspacioRelleno As Char = Chr(32)
|
||
Dim ErrorLayout = False
|
||
|
||
|
||
If DtCuentasPendientesTemp Is Nothing Then
|
||
DtCuentasPendientesTemp = DTPendientes.Copy
|
||
End If
|
||
|
||
|
||
|
||
DtCuentasPendientesTemp.CaseSensitive = False
|
||
|
||
Dim DtCuentasPendientesBancomer As DataTable = DtCuentasPendientesTemp.FiltraParametros($" (EstatusPagoElectronicoGrupos IS NULL OR EstatusPagoElectronicoGrupos = False) AND (BancoNombre like '%BBVA%' OR BancoNombre like '%BANCOMER%' AND CveBanco = '012' AND LEN(CIE) = 0) ", "", {"CveCuentaDeposito", "BancoNombre", "CLABEDestino", "Abreviatura", "RazonSocial", "CveProveedor", "CveBanco", "Cuenta", "BBVAAlias", "CIE"})
|
||
Dim DtCuentasPendientesCIE As DataTable = DtCuentasPendientesTemp.FiltraParametros($" (EstatusPagoElectronicoGrupos IS NULL OR EstatusPagoElectronicoGrupos = False) AND (BancoNombre like '%BBVA%' OR BancoNombre like '%BANCOMER%' AND LEN(CIE) > 0 AND CveBanco = '012') ", "", {"CveCuentaDeposito", "BancoNombre", "CLABEDestino", "Abreviatura", "RazonSocial", "CveProveedor", "CveBanco", "Cuenta", "BBVAAlias", "CIE"})
|
||
Dim DtCuentasPendientesInterbancarias As DataTable = DtCuentasPendientesTemp.FiltraParametros($" (EstatusPagoElectronicoGrupos IS NULL OR EstatusPagoElectronicoGrupos = False) AND (BancoNombre not like '%BBVA%' AND BancoNombre not like '%BANCOMER%' ) ", "", {"CveCuentaDeposito", "BancoNombre", "CLABEDestino", "Abreviatura", "RazonSocial", "CveProveedor", "CveBanco", "Cuenta", "BBVAAlias", "CIE"})
|
||
|
||
|
||
|
||
'Cuentas bancomer
|
||
If DtCuentasPendientesBancomer.Rows.Count > 0 Then
|
||
For Each dRow As DataRow In DtCuentasPendientesBancomer.Rows
|
||
|
||
Dim SBTmpBancomer As New StringBuilder
|
||
Dim SBErroresBancomer As New StringBuilder
|
||
Dim ErrorLineaBancomer As Boolean = False
|
||
|
||
SBErroresBancomer.Append($"{dRow("RazonSocial").ToString } ")
|
||
SBErroresBancomer.Append($"Cuenta: {dRow("Cuenta").ToString } ")
|
||
|
||
If dRow("CLABEDestino").ToString.Length <= 18 Then 'Tamaño maximo 18
|
||
SBTmpBancomer.Append(dRow("CLABEDestino").ToString.PadLeft(18, CeroRelleno))
|
||
Else
|
||
SBErroresBancomer.Append("La cuenta beneficiaria no puede ser mayor a 18 caracteres, ")
|
||
ErrorLineaBancomer = True
|
||
End If
|
||
|
||
If dRow("Abreviatura").ToString.Length = 3 Then
|
||
SBTmpBancomer.Append(dRow("Abreviatura"))
|
||
Else
|
||
SBErroresBancomer.Append("El tamaño de la divisa es incorrecto, ")
|
||
ErrorLineaBancomer = True
|
||
End If
|
||
|
||
SBTmpBancomer.Append("0999999999999.99")
|
||
|
||
If dRow("RazonSocial").ToString.Trim.Length < 31 Then 'Tamaño maximo 30
|
||
SBTmpBancomer.Append(dRow("RazonSocial").ToString.PadRight(30, EspacioRelleno))
|
||
Else
|
||
SBTmpBancomer.Append(dRow("RazonSocial").ToString.Trim.Substring(0, 30))
|
||
End If
|
||
|
||
'ALIAS DE LA CUENTA PENDIENTE TAMAÑO MAXIMO 30
|
||
SBTmpBancomer.Append(dRow("BBVAAlias").ToString.PadRight(30, EspacioRelleno))
|
||
|
||
'CORREO OPCIONAL TAMAÑO MAXIMO 80
|
||
'RegistrosAlta.Append("".ToString.PadLeft(80, EspacioRelleno))
|
||
|
||
SBTmpBancomer.Append(vbCrLf)
|
||
|
||
|
||
If Not ErrorLineaBancomer Then
|
||
RegistrosAltaBancomer.Append(SBTmpBancomer.ToString)
|
||
' ObjGrales.UpdateCuentasDepositosEstatusPagoElectronicoGrupos(dRow("CveCuentaDeposito").ToString.ToEntero, True)
|
||
Else
|
||
SBErroresBancomer.Append("<br>")
|
||
SBErrores.AppendLine(SBErroresBancomer.ToString)
|
||
End If
|
||
|
||
|
||
Next
|
||
|
||
TextoCompleto = RegistrosAltaBancomer.ToString
|
||
|
||
If CreaArchivo(2, True) Then
|
||
NombreArchivoBancomer = NombreArchivo
|
||
End If
|
||
|
||
End If
|
||
|
||
|
||
'Cuentas bancomer CIE
|
||
If DtCuentasPendientesCIE.Rows.Count > 0 Then
|
||
For Each dRow As DataRow In DtCuentasPendientesCIE.Rows
|
||
|
||
Dim SBTmpBancomerCIE As New StringBuilder
|
||
Dim SBErroresBancomerCIE As New StringBuilder
|
||
Dim ErrorLineaBancomerCIE As Boolean = False
|
||
|
||
SBErroresBancomerCIE.Append($"{dRow("RazonSocial").ToString } ")
|
||
SBErroresBancomerCIE.Append($"Cuenta: {dRow("Cuenta").ToString } ")
|
||
|
||
SBTmpBancomerCIE.Append("CV")
|
||
SBTmpBancomerCIE.Append(dRow("CIE").ToString.PadLeft(18, CeroRelleno))
|
||
|
||
If dRow("Abreviatura").ToString.Length = 3 Then
|
||
SBTmpBancomerCIE.Append(dRow("Abreviatura"))
|
||
Else
|
||
SBErroresBancomerCIE.Append("El tamaño de la divisa es incorrecto, ")
|
||
ErrorLineaBancomerCIE = True
|
||
End If
|
||
|
||
SBTmpBancomerCIE.Append("0999999999999.99")
|
||
|
||
If dRow("RazonSocial").ToString.Trim.Length < 31 Then 'Tamaño maximo 30
|
||
SBTmpBancomerCIE.Append(dRow("RazonSocial").ToString.PadRight(30, EspacioRelleno))
|
||
Else
|
||
SBTmpBancomerCIE.Append(dRow("RazonSocial").ToString.Trim.Substring(0, 30))
|
||
End If
|
||
|
||
'ALIAS DE LA CUENTA PENDIENTE TAMAÑO MAXIMO 30
|
||
SBTmpBancomerCIE.Append(dRow("BBVAAlias").ToString.PadRight(30, EspacioRelleno))
|
||
|
||
SBTmpBancomerCIE.Append(vbCrLf)
|
||
|
||
If Not ErrorLineaBancomerCIE Then
|
||
RegistrosAltaBancomerCIE.Append(SBTmpBancomerCIE.ToString)
|
||
Else
|
||
SBErroresBancomerCIE.Append("<br>")
|
||
SBErrores.AppendLine(SBErroresBancomerCIE.ToString)
|
||
End If
|
||
|
||
Next
|
||
|
||
TextoCompleto = RegistrosAltaBancomerCIE.ToString
|
||
|
||
If CreaArchivo(2, True) Then
|
||
NombreArchivoCIE = NombreArchivo
|
||
End If
|
||
|
||
End If
|
||
|
||
|
||
|
||
If DtCuentasPendientesInterbancarias.Rows.Count > 0 Then
|
||
|
||
For Each dRow As DataRow In DtCuentasPendientesInterbancarias.Rows
|
||
|
||
Dim SBTmpInterbancarias As New StringBuilder
|
||
Dim SBErroresInterBancario As New StringBuilder
|
||
Dim ErrorLineaInterbancaria As Boolean = False
|
||
|
||
SBErroresInterBancario.Append($"{dRow("RazonSocial").ToString } ")
|
||
SBErroresInterBancario.Append($"Cuenta: {dRow("Cuenta").ToString } ")
|
||
|
||
If dRow("CveBanco").ToString.Trim.Length = 3 Then
|
||
SBTmpInterbancarias.Append(dRow("CveBanco").ToString.Trim)
|
||
Else
|
||
SBErroresInterBancario.Append("clave ABM(Clave SAT) incorrecta, ")
|
||
ErrorLineaInterbancaria = True
|
||
End If
|
||
|
||
|
||
If dRow("CLABEDestino").ToString.Length <= 18 Then 'Tamaño maximo 18
|
||
SBTmpInterbancarias.Append(dRow("CLABEDestino").ToString.PadLeft(18, CeroRelleno))
|
||
Else
|
||
SBErroresInterBancario.Append("La cuenta beneficiaria no puede ser mayor a 18 caracteres, ")
|
||
ErrorLineaInterbancaria = True
|
||
End If
|
||
|
||
If dRow("Abreviatura").ToString.Length = 3 Then
|
||
SBTmpInterbancarias.Append(dRow("Abreviatura").ToString.Trim)
|
||
Else
|
||
SBErroresInterBancario.Append("El tamaño de la divisa es incorrecto, ")
|
||
ErrorLineaInterbancaria = True
|
||
End If
|
||
|
||
SBTmpInterbancarias.Append("0999999999999.99")
|
||
|
||
If dRow("RazonSocial").ToString.Trim.Length < 31 Then 'Tamaño maximo 30
|
||
SBTmpInterbancarias.Append(dRow("RazonSocial").ToString.PadRight(30, EspacioRelleno))
|
||
Else
|
||
SBTmpInterbancarias.Append(dRow("RazonSocial").ToString.Trim.Substring(0, 30))
|
||
End If
|
||
|
||
' ALIAS DE LA CUENTA PENDIENTE TAMAÑO MAXIMO 30
|
||
SBTmpInterbancarias.Append(dRow("BBVAAlias").ToString.PadRight(30, EspacioRelleno))
|
||
|
||
'CORREO OPCIONAL TAMAÑO MAXIMO 80
|
||
'RegistrosAlta.Append("".ToString.PadLeft(80, EspacioRelleno))
|
||
|
||
|
||
'Tipo de cuenta
|
||
SBTmpInterbancarias.Append("40")
|
||
|
||
SBTmpInterbancarias.Append(vbCrLf)
|
||
|
||
|
||
If Not ErrorLineaInterbancaria Then
|
||
RegistrosAltaInterbancario.Append(SBTmpInterbancarias.ToString)
|
||
' ObjGrales.UpdateCuentasDepositosEstatusPagoElectronicoGrupos(dRow("CveCuentaDeposito").ToString.ToEntero, True)
|
||
Else
|
||
SBErroresInterBancario.Append("<br>")
|
||
SBErrores.AppendLine(SBErroresInterBancario.ToString)
|
||
End If
|
||
|
||
Next
|
||
|
||
If RegistrosAltaInterbancario.Length > 0 Then
|
||
TextoCompleto = RegistrosAltaInterbancario.ToString
|
||
If CreaArchivo(2, False) Then
|
||
NombreArchivoInterbancario = NombreArchivo
|
||
End If
|
||
End If
|
||
|
||
End If
|
||
|
||
' ObjGrales.Dispose()
|
||
|
||
Dim Mensaje As New StringBuilder
|
||
|
||
|
||
'Mensaje.Append("Descarga Layouts<br><br>")
|
||
|
||
DVDescargaPagos.Visible = False
|
||
DVDescargaReporte.Visible = False
|
||
|
||
|
||
|
||
If NombreArchivoBancomer.Trim.Length > 0 Then
|
||
DVDescargaCuentas1.Visible = True
|
||
End If
|
||
If NombreArchivoInterbancario.Trim.Length > 0 Then
|
||
DVDescargaCuentas2.Visible = True
|
||
End If
|
||
If NombreArchivoCIE.Trim.Length > 0 Then
|
||
DVDescargaCuentas3.Visible = True
|
||
End If
|
||
|
||
|
||
If SBErrores.ToString.Length > 0 Then
|
||
Mensaje.Append("<a class='Texto' data-toggle='collapse' data-target='#ErroresCuentas'>Errores Cuentas</a><br>")
|
||
Mensaje.Append("<div id='ErroresCuentas' Class='collapse'>")
|
||
Mensaje.Append(SBErrores.ToString)
|
||
Mensaje.Append("</div>")
|
||
End If
|
||
|
||
If NombreArchivoBancomer.Length > 0 Or NombreArchivoInterbancario.Length > 0 Or NombreArchivoCIE.Length > 0 Then
|
||
|
||
LnkDescargaCuentas1.Text = NombreArchivoBancomer
|
||
LnkDescargaCuentas2.Text = NombreArchivoInterbancario
|
||
LnkDescargaCuentas3.Text = NombreArchivoCIE
|
||
|
||
RegistraScript("$('#ModalDescarga').modal({ backdrop: 'static', keyboard: false});")
|
||
UpModalDescarga.Update()
|
||
Else
|
||
Alert(Mensaje.ToString, TipoMensaje.MsgAdvertencia)
|
||
End If
|
||
|
||
CargaDatos()
|
||
|
||
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("/", "").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("EstatusPagoElectronicoGrupos = 'True' AND EstatusCtaDeposito = 'True'") IsNot Nothing Then
|
||
|
||
GeneraPago(DTPendientes.FiltraParametros("EstatusPagoElectronicoGrupos = 'True' AND EstatusCtaDeposito > 0"))
|
||
|
||
Else
|
||
|
||
Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia)
|
||
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub GeneraPago(DTPendientesTemp As DataTable, Optional InsertaEnDB As Boolean = True, Optional NombreArchivoEnviado As String = "")
|
||
|
||
Dim RegistrosPago As New StringBuilder
|
||
Dim MENSAJEError As New StringBuilder
|
||
|
||
Dim EsCIE As Boolean = False
|
||
Dim CeroRelleno As Char = "0"c
|
||
Dim EspacioRelleno As Char = Chr(32)
|
||
Dim ErrorLayout = False
|
||
|
||
|
||
For Each drow As DataRow In DTPendientesTemp.Rows
|
||
EsCIE = False
|
||
|
||
MENSAJEError.Clear()
|
||
|
||
MENSAJEError.AppendLine($"Error al generar pago <br>")
|
||
MENSAJEError.AppendLine($" Proveedor: {drow("RazonSocial").ToString} detalle: { drow("Observaciones").ToString} <br>")
|
||
|
||
'CveBanco = '012'
|
||
If drow("CveBanco").ToString.Trim = "012" Then
|
||
If drow("CIE").ToString.Trim.Length > 0 Then 'cuenta bancomer Con convenio CIE
|
||
EsCIE = True
|
||
If drow("CIE").ToString.Trim.Length > 0 Then
|
||
RegistrosPago.Append("CIL")
|
||
Else
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("ERROR en tamaño de CIE")
|
||
End If
|
||
Else
|
||
RegistrosPago.Append("PTC") 'cuenta bancomer
|
||
End If
|
||
|
||
Else
|
||
RegistrosPago.Append("PSC")
|
||
End If
|
||
|
||
|
||
If EsCIE Then
|
||
|
||
If drow("ConceptoCIE").ToString.Length <= 30 Then
|
||
RegistrosPago.Append(drow("ConceptoCIE").ToString.PadRight(30, CeroRelleno))
|
||
Else
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("ERROR Tamaño de ConceptoCIE.")
|
||
Exit For
|
||
End If
|
||
|
||
|
||
If drow("CIE").ToString.Length < 5 Or drow("CIE").ToString.Length > 7 Then
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("ERROR Tamaño de CIE (rango 5-7).")
|
||
Exit For
|
||
Else
|
||
RegistrosPago.Append(drow("CIE").ToString.PadLeft(7, CeroRelleno))
|
||
End If
|
||
|
||
If drow("CLABEOrigen").ToString.Trim.Length.Contiene(10, 18) Then
|
||
RegistrosPago.Append(drow("CLABEOrigen").ToString.PadLeft(18, CeroRelleno))
|
||
Else
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("ERROR EN CLABE cuenta origen")
|
||
Exit For
|
||
End If
|
||
|
||
RegistrosPago.Append(drow("Abonado").ToString.ToDecimal.ToString("0000000000000.00"))
|
||
|
||
|
||
If drow("Observaciones").ToString.Trim.Length = 0 Then
|
||
|
||
If drow("RazonSocial").ToString.Trim.Length > 30 Then
|
||
RegistrosPago.Append(drow("RazonSocial").ToString.Substring(0, 30))
|
||
Else
|
||
RegistrosPago.Append(drow("RazonSocial").ToString.PadRight(30, EspacioRelleno))
|
||
End If
|
||
Else
|
||
|
||
If drow("Observaciones").ToString.Trim.Length > 30 Then
|
||
RegistrosPago.Append(drow("Observaciones").ToString.Substring(0, 30))
|
||
Else
|
||
RegistrosPago.Append(drow("Observaciones").ToString.PadRight(30, EspacioRelleno))
|
||
End If
|
||
|
||
End If
|
||
|
||
|
||
If drow("Referencia").ToString.Trim.Length > 20 Then
|
||
RegistrosPago.Append(drow("Referencia").ToString.Substring(0, 20))
|
||
Else
|
||
RegistrosPago.Append(drow("Referencia").ToString.PadRight(20, EspacioRelleno))
|
||
End If
|
||
|
||
|
||
ElseIf drow("CveBanco").ToString.Trim = "012" And drow("CIE").ToString.Trim.Length = 0 Then
|
||
|
||
'cuentas Inicio
|
||
If drow("CLABEDestino").ToString.Trim.Length.Contiene(10, 18) Then
|
||
RegistrosPago.Append(drow("CLABEDestino").ToString.PadLeft(18, CeroRelleno))
|
||
Else
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("ERROR EN CLABE cuenta destino")
|
||
Exit For
|
||
End If
|
||
|
||
If drow("CLABEOrigen").ToString.Trim.Length.Contiene(10, 18) Then
|
||
RegistrosPago.Append(drow("CLABEOrigen").ToString.PadLeft(18, CeroRelleno))
|
||
Else
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("ERROR EN CLABE cuenta origen")
|
||
Exit For
|
||
End If
|
||
'cuentas Fin
|
||
|
||
|
||
RegistrosPago.Append(drow("Abreviatura").ToString)
|
||
RegistrosPago.Append(drow("Abonado").ToString.ToDecimal.ToString("0000000000000.00"))
|
||
|
||
|
||
If drow("Observaciones").ToString.Trim.Length = 0 Then
|
||
|
||
If drow("RazonSocial").ToString.Trim.Length > 30 Then
|
||
RegistrosPago.Append(drow("RazonSocial").ToString.Substring(0, 30))
|
||
Else
|
||
RegistrosPago.Append(drow("RazonSocial").ToString.PadRight(30, EspacioRelleno))
|
||
End If
|
||
Else
|
||
|
||
If drow("Observaciones").ToString.Trim.Length > 30 Then
|
||
RegistrosPago.Append(drow("Observaciones").ToString.Substring(0, 30))
|
||
Else
|
||
RegistrosPago.Append(drow("Observaciones").ToString.PadRight(30, EspacioRelleno))
|
||
End If
|
||
|
||
End If
|
||
|
||
ElseIf drow("CveBanco").ToString <> "012" Then 'I N T E R B A N C A R I O
|
||
|
||
'cuentas Inicio
|
||
If drow("CLABEDestino").ToString.Trim.Length.Contiene(10, 18) Then
|
||
RegistrosPago.Append(drow("CLABEDestino").ToString.PadLeft(18, CeroRelleno))
|
||
Else
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("ERROR EN CLABE cuenta destino")
|
||
Exit For
|
||
End If
|
||
|
||
If drow("CLABEOrigen").ToString.Trim.Length.Contiene(10, 18) Then
|
||
RegistrosPago.Append(drow("CLABEOrigen").ToString.PadLeft(18, CeroRelleno))
|
||
Else
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("ERROR EN CLABE cuenta origen")
|
||
Exit For
|
||
End If
|
||
'cuentas Fin
|
||
|
||
RegistrosPago.Append(drow("Abreviatura").ToString)
|
||
RegistrosPago.Append(drow("Abonado").ToString.ToDecimal.ToString("0000000000000.00"))
|
||
|
||
If drow("RazonSocial").ToString.Length <= 30 Then
|
||
RegistrosPago.Append(drow("RazonSocial").ToString.PadRight(30, EspacioRelleno))
|
||
Else
|
||
RegistrosPago.Append(drow("RazonSocial").ToString.Substring(0, 30))
|
||
End If
|
||
|
||
RegistrosPago.Append("40") '03 tarjeta debito 40 Clabe
|
||
|
||
If drow("CveBanco").ToString.Trim.Length = 3 Then
|
||
RegistrosPago.Append(drow("CveBanco").ToString.Trim)
|
||
Else
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("Es necesario establecer el banco de la cuenta deposito.")
|
||
End If
|
||
|
||
'Motivo de pago
|
||
If drow("Observaciones").ToString.Trim.Length > 30 Then
|
||
RegistrosPago.Append(drow("Observaciones").ToString.Substring(0, 30))
|
||
Else
|
||
RegistrosPago.Append(drow("Observaciones").ToString.PadRight(30, EspacioRelleno))
|
||
End If
|
||
|
||
If drow("Referencia").ToString.Trim.Length > 7 Then
|
||
RegistrosPago.Append(drow("Referencia").ToString.Substring(0, 7))
|
||
Else
|
||
RegistrosPago.Append(drow("Referencia").ToString.PadRight(7, EspacioRelleno))
|
||
End If
|
||
|
||
RegistrosPago.Append("H")
|
||
|
||
Else
|
||
ErrorLayout = True
|
||
MENSAJEError.AppendLine("Parametros incorrecots")
|
||
Exit For
|
||
End If
|
||
|
||
|
||
|
||
If ErrorLayout Then
|
||
Alert(MENSAJEError.ToString(), TipoMensaje.MsgAdvertencia)
|
||
Exit For
|
||
End If
|
||
|
||
RegistrosPago.Append(vbCrLf)
|
||
|
||
Next
|
||
|
||
|
||
If Not ErrorLayout Then
|
||
|
||
Dim NombreArchivoPago As String = ""
|
||
|
||
TextoCompleto = RegistrosPago.ToString
|
||
|
||
If CreaArchivo(1, NombreArchivoEnviado:=NombreArchivoEnviado) Then
|
||
'NombreArchivoPago = NombreArchivo
|
||
NombreArchivoPago = NombreArchivoEnviado
|
||
End If
|
||
|
||
|
||
If InsertaEnDB Then
|
||
|
||
Dim ObjBancos As New ClsBancos
|
||
ObjBancos.IniciaTransacSQL()
|
||
|
||
|
||
Dim CveLayoutEnvio = ObjBancos.AddLayoutEnvios(NombreArchivo, Date.Now, CveCuenta, PorGrupos:=True)
|
||
|
||
If CveLayoutEnvio > 0 Then
|
||
For Each dr As DataRow In DTPendientesTemp.Rows
|
||
If dr("CveProveedor").ToString <> "" Or dr("CvePersonal").ToString <> "" Then
|
||
If Not ObjBancos.AddLayoutEnviosDetalle(CveLayoutEnvio, dr("CveIE").ToString.ToEntero, dr("CveProveedor").ToString.ToEntero, dr("CvePersonal").ToString.ToEntero, 1, "Observaciones") Then
|
||
ErrorLayout = True
|
||
Exit For
|
||
End If
|
||
End If
|
||
Next
|
||
Else
|
||
ErrorLayout = True
|
||
End If
|
||
|
||
If ErrorLayout Then
|
||
ObjBancos.RollBack()
|
||
ObjBancos.Dispose()
|
||
Else
|
||
ObjBancos.Commit()
|
||
ObjBancos.Dispose()
|
||
End If
|
||
|
||
End If
|
||
|
||
|
||
|
||
|
||
|
||
If ErrorLayout = False And RegistrosPago.Length > 0 Then
|
||
|
||
Dim Mensaje As New StringBuilder
|
||
|
||
Mensaje.Append("Descarga Layout<br>")
|
||
|
||
|
||
If NombreArchivoEnviado.Length > 0 Then
|
||
NombreArchivoPago = NombreArchivoEnviado
|
||
End If
|
||
|
||
'If NombreArchivoPago.Trim.Length > 0 Then
|
||
|
||
' Mensaje.Append($"Pagos Descarga <a class='Texto' href='../Empresas/{UsuarioActual.CveEmpresa}/Layout/{NombreArchivoPago}' download> {NombreArchivoPago}<a> <br><br>")
|
||
|
||
'End If
|
||
|
||
|
||
If NombreArchivoPago.Length > 0 Then
|
||
|
||
|
||
DVDescargaPagos.Visible = True
|
||
DVDescargaCuentas1.Visible = False
|
||
DVDescargaCuentas2.Visible = False
|
||
DVDescargaCuentas3.Visible = False
|
||
DVDescargaReporte.Visible = True
|
||
|
||
DT_PagosReporte = DTPendientesTemp.Copy
|
||
|
||
LnkDescarga.Text = NombreArchivoPago
|
||
RegistraScript("$('#ModalDescarga').modal({ backdrop: 'static', keyboard: false});")
|
||
UpModalDescarga.Update()
|
||
|
||
End If
|
||
|
||
CargaDatos()
|
||
|
||
End If
|
||
|
||
|
||
Else
|
||
|
||
Alert(MENSAJEError.ToString, TipoMensaje.MsgAdvertencia)
|
||
|
||
End If
|
||
|
||
|
||
|
||
End Sub
|
||
|
||
'Private Sub GeneraPagoViejo(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
|
||
|
||
|
||
|
||
#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
|
||
|
||
|
||
|
||
#End Region
|
||
|
||
|
||
|
||
'FUNCIONARIO O EMPLEADO
|
||
#Region " ALTA FUNCIONARIO "
|
||
|
||
Private Sub AltaFyE(Optional DtCuentasPendientesTemp As DataTable = Nothing)
|
||
|
||
|
||
NombreArchivo = ""
|
||
NombreArchivoBancomer = ""
|
||
NombreArchivoInterbancario = ""
|
||
NombreArchivo = ""
|
||
|
||
|
||
|
||
Dim RegistrosAltaBancomer As New StringBuilder
|
||
Dim RegistrosAltaInterbancario As New StringBuilder
|
||
Dim SBErrores As New StringBuilder
|
||
|
||
|
||
|
||
Dim CeroRelleno As Char = "0"c
|
||
Dim EspacioRelleno As Char = Chr(32)
|
||
Dim ErrorLayout = False
|
||
|
||
|
||
If DtCuentasPendientesTemp Is Nothing Then
|
||
DtCuentasPendientesTemp = DTFyE.Copy
|
||
End If
|
||
|
||
|
||
|
||
DtCuentasPendientesTemp.CaseSensitive = False
|
||
|
||
|
||
|
||
|
||
Dim DtCuentasPendientesBancomer As DataTable = DtCuentasPendientesTemp.FiltraParametros($" (EstatusPagoElectronicoGrupos IS NULL OR EstatusPagoElectronicoGrupos = False) AND (BancoNombre like '%BBVA%' OR BancoNombre like '%BANCOMER%' ) ", "", {"CveCuentaDeposito", "BancoNombre", "CLABEDestino", "Abreviatura", "RazonSocial", "CvePersonal", "CveBanco", "Cuenta", "BBVAAlias"})
|
||
Dim DtCuentasPendientesInterbancarias As DataTable = DtCuentasPendientesTemp.FiltraParametros($" (EstatusPagoElectronicoGrupos IS NULL OR EstatusPagoElectronicoGrupos = False) AND (BancoNombre not like '%BBVA%' AND BancoNombre not like '%BANCOMER%' ) ", "", {"CveCuentaDeposito", "BancoNombre", "CLABEDestino", "Abreviatura", "RazonSocial", "CvePersonal", "CveBanco", "Cuenta", "BBVAAlias"})
|
||
'CLABEDestino
|
||
|
||
' Dim ObjGrales As New ClsGenerales
|
||
|
||
If DtCuentasPendientesBancomer.Rows.Count > 0 Then
|
||
For Each dRow As DataRow In DtCuentasPendientesBancomer.Rows
|
||
|
||
Dim SBTmpBancomer As New StringBuilder
|
||
Dim SBErroresBancomer As New StringBuilder
|
||
Dim ErrorLineaBancomer As Boolean = False
|
||
|
||
SBErroresBancomer.Append($"{dRow("RazonSocial").ToString } ")
|
||
SBErroresBancomer.Append($"Cuenta: {dRow("Cuenta").ToString } ")
|
||
|
||
If dRow("CLABEDestino").ToString.Length <= 18 Then 'Tamaño maximo 18
|
||
SBTmpBancomer.Append(dRow("CLABEDestino").ToString.PadLeft(18, CeroRelleno))
|
||
Else
|
||
SBErroresBancomer.Append("La cuenta beneficiaria no puede ser mayor a 18 caracteres, ")
|
||
ErrorLineaBancomer = True
|
||
End If
|
||
|
||
|
||
If dRow("CLABEDestino").ToString.Trim = "" Then
|
||
SBErroresBancomer.Append("La cuenta beneficiaria no puede ser nula,")
|
||
ErrorLineaBancomer = True
|
||
End If
|
||
|
||
If dRow("Abreviatura").ToString.Length = 3 Then
|
||
SBTmpBancomer.Append(dRow("Abreviatura"))
|
||
Else
|
||
SBErroresBancomer.Append("El tamaño de la divisa es incorrecto, ")
|
||
ErrorLineaBancomer = True
|
||
End If
|
||
|
||
SBTmpBancomer.Append("0999999999999.99")
|
||
|
||
If dRow("RazonSocial").ToString.Trim.Length < 31 Then 'Tamaño maximo 30
|
||
SBTmpBancomer.Append(dRow("RazonSocial").ToString.PadRight(30, EspacioRelleno))
|
||
Else
|
||
SBTmpBancomer.Append(dRow("RazonSocial").ToString.Trim.Substring(0, 30))
|
||
End If
|
||
|
||
'ALIAS DE LA CUENTA PENDIENTE TAMAÑO MAXIMO 30
|
||
SBTmpBancomer.Append(dRow("BBVAAlias").ToString.PadRight(30, EspacioRelleno))
|
||
|
||
'CORREO OPCIONAL TAMAÑO MAXIMO 80
|
||
'RegistrosAlta.Append("".ToString.PadLeft(80, EspacioRelleno))
|
||
|
||
SBTmpBancomer.Append(vbCrLf)
|
||
|
||
|
||
If Not ErrorLineaBancomer Then
|
||
RegistrosAltaBancomer.Append(SBTmpBancomer.ToString)
|
||
' ObjGrales.UpdateCuentasDepositosEstatusPagoElectronicoGrupos(dRow("CveCuentaDeposito").ToString.ToEntero, True)
|
||
Else
|
||
SBErroresBancomer.Append("<br>")
|
||
SBErrores.AppendLine(SBErroresBancomer.ToString)
|
||
End If
|
||
|
||
|
||
Next
|
||
|
||
TextoCompleto = RegistrosAltaBancomer.ToString
|
||
|
||
If CreaArchivo(2, True) Then
|
||
NombreArchivoBancomer = NombreArchivo
|
||
End If
|
||
|
||
|
||
End If
|
||
|
||
|
||
|
||
|
||
If DtCuentasPendientesInterbancarias.Rows.Count > 0 Then
|
||
|
||
For Each dRow As DataRow In DtCuentasPendientesInterbancarias.Rows
|
||
|
||
Dim SBTmpInterbancarias As New StringBuilder
|
||
Dim SBErroresInterBancario As New StringBuilder
|
||
Dim ErrorLineaInterbancaria As Boolean = False
|
||
|
||
SBErroresInterBancario.Append($"{dRow("RazonSocial").ToString } ")
|
||
SBErroresInterBancario.Append($"Cuenta: {dRow("Cuenta").ToString } ")
|
||
|
||
If dRow("CveBanco").ToString.Trim.Length = 3 Then
|
||
SBTmpInterbancarias.Append(dRow("CveBanco").ToString.Trim)
|
||
Else
|
||
SBErroresInterBancario.Append("clave ABM(Clave SAT) incorrecta, ")
|
||
ErrorLineaInterbancaria = True
|
||
End If
|
||
|
||
|
||
If dRow("CLABEDestino").ToString.Length <= 18 Then 'Tamaño maximo 18
|
||
SBTmpInterbancarias.Append(dRow("CLABEDestino").ToString.PadLeft(18, CeroRelleno))
|
||
Else
|
||
SBErroresInterBancario.Append("La cuenta beneficiaria no puede ser mayor a 18 caracteres, ")
|
||
ErrorLineaInterbancaria = True
|
||
End If
|
||
|
||
|
||
|
||
If dRow("CLABEDestino").ToString.Trim = "" Then
|
||
SBErroresInterBancario.Append("La cuenta beneficiaria no puede ser nula,")
|
||
ErrorLineaInterbancaria = True
|
||
End If
|
||
|
||
If dRow("Abreviatura").ToString.Length = 3 Then
|
||
SBTmpInterbancarias.Append(dRow("Abreviatura").ToString.Trim)
|
||
Else
|
||
SBErroresInterBancario.Append("El tamaño de la divisa es incorrecto, ")
|
||
ErrorLineaInterbancaria = True
|
||
End If
|
||
|
||
SBTmpInterbancarias.Append("0999999999999.99")
|
||
|
||
If dRow("RazonSocial").ToString.Trim.Length < 31 Then 'Tamaño maximo 30
|
||
SBTmpInterbancarias.Append(dRow("RazonSocial").ToString.PadRight(30, EspacioRelleno))
|
||
Else
|
||
SBTmpInterbancarias.Append(dRow("RazonSocial").ToString.Trim.Substring(0, 30))
|
||
End If
|
||
|
||
' ALIAS DE LA CUENTA PENDIENTE TAMAÑO MAXIMO 30
|
||
SBTmpInterbancarias.Append(dRow("BBVAAlias").ToString.PadRight(30, EspacioRelleno))
|
||
|
||
'CORREO OPCIONAL TAMAÑO MAXIMO 80
|
||
'RegistrosAlta.Append("".ToString.PadLeft(80, EspacioRelleno))
|
||
|
||
|
||
'Tipo de cuenta
|
||
SBTmpInterbancarias.Append("40")
|
||
|
||
SBTmpInterbancarias.Append(vbCrLf)
|
||
|
||
|
||
If Not ErrorLineaInterbancaria Then
|
||
RegistrosAltaInterbancario.Append(SBTmpInterbancarias.ToString)
|
||
' ObjGrales.UpdateCuentasDepositosEstatusPagoElectronicoGrupos(dRow("CveCuentaDeposito").ToString.ToEntero, True)
|
||
Else
|
||
SBErroresInterBancario.Append("<br>")
|
||
SBErrores.AppendLine(SBErroresInterBancario.ToString)
|
||
End If
|
||
|
||
Next
|
||
|
||
If RegistrosAltaInterbancario.Length > 0 Then
|
||
TextoCompleto = RegistrosAltaInterbancario.ToString
|
||
If CreaArchivo(2, False) Then
|
||
NombreArchivoInterbancario = NombreArchivo
|
||
End If
|
||
End If
|
||
|
||
End If
|
||
|
||
' ObjGrales.Dispose()
|
||
|
||
Dim Mensaje As New StringBuilder
|
||
|
||
|
||
Mensaje.Append("Descarga Layouts<br><br>")
|
||
|
||
If NombreArchivoBancomer.Trim.Length > 0 Then
|
||
DVDescargaCuentas1.Visible = True
|
||
'Mensaje.Append($"Cuentas Bancomer <a class='Texto' href='../Empresas/{UsuarioActual.CveEmpresa}/Layout/{NombreArchivoBancomer}' download > Descarga Archivo cuentas Bancomer</a> <br><br>")
|
||
End If
|
||
|
||
|
||
If NombreArchivoInterbancario.Trim.Length > 0 Then
|
||
DVDescargaCuentas2.Visible = True
|
||
' Mensaje.Append($"Cuentas Interbancarias <a class='Texto' href='../Empresas/{UsuarioActual.CveEmpresa}/Layout/{NombreArchivoInterbancario}' download >Descarga Archivo cuentas Bancomer</a> <br><br>")
|
||
End If
|
||
|
||
|
||
If SBErrores.ToString.Length > 0 Then
|
||
|
||
Mensaje.Append("<a class='Texto' data-toggle='collapse' data-target='#ErroresCuentas'>Errores Cuentas</a><br>")
|
||
Mensaje.Append("<div id='ErroresCuentas' Class='collapse'")
|
||
Mensaje.Append(SBErrores.ToString)
|
||
Mensaje.Append("</div>")
|
||
|
||
End If
|
||
|
||
If NombreArchivoBancomer.Length > 0 Or NombreArchivoInterbancario.Length > 0 Then
|
||
|
||
DVDescargaPagos.Visible = False
|
||
DVDescargaReporte.Visible = False
|
||
|
||
LnkDescargaCuentas1.Text = NombreArchivoBancomer
|
||
LnkDescargaCuentas2.Text = NombreArchivoInterbancario
|
||
RegistraScript("$('#ModalDescarga').modal({ backdrop: 'static', keyboard: false});")
|
||
|
||
UpModalDescarga.Update()
|
||
|
||
'Alert(Mensaje.ToString, TipoMensaje.MsgInformacion)
|
||
|
||
|
||
End If
|
||
|
||
CargaDatos()
|
||
|
||
End Sub
|
||
|
||
|
||
Private Sub CargaFyE()
|
||
Dim ObjBancos As New ClsBancos
|
||
|
||
If ObjBancos.GetLayoutFyE(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, PorGrupos:=True) 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
|
||
|
||
|
||
|
||
#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, PorGrupos:=True) 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 LayoutBtnGenerarPago 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(DTProveedores)
|
||
Else
|
||
AltaFyE()
|
||
End If
|
||
|
||
End Sub
|
||
Private Sub CargaProveedores()
|
||
Dim ObjBancos As New ClsBancos
|
||
|
||
If ObjBancos.GetLayoutProveedores(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, PorGrupos:=True) Then
|
||
DTProveedores = ObjBancos.DtResultados.FiltraParametros("LEN(RFC) IN (12,13)")
|
||
Else
|
||
DTProveedores = New DataTable
|
||
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)
|
||
|
||
' 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 " 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 DT_PagosReporte As New DataTable
|
||
DT_PagosReporte = DTPendientes.FiltraParametros("EstatusPagoElectronicoGrupos = 'True' AND EstatusCtaDeposito > 0").Copy()
|
||
|
||
'DT_PagosReporte.Columns(7).ColumnName = "Proveedor"
|
||
'DT_PagosReporte.Columns(2).ColumnName = "Importe"
|
||
'DT_PagosReporte.Columns(22).ColumnName = "Moneda"
|
||
|
||
|
||
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 Grupos"))
|
||
|
||
ImprimirPDF("Empresas/Grales/Formatos/LayoutPagoProveedor.rdlc", DT_PagosReporte, 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
|
||
|
||
Protected Sub LnkCabecera_Click(sender As Object, e As EventArgs)
|
||
|
||
CargaGVPendintesModal()
|
||
RegistraScript("$('#UpModalCuentas').modal();")
|
||
|
||
End Sub
|
||
|
||
|
||
|
||
|
||
|
||
Private Sub CargaGVPendintesModal()
|
||
|
||
Dim ObjBancos As New ClsBancos
|
||
|
||
If ObjBancos.GetBancosSAT Then
|
||
DTSATBancos = ObjBancos.DtResultados
|
||
End If
|
||
|
||
ObjBancos.Dispose()
|
||
|
||
Dim DTGvCuentasPendientes As DataTable = DTPendientes.Copy.FiltraParametros("CveCuentaDeposito > 0", "", {"CveCuentaDeposito", "BancoNombre", "RazonSocial", "Cuenta", "CLABEDestino", "BBVAAlias", "EstatusPagoElectronicoGrupos", "CveSATBanco", "CLABE"})
|
||
|
||
GvCuentasModal.DataSource = DTGvCuentasPendientes
|
||
GvCuentasModal.DataBind()
|
||
UpModalCuentasCuerpo.Update()
|
||
|
||
|
||
|
||
End Sub
|
||
|
||
Protected Sub GvCuentasModal_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||
|
||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||
|
||
'e.Row.FCCheckBox("ChkCuentasEstatus").Checked = True
|
||
|
||
e.Row.FCDropDownList("DdlSatBanco").DataSource = DTSATBancos
|
||
e.Row.FCDropDownList("DdlSatBanco").DataBind()
|
||
e.Row.FCDropDownList("DdlSatBanco").Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
||
e.Row.FCDropDownList("DdlSatBanco").SelectedValueExist(e.Row.DataKey("CveSATBanco"))
|
||
|
||
End If
|
||
|
||
End Sub
|
||
|
||
Protected Sub BtnModalCuentasGuardar_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim ErrorProceso As Boolean = False
|
||
Dim CountAltas As Integer = 0
|
||
|
||
Dim ObjGenerales As New ClsGenerales
|
||
|
||
|
||
ObjGenerales.IniciaTransacSQL()
|
||
|
||
For Each GvRow As GridViewRow In GvCuentasModal.Rows
|
||
|
||
Dim CveCuentaDeposito As Integer = GvRow.DataKey("CveCuentaDeposito").ToEntero
|
||
Dim ChkCuentasEstatus As CheckBox = GvRow.FCCheckBox("ChkCuentasEstatus")
|
||
Dim TxtBBVAAlias As TextBox = GvRow.FCTextBox("TxtBBVAAlias")
|
||
Dim DdlSatBanco As DropDownList = GvRow.FCDropDownList("DdlSatBanco")
|
||
|
||
|
||
If Not ObjGenerales.UpdateCuentasDepositosEstatusPagoElectronicoGrupos(CveCuentaDeposito, If(ChkCuentasEstatus.Checked, 1, 0), DdlSatBanco.SelectedValue.ToEntero, TxtBBVAAlias.Text, "-1", "-1") Then
|
||
ErrorProceso = True
|
||
Exit For
|
||
End If
|
||
|
||
Next
|
||
|
||
|
||
If ErrorProceso Then
|
||
ObjGenerales.RollBack()
|
||
Alert("Se presentoun error al actualziar las cuentas", TipoMensaje.MsgError)
|
||
Else
|
||
ObjGenerales.Commit()
|
||
Alert("Estado de cuentas actualizado correctamente.")
|
||
RegistraScript("$('#UpModalCuentas').modal('hide');")
|
||
End If
|
||
ObjGenerales.Dispose()
|
||
|
||
|
||
|
||
CargaDatos()
|
||
|
||
End Sub
|
||
|
||
Protected Sub BtnConsultaEnviados_Click(sender As Object, e As EventArgs)
|
||
CargaEnviados()
|
||
End Sub
|
||
|
||
Private Sub CargaEnviados()
|
||
|
||
Dim ObjBancos As New ClsBancos
|
||
Dim FechaI = If(IsDate(txtFechaIEnviados.Text.Trim()), txtFechaIEnviados.Text.Trim(), "-1")
|
||
Dim FechaF = If(IsDate(txtFechaFEnviados.Text.Trim()), txtFechaFEnviados.Text.Trim(), "-1")
|
||
|
||
If ObjBancos.GetLayoutPagosEnviados(DdlCuentaEnviados.SelectedValue.ToEntero, DdlEstatusEnviados.SelectedValue.ToEntero, DdlTipoGeneracionEnviados.SelectedValue, FechaI, FechaF, PorGrupos:=True) Then
|
||
DTEnviadas = ObjBancos.DtResultados
|
||
Else
|
||
DTEnviadas = Nothing
|
||
End If
|
||
|
||
ObjBancos.Dispose()
|
||
|
||
'Carga GvEnviadas
|
||
If DTEnviadas IsNot Nothing AndAlso DTEnviadas.Rows.Count > 0 Then
|
||
GvEnviadas.DataSource = DTEnviadas
|
||
End If
|
||
|
||
GvEnviadas.DataBind()
|
||
UpEnviados.Update()
|
||
|
||
End Sub
|
||
|
||
|
||
|
||
|
||
|
||
Protected Sub ImgUpload_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||
CveIEPagoActual = GvRow.DataKey("CveIE").ToEntero
|
||
|
||
' HFComprobanteActual = GvRow.FCHiddenField("HFComprobante")
|
||
|
||
GvIndexActual = GvRow.RowIndex
|
||
|
||
|
||
RegistraScript("$('#ModalUploadComprobante').modal({ backdrop: 'static', keyboard: false});")
|
||
|
||
End Sub
|
||
|
||
Protected Sub btnUploadFileComprobante_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim FileExtension As String = "-1"
|
||
Dim Filesgral As List(Of Archivo) = TxtFileComprobante.getfiles().Archivos
|
||
Dim Filename As String = ""
|
||
Dim ErrorProceso As Boolean = False
|
||
|
||
|
||
For Each fileItem As Archivo In Filesgral
|
||
|
||
Try
|
||
|
||
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
|
||
Dim tempArray() As String
|
||
tempArray = fileItem.filename.ToString().Split("-".ToCharArray())
|
||
|
||
|
||
If Not ErrorProceso Then
|
||
|
||
Dim DirectorioDestino As String = UsuarioActual.Empresa.Ruta & $"..\Temp\"
|
||
Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & $"..\Temp\{CveIEPagoActual}.{FileExtension}"
|
||
|
||
|
||
If Not Directory.Exists(DirectorioDestino) Then
|
||
Directory.CreateDirectory(DirectorioDestino)
|
||
End If
|
||
|
||
Try
|
||
|
||
If System.IO.File.Exists(rutaDestino) Then
|
||
System.IO.File.Delete(rutaDestino)
|
||
End If
|
||
|
||
GvEnviadas.Rows(GvIndexActual).FCTextBox("TxtComprobante").Text = $"{CveIEPagoActual}.{FileExtension}"
|
||
|
||
|
||
System.IO.File.Move(fileItem.FileUrl, rutaDestino)
|
||
|
||
Catch ex As Exception
|
||
Alert("Error al cargar al", TipoMensaje.MsgAdvertencia)
|
||
GuardaLog($"Error al gaurdar documento (moviendo archivo digital) --> Error{ ex.StackTrace}")
|
||
ErrorProceso = True
|
||
End Try
|
||
End If
|
||
|
||
|
||
TxtFileComprobante.Text = ""
|
||
|
||
|
||
|
||
|
||
UPModalUploadComprobante.Update()
|
||
|
||
Catch ex As Exception
|
||
OnError("Error al cargar archivo", ex)
|
||
End Try
|
||
|
||
Next
|
||
|
||
If Not ErrorProceso Then
|
||
RegistraScript("$('#ModalUploadComprobante').modal('hide')", "hidemodal3")
|
||
UpEnviados.Update()
|
||
End If
|
||
|
||
|
||
End Sub
|
||
|
||
|
||
Protected Sub LnkGvConfirmar_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||
CveIEPagoActual = GvRow.DataKey("CveIE").ToEntero
|
||
Dim Comprobante As String = If(GvRow.FCTextBox("TxtComprobante").Text.Trim = "", "-1", GvRow.FCTextBox("TxtComprobante").Text.Trim)
|
||
Dim NuevoFolio As String = If(GvRow.FCTextBox("TxtFolio").Text.Trim = "", "-1", GvRow.FCTextBox("TxtFolio").Text.Trim)
|
||
|
||
Dim ErrorProceso As Boolean = False
|
||
Dim ObjBanco As New ClsBancos
|
||
ObjBanco.IniciaTransacSQL()
|
||
|
||
Dim CveLayoutEnvioDetalle As Integer = GvRow.DataKey("CveLayoutEnvioDetalle").ToEntero
|
||
Dim CveLayoutEnvio As Integer = GvRow.DataKey("CveLayoutEnvio").ToEntero
|
||
Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero
|
||
Dim CveProveedor As Integer = GvRow.DataKey("CveProveedor").ToEntero
|
||
Dim NotificarA As String = GvRow.DataKey("NotificarA")
|
||
|
||
Dim FOrigen As String = $"{UsuarioActual.Empresa.Ruta}..\Temp\{Comprobante}"
|
||
Dim FDestino As String = $"{UsuarioActual.Empresa.Ruta}\IE\{Comprobante}"
|
||
|
||
|
||
If Not ObjBanco.UpdateLayoutEnviosDetalle(CveLayoutEnvioDetalle, CveLayoutEnvio, CveIE, CveProveedor, 2, "", True) Then
|
||
ErrorProceso = True
|
||
End If
|
||
|
||
|
||
DTFoliosPrefijos.Clear()
|
||
|
||
For Each RowGV As GridViewRow In GvEnviadas.Rows
|
||
If RowGV.RowType = DataControlRowType.DataRow Then
|
||
|
||
Dim nRow As DataRow
|
||
nRow = DTFoliosPrefijos.NewRow
|
||
|
||
nRow("CveIE") = RowGV.DataKey("CveIE").ToEntero
|
||
nRow("Folio") = RowGV.FCTextBox("TxtFolio").Text.Trim
|
||
|
||
DTFoliosPrefijos.Rows.Add(nRow)
|
||
|
||
End If
|
||
Next
|
||
DTFoliosPrefijos.AcceptChanges()
|
||
|
||
If NuevoFolio <> "-1" Or Comprobante <> "-1" And Not ErrorProceso Then
|
||
If Not ObjBanco.UpdateBancos_IEFolio(CveIE, NuevoFolio, Comprobante) Then
|
||
ErrorProceso = True
|
||
End If
|
||
End If
|
||
|
||
|
||
If Comprobante <> "-1" And Not ErrorProceso Then
|
||
|
||
Try
|
||
If File.Exists(FDestino) Then
|
||
File.Delete(FDestino)
|
||
End If
|
||
|
||
File.Move(FOrigen, FDestino)
|
||
|
||
Catch ex As Exception
|
||
ErrorProceso = True
|
||
Alert("Error al guardar comprobante.", TipoMensaje.MsgError)
|
||
End Try
|
||
End If
|
||
|
||
|
||
If ErrorProceso Then
|
||
ObjBanco.RollBack()
|
||
Else
|
||
ObjBanco.Commit()
|
||
Alert("Confirmado Correctamente")
|
||
|
||
If Comprobante = "-1" Then
|
||
FDestino = ""
|
||
End If
|
||
|
||
'NotificacionPago(CveIE, NotificarA, FDestino)
|
||
EnviarCorreoNotificacion(CveIE, NotificarA, "", UsuarioActual, False)
|
||
CargaEnviados()
|
||
|
||
For Each RowGV As GridViewRow In GvEnviadas.Rows
|
||
If RowGV.RowType = DataControlRowType.DataRow Then
|
||
RowGV.FCTextBox("TxtFolio").Text = DTFoliosPrefijos.FiltroPrimeroValor("Folio", $"CveIE = {RowGV.DataKey("CveIE").ToEntero}")
|
||
End If
|
||
Next
|
||
|
||
UpEnviados.Update()
|
||
|
||
End If
|
||
|
||
ObjBanco.Dispose()
|
||
|
||
End Sub
|
||
|
||
|
||
|
||
|
||
Protected Sub LnkGvCancelar_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||
CveIEPagoActual = GvRow.DataKey("CveIE").ToEntero
|
||
|
||
|
||
Dim ErrorProceso As Boolean = False
|
||
Dim ObjBanco As New ClsBancos
|
||
|
||
|
||
Dim CveLayoutEnvioDetalle As Integer = GvRow.DataKey("CveLayoutEnvioDetalle").ToEntero
|
||
Dim CveLayoutEnvio As Integer = GvRow.DataKey("CveLayoutEnvio").ToEntero
|
||
Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero
|
||
Dim CveProveedor As Integer = GvRow.DataKey("CveProveedor").ToEntero
|
||
Dim IDPoliza As Integer = -1
|
||
Dim CvePrePoliza As Integer
|
||
Dim FechaDocumento As Date
|
||
|
||
If Not ObjBanco.UpdateLayoutEnviosDetalle(CveLayoutEnvioDetalle, CveLayoutEnvio, CveIE, CveProveedor, 3, "", False) Then '3 es cancelacion
|
||
ErrorProceso = False
|
||
End If
|
||
|
||
'Dim NumComplementos As Integer
|
||
'Dim Conciliado As Integer
|
||
|
||
If ObjBanco.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) And Not ErrorProceso Then
|
||
|
||
|
||
If ObjBanco.DtResultados(0)("NumComplementos").ToString.ToEntero > 0 Then
|
||
ErrorProceso = True
|
||
Alert("El Moviento tiene Complementos", TipoMensaje.MsgAdvertencia)
|
||
End If
|
||
|
||
If ObjBanco.FueConciliado Then
|
||
ErrorProceso = True
|
||
Alert("El Moviento Esta conciliado", TipoMensaje.MsgAdvertencia)
|
||
End If
|
||
|
||
|
||
IDPoliza = ObjBanco.IDPoliza
|
||
CvePrePoliza = ObjBanco.DtResultados.Rows(0)("CvePrePoliza").ToString.ToEntero
|
||
FechaDocumento = ObjBanco.FechaDocumento
|
||
|
||
End If
|
||
ObjBanco.Dispose()
|
||
|
||
|
||
If Not ErrorProceso Then
|
||
|
||
|
||
|
||
Dim Banc As New ClsBancos
|
||
Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL())
|
||
|
||
Dim ObjAC As ClsContPAQi = Nothing
|
||
If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then
|
||
ObjAC = New ClsContPAQi(UsuarioActual.Empresa)
|
||
ObjAC.IniciaTransacSQL()
|
||
End If
|
||
|
||
Dim FechaCancelacion As Date = Now
|
||
|
||
Dim ErrorCancelar = False
|
||
Dim MensajeError = ""
|
||
Dim IdPolizaNueva = -1
|
||
Dim FolioPolizaNueva = -1
|
||
|
||
If (IDPoliza > 0 AndAlso (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1")) Then
|
||
|
||
If ObjAC Is Nothing Then
|
||
ErrorCancelar = True
|
||
End If
|
||
|
||
If Not ErrorCancelar Then
|
||
Dim dt As DataTable
|
||
|
||
If ObjAC.GetPoliza(IDPoliza, -1, -1, -1, -1) AndAlso ObjAC.DtResultados.Rows.Count > 0 Then
|
||
dt = ObjAC.DtResultados
|
||
|
||
' MES ANTERIOR, MOVIMIENTOS CONTRARIOS (NEGATIVOS)
|
||
If dt.Rows(0)("FechaPol").ToString.ToDate < FechaCancelacion.FirstDayOfMonth Then 'dt.Rows(0)("FechaPol").ToString.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or dt.Rows(0)("FechaPol").ToString.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then
|
||
IdPolizaNueva = ObjAC.AddPoliza(dt.Rows(0)("CodigoTipoPoliza").ToString.ToEntero, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), 0, 0, UsuarioActual.CveUsuario, FechaCancelacion)
|
||
If IdPolizaNueva > 0 Then
|
||
FolioPolizaNueva = ObjAC.Folio
|
||
|
||
'CREA POLIZA NEGATIVA
|
||
For Each dr As DataRow In dt.Rows
|
||
If Not ObjAC.AddMovimiento(IdPolizaNueva, dr("IdCuenta").ToString.ToEntero, dr("TipoMovto").ToString = "True", dr("Importe").ToString.ToDecimal * -1, dr("Referencia").ToString, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), dr("IdSegNeg").ToString.ToEntero, FechaCancelacion, "") Then
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al crear poliza negativa"
|
||
Exit For
|
||
End If
|
||
Next
|
||
|
||
'AJUSTA POLIZA
|
||
If Not ErrorCancelar Then
|
||
If Not ObjAC.AjustaPoliza(IdPolizaNueva) Then
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al ajustar poliza negativa"
|
||
End If
|
||
End If
|
||
|
||
'CANCELA IE
|
||
If Not ErrorCancelar Then
|
||
If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, FechaCancelacion) Then
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al cancelar IE"
|
||
End If
|
||
End If
|
||
|
||
Else
|
||
ErrorCancelar = True
|
||
End If
|
||
|
||
Else
|
||
|
||
If ObjAC.RemovePoliza(IDPoliza) Then
|
||
If Not ObjConta.DesvincularPrePolizaContabilizada(IDPoliza, UsuarioActual.CveEmpresa) Then
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al desvincular poliza."
|
||
End If
|
||
Else
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al eliminar poliza."
|
||
End If
|
||
|
||
If Not ErrorCancelar Then
|
||
If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al desbloquear prepoliza."
|
||
End If
|
||
End If
|
||
|
||
'CANCELA IE
|
||
If Not ErrorCancelar Then
|
||
If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, FechaCancelacion) Then
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al cancelar IE"
|
||
End If
|
||
End If
|
||
|
||
If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al contabilizar poliza"
|
||
End If
|
||
|
||
End If
|
||
Else
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al obtener la poliza"
|
||
End If
|
||
End If
|
||
|
||
Else
|
||
|
||
' If TxtFechaDocumento.Text.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or TxtFechaDocumento.Text.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then
|
||
If FechaDocumento < FechaCancelacion.FirstDayOfMonth Then
|
||
'CANCELA IE MES ANTERIOR
|
||
If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, FechaCancelacion) Then
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al cancelar IE MES ANTERIOR"
|
||
End If
|
||
Else
|
||
'CANCELA IE MES ACTUAL
|
||
If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, FechaCancelacion) Then
|
||
ErrorCancelar = True
|
||
MensajeError = "Error al cancelar IE MES ACTUAL"
|
||
End If
|
||
End If
|
||
End If
|
||
|
||
|
||
|
||
If Not ErrorCancelar Then
|
||
|
||
|
||
|
||
If ObjAC IsNot Nothing Then ObjAC.Commit()
|
||
Banc.Commit()
|
||
Dim Msg As New StringBuilder
|
||
|
||
If IdPolizaNueva > 0 Then
|
||
Msg.AppendFormat("<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza de cancelación</a>", IdPolizaNueva)
|
||
Else
|
||
Msg.Append("Pago Cancelado Correctamente.")
|
||
End If
|
||
|
||
Alert(Msg.ToString, TipoMensaje.MsgInformacion)
|
||
|
||
Else
|
||
|
||
If ObjAC IsNot Nothing Then ObjAC.RollBack()
|
||
Banc.RollBack()
|
||
Alert("El movimiento bancario no se pudo cancelar. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||
GuardaLog(MensajeError + " | CANCELAR IE")
|
||
|
||
End If
|
||
|
||
If ObjAC IsNot Nothing Then ObjAC.Dispose()
|
||
Banc.Dispose()
|
||
ObjConta.Dispose()
|
||
|
||
|
||
End If
|
||
|
||
End Sub
|
||
|
||
|
||
Protected Sub LnkDescarga_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim FileName As String = NombreArchivo
|
||
Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivo}"
|
||
Response.Clear()
|
||
Response.ContentType = "application/octet-stream"
|
||
Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
|
||
Response.TransmitFile(FilePath)
|
||
Response.End()
|
||
|
||
End Sub
|
||
|
||
|
||
Protected Sub LnkDescargaCuentas1_Click(sender As Object, e As EventArgs)
|
||
Dim FileName As String = NombreArchivoBancomer
|
||
Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivoBancomer}"
|
||
Response.Clear()
|
||
Response.ContentType = "application/octet-stream"
|
||
Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
|
||
Response.TransmitFile(FilePath)
|
||
Response.End()
|
||
End Sub
|
||
Protected Sub LnkDescargaCuentas2_Click(sender As Object, e As EventArgs)
|
||
Dim FileName As String = NombreArchivoInterbancario
|
||
Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivoInterbancario}"
|
||
Response.Clear()
|
||
Response.ContentType = "application/octet-stream"
|
||
Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
|
||
Response.TransmitFile(FilePath)
|
||
Response.End()
|
||
End Sub
|
||
|
||
Protected Sub LnkDescargaCuentas3_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim FileName As String = NombreArchivoCIE
|
||
Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivoCIE}"
|
||
Response.Clear()
|
||
Response.ContentType = "application/octet-stream"
|
||
Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
|
||
Response.TransmitFile(FilePath)
|
||
Response.End()
|
||
|
||
End Sub
|
||
|
||
|
||
|
||
Protected Sub LnkDescargaReporte_Click(sender As Object, e As EventArgs)
|
||
|
||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/LayoutAltaProveedor.rdlc", UsuarioActual.Empresa.Ruta))
|
||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||
|
||
DT_PagosReporte = DT_PagosReporte.FiltraParametros("EstatusPagoElectronicoGrupos = 'True' AND EstatusCtaDeposito > 0").Copy()
|
||
|
||
Dim params As New List(Of ReportParameter)
|
||
|
||
If Archivo.Exists Then
|
||
ImprimirPDF(String.Format("{0}Formatos\LayoutPagoProveedor.rdlc", UsuarioActual.Empresa.Ruta), DtPago, params, "LayoutPagoProveedor", RDSName:="DSPagoElectronicoV2")
|
||
Else
|
||
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", DT_PagosReporte, params, "LayoutPagoProveedor", RDSName:="DSPagoElectronicoV2")
|
||
End If
|
||
|
||
|
||
|
||
End Sub
|
||
|
||
|
||
'Private Sub NotificacionPago(CveIE As Integer, CorreoNotificarA As String, RutaComprobante As String)
|
||
|
||
|
||
|
||
' If CorreoNotificarA.Length > 0 Then
|
||
' Dim Body As String = GeneraCorreo(CveIE)
|
||
' 'Dim Comprobante As String = ""
|
||
|
||
' Dim File As Byte() = Nothing
|
||
|
||
' Dim Hilo As New Threading.Thread(Sub() MandaCorreo(CorreoNotificarA, "Notificaciones de pago", Body, CveIE, RutaComprobante, File))
|
||
' Hilo.Start()
|
||
' End If
|
||
|
||
|
||
|
||
|
||
'End Sub
|
||
|
||
|
||
Private Sub EnviarCorreoNotificacion(CveIENotificar As Integer, CorreoNotificarA As String, CopiaPara As String, UsuarioActualNotificar As Usuario, MostarAlert As Boolean)
|
||
|
||
Try
|
||
Dim Hilo As New Threading.Thread(Sub() EnviarCorreoNotifiMandaCorreocacionHilo(CveIENotificar, CorreoNotificarA, CopiaPara, UsuarioActualNotificar))
|
||
Hilo.Start()
|
||
|
||
|
||
If MostarAlert Then
|
||
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
|
||
If MostarAlert Then
|
||
Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError)
|
||
End If
|
||
|
||
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub EnviarCorreoNotifiMandaCorreocacionHilo(CveIENotificar As Integer, CorreoNotificarA As String, CopiaPara As String, UsuarioActualNotificar As Usuario)
|
||
|
||
Try
|
||
Dim ObjBancos As New ClsBancos()
|
||
|
||
If ObjBancos.NotificacionPago(CveIENotificar, CorreoNotificarA, CopiaPara, UsuarioActualNotificar) Then
|
||
Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion)
|
||
Else
|
||
Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError)
|
||
End If
|
||
|
||
ObjBancos.Dispose()
|
||
|
||
Catch ex As Exception
|
||
GuardaLog("Error al enviar notificación de pago PagoElectronicoGrupos --> " & ex.StackTrace.ToString)
|
||
End Try
|
||
|
||
End Sub
|
||
|
||
'Private Sub MandaCorreo(Para As String, Asunto As String, Body As String, CveIE As Integer, Comprobante As String, File As Byte())
|
||
' Try
|
||
' Dim Mail As New ClsSisMail()
|
||
' Para = If(Para IsNot Nothing, Para, "")
|
||
' Asunto = If(Asunto IsNot Nothing, Asunto, "")
|
||
' Body = If(Body IsNot Nothing, Body, "")
|
||
|
||
' Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail)
|
||
' If Comprobante IsNot Nothing AndAlso Comprobante <> "" Then
|
||
' ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.Ruta = Comprobante})
|
||
' End If
|
||
|
||
' If File IsNot Nothing Then
|
||
' ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoCuentaCxP.pdf"})
|
||
' End If
|
||
|
||
' Dim separador As Char() = {";"c, ","c}
|
||
' Dim strArray As String() = Para.Split(separador)
|
||
|
||
' Para = ""
|
||
|
||
' For Each sCorreo As String In strArray
|
||
' If ClsSisMail.IsMailShared(sCorreo) And sCorreo.Trim.Length > 0 Then
|
||
' Para = $"{Para}{sCorreo};"
|
||
' End If
|
||
' Next
|
||
|
||
' Para = Para.Substring(0, Para.Length - 1)
|
||
|
||
' If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=ListaArchivos, Displayname:=$"SIG Notificaciones: Pago de {UsuarioActual.Empresa.Empresa}") Then
|
||
' Dim objIE As New ClsBancos
|
||
' objIE.UpdateBancos_IENotificaciones(1, "-1", "-1", CveIE)
|
||
' objIE.Dispose()
|
||
' End If
|
||
' Catch ex As Exception
|
||
' OnError("Ocurrio un error al enviar el correo", ex)
|
||
' End Try
|
||
|
||
'End Sub
|
||
|
||
|
||
|
||
|
||
|
||
'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 Class
|