diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 4dbde281c..e7bde6bce 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -2839,11 +2839,11 @@ Public Class ClsBancos End Try Return Retorno - End Function + End Function #End Region - + #Region "B A N C O S - P A G O - E L E C T R O N I C O" - Public Function GetLayoutPagos(CveCuenta As Integer, CveBLE As Integer, Tipo As String) As Boolean + Public Function GetLayoutPagos(CveCuenta As Integer, CveBLE As Integer, Tipo As String, Optional PorGrupos As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Banc_LayoutPagos") @@ -2852,6 +2852,7 @@ Public Class ClsBancos .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta .Add("@CveBLE", SqlDbType.Int).Value = CveBLE .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@PorGrupos", SqlDbType.Bit).Value = PorGrupos End With Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 89892002b..56b0aa132 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4690,6 +4690,7 @@ Public Class ClsPaginas PaginaDict.Add("/PV/PVRepCompras.aspx".ToUpper(), 272) PaginaDict.Add("/PV/PVRepVentasCompras.aspx".ToUpper(), 273) + PaginaDict.Add("/Bancos/PagoElectronicoGrupos.aspx".ToUpper(), -1) diff --git a/Bancos/PagoElectronicoGrupos.aspx b/Bancos/PagoElectronicoGrupos.aspx new file mode 100644 index 000000000..f1752353f --- /dev/null +++ b/Bancos/PagoElectronicoGrupos.aspx @@ -0,0 +1,640 @@ +<%@ Page Title="Bancos - Pago Electrónico" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PagoElectronicoGrupos.aspx.vb" Inherits="Bancos_PagoElectronicoGrupos" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Pago Electrónico + + + + + + + + + + + + + + + + +
+
+
+
    +
  • Cuenta: + +
  • +
  • Tipo: + + + + + + +
  • +
+
+
+ +
+
+ +
+
+
+
+ +
+ +
+ +
+ + +
+
+
+ + Generación de Archivos +
+
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+
+ + Alta Beneficiarios +
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + +
Altas: +
Interbancarias: +
Bancomer: +
+ +
+
+
+
+ +
+
+
+
+ + Pago Beneficiarios +
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + + + +
Movimientos: + +
Importe: $ + +
+ +
+
+
+
+ +
+ +
+
+
+ <%-- + + --%> +
+
+ +
+ +
+
+
+ + Cargar Archivos +
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + + + + +
+ Seleccione el archivo TXT a cargar + +
+ + Seleccionar Archivo + +
+
+ +
+
+ Tipo de archivo a cargar: + + + +
+
+
+ +
+ +
+ +
+ +
+ +
+ + +
+ +
+
+ Layouts Pendientes +
+ + + + + + + + + + <%----%> + + + +    + + + <%----%> + + + + + +
+ +
+
+ Layouts Enviados +
+ + + + + + + + + + <%----%> + + + <%----%> + + + + + <%----%> + + + + + + +
+ +
+
+
+
+ +
+ +
+
+ + + + + <%-- + +
+
+
+
    +
  • Cuenta: + +
  • +
  • Estatus: + + + + + + +
  • +
  • Fecha.I.: + + + + + + + + +
  • +
  • Fecha.F.: + + + + + + + + +
  • +
+
+
+ +
+
+
+
+
--%> + + + + + + + + +
+
+
+ + "> + +
+
+
    +
  • Cuenta + +
  • +
  • Tipo + + + + + + +
  • +
  • Estatus + + + + + + +
  • +
  • F.I.   +
    + + + + + + + + + + +
    +
  • +
  • F.F    +
    + + + + + + + + + + +
    +
  • +
+
+ +
+
+ + <%--
+
+ + +
+
+
Cuenta:
+
+
+ +
Estatus:
+
+
+
Fecha I:
+
+
+
Fecha F:
+
+
+
+
+ +
+ +
--%> +
+
+
+ + <%-- + + + + + + + + + + + + + +
Cuenta:Estatus: Fecha.I.:  + +  Fecha.F.:  + +
+
+
--%> + +
+
+ + + + + + + <%----%> + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+
+
    +
  • Tipo: + + + + +
  • +
+
+
+ +
+
+
+
+
+
+ + + + + + + + +
+ +
+
+
+
+ + + + + + + <%----%> + <%----%> + + + + + + + + + + + <%----%> + <%-- + + + + --%> + <%----%> + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + +
+ + + + diff --git a/Bancos/PagoElectronicoGrupos.aspx.vb b/Bancos/PagoElectronicoGrupos.aspx.vb new file mode 100644 index 000000000..1bbca81d9 --- /dev/null +++ b/Bancos/PagoElectronicoGrupos.aspx.vb @@ -0,0 +1,2777 @@ +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 DTProveedores As DataTable + Get + Return CType(ViewState("DTProveedores"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTProveedores") = value + End Set + End Property + Private Property DTFyE As DataTable + Get + Return CType(ViewState("DTFyE"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTFyE") = value + End Set + End Property + Private Property DTReportes As DataTable + Get + Return CType(ViewState("DTReportes"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTReportes") = value + End Set + End Property + Private Property DTPendienteActual As DataTable + Get + Return CType(ViewState("DTPendienteActual"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTPendienteActual") = value + End Set + End Property + Private Property DTEnviadas As DataTable + Get + Return CType(ViewState("DTEnviadas"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTEnviadas") = value + End Set + End Property + Private ReadOnly Property PadCeros As Char + Get + Return "0"c + End Get + End Property + Private Property TotalAcumulado As Double + Get + Return ViewState("TotalAcumulado").ToString.ToDouble + End Get + Set(value As Double) + ViewState("TotalAcumulado") = value + End Set + End Property + Private Property CveCuenta As Integer + Get + Return ViewState("CveCuenta").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCuenta") = value + End Set + End Property + Private Property DtPago As DataTable + Get + Return CType(ViewState("DtPago"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtPago") = value + End Set + End Property + Private Property DtAlta As DataTable + Get + Return CType(ViewState("DtAlta"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtAlta") = value + End Set + End Property + Private Property CorreoNotificacionesEmpresa As String + Get + Return ViewState("CorreoNotificacionesEmpresa").ToString + End Get + Set(value As String) + ViewState("CorreoNotificacionesEmpresa") = value + End Set + End Property + Private Property TipoMasiva As Integer + Get + Return ViewState("TipoMasiva").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("TipoMasiva") = value + End Set + End Property +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not IsPostBack Then + + ViewState("NombreArchivo") = "" + ViewState("HeaderTexto") = "" + ViewState("DetalleTexto") = "" + ViewState("TrailerTexto") = "" + ViewState("Vacio") = "" + ViewState("TotalAcumulado") = 0 + CveCuenta = -1 + TipoMasiva = 1 + + txtFechaI.Text = Date.Now.ToShortDateString + txtFechaF.Text = Date.Now.ToShortDateString + + CargaCuentas() + CargaProveedores() + InicializaDatosGenerales() + + + End If + + + End Sub + + +#Region " C A R G A - D A T O S " + Private Sub CargaCuentas() + DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("UsaLayoutGrupos = 1") + DdlCuenta.DataBind() + UpFiltros.Update() + + DdlCuentaReportes.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros("UsaLayoutGrupos = 1") + DdlCuentaReportes.DataBind() + UpFiltrosReporte.Update() + End Sub + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CveCuenta = DdlCuenta.SelectedValue.ToEntero + CargaDatos() + End Sub + Private Sub CargaDatos() + + 'Carga datos en DT´s + Dim ObjBancos As New ClsBancos + If ObjBancos.GetLayoutPagos(CveCuenta, -1, DdlTipoGeneracion.SelectedValue, PorGrupos:=True) Then + DTPendientes = ObjBancos.DtResultados + Else + DTPendientes = Nothing + End If + + If ObjBancos.GetLayoutPagosEnviados(CveCuenta, 1, DdlTipoGeneracion.SelectedValue, "-1", "-1") Then + DTEnviadas = ObjBancos.DtResultados + Else + DTEnviadas = Nothing + End If + ObjBancos.Dispose() + + + 'Carga GvPendientes + If DTPendientes IsNot Nothing AndAlso DTPendientes.Rows.Count > 0 Then + GvPendientes.DataSource = DTPendientes + End If + GvPendientes.DataBind() + + 'Carga GvEnviadas + If DTEnviadas IsNot Nothing AndAlso DTEnviadas.Rows.Count > 0 Then + GvEnviadas.DataSource = DTEnviadas + End If + GvEnviadas.DataBind() + + UpGVDatos.Update() + + If DTPendientes IsNot Nothing AndAlso DTPendientes.Rows.Count > 0 Then + CargaDatosInformativos() + End If + + End Sub + Private Sub CargaDatosInformativos() + Dim Altas = 0 + Dim Interbancarias = 0 + Dim Bancomer = 0 + + Dim Movimientos = 0 + Dim Importe = 0.0 + + For Each dr As DataRow In DTPendientes.Rows + + If dr("EstatusCtaDeposito").ToString <> "True" Then + Continue For + End If + + If dr("CveCuentaDeposito").ToString <> "" And dr("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 + + LbNumeroAltas.Text = Altas.ToString + LbNumeroInterbancarias.Text = Interbancarias.ToString + LbNumeroBancomer.Text = Bancomer.ToString + + LbNumeroMovimientos.Text = Movimientos.ToString + LbImporteMovimientos.Text = Importe.ToString.FormatoNumero + + UpComandosGeneracion.Update() + End Sub +#End Region + +#Region " DATOS GENERALES LAYOUT " + Private Sub InicializaDatosGenerales() + + If UsuarioActual.CveEmpresa = 66 Then + CorreoNotificacionesEmpresa = "pagos@gluyasconstrucciones.com" + ElseIf UsuarioActual.CveEmpresa = 13 Then + CorreoNotificacionesEmpresa = "signotificaciones@adssistemas.mx" + Else + CorreoNotificacionesEmpresa = "signotificaciones@adssistemas.mx" + End If + + End Sub +#End Region + + +#Region " GENERA Y DESCARGA ARCHIVO (TXT) " + Protected Sub CrearTXT() + Dim path As String = Server.MapPath(String.Format("~/Empresas/{0}/Layout/{1}.txt", UsuarioActual.CveEmpresa, NombreArchivo)) + ' Create or overwrite the file. + Dim fs As FileStream = File.Create(path) + + ' Add text to the file. + Dim info As Byte() = New UTF8Encoding(True).GetBytes(TextoCompleto) + fs.Write(info, 0, info.Length) + fs.Close() + End Sub + Private Sub DescargarArchivo() + With HttpContext.Current.Response + .Clear() + .Buffer = True + .ContentType = "textplain" + .AddHeader("Content-Disposition", String.Format("attachment;filename={0}{1}.txt", NombreArchivo, Date.Now.ToString("ddMMyyyy"))) + .Charset = "UTF-8" + .ContentEncoding = Encoding.Default + .Write(TextoCompleto) + .Flush() + .End() + End With + End Sub + Private Sub DescargaZip() + Dim path As String = Server.MapPath(String.Format("~/Empresas/{0}/Layout/", UsuarioActual.CveEmpresa)) + Response.Clear() + Dim ElZip As ZipFile = New ZipFile() + Using ElZip + ElZip.AddDirectory(path) + ElZip.Save(Response.OutputStream) + End Using + Response.AddHeader("Content-Disposition", "attachment; filename=LayoutPagos.zip") + Response.ContentType = "application/zip" + Response.End() + End Sub + Private Function CreaArchivo(Tipo As Integer) As Boolean + + + DirectoryExistsCreate(String.Format("{0}Layout", UsuarioActual.Empresa.Ruta)) + + NombreArchivo = String.Format("{2}{1}{0}.txt", UsuarioActual.CveUsuario, Date.Now.ToString("yyyyMMdd-HH-mm"), If(Tipo = 1, "LAYOUTPAGO", "LAYOUTALTA")) + + Dim path As String = String.Format("{0}Layout\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo) + Dim fs As FileStream = File.Create(path) + + ' Add text to the file. + Dim info As Byte() = New UTF8Encoding(True).GetBytes(TextoCompleto) + fs.Write(info, 0, info.Length) + fs.Close() + + Return True + End Function + Private Function GuardaTXT() As Boolean + Dim Retorno = True + Try + Dim Ruta = "" + Dim FileName As String = Path.GetFileName(FUTxt.PostedFile.FileName) + NombreArchivo = FileName + Dim Extension As String = Path.GetExtension(FUTxt.PostedFile.FileName) + Dim FolderPath As String = String.Format("{0}Empresas\", Request.ApplicationPath) + Dim FilePath As String = Server.MapPath(FolderPath + FileName) + FUTxt.SaveAs(FilePath) + NombreArchivo = FilePath + Catch ex As Exception + Retorno = False + End Try + + Return Retorno + End Function +#End Region + +#Region " TAB PRINCIPAL " + + Protected Sub GvPendientes_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + + 'Colorea GV + If e.Row.DBCampo("RazonSocial").ToString = "" Then + e.Row.BackColor = Drawing.Color.WhiteSmoke + Else + If e.Row.DBCampo("EstatusPagoElectronicoGrupos").ToString <> "True" Then + e.Row.BackColor = Drawing.Color.LightSalmon + e.Row.ToolTip = "Cuenta Deposito aun sin dar de Alta." + End If + + If e.Row.DBCampo("CveProveedor").ToString.ToEntero > 0 Then + e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor")) + Else + e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal")) + End If + + End If + + If Not e.Row.DBCampo("CveCuentaDeposito").ToString.ToEntero > 0 Then + e.Row.Cells(0).BackColor = Drawing.Color.Red + e.Row.ToolTip = "Sin Cuenta Deposito asignada" + End If + + If e.Row.DBCampo("EstatusCtaDeposito").ToString = "False" Then + e.Row.Cells(0).BackColor = Drawing.Color.Red + e.Row.ToolTip = "Cuenta Deposito INACTIVA" + End If + + e.Row.FCHyperLink("HLImporte").NavigateUrl = String.Format("IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE")) + + End If + End Sub + Protected Sub GvEnviadas_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + 'Colorea GV + If e.Row.DBCampo("CveIE").ToString = "" Then + e.Row.BackColor = Drawing.Color.LightGray + + + 'Si la fecha de generacion del archivo es diferente de hoy activamos el boton REGENERAR + 'If e.Row.DBCampo("Fecha").ToDate.ToShortDateString <> Date.Now.ToShortDateString Then + ' e.Row.FCLinkButton("LBRegenerar").Visible = True + 'End If + If DTEnviadas.MAX("FueConciliado", String.Format("CveLayoutEnvio = {0}", e.Row.DBCampo("CveLayoutEnvio"))).ToEntero > 0 Then + e.Row.ToolTip = "El movimiento no se puede regenerar ya que alguno de sus movimientos ya fue conciliado" + Else + e.Row.FCLinkButton("LBRegenerar").Visible = True + End If + + Else + + If e.Row.DBCampo("FueConciliado") = "1" Then + e.Row.ForeColor = Drawing.Color.Red + e.Row.ToolTip = "Este movimiento ya fue conciliado." + End If + + If e.Row.DBCampo("CveProveedor").ToString.ToEntero > 0 Then + e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor")) + Else + e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal")) + End If + e.Row.FCHyperLink("HLDetalle").NavigateUrl = String.Format("IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE")) + End If + End If + End Sub + Protected Sub LBRegenerar_Click(sender As Object, e As EventArgs) + + Dim CveBLE = CType(sender, LinkButton).CommandArgument.ToEntero + Dim DtRegenerar As New DataTable + + Dim ObjBancos As New ClsBancos + If ObjBancos.GetLayoutPagos(CveCuenta, CveBLE, "-1") Then + DtRegenerar = ObjBancos.DtResultados + Else + DtRegenerar = Nothing + End If + ObjBancos.Dispose() + + If DtRegenerar IsNot Nothing Then + GeneraPago(DtRegenerar) + Else + Alert("Ocurrió un error al obtener los datos para generar el archivo. Por favor vuelva a intentar.", TipoMensaje.MsgError) + End If + + + End Sub + +#End Region + + + + 'RECARGA DATOS +#Region " RECARGA DATOS " + + Private Sub RecargaDatos() + CargaDatos() + TipoMasiva = 1 + DdlTipoCargaMasiva.SelectedValueExist("1") + CargaProveedores() + End Sub + +#End Region + + + + 'ARMA Y GENERA TXT'S + + +#Region "ALTA PROVEEDORES" + + + Protected Sub BtnAltas_Click(sender As Object, e As EventArgs) + + If Not DdlCuenta.SelectedValue.ToEntero > 0 Then + Alert("Primero debe seleccionar una Cuenta", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + AltaProveedores(1) + End Sub + + Private Sub AltaProveedores(TipoAlta As Integer) + + + NombreArchivo = "" + + Dim RegistrosAltaBancomer As New StringBuilder + Dim RegistrosAltaInterbancario As New StringBuilder + + Dim NombreArchivoBancomer As String = "" + Dim NombreArchivoInterbancario As String = "" + + Dim CeroRelleno As Char = "0"c + Dim EspacioRelleno As Char = Chr(32) + Dim ErrorLayout = False + + + Dim DtCuentasPendientesTemp As DataTable = DTPendientes.Copy + DtCuentasPendientesTemp.CaseSensitive = False + + Dim DtCuentasPendientesBancomer As DataTable = DtCuentasPendientesTemp.FiltraParametros($" (EstatusPagoElectronicoGrupos IS NULL OR EstatusPagoElectronicoGrupos = False) AND (CuentaPago like '%BBVA%' OR CuentaPago like '%BANCOMER%' ) ", "", {"CuentaPago", "NumCuenta", "AbreviaturaMon", "RazonSocial", "CveProveedor", "CveBanco"}) + Dim DtCuentasPendientesInterbancarias As DataTable = DtCuentasPendientesTemp.FiltraParametros($" (EstatusPagoElectronicoGrupos IS NULL OR EstatusPagoElectronicoGrupos = False) AND NOT (CuentaPago like '%BBVA%' OR CuentaPago like '%BANCOMER%' ) ", "", {"CuentaPago", "NumCuenta", "AbreviaturaMon", "RazonSocial", "CveProveedor", "CveBanco"}) + + + If DtCuentasPendientesBancomer.Rows.Count > 0 Then + For Each dRow As DataRow In DtCuentasPendientesBancomer.Rows + + + If dRow("NumCuenta").ToString.Length < 19 Then 'Tamaño maximo 18 + RegistrosAltaBancomer.Append(dRow("NumCuenta").ToString.PadLeft(18, CeroRelleno)) + + End If + + If dRow("AbreviaturaMon").ToString.Length = 3 AndAlso dRow("AbreviaturaMon").ToString.Contiene("MXN", "USD", "EUR") Then + RegistrosAltaBancomer.Append(dRow("AbreviaturaMon")) + End If + + RegistrosAltaBancomer.Append("0999999999999.99") + + If dRow("RazonSocial").ToString.Trim.Length < 31 Then 'Tamaño maximo 30 + RegistrosAltaBancomer.Append(dRow("RazonSocial").ToString.PadLeft(30, EspacioRelleno)) + Else + RegistrosAltaBancomer.Append(dRow("RazonSocial").ToString.Trim.Substring(0, 30)) + End If + + 'ALIAS DE LA CUENTA PENDIENTE TAMAÑO MAXIMO 30 + RegistrosAltaBancomer.Append(dRow("CveProveedor").ToString.PadLeft(30, EspacioRelleno)) + + 'CORREO OPCIONAL TAMAÑO MAXIMO 80 + 'RegistrosAlta.Append("".ToString.PadLeft(80, EspacioRelleno)) + + RegistrosAltaBancomer.Append(vbCrLf) + Next + + TextoCompleto = RegistrosAltaBancomer.ToString + + If CreaArchivo(2) Then + NombreArchivoBancomer = NombreArchivo + End If + + + End If + + + + + If DtCuentasPendientesInterbancarias.Rows.Count > 0 Then + + For Each dRow As DataRow In DtCuentasPendientesInterbancarias.Rows + + If Not (dRow("CuentaPago").ToString.ToUpper.Contains("BBVA") Or dRow("CuentaPago").ToString.ToUpper.Contains("BANCOMER")) Then + + If dRow("CveBanco").ToString = "" Then + RegistrosAltaInterbancario.Append(dRow("CveBanco").ToString) + Else + Alert("La cuenta deposito no tiene clave ABM(Clave SAT) asignada", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + End If + + + + If dRow("NumCuenta").ToString.Length < 19 Then 'Tamaño maximo 18 + RegistrosAltaInterbancario.Append(dRow("NumCuenta").ToString.PadLeft(18, CeroRelleno)) + End If + + If dRow("AbreviaturaMon").ToString.Length = 3 AndAlso dRow("AbreviaturaMon").ToString.Contiene("MXN", "USD", "EUR") Then + RegistrosAltaInterbancario.Append(dRow("AbreviaturaMon")) + End If + + RegistrosAltaInterbancario.Append("0999999999999.99") + + If dRow("RazonSocial").ToString.Trim.Length < 31 Then 'Tamaño maximo 30 + RegistrosAltaInterbancario.Append(dRow("RazonSocial").ToString.PadLeft(30, EspacioRelleno)) + Else + RegistrosAltaInterbancario.Append(dRow("RazonSocial").ToString.Trim.Substring(0, 30)) + End If + + 'ALIAS DE LA CUENTA PENDIENTE TAMAÑO MAXIMO 30 + RegistrosAltaInterbancario.Append(dRow("CveProveedor").ToString.PadLeft(30, EspacioRelleno)) + + 'CORREO OPCIONAL TAMAÑO MAXIMO 80 + 'RegistrosAlta.Append("".ToString.PadLeft(80, EspacioRelleno)) + + If Not (dRow("CuentaPago").ToString.ToUpper.Contains("BBVA") Or dRow("CuentaPago").ToString.ToUpper.Contains("BANCOMER")) Then + RegistrosAltaInterbancario.Append("40") + End If + + RegistrosAltaInterbancario.Append(vbCrLf) + + Next + + + TextoCompleto = RegistrosAltaInterbancario.ToString + If CreaArchivo(2) Then + NombreArchivoInterbancario = NombreArchivo + End If + + End If + + + Dim Mensaje As New StringBuilder + + + Mensaje.Append("Descarga Layouts
") + + If NombreArchivoBancomer.Trim.Length > 0 Then + Mensaje.Append($"Cuentas Bancomer Descarga Archivo cuentas Bancomer

") + End If + + + If NombreArchivoInterbancario.Trim.Length > 0 Then + Mensaje.Append($"Cuentas Interbancarias
Descarga Archivo cuentas Bancomer") + End If + + If NombreArchivoBancomer.Length > 0 Or NombreArchivoInterbancario.Length > 0 Then + Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) + End If + + + + End Sub + + + + Private Sub AltaProveedoresViejo(TipoAlta As Integer) + Dim DtTemp As DataTable = Nothing + CreaDtAlta() + + + 'TIPO ALTA + '1 = Alta comun + '2 = Alta masiva + If TipoAlta = 1 Then + If DTPendientes Is Nothing OrElse DTPendientes.FiltraParametros("EstatusCtaDeposito = 'True'").Rows.Count <= 0 Then + Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia) + Exit Sub + Else + DtTemp = DTPendientes.FiltraParametros("EstatusCtaDeposito = 'True'").Copy + End If + ElseIf TipoAlta = 2 Then + If DTProveedores Is Nothing OrElse DTProveedores.Rows.Count <= 0 Then + Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia) + Exit Sub + Else + DtTemp = DTProveedores.Copy + End If + ElseIf TipoAlta = 3 Then + If DTFyE Is Nothing OrElse DTFyE.Rows.Count <= 0 Then + Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia) + Exit Sub + Else + DtTemp = DTProveedores.Copy + End If + End If + + 'REINICIA PROPIEDAS + HeaderTexto = "" + DetalleTexto = "" + TrailerTexto = "" + TotalAcumulado = 0 + + ''VALIDA CUENTAS DEPOSITOS + Dim ErrorCuenta = False + Dim ProveedoresError As StringBuilder = New StringBuilder + ProveedoresError.AppendFormat("") + Dim TotalDetalles As Integer = 0 + Dim EsBancomer = False + For Each gvr As DataRow In DtTemp.Rows + If gvr("CveCuentaDeposito").ToString <> "" AndAlso gvr("EstatusPagoElectronico").ToString <> "True" AndAlso gvr("AltaCuenta").ToString = "1" Then + DTPendienteActual = DtTemp.FiltraParametros(String.Format("CveCuentaDeposito = {0}", gvr("CveCuentaDeposito").ToString)) + ErrorCuenta = False + EsBancomer = False + + If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then + EsBancomer = True + End If + + ''COMENTADO PARA PERMITIR ENTRADA DE UNA CUENTA A PROVEEDOR, 22 DE SEPTIEMBRE, ISRAEL PIÑA + 'If Not ErrorCuenta Then + ' If EsBancomer AndAlso (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso Not DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then + ' ProveedoresError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ' ErrorCuenta = True + ' End If + 'End If + + ''CLABE SIEMPRE OBLIGATORIA CUANDO NO ES BANCOMER CON CIE + 'If (DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And Not EsBancomer) Or (EsBancomer And TxtConvenioCIE.Text.Trim.Length <> 6 And DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18) Then + ' Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + + 'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER + If Not ErrorCuenta Then + If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And DTPendienteActual(0)("CLABE").ToString.Trim.Length = 0 And Not EsBancomer Then + ProveedoresError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + 'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10 + If Not ErrorCuenta Then + If DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 10 AndAlso EsBancomer Then + ProveedoresError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + 'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18 + If Not ErrorCuenta Then + If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 Then + ProveedoresError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + 'SI CIE TIENE ALGO DEBE TENER REFERENCIA OBLIGATORIA + If Not ErrorCuenta Then + If DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0 And DTPendienteActual(0)("Referencia").ToString.Trim.Length < 3 Then + ProveedoresError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + 'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA" + If Not ErrorCuenta Then + If EsBancomer AndAlso Not (DTPendienteActual(0)("Cuenta").ToString.Trim.Length = 10 Or DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0) Then + ProveedoresError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + + 'DTPendienteActual(0)("").ToString + + 'VALDIACION ANTIGUA + 'If Not (DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER")) Then + ' If Not DTPendienteActual(0)("CLABE").ToString.Length = 18 Then + ' ProveedoresError.AppendFormat("Proveedor: {0}", DTPendienteActual(0)("RazonSocial").ToString) + ' ErrorCuenta = True + ' End If + 'End If + + If Not ErrorCuenta Then + If TotalDetalles > 0 Then + DetalleTexto &= vbCrLf + End If + CrearDetalle() + TotalDetalles += 1 + End If + + End If + Next + ProveedoresError.AppendFormat("
ProveedorCuentaError
{0}{1}CLABE NO PERTENECE A BANCOMER
{0}{1}CLABE ES OBLIGATORIA
{0}{1}NUMERO DE CUENTA CON FORMATO INCORRECTO
{0}{1}CLABE CON FORMATO INCORRECTO
{0}{1}CIE CON FORMATO INCORRECTO
{0}{1}CUENTA BANCOMER SIN CUENTA O CIE
") + + + If TotalDetalles > 0 Then + FormarTexto(TotalDetalles) + CreaArchivo(2) + + Dim Descargas As New StringBuilder() + Descargas.AppendFormat("
  • TXT
  • ", NombreArchivo) + 'Descargas.AppendFormat("
  • Reporte
  • ", NombreArchivo) + Descargas.AppendFormat("
  • Descargar Reporte
  • ", NombreArchivo) + + + Dim TextoErrorProveedores = "" + If ProveedoresError.Length > 160 Then TextoErrorProveedores = String.Format("


    Proveedores con Error:

    ------------------------------------------------------------------
    {0}

    ", ProveedoresError.ToString) + + Alert(String.Format("
    El Layout fue creado satisfactoriamente.{1}
    Descargas:", Descargas, TextoErrorProveedores), TipoMensaje.MsgInformacion) + + 'NombreArchivo = "LayoutAltaProveedores" + 'DescargarArchivo() + Else + Alert("No hay proveedores que dar de alta", TipoMensaje.MsgInformacion) + End If + + End Sub + + Protected Sub CrearDetalle() + Dim Resultado = True + Dim CuentaDeposito As String = "" + Dim TipoCuentaDeposito As String = "" + Dim TipoCuenta As String = "" + + ''''' LLENADO DE DETALLE + 'Campos #1-4 del Detalle + DetalleTexto &= String.Format("DA{0}N ", DTPendienteActual(0)("CveCuentaDeposito").ToString.ToUpper.PadLeft(30, PadCeros)) + + 'Banco BBVA + If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Then + 'Llenamos datos de BBVA + 'Campo #5-7 del detalle + + 'Busca que cuenta sera la asignada para el proveedor + If DTPendienteActual(0)("CIE").ToString <> "" Then + CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros)) + TipoCuenta = "50" + TipoCuentaDeposito = "CIE" + ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then + CuentaDeposito = DTPendienteActual(0)("Cuenta").ToString + TipoCuenta = "99" + TipoCuentaDeposito = "Cuenta" + ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then + CuentaDeposito = DTPendienteActual(0)("CLABE").ToString + TipoCuenta = "40" + TipoCuentaDeposito = "CLABE" + End If + + + DetalleTexto &= String.Format("{0}{1}{2}", DTPendienteActual(0)("Abreviatura").ToString, TipoCuenta, CuentaDeposito.PadLeft(35, PadCeros)) + + 'Llenamos en blanco datos de otros bancos + 'Campos 8-17 del detalle --- 64 de otros bancos y 45 para FILLER --- Fecha de Alta + DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(109), DateTime.Now().ToString("yyyy-MM-dd")) + + + 'Otros Bancos NACIONAL!! + Else + + CuentaDeposito = DTPendienteActual(0)("CLABE").ToString + TipoCuentaDeposito = "CLABE" + + 'Llenamos en blanco datos de BBVA + DetalleTexto &= Vacio.PadRight(40) + + 'Llenamos datos de otros bancos + 'Campos 8- 17 del detalle --- 44 de otros bancos --- 20 de internacional --- 45 Filler -- Fecha de Alta + DetalleTexto &= String.Format("{0}40{1}{2}{3}{4}{5}", DTPendienteActual(0)("Abreviatura").ToString, DTPendienteActual(0)("CLABE").ToString.PadLeft(35, PadCeros), DTPendienteActual(0)("CLABE").ToString.Substring(0, 3).PadLeft(4, PadCeros), Vacio.PadRight(20), Vacio.PadRight(45), DateTime.Now().ToString("yyyy-MM-dd")) + End If + + 'Llenamos datos de Tipo de Persona - Fisica o Moral + TipoPersona() + + 'Campos 27-32 --- Fillers --- datos de otros bancos (internacional) + DetalleTexto &= Vacio.PadLeft(153) + + 'Campos 33-36 --- Datos de confirmacion + DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), CorreoNotificacionesEmpresa.ToUpper.PadRight(50)) + + 'If DTPendienteActual(0)("ContactoMail").ToString.Length > 0 Then + ' 'DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), DTPendienteActual(0)("ContactoMail").ToString.ToUpper.PadRight(50)) + 'ElseIf DTPendienteActual(0)("ContactoMail").ToString.Length <= 0 Then + ' DetalleTexto &= String.Format("{0}00{1}", Vacio.PadRight(40), Vacio.PadRight(50)) + 'End If + + 'Campos 37-39 -- FILLER + DetalleTexto &= String.Format("00{0}", Vacio.PadRight(38)) + + + ''LLENA DT PARA REPORTE + Dim Row = DtAlta.NewRow() + Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString + Row("Banco") = DTPendienteActual(0)("BancoNombre").ToString + Row("TipoCuenta") = TipoCuentaDeposito + Row("Cuenta") = String.Format("{0}", CuentaDeposito) + DtAlta.Rows.Add(Row) + End Sub + + Protected Sub TipoPersona() + 'Persona Moral + If DTPendienteActual(0)("RFC").ToString.Length = 12 Then + Dim fecha As String = DTPendienteActual(0)("FechaIng").ToString + Dim NombreProveedor = DTPendienteActual(0)("RazonSocial").ToString.Replace("‚"c, Vacio).Replace("‚"c, Vacio).ToUpper.PadRight(50) + NombreProveedor = If(NombreProveedor.Length > 50, NombreProveedor.Substring(0, 50), NombreProveedor) + + 'Campo 18-20 del detalle + DetalleTexto &= String.Format("M{0}{1}-{2}-{3}", NombreProveedor, fecha.Substring(6, 4), fecha.Substring(3, 2), fecha.Substring(0, 2)) + 'Campo 21-26 del detalle --- 10 FILLER - 70 de TipoPersona FISICA - 14 de RFC + DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(80), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14)) + + 'Persona Fisica + ElseIf DTPendienteActual(0)("RFC").ToString.Length = 13 Then + + + If DTPendienteActual(0)("Tipo").ToString = "FyE" Then + + 'Llenamos datos de Tipo de Persona - Fisica nombres Primer apellido Segundo apellido + DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), DTPendienteActual(0)("Nombres").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("APaterno").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("AMaterno").ToString.PadRight(20).Substring(0, 20)) + + 'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC + DetalleTexto &= String.Format("{0}{1}", DTPendienteActual(0)("FechaNacimiento").ToString.ToDate.ToString("yyyy-MM-dd"), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14)) + + Else + + 'Obtener nombre + Dim Nombre() As String = Split(DTPendienteActual(0)("RazonSocial").ToString.Replace(",", "")) + + 'Campo 18-24 del detalle --- 60 Tipo Persona Moral --- 10 Filler -- Datos Persona Fisica + If Nombre.Length = 2 Then + DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), Nombre(0).PadRight(20).Substring(0, 20), Nombre(1).PadRight(20).Substring(0, 20), Vacio.PadRight(20).Substring(0, 20)) + ElseIf Nombre.Length = 3 Then + DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), Nombre(0).PadRight(20), Nombre(1).PadRight(20).Substring(0, 20), Nombre(2).PadRight(20).Substring(0, 20)) + ElseIf Nombre.Length = 4 Then + DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), (Nombre(0) & " " & Nombre(1)).PadRight(20).Substring(0, 20), Nombre(2).PadRight(20).Substring(0, 20), Nombre(3).PadRight(20).Substring(0, 20)) + ElseIf Nombre.Length > 4 Then + + Dim NombreComplejo As New List(Of String) + + 'ignoramos cualquier palabra del nombre que tenga un length igual o menor a 2 + For index = 0 To Nombre.Length - 1 + If Nombre(index).Length > 2 Then + NombreComplejo.Add(Nombre(index)) + End If + Next + + If NombreComplejo.Count = 2 Then + DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), NombreComplejo.Item(0).PadRight(20).Substring(0, 20), NombreComplejo.Item(1).PadRight(20).Substring(0, 20), Vacio.PadRight(20).Substring(0, 20)) + ElseIf NombreComplejo.Count = 3 Then + DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), NombreComplejo.Item(0).PadRight(20), NombreComplejo.Item(1).PadRight(20).Substring(0, 20), NombreComplejo.Item(2).PadRight(20).Substring(0, 20)) + ElseIf NombreComplejo.Count = 4 Then + DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), (NombreComplejo.Item(0) & " " & NombreComplejo.Item(1)).PadRight(20).Substring(0, 20), NombreComplejo.Item(2).PadRight(20).Substring(0, 20), NombreComplejo.Item(3).PadRight(20).Substring(0, 20)) + ElseIf NombreComplejo.Count > 4 Then + Dim Nombres = "" + + 'todas las palabras menos las 2 ultimas forman parte del nombre + For index = 0 To NombreComplejo.Count - 3 + If Nombres <> "" Then Nombres += " " + Nombres += NombreComplejo.Item(index) + Next + DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), Nombres.PadRight(20).Substring(0, 20), NombreComplejo.Item(NombreComplejo.Count - 2).PadRight(20).Substring(0, 20), NombreComplejo.Item(NombreComplejo.Count - 1).PadRight(20).Substring(0, 20)) + + End If + + End If + + 'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC + Dim fecha As String = DTPendienteActual(0)("RFC").ToString.Substring(4, 6) + DetalleTexto &= String.Format("19{0}-{1}-{2}{3}", fecha.Substring(0, 2), fecha.Substring(2, 2), fecha.Substring(4, 2), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14)) + + End If + + + Else + 'Alert("Hola") + End If + End Sub + Protected Sub FormarTexto(Registros As Integer) + '''''' LLENADO HEADER + Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString + 'Campos #1-4 del Header + HeaderTexto = String.Format("H{0}{1}GRUPO01 ", convenio.PadLeft(9, PadCeros), DateTime.Now().ToString("yyyy-MM-dd")) + 'Campo #5 del Header + + Dim IdentificadoUsuario As String = UsuarioActual.Usuario.Replace(" ", "").Replace(".", "").Replace("@", "").Replace("/", "").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("EstatusPagoElectronico > 0 AND EstatusCtaDeposito > 0")) + + Else + + Alert("No hay registros para generar", TipoMensaje.MsgAdvertencia) + + End If + End Sub + + Private Sub GeneraPago(DTPendientesTemp As DataTable) + + Dim RegistrosPago As New StringBuilder + Dim MENSAJE As New StringBuilder + + + Dim CeroRelleno As Char = "0"c + Dim EspacioRelleno As Char = Chr(32) + Dim ErrorLayout = False + + + For Each drow As DataRow In DTPendientesTemp.Rows + + + If drow("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or drow("BancoNombre").ToString.ToUpper.Contains("BBVA") Then + RegistrosPago.Append("PTC") + Else + RegistrosPago.Append("PSC") + End If + + If drow("CLABEOrigen").ToString.Trim.Length = 18 Then + RegistrosPago.Append(drow("CLABEOrigen").ToString) + Else + ErrorLayout = True + MENSAJE.AppendLine("ERROR EN CLABE") + Exit For + End If + + If drow("CLABEDestino").ToString.Trim.Length <> 18 Then + RegistrosPago.Append(drow("CLABEDestino").ToString) + Else + ErrorLayout = True + MENSAJE.AppendLine("ERROR EN CLABE") + Exit For + End If + + RegistrosPago.Append("Abreviatura") + + RegistrosPago.Append(drow("Abonado").ToString.ToDecimal.ToString("0000000000000.00")) + + RegistrosPago.Append(drow("CveIE").ToString.PadRight(30, EspacioRelleno)) + + RegistrosPago.Append(vbCrLf) + + 'CveIE + + Next + + + + 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 '{0}' 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 '{0}' del proveedor '{1}' 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("
  • TXT
  • ", NombreArchivo) + ' Descargas.AppendFormat("
  • Reporte
  • ", NombreArchivo) + Descargas.AppendFormat("
  • Descargar Reporte
  • ", NombreArchivo) + + Alert(String.Format("
    El Layout fue creado satisfactoriamente.


    Descargas:", Descargas), TipoMensaje.MsgInformacion) + 'Alert("El Layout fue creado satisfactoriamente") + Else + ObjBancos.RollBack() + ObjBancos.Dispose() + Alert("Ocurrio un problema al registrar la creacion del Layout. Por favor vuelva a intentar.", TipoMensaje.MsgError) + End If + + End Sub + + Protected Sub CrearDetallePagos() + 'Dim Resultado = True + Dim Importe As String = DTPendienteActual(0)("Abonado").ToString ' importe + Dim Divisa As String = DTPendienteActual(0)("Abreviatura").ToString.ToUpper + 'Dim Factura As String = "FAC-123456".Replace("-", " ") + Dim Referencia As String = "" + + Dim Observaciones As String = DTPendienteActual(0)("Observaciones").ToString.Replace(":", "").Replace("-", " ").Replace(",", "").Replace(vbCrLf, " ").ToUpper + + ''PARA DETECTAR SI ES CIE + Dim CuentaDeposito As String + Dim CodigoOperacion As String = "2" + + 'Busca que cuenta sera la asignada para el proveedor + If DTPendienteActual(0)("CIE").ToString.Length >= 4 Then + CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros)) + CodigoOperacion = "3" + Referencia = If(DTPendienteActual(0)("Referencia").ToString = "", "0", DTPendienteActual(0)("Referencia").ToString) 'String.Format("CVEIE{0}", DTPendienteActual(0)("CveIE").ToString).ToUpper 'cveIE + Else + Referencia = Observaciones.Replace(" ", "") + Referencia = If(Referencia.Length > 20, Referencia.Substring(0, 20), Referencia) + Referencia = If(Referencia.Length = 0, "PAGO", Referencia) + End If + + + ''CLAVE DE REGISTRO PARA CONTROL PROPIO ADSISTEMAS -- orita se esta guardando en el campo #9 + Dim Cve = String.Format("CVEIE{0}", DTPendienteActual(0)("CveIE").ToString).ToUpper 'cveIE + + + ''''' LLENADO DE DETALLE + 'Campos #1-6 del Detalle + DetalleTexto &= String.Format("DAP{0}{1}PDA", Referencia.PadRight(20), DTPendienteActual(0)("CveCuentaDeposito").ToString.PadLeft(30, PadCeros)) + + 'Pago a cuenta BBVA + If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Then + 'Campos 7-24 del Detalle + 'CVE IE EN CAMPO 9 - VIEJO + 'DetalleTexto &= String.Format("{0}{1}{2}{3}N{4}", CodigoOperacion, Vacio.PadLeft(20, PadCeros), Cve.PadRight(15), Vacio.PadRight(139), Vacio.PadRight(187)) + DetalleTexto &= String.Format("{0}{1}{2}{3}{4}N{5}", CodigoOperacion, Vacio.PadLeft(20, PadCeros), Vacio.PadRight(40), Cve.PadRight(37), Vacio.PadRight(77), Vacio.PadRight(187)) + Else + Dim ReferenciaNumerica As String = "0" 'DTPendienteActual(0)("Referencia").ToString + Dim Motivo As String = "Pago de facturas" + + 'Campos 7-24 del Detalle + 'CVE IE EN CAMPO 9 - VIELO + 'DetalleTexto &= String.Format("6{0}{1}{2}{3}{4}N{5}", Vacio.PadRight(20, PadCeros), Cve.PadRight(15), ReferenciaNumerica.PadRight(25), Motivo.ToUpper.PadRight(37), Vacio.PadRight(77), Vacio.PadRight(187)) + DetalleTexto &= String.Format("6{0}{1}{2}{3}{4}N{5}", Vacio.PadRight(20, PadCeros), Vacio.PadRight(15), ReferenciaNumerica.PadRight(25), Cve.PadRight(37), Vacio.PadRight(77), Vacio.PadRight(187)) + End If + + 'OBTENEMOS EL CORREO DEL PROVEEDOR + Dim Correo = CorreoNotificacionesEmpresa.ToUpper.PadRight(50) + 'Correo = If(Correo.Length > 0, Correo.ToUpper.PadRight(50), Vacio.PadRight(50)) + + 'Campos 24-50 del Detalle 0 1 2 3 4 5 6 7 8 9 + DetalleTexto &= String.Format("{0}{1}FA{2}{3}01{4}N{5}{6}{7}{7}{7}{6}N {7}700{8}{9}{7}", Divisa, Vacio.PadLeft(20), Importe.FormatoNumero.Replace(",", "").Replace(".", "").PadLeft(15, PadCeros), Vacio.PadRight(15, PadCeros), Correo, Vacio.PadRight(12, PadCeros), DateTime.Now.ToString("yyyy-MM-dd"), "0001-01-01", Observaciones.PadRight(700), Vacio.PadRight(52)) + TotalAcumulado += Importe.ToDouble + + + + ''LLENA DTPAGOS PARA REPORTE + Dim Row = DtPago.NewRow() + Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString + + If DTPendienteActual(0)("CIE").ToString <> "" Then + Row("Cuenta") = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros)) + ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then + Row("Cuenta") = DTPendienteActual(0)("Cuenta").ToString + ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then + Row("Cuenta") = DTPendienteActual(0)("CLABE").ToString + End If + + Row("Importe") = Importe + Row("Moneda") = DTPendienteActual(0)("Abreviatura").ToString.ToUpper + Row("Observaciones") = DTPendienteActual(0)("Observaciones").ToString + DtPago.Rows.Add(Row) + + End Sub + + Protected Sub FormarTextoPagos(Registros As Integer, Total As String) + Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString + + '''''' LLENADO HEADER + 'Campos #1-4 del Header + HeaderTexto = String.Format("H{0}{1}01", convenio.PadLeft(9, PadCeros), DateTime.Now().ToString("yyyy-MM-dd")) + 'Campo #5 del Header + HeaderTexto &= String.Format("P{0}{1}", DateTime.Now().ToString("s").Replace("-", "").Replace(":", ""), Vacio.PadRight(14)) + 'Campos #6-11 del Header + HeaderTexto &= String.Format("00").PadRight(1314) + + + ''''' LLENADO DE TRAILER + TrailerTexto = String.Format("T{0}{1}{2}{3}", Registros.ToString.PadLeft(10, PadCeros), Total.PadLeft(15, PadCeros), Vacio.PadRight(225, PadCeros), Vacio.PadRight(1115)) + + + ''''' ARMADO DEL TEXTO COMPLETO + TextoCompleto = String.Format("{1}{0}{2}{0}{3}{0}", vbCrLf, HeaderTexto, DetalleTexto, TrailerTexto) + + End Sub +#End Region + +#Region "CARGA ALTA PROVEEDORES" + + Private Sub CreaDtAlta() + + DtAlta = New DataTable + DtAlta.Columns.Add("CveProveedor", GetType(String)) + + DtAlta.Columns.Add("Proveedor", GetType(String)) + DtAlta.Columns.Add("Banco", GetType(String)) + DtAlta.Columns.Add("TipoCuenta", GetType(String)) + DtAlta.Columns.Add("Cuenta", GetType(String)) + DtAlta.Columns.Add("Estatus", GetType(String)) + + DtAlta.Columns.Add("MensajeAdicional", GetType(String)) + DtAlta.Columns.Add("Moneda", GetType(String)) + + End Sub + + + Protected Sub BtnCargarAlta_Click(sender As Object, e As EventArgs) + Dim ErrorArchivo = False + + If FUTxt.HasFile Then + If Not GuardaTXT() Then + Alert("Ocurrio un error al cargar el archivo", TipoMensaje.MsgError) + Exit Sub + End If + Else + Alert("No tiene ningun archivo", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + + 'LEE TXT + Dim Texto As String + + Dim sr As New System.IO.StreamReader(NombreArchivo) + Texto = sr.ReadToEnd() + sr.Close() + + Dim TextoArreglo() = Texto.Split(CChar(vbCrLf)) + + 'Alert(TextoArreglo.Length.ToString) + + 'LEE LINEA POR LINEA + Dim RespuestaHeader = "", RespuestaDetalle = "", RespuestaTrailer = "", CveCuentasDeposito = "" + CreaDtAlta() + Dim ObjGrales As New ClsGenerales + Dim Row As DataRow = Nothing + Dim TipoCuentaDeposito = "" + + For i = 0 To TextoArreglo.Length - 1 Step 1 + 'Valida que el primer renglon sea el HEADER + If i = 0 Then + If TextoArreglo(i).Substring(0, 1) <> "H" Then + ErrorArchivo = True + Exit For + Else + RespuestaHeader = TextoArreglo(i).Substring(50, 2) + End If + Else + 'LEE DETALLE + If TextoArreglo(i).Length > 1 Then + If TextoArreglo(i).Substring(1, 1) = "D" Then + + 'If i > 1 Then + ' RespuestaDetalle += vbCrLf + 'End If + + 'RespuestaDetalle += String.Format("{0}{1}", If(TextoArreglo(i).Substring(197, 1) = "M", TextoArreglo(i).Substring(198, 50).Trim, TextoArreglo(i).Substring(268, 60).Trim), (TextoArreglo(i).Substring(599, 30))) + + ''Guardo CveCuentaDeposito cuando la operacion salio exitosa para actualizar en la DB + If TextoArreglo(i).Substring(597, 2) = "00" Or TextoArreglo(i).Substring(597, 2) = "34" Then + CveCuentasDeposito += If(CveCuentasDeposito <> "", ",", "") + CveCuentasDeposito += TextoArreglo(i).Substring(3, 30).ToEntero.ToString + End If + + + ''LLENA DT PARA REPORTE + Row = DtAlta.NewRow() + + Row("Proveedor") = If(TextoArreglo(i).Substring(197, 1) = "M", TextoArreglo(i).Substring(198, 50).Trim, TextoArreglo(i).Substring(268, 60).Trim) + + 'BANCO + If ObjGrales.GetCuentasDepositos(CveCuentaDeposito:=TextoArreglo(i).Substring(3, 30).ToEntero) Then + If ObjGrales.DtResultados.Rows.Count = 1 Then + Row("Banco") = ObjGrales.DtResultados.Rows(0)("BancoNombre").ToString + Else + ErrorArchivo = True + Exit For + End If + Else + ErrorArchivo = True + Exit For + End If + + 'CUENTA + If TextoArreglo(i).Substring(41, 2).Trim <> "" Then + Row("Cuenta") = String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)) + ElseIf TextoArreglo(i).Substring(81, 2).Trim <> "" Then + Row("Cuenta") = String.Format("{0}", TextoArreglo(i).Substring(83, 35).TrimStart("0"c)) + Row("TipoCuenta") = "CLABE" + Else + ErrorArchivo = True + Exit For + End If + + 'TIPO CUENTA + If Row("TipoCuenta").ToString = "" Then + If String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 8 Then + Row("TipoCuenta") = "CIE" + ElseIf String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 10 Or String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 9 Then + Row("TipoCuenta") = "Cuenta" + ElseIf String.Format("{0}", TextoArreglo(i).Substring(43, 35).TrimStart("0"c)).Length = 18 Then + Row("TipoCuenta") = "CLABE" + End If + End If + + Row("Estatus") = TextoArreglo(i).Substring(599, 30) + + DtAlta.Rows.Add(Row) + + ''LLENA PARA ALERT + 'If i > 1 Then + ' RespuestaDetalle += vbCrLf + 'End If + + 'RespuestaDetalle += String.Format("{0}{1}", If(TextoArreglo(i).Substring(197, 1) = "M", TextoArreglo(i).Substring(198, 50).Trim, TextoArreglo(i).Substring(268, 60).Trim), (TextoArreglo(i).Substring(599, 30))) + + + 'LEE TRAILER + ElseIf TextoArreglo(i).Substring(1, 1) = "T" Then + RespuestaTrailer = TextoArreglo(i).Substring(32, 10) + RespuestaTrailer += vbCrLf + RespuestaTrailer += TextoArreglo(i).Substring(42, 10) + RespuestaTrailer += vbCrLf + RespuestaTrailer += TextoArreglo(i).Substring(52, 10) + Exit For + Else + ErrorArchivo = True + Exit For + End If + End If + End If + Next + ObjGrales.Dispose() + + + Dim Respuesta As New StringBuilder + 'LEE ARCHIVO + If Not ErrorArchivo Then + 'TRADUCE CODIGO RESPUESTA HEADER + If RespuestaHeader = "01" Then + RespuestaHeader = "ACEPTADO TOTAL" + ElseIf RespuestaHeader = "02" Then + RespuestaHeader = "ACEPTADO PARCIAL" + ElseIf RespuestaHeader = "03" Then + RespuestaHeader = "RECHAZADO" + End If + + 'DIVIDE DETALLE + Dim Detalle() = RespuestaDetalle.Split(CChar(vbCrLf)) + + 'DIVIDE TRAILER + Dim Trailer() = RespuestaTrailer.Split(CChar(vbCrLf)) + + 'ARMADO DE RESPUESTA + Respuesta.AppendFormat("
    Resumen de respuesta: {0}
    ", RespuestaHeader) + Respuesta.AppendFormat("Numero de movimientos: {0}


    ", DtAlta.Rows.Count) + Respuesta.Append("------------------------------ Detalle de los movimientos ------------------------------
    ") + + Respuesta.Append("") + 'For i = 0 To Detalle.Length - 1 + ' Respuesta.AppendFormat("{1}", i + 1, Detalle(i).Trim) + 'Next + Dim i = 1 + Dim Style = "" + Dim TotalExitos = 0, TotalFracasos = 0 + For Each dr As DataRow In DtAlta.Rows + + If dr("estatus").ToString.Trim.Contiene("OPERACION EXITOSA", "ALTA TERCERO EXITOSO") Then + Style = "" + TotalExitos += 1 + Else + Style = "style=""background-color:#FF5F5F;"" " + TotalFracasos += 1 + End If + + Respuesta.AppendFormat("", i, dr("Proveedor"), dr("Banco"), dr("TipoCuenta"), dr("Cuenta"), dr("estatus"), Style) + i += 1 + Next + + Respuesta.Append("
    #ProveedorBancoTipo CuentaCuentaEstatus
    {0}
    {0}{1}{2}{3}{4}{5}
    -------------------------------------------------------------------------------------
    ") + + Respuesta.AppendFormat("Total de movimientos exitosos: {0}
    ", TotalExitos) + Respuesta.AppendFormat("Total de movimientos NO exitosos: {0}
    ", TotalFracasos) + + 'LEE DESDE EL LAYOUT + 'Respuesta.AppendFormat("Total de altas rechazadas: {0}
    ", Trailer(0).ToString.ToEntero) + 'Respuesta.AppendFormat("Total de bajas rechazadas: {0}
    ", Trailer(1).ToString.ToEntero) + 'Respuesta.AppendFormat("Total de cambios rechazados: {0}
    ", Trailer(2).ToString.ToEntero) + + End If + + If Not ErrorArchivo Then + + If CveCuentasDeposito <> "" Then + Dim ObjIE As New ClsBancos + Dim ErrorDB = False + ObjIE.IniciaTransacSQL() + Dim ArrayCuentasDeposito() = CveCuentasDeposito.Split(","c) + + For index = 0 To ArrayCuentasDeposito.Length - 1 + If Not ObjIE.UpdateCuentaDepositoPagoElectronico(ArrayCuentasDeposito(index).ToEntero) Then + ErrorDB = True + End If + Next + + If Not ErrorDB Then + ObjIE.Commit() + Respuesta.Append("

    NOTA: El archivo se analizo correctamente y se efectuaron todos los cambios en el sistema.") + 'Respuesta.AppendFormat("
    Descargar reporte", NombreArchivo) + Respuesta.AppendFormat("
  • Descargar Reporte
  • ", NombreArchivo) + + Alert(Respuesta.ToString, TipoMensaje.MsgInformacion) + Else + ObjIE.RollBack() + Respuesta.Append("

    NOTA: El archivo se analizo correctamente pero ocurrio un problema al efectuar los cambios en el sistema. Por favor vuelta a intentar.") + Alert(Respuesta.ToString, TipoMensaje.MsgError) + End If + + ObjIE.Dispose() + Else + Respuesta.AppendFormat("

    NOTA: El archivo se analizo correctamente pero ningun movimiento fue exitoso.") + 'Respuesta.AppendFormat("
    Descargar reporte", NombreArchivo) + Respuesta.AppendFormat("
  • Descargar Reporte
  • ", NombreArchivo) + + Alert(Respuesta.ToString, TipoMensaje.MsgAdvertencia) + End If + + Else + Alert("Ocurrio un problema al leer el archivo. Por favor revise que el archivo sea el correcto e intente de nuevo.", TipoMensaje.MsgError) + End If + + 'ELIMINA TXT + My.Computer.FileSystem.DeleteFile(NombreArchivo) + + RecargaDatos() + + End Sub +#End Region + +#Region "CARGA PAGO PROVEEDORES" + Private Sub CreaDtPago() + + DtPago = New DataTable + DtPago.Columns.Add("NumeroConvenio", GetType(String)) + DtPago.Columns.Add("ClaveProveedor", GetType(String)) + DtPago.Columns.Add("ReferenciaPago", GetType(String)) + DtPago.Columns.Add("TipoPago", GetType(String)) + + DtPago.Columns.Add("Proveedor", GetType(String)) + DtPago.Columns.Add("Cuenta", GetType(String)) + DtPago.Columns.Add("Importe", GetType(Decimal)) + DtPago.Columns.Add("Moneda", GetType(String)) + DtPago.Columns.Add("Observaciones", GetType(String)) + + DtPago.Columns.Add("FechaOperacion", GetType(String)) + + End Sub + + + Protected Sub BtnCargarPago_Click(sender As Object, e As System.EventArgs) + Dim ErrorArchivo = False + Dim TextoErrorArchivo = "Ocurrió un problema al leer el archivo, por favor revise que el archivo sea el correcto e intente de nuevo." + + If FUTxt.HasFile Then + If Not GuardaTXT() Then + Alert("Ocurrio un error al cargar el archivo", TipoMensaje.MsgError) + Exit Sub + End If + Else + Alert("No tiene ningun archivo", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + + 'LEE TXT + Dim Texto As String + Dim sr As New System.IO.StreamReader(NombreArchivo) + Texto = sr.ReadToEnd() + sr.Close() + Dim TextoArreglo() = Texto.Split(CChar(vbCrLf)) + + 'INICIALIZA VARIABLES + Dim ObjBancos As New ClsBancos + Dim RespuestaHeader = "", RespuestaDetalle = "", RespuestaTrailer = "", Proveedor = "", CuentaAbono = "", Estatus = "", CveIEs = "", EstatusIEs = "", FechaMovto = "", Correos = "" + Dim Row As DataRow = Nothing + Dim Convenio = "" + CreaDtPago() + + 'LEE LINEA POR LINEA + For i = 0 To TextoArreglo.Length - 1 + 'Valida que el primer renglon sea el HEADER + If i = 0 Then + If TextoArreglo(i).Substring(0, 1) <> "H" Then + ErrorArchivo = True + Exit For + Else + ' Codigo de respuesta | Cuenta cargo + RespuestaHeader = String.Format("{0}|{1}", TextoArreglo(i).Substring(52, 2), TextoArreglo(i).Substring(77, 35)) + Convenio = TextoArreglo(i).Substring(2, 9) + End If + Else + If TextoArreglo(i).Length > 1 Then + + 'LEE DETALLE + If TextoArreglo(i).Substring(1, 1) = "D" Then + If i > 1 Then + RespuestaDetalle += vbCrLf + End If + + 'TRUENA PORQUE AHORA ES LA CVECUENTADEPOSITO + 'Proveedor = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveProveedor = {0}", TextoArreglo(i).Substring(24, 30).ToEntero)).Rows(0)("RazonSocial").ToString + + Correos += If(Correos <> "", "|", "") + + If ObjBancos.GetProveedorCuentaDeposito(TextoArreglo(i).Substring(24, 30).ToDouble.ToEntero) Then + If ObjBancos.DtResultados.Rows.Count > 0 Then + + Proveedor = ObjBancos.DtResultados.Rows(0)("RazonSocial").ToString + + 'Correos += If(TextoArreglo(i).Substring(477, 50).Trim = "", "-1", TextoArreglo(i).Substring(477, 50).Trim) + Correos += String.Format("{0};{1}", ObjBancos.DtResultados.Rows(0)("NotificarA").ToString, ObjBancos.DtResultados.Rows(0)("ContactoMailCobranza").ToString) + + + ''SELECCIONA CUENTA ABONO PARA CORREO + Select Case TextoArreglo(i).Substring(57, 1).ToEntero + Case 1 + CuentaAbono = "NO APLICA" + Case 2 + CuentaAbono = If(ObjBancos.DtResultados.Rows(0)("Cuenta").ToString <> "", ObjBancos.DtResultados.Rows(0)("Cuenta").ToString, ObjBancos.DtResultados.Rows(0)("CLABE").ToString) + Case 3 + CuentaAbono = ObjBancos.DtResultados.Rows(0)("CIE").ToString + Case 4 + CuentaAbono = ObjBancos.DtResultados.Rows(0)("SWIFT").ToString + Case 5, 6, 7 + CuentaAbono = ObjBancos.DtResultados.Rows(0)("CLABE").ToString + End Select + + Else + Proveedor = "PROVEEDOR NO ENCONTRADO" + End If + Else + Proveedor = "PROVEEDOR NO ENCONTRADO" + End If + + Estatus = If(TextoArreglo(i).Substring(1325, 2) = "00", "OPERACION EXITOSA: ", "OPERACION FALLIDA: ") + ' Proveedor | Importe | Descripcion estatus + RespuestaDetalle += String.Format("{0}{1}.{2} {5}{3}{4}", Proveedor, TextoArreglo(i).Substring(445, 13).ToDouble.ToEntero, TextoArreglo(i).Substring(458, 2).ToEntero, Estatus, TextoArreglo(i).Substring(1327, 30), TextoArreglo(i).Substring(420, 3)) + + ''Guardo CveIE cuando la operacion salio exitosa para actualizar en la DB el IE + 'If TextoArreglo(i).Substring(1325, 2) = "00" Then + CveIEs += If(CveIEs <> "", ",", "") + 'VIEJO IE EN CAMPO 9 + 'CveIEs += TextoArreglo(i).Substring(83, 10).Trim + CveIEs += TextoArreglo(i).Substring(123, 32).Trim + + 'SI VIENE SIN RESPUESTA ES ERROR DE ARCHIVO + If TextoArreglo(i).Substring(1325, 2).Trim = "" Then + ErrorArchivo = True + TextoErrorArchivo = "El archivo que se intento procesar no es de respuesta. Por favor verifique cargar el archivo correcto." + Exit For + End If + + EstatusIEs += If(EstatusIEs <> "", ",", "") + EstatusIEs += If(TextoArreglo(i).Substring(1325, 2) = "00", "2", "3") + + FechaMovto += If(FechaMovto <> "", ",", "") + FechaMovto += TextoArreglo(i).Substring(540, 10) + + 'If Proveedor = "PROVEEDOR NO ENCONTRADO" Or CuentaAbono = "" Then + ' Continue For + 'End If + + + ''LLENA DTPAGOS PARA CORREO + Row = DtPago.NewRow() + Row("NumeroConvenio") = Convenio + Row("ClaveProveedor") = TextoArreglo(i).Substring(24, 30) + Row("Proveedor") = Proveedor + Row("ReferenciaPago") = TextoArreglo(i).Substring(4, 20) + Row("Cuenta") = CuentaAbono + + Select Case TextoArreglo(i).Substring(57, 1).ToEntero + Case 1 + Row("TipoPago") = "1 .- ABONO EN VENTANILLA" + Case 2 + Row("TipoPago") = "2 .- ABONO A CUENTAS BANCOMER" + Case 3 + Row("TipoPago") = "3 .- ABONO A CONVENIO CIE" + Case 4 + Row("TipoPago") = "4 .- ABONO A CUENTA INTERNACIONAL VIA SWIFT" + Case 5 + Row("TipoPago") = "5 .- ABONO A CUENTA INTERBANCARIA DIA SIGUIENTE" + Case 6 + Row("TipoPago") = "6 .- ABONO A CUENTA INTERBANCARIA MISMO DIA" + Case 7 + Row("TipoPago") = "7 .- ABONO A CUENTA INTERNACIONAL VIA ACH" + End Select + + Try + Row("Cuenta") = If(Row("Cuenta").ToString = "", String.Format("******{0}", CuentaAbono.Substring(CuentaAbono.Length - 4, 4)), Row("Cuenta").ToString) + Catch ex As Exception + Row("Cuenta") = "******" + End Try + + Row("Importe") = String.Format("{0}.{1}", TextoArreglo(i).Substring(445, 13), TextoArreglo(i).Substring(458, 2)).ToDecimal.ToString + Row("FechaOperacion") = TextoArreglo(i).Substring(540, 10) + Row("Observaciones") = TextoArreglo(i).Substring(605, 700).Trim + DtPago.Rows.Add(Row) + + 'End If + + 'LEE TRAILER + ElseIf TextoArreglo(i).Substring(1, 1) = "T" Then + + 'PARA BCOM, YA QUE TRUNCA EL STRING CUANDO SOLO ES MXP + If TextoArreglo(i).Length < 1367 Then + TextoArreglo(i) = TextoArreglo(i).PadRight(1367) + End If + + RespuestaTrailer += "------------------------------------------------------------ RESUMEN ------------------------------------------------------------" + RespuestaTrailer += String.Format("") + RespuestaTrailer += String.Format("", TextoArreglo(i).Substring(77, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(327, 10).ToDouble.ToEntero.ToString) + RespuestaTrailer += String.Format("", TextoArreglo(i).Substring(87, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(100, 2).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(337, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(350, 2).ToDouble.ToEntero.ToString) + RespuestaTrailer += String.Format("", TextoArreglo(i).Substring(177, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(302, 10).ToDouble.ToEntero.ToString) + RespuestaTrailer += String.Format("
    ConceptoPesos (MXP)Dolares (USD)
    Total registros rechazados:{0}{1}
    Total Importe rechazado: $:{0}.{1}{2}.{3}
    Total registros aceptados:{0}{1}
    Total Importe aceptado $:{0}.{1}{2}.{3}
    ", TextoArreglo(i).Substring(187, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(200, 2).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(312, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(325, 2).ToDouble.ToEntero.ToString) + + 'RespuestaTrailer += String.Format("Total registros rechazados: {1}{0} Total Importe rechazado: $ {2}.{3}{0} Total registros aceptados: {4}{0} Total Importe aceptado: $ {5}.{6}{0}", "
    ", TextoArreglo(i).Substring(77, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(87, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(100, 2).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(177, 10).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(187, 13).ToDouble.ToEntero.ToString, TextoArreglo(i).Substring(200, 2).ToEntero.ToString) + Else + ErrorArchivo = True + Exit For + End If + End If + End If + Next + + ObjBancos.Dispose() + + Dim Respuesta As New StringBuilder + If Not ErrorArchivo Then + + 'DIVIDE HEADER + Dim Header() = RespuestaHeader.Split(CChar("|")) + 'TRADUCE CODIGO RESPUESTA HEADER + If Header(0) = "01" Then + RespuestaHeader = "ACEPTADO TOTAL" + ElseIf Header(0) = "02" Then + RespuestaHeader = "ACEPTADO PARCIAL" + ElseIf Header(0) = "03" Then + RespuestaHeader = "RECHAZADO" + End If + RespuestaHeader += String.Format("
    Cuenta Cargo: {0}", Header(1)) + + 'DIVIDE DETALLE + Dim Detalle() = RespuestaDetalle.Split(CChar(vbCrLf)) + + 'ARMADO DE RESPUESTA + Respuesta.AppendFormat("
    Resumen de respuesta: {0}
    ", RespuestaHeader) + Respuesta.AppendFormat("Numero de movimientos: {0}

    ", Detalle.Length.ToString) + Respuesta.Append("----------------------------------------------------- Detalle de los movimientos --------------------------------------------------
    ") + Respuesta.Append("") + For i = 0 To Detalle.Length - 1 + Respuesta.AppendFormat("{1}", i + 1, Detalle(i).Trim) + Next + Respuesta.Append("
    #ProveedorImporte($)MonedaEstatus
    {0}
    ----------------------------------------------------------------------------------------------------------------------
    ") + Respuesta.AppendFormat(RespuestaTrailer) + + + End If + + If Not ErrorArchivo Then + If CveIEs <> "" Then + Dim ObjIE As New ClsBancos + Dim ErrorDB = False + ObjIE.IniciaTransacSQL() + Dim ArrayCveIEs() = CveIEs.Split(","c) + Dim ArrayEstatusIEs() = EstatusIEs.Split(","c) + Dim ArrayFechasMovto() = FechaMovto.Split(","c) + Dim ArrayCorreos() = Correos.Split("|"c) + + Dim ArregloHilos As New Generic.List(Of System.Threading.Thread) + Dim ArregloParametros As New Generic.List(Of List(Of String)) + + For index = 0 To ArrayCveIEs.Length - 1 + If ObjIE.UpdatePagoElectronicoCarga(ArrayCveIEs(index).ToEntero, ArrayEstatusIEs(index).ToEntero) Then + + 'Cuando salio exitoso actualizamos el IE + If ArrayEstatusIEs(index).ToEntero = 2 Then + If ObjIE.UpdateIEPagoElectronico(ArrayCveIEs(index).ToEntero, ArrayFechasMovto(index).ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then 'DESPROGRAMA LAS COMPRAS RELACIONADAS EN ESTE PA + + 'Cambiamos estatus notificación + If ObjIE.UpdateBancos_IENotificaciones(2, "-1", "-1", ArrayCveIEs(index).ToEntero) Then + + 'Obtenemos los correos del movimiento + If ArrayCorreos(index) <> "-1" Or ArrayCorreos(index) <> "" Then + + 'Dim CorreosMovto() = ArrayCorreos(index).Split(";"c) + 'For index2 = 0 To CorreosMovto.Length - 1 + ' If CorreosMovto(index2).Length > 5 Then + ' End If + 'Next + + Dim Param As New List(Of String) + + Param.Add(ArrayCorreos(index)) 'Para + Param.Add("Notificación de Pago") 'Asunto + Param.Add(GeneraCorreo2(DtPago.Rows(index), ObjIE, ArrayCveIEs(index).ToEntero)) 'Body + + Dim Hilo As New Threading.Thread(AddressOf MandaCorreo) + ArregloHilos.Add(Hilo) + ArregloParametros.Add(Param) + End If + Else + ErrorDB = True + End If + + Else + ErrorDB = True + End If + Else + + 'Cuando salio NO exitoso cancelamos el IE + If Not ObjIE.CancelarBancos_IE(UsuarioActual.CveUsuario, ArrayCveIEs(index).ToEntero, False, -1, -1) Then + ErrorDB = True + End If + End If + + Else + ErrorDB = True + End If + Next + + If Not ErrorDB Then + ObjIE.Commit() + 'ObjIE.RollBack() + + 'EMPIEZA A ENVIAR CORREO POR HILOS + For index = 0 To ArregloHilos.Count - 1 + ArregloHilos(index).Start(ArregloParametros(index)) + Next + + Respuesta.Append("

    NOTA: El archivo se analizo correctamente y se efectuaron todos los cambios en el sistema.") + Alert(Respuesta.ToString, TipoMensaje.MsgInformacion) + + CargaDatos() + Else + ObjIE.RollBack() + Respuesta.Append("

    NOTA: El archivo se analizo correctamente pero ocurrió un problema al efectuar los cambios en el sistema. Por favor vuelva a intentar.") + Alert(Respuesta.ToString, TipoMensaje.MsgError) + End If + + ObjIE.Dispose() + Else + Respuesta.AppendFormat("

    NOTA: El archivo se analizo correctamente pero ningun movimiento fue exitoso.") + Alert(Respuesta.ToString, TipoMensaje.MsgAdvertencia) + End If + Else + Alert(TextoErrorArchivo, TipoMensaje.MsgError) + End If + + 'ELIMINA TXT + My.Computer.FileSystem.DeleteFile(NombreArchivo) + + RecargaDatos() + + End Sub +#End Region + + + + 'FUNCIONARIO O EMPLEADO +#Region " ALTA FUNCIONARIO " + Private Sub CargaFyE() + Dim ObjBancos As New ClsBancos + + If ObjBancos.GetLayoutFyE(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + DTFyE = ObjBancos.DtResultados.FiltraParametros("LEN(RFC) IN (13)") + Else + DTFyE = Nothing + End If + ObjBancos.Dispose() + + If DTFyE.Rows.Count > 0 Then + GvProveedores.DataSource = DTFyE + End If + GvProveedores.DataBind() + + UpProveedores.Update() + End Sub + Private Sub GeneraAltaFyE() + Dim DtTemp As DataTable = Nothing + + 'REINICIA PROPIEDAS + HeaderTexto = "" + DetalleTexto = "" + TrailerTexto = "" + TotalAcumulado = 0 + CreaDtAlta() + + DtTemp = DTFyE + + ''VALIDA CUENTAS DEPOSITOS + Dim ErrorCuenta = False + Dim FyEError As StringBuilder = New StringBuilder + FyEError.AppendFormat("") + + Dim TotalDetalles As Integer = 0 + Dim EsBancomer = False + For Each gvr As DataRow In DtTemp.Rows + If gvr("CvePersonal").ToString <> "" AndAlso gvr("EstatusPagoElectronico").ToString <> "True" AndAlso gvr("AltaCuenta").ToString = "1" Then + DTPendienteActual = DtTemp.FiltraParametros(String.Format("CveCuentaDeposito = {0}", gvr("CveCuentaDeposito").ToString)) + ErrorCuenta = False + EsBancomer = False + + If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then + EsBancomer = True + End If + + 'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER + If Not ErrorCuenta Then + If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And DTPendienteActual(0)("CLABE").ToString.Trim.Length = 0 And Not EsBancomer Then + FyEError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + 'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10 + If Not ErrorCuenta Then + If DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 10 AndAlso EsBancomer Then + FyEError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + 'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18 + If Not ErrorCuenta Then + If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 Then + FyEError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + 'SI CIE TIENE ALGO DEBE TENER REFERENCIA OBLIGATORIA + If Not ErrorCuenta Then + If DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0 And DTPendienteActual(0)("Referencia").ToString.Trim.Length < 3 Then + FyEError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + 'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA" + If Not ErrorCuenta Then + If EsBancomer AndAlso Not (DTPendienteActual(0)("Cuenta").ToString.Trim.Length = 10 Or DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0) Then + FyEError.AppendFormat("", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString) + ErrorCuenta = True + End If + End If + + If Not ErrorCuenta Then + If TotalDetalles > 0 Then + DetalleTexto &= vbCrLf + End If + GeneraAltaDetalleFyE() + TotalDetalles += 1 + End If + + End If + Next + FyEError.AppendFormat("
    PersonalCuentaError
    {0}{1}CLABE ES OBLIGATORIA
    {0}{1}NUMERO DE CUENTA CON FORMATO INCORRECTO
    {0}{1}CLABE CON FORMATO INCORRECTO
    {0}{1}CIE CON FORMATO INCORRECTO
    {0}{1}CUENTA BANCOMER SIN CUENTA O CIE
    ") + + + If TotalDetalles > 0 Then + FormarTextoAltaFyE(TotalDetalles) + CreaArchivo(2) + + Dim Descargas As New StringBuilder() + Descargas.AppendFormat("
  • TXT
  • ", NombreArchivo) + 'Descargas.AppendFormat("
  • Reporte
  • ", NombreArchivo) + Descargas.AppendFormat("
  • Descargar Reporte
  • ", NombreArchivo) + + + Dim TextoErrorProveedores = "" + If FyEError.Length > 160 Then TextoErrorProveedores = String.Format("


    Proveedores con Error:

    ------------------------------------------------------------------
    {0}

    ", FyEError.ToString) + + Alert(String.Format("
    El Layout fue creado satisfactoriamente.{1}
    Descargas:", Descargas, TextoErrorProveedores), TipoMensaje.MsgInformacion) + + 'NombreArchivo = "LayoutAltaProveedores" + 'DescargarArchivo() + Else + Alert("No hay proveedores que dar de alta", TipoMensaje.MsgInformacion) + End If + + + End Sub + Private Sub GeneraAltaDetalleFyE() + Dim Resultado = True + Dim CuentaDeposito As String = "" + Dim TipoCuentaDeposito As String = "" + Dim TipoCuenta As String = "" + + ''''' LLENADO DE DETALLE + 'Campos #1-4 del Detalle + DetalleTexto &= String.Format("DA{0}N ", DTPendienteActual(0)("CveCuentaDeposito").ToString.ToUpper.PadLeft(30, PadCeros)) + + 'Banco BBVA + If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Then + 'Llenamos datos de BBVA + 'Campo #5-7 del detalle + + 'Busca que cuenta sera la asignada para el proveedor + If DTPendienteActual(0)("CIE").ToString <> "" Then + CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros)) + TipoCuenta = "50" + TipoCuentaDeposito = "CIE" + ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then + CuentaDeposito = DTPendienteActual(0)("Cuenta").ToString + TipoCuenta = "99" + TipoCuentaDeposito = "Cuenta" + ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then + CuentaDeposito = DTPendienteActual(0)("CLABE").ToString + TipoCuenta = "40" + TipoCuentaDeposito = "CLABE" + End If + + + DetalleTexto &= String.Format("{0}{1}{2}", DTPendienteActual(0)("Abreviatura").ToString, TipoCuenta, CuentaDeposito.PadLeft(35, PadCeros)) + + 'Llenamos en blanco datos de otros bancos + 'Campos 8-17 del detalle --- 64 de otros bancos y 45 para FILLER --- Fecha de Alta + DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(109), DateTime.Now().ToString("yyyy-MM-dd")) + + + 'Otros Bancos NACIONAL!! + Else + + CuentaDeposito = DTPendienteActual(0)("CLABE").ToString + TipoCuentaDeposito = "CLABE" + + 'Llenamos en blanco datos de BBVA + DetalleTexto &= Vacio.PadRight(40) + + 'Llenamos datos de otros bancos + 'Campos 8- 17 del detalle --- 44 de otros bancos --- 20 de internacional --- 45 Filler -- Fecha de Alta + DetalleTexto &= String.Format("{0}40{1}{2}{3}{4}{5}", DTPendienteActual(0)("Abreviatura").ToString, DTPendienteActual(0)("CLABE").ToString.PadLeft(35, PadCeros), DTPendienteActual(0)("CLABE").ToString.Substring(0, 3).PadLeft(4, PadCeros), Vacio.PadRight(20), Vacio.PadRight(45), DateTime.Now().ToString("yyyy-MM-dd")) + End If + + 'Llenamos datos de Tipo de Persona - Fisica + ' nombres Primer apellido Segundo apellido + DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), DTPendienteActual(0)("Nombres").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("APaterno").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("AMaterno").ToString.PadRight(20).Substring(0, 20)) + + 'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC + DetalleTexto &= String.Format("{0}{1}", DTPendienteActual(0)("FechaNacimiento").ToString.ToDate.ToString("yyyy-MM-dd"), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14)) + + 'Campos 27-32 --- Fillers --- datos de otros bancos (internacional) + DetalleTexto &= Vacio.PadLeft(153) + + 'Campos 33-36 --- Datos de confirmacion + DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), CorreoNotificacionesEmpresa.ToUpper.PadRight(50)) + + 'If DTPendienteActual(0)("ContactoMail").ToString.Length > 0 Then + ' 'DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), DTPendienteActual(0)("ContactoMail").ToString.ToUpper.PadRight(50)) + 'ElseIf DTPendienteActual(0)("ContactoMail").ToString.Length <= 0 Then + ' DetalleTexto &= String.Format("{0}00{1}", Vacio.PadRight(40), Vacio.PadRight(50)) + 'End If + + 'Campos 37-39 -- FILLER + DetalleTexto &= String.Format("00{0}", Vacio.PadRight(38)) + + + ''LLENA DT PARA REPORTE + Dim Row = DtAlta.NewRow() + Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString + Row("Banco") = DTPendienteActual(0)("BancoNombre").ToString + Row("TipoCuenta") = TipoCuentaDeposito + Row("Cuenta") = String.Format("{0}", CuentaDeposito) + DtAlta.Rows.Add(Row) + End Sub + Protected Sub FormarTextoAltaFyE(Registros As Integer) + '''''' LLENADO HEADER + Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString + 'Campos #1-4 del Header + HeaderTexto = String.Format("H{0}{1}GRUPO01 ", convenio.PadLeft(9, PadCeros), DateTime.Now().ToString("yyyy-MM-dd")) + 'Campo #5 del Header + HeaderTexto &= String.Format("{0}{1}", UsuarioActual.CveUsuario, DateTime.Now().ToString("yyyyMMdd")).PadRight(20) + 'Campos #6-8 del Header + HeaderTexto &= String.Format("00").PadRight(586) + Dim HeaderLength = HeaderTexto.Length + + ''''' LLENADO DE TRAILER + TrailerTexto = String.Format("T{0}{1}{2}", Registros.ToString.PadLeft(10, PadCeros), Vacio.PadRight(50, PadCeros), Vacio.PadRight(575)) + + ''''' ARMADO DEL TEXTO COMPLETO + TextoCompleto = String.Format("{1}{0}{2}{0}{3}{0}", vbCrLf, HeaderTexto, DetalleTexto, TrailerTexto) + 'TxtAltas.Text = TextoCompleto + End Sub +#End Region + + + + 'TABS +#Region "R E P O R T E S" + Protected Sub BtnConsultarReportes_Click(sender As Object, e As EventArgs) + CargaReporte() + End Sub + + Private Sub CargaReporte() + Dim ObjBancos As New ClsBancos + Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") + Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") + + If ObjBancos.GetLayoutPagosEnviados(DdlCuentaReportes.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, DdlTipoReportes.SelectedValue, FechaI, DateAdd(DateInterval.Day, 1, FechaF.ToDate).ToShortDateString) Then + DTReportes = ObjBancos.DtResultados + Else + DTReportes = Nothing + End If + ObjBancos.Dispose() + + If DTReportes.Rows.Count > 0 Then + GvReportes.DataSource = DTReportes + End If + GvReportes.DataBind() + + UpDatosReportes.Update() + + End Sub + + Protected Sub GvReportes_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + + 'Colorea GV + If e.Row.DBCampo("CveProveedor").ToString = "" Then + e.Row.BackColor = Drawing.Color.LightGray + Else + e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor")) + End If + End If + End Sub + + +#End Region + + +#Region "C A R G A - M A S I V A" + Protected Sub BtnCargaMasiva_Click(sender As Object, e As EventArgs) + If DdlTipoCargaMasiva.SelectedValue.ToEntero = 1 Then + TipoMasiva = 1 + GvProveedores.Columns(0).HeaderText = "Proveedor" + CargaProveedores() + BtnGenerarProveedores.Text = "Generar Layout Alta Proveedores" + Else + TipoMasiva = 2 + GvProveedores.Columns(0).HeaderText = "Funcionario" + CargaFyE() + BtnGenerarProveedores.Text = "Generar Layout Alta Funcionarios" + End If + End Sub + Protected Sub BtnGenerarProveedores_Click(sender As Object, e As EventArgs) + + If Not DdlCuenta.SelectedValue.ToEntero > 0 Then + Alert("Primero debe seleccionar una Cuenta", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If TipoMasiva = 1 Then + AltaProveedores(2) + Else + GeneraAltaFyE() + End If + + End Sub + Private Sub CargaProveedores() + Dim ObjBancos As New ClsBancos + + If ObjBancos.GetLayoutProveedores(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + DTProveedores = ObjBancos.DtResultados.FiltraParametros("LEN(RFC) IN (12,13)") + Else + DTProveedores = Nothing + End If + ObjBancos.Dispose() + + If DTProveedores.Rows.Count > 0 Then + GvProveedores.DataSource = DTProveedores + End If + GvProveedores.DataBind() + + UpProveedores.Update() + End Sub + Protected Sub GvProveedores_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + If TipoMasiva = 1 Then + e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor")) + Else + e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal")) + End If + End If + + + + End Sub +#End Region + + + + 'CORREO +#Region " GENERA Y MANDA CORREO " + Private Sub MandaCorreo(data As Object) + Dim Parametros As List(Of String) = DirectCast(data, List(Of String)) + + Dim Mail As New ClsSisMail() + Dim Para As String = Parametros(0) + Dim Asunto As String = Parametros(1) + Dim Body As String = Parametros(2) + + 'NO SE OCUPAN + 'Dim CveIE As Integer = Parametros(3).ToEntero + 'Dim CveTipoTransaccion As Integer = Parametros(4).ToEntero + 'Dim Estatus As Integer = If(CveTipoTransaccion = 2, 2, 1) ' cuando es transferencia, no lo pasa por entregar + + ' Mail.MandaCorreo(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) + Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) + End Sub + + Private Function GeneraCorreo(CveIE As Integer, objIE As ClsBancos) As String + Dim strBody As New StringBuilder + + If objIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat(" {0}", UsuarioActual.Empresa.Empresa) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Direccion) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Colonia) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.RFC) + strBody.AppendFormat(" ") + strBody.AppendFormat("
    {0}
    Col. {0}
    {0}, {1}, C.P.{2}
    RFC {0}
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("


    ") + + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + + If objIE.CveTipoTransaccion = 1 Then ' cuando es cheque + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + End If + + If objIE.CveTipoTransaccion = 2 Then ' cuando es transf + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + End If + + strBody.Append(" ") + strBody.AppendFormat(" ") + strBody.Append(" ") + strBody.Append("
    Usted puede pasar a recorger el cheque en las oficinas administrativas.
    Se notifica el envío de transferencia de pago.
     
    ") + strBody.Append("
    ") + + + strBody.AppendFormat("
    ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat(" Beneficiario:{0} ", objIE.PagueseA) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.Banco) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.FechaDocumento.ToString("dd/MM/yyyy")) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.Importe.FormatoNumero, objIE.Moneda) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.Observaciones) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
    Movimiento:Transferencia Bancaria
    Banco:{0}
    Fecha:{0}
    Importe:$ {0} {1}
    Observaciones:{0}
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + strBody.AppendFormat("
    ") + + + + strBody.Append("
    Favor de no responder a este correo.
    ") + + strBody.Append("") + End If + + Return strBody.ToString + End Function +#End Region + +#Region " GENERA CORREO 2" + + Private Function GeneraCorreo2(Dr As DataRow, ByRef ObjIE As ClsBancos, CveIE As Integer) As String + Dim strBody As New StringBuilder + + + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append("
    ") + strBody.Append("

    ") + + + 'strBody.Append(" De: Bancomer.com [mailto:alertatdu@serviciobancomer.com]
    ") + + strBody.Append("

    ") + strBody.AppendFormat(" ", UrlSitio) + strBody.Append("
    ") + + + strBody.AppendFormat(" Enviado el: {0} {1}
    ", Date.Now.ToLongDateString, Date.Now.ToShortTimeString) + strBody.AppendFormat(" Para:{0}
    ", If(UsuarioActual.CveEmpresa = 66, "PAGOS@GLUYASCONSTRUCCIONES.COM", "")) + strBody.Append(" Asunto: CONFIRMACION SIT DISPERSION ") + strBody.Append("

    ") + strBody.Append("

    ") + strBody.Append("   ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" ", UrlSitio) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append("   ") + strBody.Append("

    ") + strBody.Append("

    ") + strBody.Append(" Confirmación de pago realizado bajo las siguientes condiciones: ") + strBody.Append("

    ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append("
    ") + strBody.Append(" ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" NOMBRE DEL CLIENTE: ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" {0} ", UsuarioActual.Empresa.Empresa) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" NÚMERO DE CONVENIO: ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" {0} ", Dr("NumeroConvenio").ToString) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" CLAVE DEL PROVEEDOR: ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" {0} ", Dr("ClaveProveedor").ToString) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" NOMBRE DEL PROVEEDOR/TERCERO: ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" {0} ", Dr("Proveedor").ToString) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" REFERENCIA DEL PAGO: ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" {0} ", Dr("ReferenciaPago").ToString) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" TIPO DE PAGO: ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" {0} ", Dr("TipoPago").ToString) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" CUENTA DE ABONO: ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" {0} ", Dr("Cuenta").ToString) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" IMPORTE DEL PAGO: ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" ${0}  ", Dr("Importe").ToString.FormatoNumero) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" FECHA DE OPERACIÓN ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" {0} ", Dr("FechaOperacion").ToString) + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.Append(" MENSAJE ADICIONAL: ") + strBody.Append("

    ") + strBody.Append("
    ") + strBody.Append("

    ") + strBody.AppendFormat(" {0} ", Dr("Observaciones").ToString.PadRight(70, " "c).Replace(" ", " ")) + strBody.Append("

    ") + strBody.Append("
    ") + + + + strBody.Append("
    ") + strBody.AppendFormat(" ", UrlSitio) + strBody.Append("
    ") + + + + strBody.Append("

    ") + strBody.Append("   ") + strBody.Append("

    ") + strBody.Append("

    ") + strBody.Append("   ") + strBody.Append("

    ") + strBody.Append("

    ") + strBody.Append("   ") + strBody.Append("

    ") + strBody.Append("

    ") + strBody.Append("   ") + strBody.Append("

    ") + strBody.Append("

    ") + strBody.Append("   ") + strBody.Append("

    ") + + + If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then + If ObjIE.DtResultados.Rows.Count > 0 Then + Dim dtMovs As DataTable + + Dim Mov As New ClsContabilidad + If Mov.GetPrePolizasDetalle(-1, CveIE) Then + dtMovs = Mov.DtResultados.FiltraParametros("CveConceptoContable IN (17)") + + strBody.Append(" ") + strBody.Append(" ") + + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + + For Each Dr2 As DataRow In dtMovs.Rows + strBody.Append(" ") + strBody.Append($" ") + strBody.Append($" ") + strBody.Append($" ") + strBody.Append($" ") + strBody.Append($" ") + strBody.Append($" ") + strBody.Append(" ") + Next + + strBody.Append(" ") + strBody.Append("
    Listado de facturas pagadas
    Factura ") + strBody.Append(" Fecha ") + strBody.Append(" Original ") + strBody.Append(" Abonado ") + strBody.Append(" Nota Crédito ") + strBody.Append(" Saldo ") + strBody.Append("
    {Dr2("SerieFolio")}{Dr2("FechaCompra").ToString.ToDate.ToShortDateString}{Dr2("Total").ToString.ToDouble.FormatoNumero}{Dr2("Importe").ToString.ToDouble.FormatoNumero}{Dr2("ImporteNC").ToString.ToDouble.FormatoNumero}{Dr2("Saldo").ToString.ToDouble.FormatoNumero}
    ") + + strBody.Append("
    ") + strBody.Append(" ") + strBody.Append(" ") + + End If + Mov.Dispose() + + End If + 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 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("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/LayoutPagoProveedor.rdlc", DtPago, params, "LayoutPagoProveedor", RDSName:="DSPagoElectronicoV2") + End If + + End Sub +#End Region + + + 'NO QUITAR, SE OCUPA PARA EXPORTAR PDF + Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + Return + End Sub + + + +End Class diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index bf0ac93bf..17bed395d 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -2389,6 +2389,10 @@ Partial Class Bancos_ProveedoresAbonar 'cuando es layout If tTipoTransaccion = 9 Then dt = dt.FiltraParametros("UsaLayout = 1") + End If + + If tTipoTransaccion = 17 Then + dt = dt.FiltraParametros("UsaLayoutGrupos = 1") End If DdlCuenta.DataSource = dt @@ -2462,7 +2466,8 @@ Partial Class Bancos_ProveedoresAbonar Dim Dep As New ClsGenerales If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor) Then - If Dep.DtResultados.FiltraParametros("Estatus ='True'").Rows.Count > 0 Then + If Dep.DtResultados.FiltraParametros("Estatus ='True'").Rows.Count > 0 Then + If DdlTipoTransaccion.SelectedValue = "9" Then If Dep.DtResultados.Rows.Count > 0 Then @@ -2477,6 +2482,20 @@ Partial Class Bancos_ProveedoresAbonar Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia) End If + ElseIf DdlTipoTransaccion.SelectedValue = "17" Then + + If Dep.DtResultados.Rows.Count > 0 Then + DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("EstatusPagoElectronicoGrupos = 'True' AND Estatus ='True'") + End If + + If Dep.DtResultados.FiltraParametros("EstatusPagoElectronicoGrupos = 'True' AND Estatus ='True'").Rows.Count > 0 Then + trCuentaDeposito.Visible = True + DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) + Else + BtnIEGuardar.Enabled = False + Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia) + End If + Else DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("Estatus ='True'") If Dep.DtResultados.Rows.Count > 0 Then diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index dea3762d5..1dad856cc 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -554,7 +554,7 @@ diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index f68fe8254..322dd0d2e 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -2841,14 +2841,33 @@ Partial Class Compras_eFacturas - For Each drow As DataRow In ObjCompras.DtResultados.FiltraParametros("CveIE > 0 AND FechaDocumento IS NOT NULL", "", {"FechaDocumento"}).Rows + 'For Each drow As DataRow In ObjCompras.DtResultados.FiltraParametros("CveIE > 0 AND FechaDocumento IS NOT NULL", "", {"FechaDocumento"}).Rows - Dim FechaDocumento As Date = drow("FechaDocumento").ToString.ToDate + ' Dim FechaDocumento As Date = drow("FechaDocumento").ToString.ToDate + + ' Dim FT1 As Date = FechaDocumento.AddDays(-6) + ' Dim FT2 As Date = FechaDocumento.AddDays(7) + + ' If Not (FechaPago >= FT1 And FechaPago < FT2) Then + + ' BtnVincularPago.Visible = False + ' MSGComplemento = MSGComplemento & " Existen mas de 3 días de diferencia entre la fecha del documento y la fecha de complemento. " + + ' Exit For + ' End If + + 'Next + + + For Each GvRowF As GridViewRow In GVPDocumentosRelacionadosPagos.Rows + + Dim FechaDocumento As Date = GvRowF.DataKey("FechaPago").ToString.ToDate + Dim FechaDoRecibo As Date = GvRowF.DataKey("Fecha").ToString.ToDate Dim FT1 As Date = FechaDocumento.AddDays(-6) Dim FT2 As Date = FechaDocumento.AddDays(7) - If Not (FechaPago >= FT1 And FechaPago < FT2) Then + If Not (FechaDoRecibo >= FT1 And FechaDoRecibo < FT2) Then BtnVincularPago.Visible = False MSGComplemento = MSGComplemento & " Existen mas de 3 días de diferencia entre la fecha del documento y la fecha de complemento. " @@ -2858,6 +2877,9 @@ Partial Class Compras_eFacturas Next + + + If MSGComplemento.Trim.Length > 0 Then ' BtnVincularPago.Visible = False diff --git a/Contabilidad/PopUpAuxiliar.aspx b/Contabilidad/PopUpAuxiliar.aspx index fd8deccef..50fe4092b 100644 --- a/Contabilidad/PopUpAuxiliar.aspx +++ b/Contabilidad/PopUpAuxiliar.aspx @@ -1,249 +1,249 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PopUpAuxiliar.aspx.vb" Inherits="PopUpAuxiliar" %> - -<%@ Import Namespace="Extensiones" %> - - - - - - - - - Auxiliar Contable - - - - - - - - - - - - + +
    -
    - - -          -          -          - -
    -
    -
    -
    -
    - - Movimientos -
    -
    - - - - - - - - - - -
    -
    - -
    -
    -
    - - - + +
    - - +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PopUpAuxiliar.aspx.vb" Inherits="PopUpAuxiliar" %> + +<%@ Import Namespace="Extensiones" %> + + + + + + + + + Auxiliar Contable - + + + + + + + + + + + - -
    +
    + + +          +          +          + +
    +
    +
    +
    +
    + + Movimientos +
    +
    + + + + + + + + + + +
    +
    + +
    +
    +
    + + + - -
    + + - - - - Fecha - - - - - - Concepto - - - - - - Cargo - - - - - - Abono - - - - - - Folio (Ref.) - -   - - - - Contabilizado - - - - - - Num. Póliza - - - - - - Fecha Conta. - - - - - - Referencia - - - - - - Usuario - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + Fecha + + + + + + Concepto + + + + + + Cargo + + + + + + Abono + + + + + + Folio (Ref.) + +   + + + + Contabilizado + + + + + + Num. Póliza + + + + + + Fecha Conta. + + + + + + Referencia + + + + + + Usuario + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - -
    - -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - -
    - - + +
    + + +
    + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    + + diff --git a/Contabilidad/Reportes/RepAnexoCatalogo.rdlc b/Contabilidad/Reportes/RepAnexoCatalogo.rdlc index f94a74db7..ed3b469e3 100644 --- a/Contabilidad/Reportes/RepAnexoCatalogo.rdlc +++ b/Contabilidad/Reportes/RepAnexoCatalogo.rdlc @@ -1,1409 +1,1408 @@ - - - - - - - - - 2.27047cm - - - 5.35442cm - - - 2.03692cm - - - 1.82105cm - - - 2.37085cm - - - 2.56137cm - - - 2.39183cm - - - 1.75684cm - - - - - 0.635cm - - - - - true - true - - - - - - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Saldos Iniciales - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - 2 - - - - - - - true - true - - - - - - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Saldos Actuales - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - 2 - - - - - - - 0.6cm - - - - - true - true - - - - - Cuenta - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Nombre - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Deudor - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Acreedor - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Cargos - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Abonos - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Deudor - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Acreedor - - - - - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.4cm - - - - - true - true - - - - - =Fields!Codigo.Value - - - - - - 2pt - 2pt - 1pt - 1pt - - - - - - - - true - true - - - - - =Fields!Nombre.Value - - - - - - 1pt - 1pt - 1pt - 1pt - - - - - - - - true - true - - - - - =IIf(Fields!Tipo.Value <> "D", FormatNumber(Fields!SaldoInicial.Value,2) & " ", FormatNumber(Fields!SaldoInicial.Value,2)) - - - - - - - SaldoInicial - - - 2pt - 2pt - 1pt - 1pt - - - 2 - - - - - - - true - true - - - - - =Fields!Cargos.Value - - - - - - 2pt - 2pt - 1pt - 1pt - - - - - - - - true - true - - - - - =Fields!Abonos.Value - - - - - - 2pt - 2pt - 1pt - 1pt - - - - - - - - true - true - - - - - =IIf(Fields!Tipo.Value <> "D", FormatNumber(Fields!SaldoActual.Value,2) & " ", FormatNumber(Fields!SaldoActual.Value,2)) - - - - - - - SaldoActual - - - 2pt - 2pt - 1pt - 1pt - - - 2 - - - - - - - - - - - - - - - - - - - - - - - After - true - - - After - true - - - - - - - DataSet1 - 1.71477cm - 1.635cm - 20.56375cm - - - - - - true - true - - - - - Anexo del catálogo del - - - - =Parameters!pFechaInicio.Value - - - - al - - - - =Parameters!pFechaFin.Value - - - - - - - Textbox5 - 0.93839cm - 2.27047cm - 0.6cm - 18.29327cm - 1 - - - 2pt - 2pt - 2pt - 2pt - - - - External - = Parameters!pImg.Value - FitProportional - 0.01513cm - 0cm - 1.5cm - 2.27047cm - 2 - - - - - - true - true - - - - - =Parameters!pEmp.Value - - - - - - - Textbox10 - 0.89389in - 0.33891in - 7.20207in - 3 - - - 2pt - 2pt - 2pt - 2pt - - - - 1.41576in - - - - =Parameters!pFechaFin.Value - - - - - - - Textbox5 - 2.27047cm - 0.6cm - 18.29327cm - - = (Globals.PageNumber=1) - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - 0.52094in - true - true - - - true - true - - - - - ="Página " & Globals.PageNumber & " de " & Globals.TotalPages - - - - - - - Textbox3 - 0.14111cm - 16.41508cm - 0.6cm - 4.14867cm - - - 2pt - 2pt - 2pt - 2pt - - - - 0.06944in - 0in - 8.09596in - 1 - - - - - - true - true - - - - - Usuario: - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!usuarioImprimio.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Fecha Impresión: - - - - - - - Textbox2 - 0.08333in - 2.89776in - 0.20844in - 1.1182in - 4 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Globals!ExecutionTime - - - - - - - Textbox2 - 0.08333in - 4.01596in - 0.20844in - 2.10083in - 5 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - IMPRESO EN SIG, Anexo Catalogo - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.19685in - 0.19685in - 0.3937in - 0.3937in - 0.05118in - + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Saldos Iniciales + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + 2 + + + + + + + true + true + + + + + + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Saldos Actuales + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + 2 + + + + + + + 0.6cm + + + + + true + true + + + + + Cuenta + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Nombre + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Deudor + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Acreedor + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Cargos + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Abonos + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Deudor + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Acreedor + + + + + + + Black + + 1pt + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.4cm + + + + + true + true + + + + + =Fields!Codigo.Value + + + + + + 2pt + 2pt + 1pt + 1pt + + + + + + + + true + true + + + + + =Fields!Nombre.Value + + + + + + 1pt + 1pt + 1pt + 1pt + + + + + + + + true + true + + + + + =Fields!SaldoInicial.Value + + + + + + + SaldoInicial + + + 2pt + 2pt + 1pt + 1pt + + + 2 + + + + + + + true + true + + + + + =Fields!Cargos.Value + + + + + + 2pt + 2pt + 1pt + 1pt + + + + + + + + true + true + + + + + =Fields!Abonos.Value + + + + + + 2pt + 2pt + 1pt + 1pt + + + + + + + + true + true + + + + + =Fields!SaldoActual.Value + + + + + + + SaldoActual + + + 2pt + 2pt + 1pt + 1pt + + + 2 + + + + + + + + + + + + + + + + + + + + + + + After + true + + + After + true + + + + + + + DataSet1 + 1.71477cm + 1.635cm + 20.56375cm + + + + + + true + true + + + + + Anexo del catálogo del + + + + =Parameters!pFechaInicio.Value + + + + al + + + + =Parameters!pFechaFin.Value + + + + + + + Textbox5 + 0.93839cm + 2.27047cm + 0.6cm + 18.29327cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + External + = Parameters!pImg.Value + FitProportional + 0.01513cm + 1.5cm + 2.27047cm + 2 + + + + + + true + true + + + + + =Parameters!pEmp.Value + + + + + + + Textbox10 + 0.89389in + 0.33891in + 7.20207in + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + 1.41576in + + + + =Parameters!pFechaFin.Value + + + + + + + Textbox5 + 2.27047cm + 0.6cm + 18.29327cm + + = (Globals.PageNumber=1) + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + 0.52094in + true + true + + + true + true + + + + + ="Página " & Globals.PageNumber & " de " & Globals.TotalPages + + + + + + + Textbox3 + 0.14111cm + 16.41508cm + 0.6cm + 4.14867cm + + + 2pt + 2pt + 2pt + 2pt + + + + 0.06944in + 0in + 8.09596in + 1 + + + + + + true + true + + + + + Usuario: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!usuarioImprimio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + + + + Textbox2 + 0.08333in + 2.89776in + 0.20844in + 1.1182in + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Globals!ExecutionTime + + + + + + + Textbox2 + 0.08333in + 4.01596in + 0.20844in + 2.10083in + 5 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + IMPRESO EN SIG, Anexo Catalogo + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.19685in + 0.19685in + 0.3937in + 0.3937in + 0.05118in + - - - - -
  • - Saldar Cuentas Incobrables -
  • -
  • - Vincular Intermediario -
  • -
    -
    -
    - - Abonar Cliente: - - - - - - - - - -
    - -
    -
    -
    -
    -
    - - Banco   - Ingresos x Comprobar - Pago Intermediario - -
    -
    - -
    - - -
    -
    - T.C: - - - - -
    - -
    - -
    - -
    - -
    - - - -
    -
    -
    -
    - -
    - - - -
    -
    -
    -
    -
    - -
    - - - - - -
    - -
    -
    - -
    - - - - - -
    - - - - -
    - T.C: - - - -
    - -
    -
    -
    -
    -
    - -
    -
    - - - - -
    - - - - - - - - - - - - -
    -
    -
    - -
    - - - -
    -
    - -
    - $ - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - -
    -
    - $ - - - - -
    -
    -
    - -
    - -
    -
    - - - -
    - -
    - - <%-- - --%> -
    -
    -
    - -
    - - <%-- - --%> -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    - -
    -
    - -
    - - - - - - - - -
    - - - -
    - -
    - -
    -
    -
    -
    - -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px; margin-right: 20px" class="btn btn-circle btn-sm label-info"> -
    -
    - - - - - - - - - - - - - - - Venta - - - - - - <%----%> - - Fecha Venta - - - - - - Fecha Vencimiento - - - - - - Días Vencidos - -   - - - - - - Monto Compra - -   - - - - - -   - - - - Abonado - -   - - - - Saldo - -   - - - - Abonar - - - - - - - Ot. Ing. - - - - - - - Descuento Pronto Pago - -   - - - - - - - - - Auxiliar - - - - - - CveVenta - - - - - - - - - - - - - <%-- MODAL SALDAR INCOBRABLE--%> - - <%-- FIN MODAL SALDAR INCOBRABLE--%> - - - - -
    - - + + + - + } + + function FnLimites(chk, txt, limiteInferior, limiteSuperior) { + if (ToDouble(txt.value) < limiteInferior) { + txt.value = limiteInferior; + alert("El Importe no debe de exceder a el saldo"); + } else if (ToDouble(txt.value) > limiteSuperior) { + txt.value = limiteSuperior; + alert("El Importe no debe de exceder a el saldo"); + } + + var Suma = SumaValores(); + $get('TxtImporte').value = FormatoNumero(Suma, 2); + + if ($get('TxtTotal') != null) { + $get('TxtTotal').value = FormatoNumero(Suma + (ToDouble($get('TxtOtrosImportes').value * -1)), 2); + } + + CambiaPesosDolares() + CambiaDolaresPesos() + + } + + function CambiaPesosDolares() { + $get('TxtImporte').value = FormatoNumero(SumaValores(), 2); + $('#LtlTotalMXN').text(FormatoNumero(SumaValores(), 2)) + if ($("#LbImporteME").length) { + $get('LbImporteME').innerHTML = '$ ' + FormatoNumero(SumaValores(), 2) + ' USD'; + $get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value) * ToDouble($get('TxtTC').value), 2); + $get('LtlTotalMXN').value = FormatoNumero(ToDouble($get('TxtImporte').value) * ToDouble($get('TxtTC').value), 2); + } + + if ($get('TxtTotal') != null) { + $get('TxtTotal').value = FormatoNumero(ToDouble($get('TxtImporte').value) + (ToDouble($get('TxtOtrosImportes').value * -1)), 2); + } + } + + function CambiaDolaresPesos() { + + $get('TxtImporte').value = FormatoNumero(SumaValores(), 2); + $('#LtlTotalMXN').text(FormatoNumero(SumaValores(), 2)) + + + + if ($("#LbImporteMN").length) { + $get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaValores(), 2) + ' MXN'; + $get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value) / ToDouble($get('TxtTCDolares').value), 2); + $get('LtlTotalMXN').value = FormatoNumero(ToDouble($get('TxtImporte').value) / ToDouble($get('TxtTCDolares').value), 2); + + } + + if ($get('TxtTotal') != null) { + $get('TxtTotal').value = FormatoNumero(ToDouble($get('TxtImporte').value) + (ToDouble($get('TxtOtrosImportes').value * -1)), 2); + } + + } + + function waitforpastedata(elem, savedcontent) { + if (elem.childNodes && elem.childNodes.length > 0) { + processpaste(elem, savedcontent); + } + else { + that = { + e: elem, + s: savedcontent + } + that.callself = function () { + waitforpastedata(that.e, that.s) + } + setTimeout(that.callself, 20); + } + } + + function processpaste(elem, savedcontent) { + pasteddata = elem.innerHTML; + //^^Alternatively loop through dom (elem.childNodes or elem.getElementsByTagName) here + + elem.innerHTML = savedcontent; + + // Do whatever with gathered data; + alert(pasteddata); + } + + function CheckAll() { + var topLevelElem = document.getElementById("C_UPVentas"); + var textBoxes = topLevelElem.getElementsByTagName("input"); + var check = false; + + for (var i = 0; i < textBoxes.length; i++) { + if (textBoxes[i].type == "checkbox") { + + + if (textBoxes[i].id == "ChkAll") { + check = !textBoxes[i].checked; + continue; + } + + + if (textBoxes[i].checked && check) { + textBoxes[i].click(); + } else if (!textBoxes[i].checked && !check) { + textBoxes[i].click(); + } + + } + } + + } + + var TipoCambioActual = 0.0; + function CambiaTC(txt) { + let TipoCambioTxt = ToDouble(txt.value) + if (TipoCambioActual != TipoCambioTxt) { + $get("BtnCambiaTipoMoneda").click(); + TipoCambioActual = TipoCambioTxt; + } + } + + diff --git a/vwd.webinfo b/vwd.webinfo index 2f273a97f..9a68975f3 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -20,6 +20,20 @@ + + + + + + + + + + + + + +