Option Explicit On Option Strict On Imports System.Data Imports System.IO Imports Extensiones Imports GemBox.Spreadsheet Imports Microsoft.Reporting.WebForms Partial Class Compras_CatProveedores Inherits ClsPaginas Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then ViewState("Orden") = "" 'CargaDatos() InicializaValores() ImgPersonalizar.Attributes.Add("onclick", "$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');") Me.Form.DefaultButton = BtnConsultar.UniqueID End If End Sub Private Sub InicializaValores() DdlResponsable.DataSource = GlobalDTUsuarioResponsable(UsuarioActual.CveEmpresa) DdlResponsable.DataBind() DdlResponsable.Items.Insert(0, New ListItem("Todos", "-1")) DdlClasificacionProveedor.DataSource = GlobalDTProveedorClasificacion(UsuarioActual.CveEmpresa) DdlClasificacionProveedor.DataBind() DdlClasificacionProveedor.Items.Insert(0, New ListItem("Todos", "-1")) DdlMoneda.DataSource = GlobalDTMonedas DdlMoneda.DataBind() DdlMoneda.Items.Insert(0, New ListItem("Todos", "-1")) End Sub Public Sub CargaDatos() Dim ObjProveedores As New ClsCompProveedores If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then ViewState("DTProveedores") = ObjProveedores.DtResultados Else Me.GvDatos.DataSource = Nothing End If ObjProveedores.Dispose() GvDatos.DataSource = CType(ViewState("DTProveedores"), DataTable) GvDatos.DataBind() UpDatos.Update() End Sub Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click If ChkCodigo.Checked Then GvDatos.Columns(0).Visible = True Else GvDatos.Columns(0).Visible = False End If If ChkRazonSocial.Checked Then GvDatos.Columns(1).Visible = True Else GvDatos.Columns(1).Visible = False End If If ChkNombreComercial.Checked Then GvDatos.Columns(2).Visible = True Else GvDatos.Columns(2).Visible = False End If If ChkRFC.Checked Then GvDatos.Columns(3).Visible = True Else GvDatos.Columns(3).Visible = False End If If ChkEstatus.Checked Then GvDatos.Columns(4).Visible = True Else GvDatos.Columns(4).Visible = False End If If ChkFechaIng.Checked Then GvDatos.Columns(5).Visible = True Else GvDatos.Columns(5).Visible = False End If If ChkUsuario.Checked Then GvDatos.Columns(6).Visible = True Else GvDatos.Columns(6).Visible = False End If If ChkNombreCorto.Checked Then GvDatos.Columns(7).Visible = True Else GvDatos.Columns(7).Visible = False End If If ChkDireccion.Checked Then GvDatos.Columns(8).Visible = True Else GvDatos.Columns(8).Visible = False End If If ChkContactoNombre.Checked Then GvDatos.Columns(9).Visible = True Else GvDatos.Columns(9).Visible = False End If If ChkTelefono.Checked Then GvDatos.Columns(10).Visible = True Else GvDatos.Columns(10).Visible = False End If If ChkContactoCelular.Checked Then GvDatos.Columns(11).Visible = True Else GvDatos.Columns(11).Visible = False End If If ChkContactoMail.Checked Then GvDatos.Columns(12).Visible = True Else GvDatos.Columns(12).Visible = False End If If ChkLimiteCredito.Checked Then GvDatos.Columns(13).Visible = True Else GvDatos.Columns(13).Visible = False End If If ChkPlazoPago.Checked Then GvDatos.Columns(14).Visible = True Else GvDatos.Columns(14).Visible = False End If If ChkObservaciones.Checked Then GvDatos.Columns(15).Visible = True Else GvDatos.Columns(15).Visible = False End If If ChkIVA.Checked Then GvDatos.Columns(16).Visible = True Else GvDatos.Columns(16).Visible = False End If If ChkRetIVA.Checked Then GvDatos.Columns(17).Visible = True Else GvDatos.Columns(17).Visible = False End If If ChkRetISR.Checked Then GvDatos.Columns(18).Visible = True Else GvDatos.Columns(18).Visible = False End If If ChkCtaContable.Checked Then GvDatos.Columns(19).Visible = True Else GvDatos.Columns(19).Visible = False End If UpDatos.Update() RegistraScript("$('#ModalPersonalizar').modal('hide');") End Sub #Region "G V D A T O S" Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowIndex = 0 Then e.Row.Cells(0).Width = Unit.Pixel(60) e.Row.Cells(1).Width = Unit.Pixel(250) e.Row.Cells(2).Width = Unit.Pixel(250) e.Row.Cells(3).Width = Unit.Pixel(100) e.Row.Cells(4).Width = Unit.Pixel(60) e.Row.Cells(5).Width = Unit.Pixel(70) e.Row.Cells(6).Width = Unit.Pixel(100) End If 'e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center 'e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Center 'e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Center 'e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Center 'e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Center 'e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Center e.Row.FCLiteral("LtlCodigo").Text = "" & e.Row.FCLiteral("LtlCodigo").Text & "" e.Row.FCLiteral("LtlRazonSocial").Text = "" & e.Row.FCLiteral("LtlRazonSocial").Text & "" e.Row.FCLiteral("LtlNombreComercial").Text = "" & e.Row.FCLiteral("LtlNombreComercial").Text & "" e.Row.FCLiteral("LtlRFC").Text = "" & e.Row.FCLiteral("LtlRFC").Text & "" e.Row.FCLiteral("LtlEstatus").Text = "" & e.Row.FCLiteral("LtlEstatus").Text & "" e.Row.FCLiteral("LtlFecha").Text = "" & e.Row.FCLiteral("LtlFecha").Text & "" e.Row.FCLiteral("LtlUsuario").Text = "" & e.Row.FCLiteral("LtlUsuario").Text & "" End If End Sub #End Region Private Sub ImgExcel2_Click(sender As Object, e As EventArgs) Handles ImgExcel2.Click GvDatos.ExportToExcel("RepProveedores_" & NowADS().ToShortDateString) End Sub Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Dim ObjProveedores As New ClsCompProveedores Dim Codigo, RazonSocial, RFC As String Codigo = "-1" RazonSocial = "-1" RFC = "-1" If TxtCodigo.Text.Trim <> String.Empty Then Codigo = TxtCodigo.Text.Trim If TxtRazonSocial.Text.Trim <> String.Empty Then RazonSocial = TxtRazonSocial.Text.Trim If TxtRFC.Text.Trim <> String.Empty Then RFC = TxtRFC.Text.Trim If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, Codigo, RazonSocial, "-1", "-1", RFC, "-1", "-1", -1, UsuarioActual.CveEmpresa, CveTipoProveedor:=DdlTipoProveedor.SelectedValue.ToEntero, CveUsuarioResponsable:=DdlResponsable.SelectedValue.ToEntero, CveMonedaPreferente:=DdlMoneda.SelectedValue.ToEntero, CveProveedorClasificacion:=DdlClasificacionProveedor.SelectedValue.ToEntero) Then If ObjProveedores.DtResultados.Rows.Count > 0 Then ViewState("DTProveedores") = ObjProveedores.DtResultados Else ViewState("DTProveedores") = Nothing Alert("No se encontraron registros con los parametros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia) End If End If ObjProveedores.Dispose() GvDatos.DataSource = CType(ViewState("DTProveedores"), DataTable) GvDatos.DataBind() UpDatos.Update() End Sub Protected Sub LnkCtasBanc_Click(sender As Object, e As EventArgs) Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") Dim DtDatos As DataTable = Nothing Dim ObjBancos As New ClsBancos If ObjBancos.GetCuentasBancarias(UsuarioActual.CveEmpresa) Then DtDatos = ObjBancos.DtResultados.Copy() End If ObjBancos.Dispose() If DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) ImprimirPDF("Empresas/Grales/Formatos/RepCuentasBancarias.rdlc", DtDatos, params, "RepCuentasBancarias", "Excel") Else Alert("No se encontraron datos con los filtros especificados", TipoMensaje.MsgAdvertencia) End If End Sub Protected Sub LnkCtasBancSinProveedor_Click(sender As Object, e As EventArgs) Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") Dim DtDatos As DataTable = Nothing 'Dim GvDatosSC As New GridView With { .AutoGenerateColumns = True } Dim ObjComp As New ClsCompProveedores If ObjComp.GetProveedoresSinCuentas(UsuarioActual.CveEmpresa) Then DtDatos = ObjComp.DtResultados 'GvDatosSC.DataBind() End If ObjComp.Dispose() If DtDatos IsNot Nothing Then DtDatos.TableName = "Proveedores" DtDatos.ExportToExcelG("Proveedores Sin Cuentas", "Proveedores sin Cuentas Bancarias", UsuarioActual) End If End Sub End Class