Option Explicit On Option Strict On Imports System.Data Imports System.IO Imports Extensiones Imports Microsoft.Reporting.WebForms Partial Class RepCxC Inherits ClsPaginas #Region "P R O P I E D A D E S" Private Property DtDatos As DataTable Get DtDatos = DirectCast(ViewState("DtDatos"), DataTable) End Get Set(ByVal value As DataTable) ViewState("DtDatos") = value End Set End Property Private Property DtPersonalizarRango As DataTable Get DtPersonalizarRango = DirectCast(ViewState("DtPersonalizarRango"), DataTable) End Get Set(ByVal value As DataTable) ViewState("DtPersonalizarRango") = value End Set End Property Private Property Index As Integer Get Index = DirectCast(ViewState("Index"), Integer) End Get Set(ByVal value As Integer) ViewState("Index") = value End Set End Property Private Property Modalidad As String Get Modalidad = DirectCast(ViewState("Modalidad"), String) End Get Set(ByVal value As String) ViewState("Modalidad") = value End Set End Property Private Property TCEspecifico As Double Private Property CveCobranzaEstatus As Integer Get CveCobranzaEstatus = DirectCast(ViewState("CveCobranzaEstatus"), Integer) End Get Set(ByVal value As Integer) ViewState("CveCobranzaEstatus") = value End Set End Property Private Property CveClienteClasificacion As Integer Get CveClienteClasificacion = DirectCast(ViewState("CveClienteClasificacion"), Integer) End Get Set(ByVal value As Integer) ViewState("CveClienteClasificacion") = value End Set End Property Private Property Agrupador As String Get Return ViewState("Agrupador").ToString End Get Set(value As String) ViewState("Agrupador") = value End Set End Property Private Property DtColor As DataTable Get Return DirectCast(ViewState("DtColor"), DataTable) End Get Set(value As DataTable) ViewState("DtColor") = value End Set End Property Private Property DtGrafica As DataTable Get Return DirectCast(ViewState("DtGrafica"), DataTable) End Get Set(value As DataTable) ViewState("DtGrafica") = 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 Index = 0 Modalidad = "" CargaCombos() CargaGvPersonalizarRaqngoColumnas() CargaDatos() ActivaEnviarEstadoCuenta() If UsuarioActual.CveRol = 1 Or UsuarioActual.TienePermisoProceso(243) Then LnkDescargarSegmentos.Visible = True CreaDataTableColor() End If End Sub #Region "CARGAS" Private Sub CargaCombos() 'CargaClientes If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then DdlClientesWS.setEsWebService(True) Else DdlClientesWS.setEsWebService(False) CargaClientes() End If 'DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) 'DdlClientes.DataBind() 'CargaSubProyectos DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) DdlSubProyecto.DataBind() 'Carga Vendedor DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) DdlVendedor.DataBind() DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor) If UsuarioActual.CveVendedor > 0 AndAlso Not UsuarioActual.TienePermisoProceso(263) Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) DdlVendedor.Attributes.Add("disabled", "disabled") DdlVendedor.Enabled = False End If 'CargaUsuarios DdlUsuario.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) DdlUsuario.DataBind() 'CargaResponsable DdlResponsable.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa) DdlResponsable.DataBind() ' DdlTipoDocto.Items.Add(New ListItem("Ing X Comp", "IxC")) txtCorteA.Text = $"31/12/{Now.Year}" 'Carga Cobranza Estatus DdlCobranzaEstatus.DataSource = GlobalDTCobranzaEstatus(UsuarioActual.CveEmpresa) DdlCobranzaEstatus.DataBind() DdlCobranzaEstatus.Items.Insert(0, New ListItem("Todos", "-1")) 'Carga Clasificacion Cliente DdlClienteClasificacion.DataSource = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa) DdlClienteClasificacion.DataBind() DdlClienteClasificacion.Items.Insert(0, New ListItem("Todos", "-1")) 'Dim ObjSisUsuarios As New ClsSisUsuarios() 'If ObjSisUsuarios.GetEmpresasUsuario(UsuarioActual.CveUsuario) Then ' DdlEmpresas.DataSource = ObjSisUsuarios.DtResultados ' DdlEmpresas.DataBind() ' DivEmpresasFiltro.Visible = True ' For i As Integer = 0 To DdlEmpresas.Items.Count - 1 ' DdlEmpresas.Items(i).Selected = True ' Next 'End If 'ObjSisUsuarios.Dispose() End Sub Private Sub CargaDatos() Dim ObjMovtos As New ClsMovimientos() Dim FechaI As String = txtFechaI.Text Dim FechaF As String = txtFechaF.Text Dim FechaVI As String = txtFechaVI.Text Dim FechaVF As String = txtFechaVF.Text If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then TCEspecifico = TxtEspecifico.Text.ToDouble Else TCEspecifico = -1 End If If txtFechaI.Text = "" Then FechaI = "-1" If txtFechaF.Text = "" Then FechaF = "-1" If txtFechaVI.Text = "" Then FechaVI = "-1" If txtFechaVF.Text = "" Then FechaVF = "-1" CveCobranzaEstatus = DdlCobranzaEstatus.SelectedValue.ToEntero CveClienteClasificacion = DdlClienteClasificacion.SelectedValue.ToEntero Dim CveCliente = If(DdlClientesWS.SelectedValue.ToEntero > 0, DdlClientesWS.SelectedValue.ToEntero, -1) If ObjMovtos.GetCxC(FechaI, FechaF, CveCliente, DdlSubProyecto.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, -1, "-1", UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico, If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM), FechaVI, FechaVF, FechaCorte:=txtCorteA.Text.ToDate, EstatusCliente:=DdlEstatusCliente.SelectedValue.ToEntero, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveCobranzaEstatus:=CveCobranzaEstatus, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero) Then GvDatos.DataSource = ObjMovtos.DtResultados DtDatos = ObjMovtos.DtResultados DtGrafica = ObjMovtos.DtResultados Else GvDatos.DataSource = Nothing End If Dim NumCol As Integer If ObjMovtos.DtResultados.Rows.Count > 0 Then GvDatos.Columns(4).Visible = False GvDatos.Columns(5).Visible = False GvDatos.Columns(6).Visible = False GvDatos.Columns(7).Visible = False GvDatos.Columns(8).Visible = False GvDatos.Columns(9).Visible = False GvDatos.Columns(10).Visible = False GvDatos.Columns(11).Visible = False GvDatos.Columns(12).Visible = False Dim Contador As Integer = 4 Dim CargaColumnaVencido As Boolean = False Dim Dr As DataRow = ObjMovtos.DtResultados.Rows(0) If Dr("NomC1").ToString <> "" Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = Dr("NomC1").ToString Contador += 1 End If If Dr("TC2").ToString.ToEntero = 2 And Not CargaColumnaVencido Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = "Total" Contador += 1 CargaColumnaVencido = True NumCol = 2 End If If Dr("NomC2").ToString <> "" Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = Dr("NomC2").ToString Contador += 1 End If If Dr("TC3").ToString.ToEntero = 2 And Not CargaColumnaVencido Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = "Total" Contador += 1 CargaColumnaVencido = True NumCol = 3 End If If Dr("NomC3").ToString <> "" Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = Dr("NomC3").ToString Contador += 1 End If If Dr("TC4").ToString.ToEntero = 2 And Not CargaColumnaVencido Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = "Total" Contador += 1 CargaColumnaVencido = True NumCol = 4 End If If Dr("NomC4").ToString <> "" Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = Dr("NomC4").ToString Contador += 1 End If If Dr("TC5").ToString.ToEntero = 2 And Not CargaColumnaVencido Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = "Total" Contador += 1 CargaColumnaVencido = True NumCol = 5 End If If Dr("NomC5").ToString <> "" Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = Dr("NomC5").ToString Contador += 1 End If If Dr("TC6").ToString.ToEntero = 2 And Not CargaColumnaVencido Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = "Total" Contador += 1 CargaColumnaVencido = True NumCol = 6 End If If Dr("NomC6").ToString <> "" Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = Dr("NomC6").ToString Contador += 1 End If If Dr("TC7").ToString.ToEntero = 2 And Not CargaColumnaVencido Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = "Total" Contador += 1 CargaColumnaVencido = True NumCol = 7 End If If Dr("NomC7").ToString <> "" Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = Dr("NomC7").ToString Contador += 1 End If If Dr("TC8").ToString.ToEntero = 2 And Not CargaColumnaVencido Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = "Total" Contador += 1 CargaColumnaVencido = True NumCol = 8 End If If Dr("NomC8").ToString <> "" Then GvDatos.Columns(Contador).Visible = True GvDatos.Columns(Contador).HeaderText = Dr("NomC8").ToString Contador += 1 End If End If ObjMovtos.Dispose() GvDatos.DataBind() ActualizarDatatable(NumCol) Agrupador = DdlGrupo.SelectedItem.Text End Sub #End Region #Region "CONSULTAR" Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click CargaDatos() UPDatos.Update() ActivaEnviarEstadoCuenta() End Sub #End Region #Region "GRIDVIEW" Protected Sub GvDatos_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowCreated If e.Row.RowType = DataControlRowType.Header Then Dim FC As New SortedList FC.Add(0, " ,2,1,ColumnaenBlanco") FC.Add(2, "Vencido,4,1,Titulos") FC.Add(3, "Por Vencer,5,1,Titulos") GetMultiRowHeader(DirectCast(sender, GridView), e, FC, "Titulos") End If End Sub Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim Css As String = "Texto" If e.Row.DBCampo("Orden") = "" Then e.Row.CssClass = "Totales" e.Row.Cells(3).BackColor = Drawing.Color.Transparent e.Row.Cells(13).BackColor = Drawing.Color.Transparent End If If e.Row.RowIndex = 1 Then e.Row.Cells(0).Width = Unit.Pixel(295) e.Row.Cells(1).Width = Unit.Pixel(90) e.Row.Cells(2).Width = Unit.Pixel(90) e.Row.Cells(3).Width = Unit.Pixel(90) End If Dim FechaI, FechaF, FechaVI, FechaVF As String FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") FechaVI = If(IsDate(txtFechaVI.Text.Trim()), txtFechaVI.Text.Trim(), "-1") FechaVF = If(IsDate(txtFechaVF.Text.Trim()), txtFechaVF.Text.Trim(), "-1") Dim CveClienteSucursal As Integer = -1 If DdlGrupo.SelectedValue = "5" Then CveClienteSucursal = e.Row.DBCampo("CveClienteSucursal").ToString.ToEntero If e.Row.DBCampo("CveCliente").ToString.ToEntero <= 0 Then ' cuando es el total general. CveClienteSucursal = -1 End If If e.Row.DBCampo("CveCliente").ToString.ToEntero > 0 Then e.Row.FCLiteral("LtlGrupo").Text = $"{e.Row.DBCampo("GPO")}" End If End If Dim Liga1 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=C1&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga2 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=C2&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga3 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=C3&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga4 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=C4&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga5 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=C5&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga6 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=C6&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga7 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=C7&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga8 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=C8&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga9 As String = String.Format("/CxC/RepCxCDetalle.aspx.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga10 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=TV&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim Liga11 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=TPV&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) Dim LigaTot As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}&CveResponsable={13}&TipoDocto={14}&TipoCambio={15}&TCEspecifico={16}&FechaVI={17}&FechaVF={18}&CveClienteSucursal={19}&FechaCorte={20}&CveCobranzaEstatus={21}&CveClienteClasificacion={22}&LimiteCredito={23}", DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), FechaVI, FechaVF, CveClienteSucursal, txtCorteA.Text, CveCobranzaEstatus, CveClienteClasificacion, e.Row.DBCampo("LimiteCredito")) e.Row.FCHyperLink("HplSaldo").NavigateUrl = LigaTot Dim Contador As Integer = 1 Dim ContadorColumna As Integer = 4 Dim CargaColumnaVencido As Boolean = False If e.Row.DBCampo("NomC1").ToString <> "" Then e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna1").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga1 Contador += 1 ContadorColumna += 1 End If If e.Row.DBCampo("TC2").ToString.ToEntero = 2 And Not CargaColumnaVencido Then If Not e.Row.DBCampo("Orden") = "" Then e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray End If e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 Contador += 1 CargaColumnaVencido = True ContadorColumna += 1 End If If e.Row.DBCampo("NomC2").ToString <> "" Then e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna2").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga2 Contador += 1 ContadorColumna += 1 End If If e.Row.DBCampo("TC3").ToString.ToEntero = 2 And Not CargaColumnaVencido Then If Not e.Row.DBCampo("Orden") = "" Then e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray End If e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 Contador += 1 CargaColumnaVencido = True ContadorColumna += 1 End If If e.Row.DBCampo("NomC3").ToString <> "" Then e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna3").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga3 Contador += 1 ContadorColumna += 1 End If If e.Row.DBCampo("TC4").ToString.ToEntero = 2 And Not CargaColumnaVencido Then If Not e.Row.DBCampo("Orden") = "" Then e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray End If e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 Contador += 1 CargaColumnaVencido = True ContadorColumna += 1 End If If e.Row.DBCampo("NomC4").ToString <> "" Then e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna4").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga4 Contador += 1 ContadorColumna += 1 End If If e.Row.DBCampo("TC5").ToString.ToEntero = 2 And Not CargaColumnaVencido Then If Not e.Row.DBCampo("Orden") = "" Then e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray End If e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 Contador += 1 CargaColumnaVencido = True ContadorColumna += 1 End If If e.Row.DBCampo("NomC5").ToString <> "" Then e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna5").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga5 Contador += 1 ContadorColumna += 1 End If If e.Row.DBCampo("TC6").ToString.ToEntero = 2 And Not CargaColumnaVencido Then If Not e.Row.DBCampo("Orden") = "" Then e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray End If e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 Contador += 1 CargaColumnaVencido = True ContadorColumna += 1 End If If e.Row.DBCampo("NomC6").ToString <> "" Then e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna6").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga6 Contador += 1 ContadorColumna += 1 End If If e.Row.DBCampo("TC7").ToString.ToEntero = 2 And Not CargaColumnaVencido Then If Not e.Row.DBCampo("Orden") = "" Then e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray End If e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 Contador += 1 CargaColumnaVencido = True ContadorColumna += 1 End If If e.Row.DBCampo("NomC7").ToString <> "" Then e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna7").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga7 Contador += 1 ContadorColumna += 1 End If If e.Row.DBCampo("TC8").ToString.ToEntero = 2 And Not CargaColumnaVencido Then If Not e.Row.DBCampo("Orden") = "" Then e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray End If e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 Contador += 1 CargaColumnaVencido = True ContadorColumna += 1 End If If e.Row.DBCampo("NomC8").ToString <> "" Then e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna8").ToString.FormatoNumero e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga8 Contador += 1 ContadorColumna += 1 End If e.Row.Cells(4).Width = Unit.Pixel(75) e.Row.Cells(5).Width = Unit.Pixel(75) e.Row.Cells(6).Width = Unit.Pixel(75) e.Row.Cells(7).Width = Unit.Pixel(75) e.Row.Cells(8).Width = Unit.Pixel(75) e.Row.Cells(9).Width = Unit.Pixel(75) e.Row.Cells(10).Width = Unit.Pixel(75) e.Row.Cells(11).Width = Unit.Pixel(75) e.Row.Cells(12).Width = Unit.Pixel(75) e.Row.Cells(13).Width = Unit.Pixel(75) e.Row.FCHyperLink("HplPorVencer").NavigateUrl = Liga11 e.Row.FCHyperLink("LtlVentas").NavigateUrl = Liga9 e.Row.FCHyperLink("LtlSaldo1").NavigateUrl = LigaTot If e.Row.FCHyperLink("HplSaldo").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplSaldo").Text = "-" If e.Row.FCHyperLink("HplColumna1").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna1").Text = "-" If e.Row.FCHyperLink("HplColumna2").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna2").Text = "-" If e.Row.FCHyperLink("HplColumna3").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna3").Text = "-" If e.Row.FCHyperLink("HplColumna4").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna4").Text = "-" If e.Row.FCHyperLink("HplColumna5").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna5").Text = "-" If e.Row.FCHyperLink("HplColumna6").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna6").Text = "-" If e.Row.FCHyperLink("HplColumna7").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna7").Text = "-" If e.Row.FCHyperLink("HplColumna8").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna8").Text = "-" If e.Row.FCHyperLink("HplColumna9").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna9").Text = "-" If e.Row.FCHyperLink("HplPorVencer").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplPorVencer").Text = "-" If e.Row.FCHyperLink("LtlVentas").Text.ToDouble = 0 Then e.Row.FCHyperLink("LtlVentas").Text = "-" End If End Sub #End Region #Region "PERSONALIZAR COLUMNAS" Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click If ChkVentasVsSaldo.Checked Then GvDatos.Columns(14).Visible = True GvDatos.Columns(15).Visible = True GvDatos.Columns(16).Visible = True GvDatos.Columns(17).Visible = True GvDatos.Columns(18).Visible = True Else GvDatos.Columns(14).Visible = False GvDatos.Columns(15).Visible = False GvDatos.Columns(16).Visible = False GvDatos.Columns(17).Visible = False GvDatos.Columns(18).Visible = False End If If ChkCodigoCl.Checked Then GvDatos.Columns(1).Visible = True Else GvDatos.Columns(1).Visible = False End If If ChkNombreCorto.Checked Then GvDatos.Columns(2).Visible = True Else GvDatos.Columns(2).Visible = False End If UPDatos.Update() End Sub #End Region #Region "IMPRESIONES" Private Sub ActualizarDatatable(NumCol As Integer) If DtDatos IsNot Nothing Then For Each Dt As DataRow In DtDatos.Rows For Cont = 9 To NumCol + 1 Step -1 Dt($"Columna{Cont}") = Dt($"Columna{Cont - 1}") Dt($"TC{Cont}") = Dt($"TC{Cont - 1}") Dt($"NomC{Cont}") = Dt($"NomC{Cont - 1}") Next Dt($"Columna{NumCol}") = Dt("vencido") Dt($"TC{NumCol}") = "1" Dt($"NomC{NumCol}") = "Total" Next End If End Sub Protected Sub ImgExcel_Click(sender As Object, e As System.EventArgs) Handles ImgExcel.Click GenerarPDF("EXCEL") End Sub Private Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click GenerarPDF() End Sub Private Sub GenerarPDF(Optional Formato As String = "PDF") Dim FechaI As String = txtFechaI.Text Dim FechaF As String = txtFechaF.Text If txtFechaI.Text = "" Then FechaI = "-1" If txtFechaF.Text = "" Then FechaF = "-1" If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then TCEspecifico = TxtEspecifico.Text.ToDouble Else TCEspecifico = -1 End If Dim CveCliente = If(DdlClientesWS.SelectedValue.ToEntero > 0, DdlClientesWS.SelectedValue.ToEntero, -1) Dim Cliente = If(DdlClientesWS.SelectedValue = "-1", "", $" Cliente: {DdlClientesWS.SelectedText}") Dim Sucursal = If(DdlSubProyecto.SelectedValue = "-1", "", $" Sucursal: {DdlSubProyecto.SelectedItem.Text}") Dim Grupo = $" Agrupado Por: {DdlGrupo.SelectedItem.Text}" 'If(DdlGrupo.SelectedValue = "5", "", $" Agrupado Por: {DdlGrupo.SelectedItem.Text}") Dim TipoDocto = If(DdlTipoDocto.GetSelectedText = "Ingresos,Remisión,Anticipos,Egresos,Ingresos X Comp,Devolución" Or DdlTipoDocto.GetSelectedText = "", "", $" Documentos: {DdlTipoDocto.GetSelectedText}") Dim Vendedor = If(DdlVendedor.SelectedValue = "-1", "", $" Vendedor: {DdlVendedor.SelectedItem.Text}") Dim FechaIn As String = If(txtFechaI.Text = "", "", $" Fecha Inicio Docto: {txtFechaI.Text}") Dim FechaFn As String = If(txtFechaF.Text = "", "", $" Fecha Fin Docto: {txtFechaF.Text}") Dim FVI As String = If(txtFechaVI.Text = "", "", $" Fecha Venc. Inic.: {txtFechaVI.Text}") Dim FVF As String = If(txtFechaVF.Text = "", "", $" Fecha Venc. Final: {txtFechaVF.Text}") Dim Registro = If(DdlUsuario.SelectedValue = "-1", "", $" Registró: {DdlUsuario.SelectedItem.Text}") Dim Responsable = If(DdlResponsable.SelectedValue = "-1", "", $" Responsable: {DdlResponsable.SelectedItem.Text}") Dim EstatusCob = If(DdlCobranzaEstatus.SelectedValue = "-1", "", $" Estatus Cobranza: {DdlCobranzaEstatus.SelectedItem.Text}") Dim CorteA As String = If(txtCorteA.Text = "31/12/2019", "", $" Corte A: {txtCorteA.Text}") Dim EstatusCli = If(DdlEstatusCliente.SelectedValue = "-1", "", $" Clientes: {DdlEstatusCliente.SelectedItem.Text}") Dim ClasificacionCli = If(DdlClienteClasificacion.SelectedValue = "-1", "", $" Clasificación Cliente: {DdlClienteClasificacion.SelectedItem.Text}") Dim TituloReporte As String = "REPORTE DE CUENTAS POR COBRAR DEL CLIENTE" 'If UsuarioActual.CveEmpresa = 72 Then ' TituloReporte = "Antigüedad de Saldos" 'End If If DtDatos.Rows.Count > 0 Then Dim CantidadColumnas As Integer = 0 If DtDatos.Rows(0)("TC1").ToString.ToEntero = 1 Or DtDatos.Rows(0)("TC1").ToString.ToEntero = 2 Then CantidadColumnas += 1 If DtDatos.Rows(0)("TC2").ToString.ToEntero = 1 Or DtDatos.Rows(0)("TC2").ToString.ToEntero = 2 Then CantidadColumnas += 1 If DtDatos.Rows(0)("TC3").ToString.ToEntero = 1 Or DtDatos.Rows(0)("TC3").ToString.ToEntero = 2 Then CantidadColumnas += 1 If DtDatos.Rows(0)("TC4").ToString.ToEntero = 1 Or DtDatos.Rows(0)("TC4").ToString.ToEntero = 2 Then CantidadColumnas += 1 If DtDatos.Rows(0)("TC5").ToString.ToEntero = 1 Or DtDatos.Rows(0)("TC5").ToString.ToEntero = 2 Then CantidadColumnas += 1 If DtDatos.Rows(0)("TC6").ToString.ToEntero = 1 Or DtDatos.Rows(0)("TC6").ToString.ToEntero = 2 Then CantidadColumnas += 1 If DtDatos.Rows(0)("TC7").ToString.ToEntero = 1 Or DtDatos.Rows(0)("TC7").ToString.ToEntero = 2 Then CantidadColumnas += 1 If DtDatos.Rows(0)("TC8").ToString.ToEntero = 1 Or DtDatos.Rows(0)("TC8").ToString.ToEntero = 2 Then CantidadColumnas += 1 If DtDatos.Rows(0)("TC9").ToString.ToEntero = 1 Or DtDatos.Rows(0)("TC9").ToString.ToEntero = 2 Then CantidadColumnas += 1 Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("FechaInicio", FechaI)) params.Add(New ReportParameter("FechaFin", FechaF)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("Grupo", DdlGrupo.SelectedItem.Text)) params.Add(New ReportParameter("AgrupadoPor", $"{Cliente}{Sucursal}{Grupo}{Vendedor}{FechaIn}{FechaFn}{Registro}{Responsable}{TipoDocto}{EstatusCob}{FVI}{FVF}{EstatusCli}{ClasificacionCli}{CorteA}")) params.Add(New ReportParameter("TituloReporte", TituloReporte)) params.Add(New ReportParameter("CantColumnas", CantidadColumnas.ToString)) If Imagen.Exists Then params.Add(New ReportParameter("LogoPath", logouri)) Else params.Add(New ReportParameter("LogoPath", "")) End If ImprimirPDF("Empresas/Grales/Formatos/RepCxC.rdlc", DtDatos, params, "ReporteCxC", Formato) Else Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia) End If End Sub #End Region #Region "TIPO DE CAMBIO" Private Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged If RblTipoCambio.SelectedValue.ToEntero = 3 Then Dim TipoCambio As Double LiEspecifico.Visible = True TipoCambio = GlobalTipoCambio(Now) TxtEspecifico.Text = TipoCambio.ToString Else LiEspecifico.Visible = False End If UpBodyTipoCambio.Update() End Sub Private Sub BtnTipoCambio_Click(sender As Object, e As EventArgs) Handles BtnTipoCambio.Click CargaDatos() RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio")) UPDatos.Update() End Sub #End Region #Region "PERSONALIZAR RANGO COLUMNAS" Protected Sub GvPersonalizarRango_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then If Not e.Row.DBCampo("RangoFinal").ToDouble > 0 Then e.Row.Cells(2).Text = "+" End If End If End Sub Private Sub CargaGv() GvPersonalizarRango.DataSource = DtPersonalizarRango GvPersonalizarRango.DataBind() UpBodyPersonalizar.Update() End Sub Private Sub CargaGvPersonalizarRaqngoColumnas() Dim ObjComp As New ClsCompras If ObjComp.GetRepCxCColumnas(UsuarioActual.CveEmpresa) Then GvPersonalizarRango.DataSource = ObjComp.DtResultados DtPersonalizarRango = ObjComp.DtResultados End If ObjComp.Dispose() GvPersonalizarRango.DataBind() UpPersonalizarRango.Update() End Sub Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs) Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) DtPersonalizarRango.Rows.RemoveAt(gvRow.RowIndex) DtPersonalizarRango.AcceptChanges() CargaGv() End Sub Protected Sub LnkEditar_Click(sender As Object, e As EventArgs) Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) Index = gvRow.RowIndex Modalidad = "U" DdlTipo.SelectedValueExist(gvRow.DataKey("Tipo")) TxtRI.Text = gvRow.DataKey("RangoInicial") TxtRF.Text = gvRow.DataKey("RangoFinal") If Not TxtRF.Text.ToDouble > 0 Then ChkMayor.Checked = True TxtRF.Enabled = False Else ChkMayor.Checked = False End If RegistraScript("$('#DivPersonalizarRangoEditar').modal()") UpPersonalizarRangoEditar.Update() End Sub Private Sub LimpiaPersonalizarColumna() DdlTipo.SelectedIndex = 0 TxtRI.Text = "" TxtRF.Text = "" ChkMayor.Checked = False SoloNumeros2.Enabled = True TxtRF.Enabled = True RFVRF.Enabled = True End Sub Protected Sub ChkMayor_CheckedChanged(sender As Object, e As EventArgs) CambioChecked() End Sub Private Sub CambioChecked() If ChkMayor.Checked Then SoloNumeros2.Enabled = False TxtRF.Enabled = False TxtRF.Text = "" RFVRF.Enabled = False Else SoloNumeros2.Enabled = True TxtRF.Enabled = True TxtRF.Text = "" RFVRF.Enabled = True End If UpBodyEdit.Update() End Sub Protected Sub BtnGuardarPersonalizarRangoEditar_Click(sender As Object, e As EventArgs) If Not ChkMayor.Checked And TxtRI.Text.ToDouble > TxtRF.Text.ToDouble Then Alert("El rango final tiene que ser mayor que el inicial.", TipoMensaje.MsgAdvertencia) Exit Sub End If If Modalidad = "A" Then Dim Dt As DataRow = Nothing Dt = DtPersonalizarRango.NewRow Dt("RangoInicial") = TxtRI.Text.ToDouble Dt("RangoFinal") = TxtRF.Text.ToDouble Dt("Tipo") = DdlTipo.SelectedValue Dt("TipoEscrito") = DdlTipo.SelectedItem.Text DtPersonalizarRango.Rows.InsertAt(Dt, DtPersonalizarRango.Rows.Count) ElseIf Modalidad = "U" Then DtPersonalizarRango.Rows(Index)("RangoInicial") = TxtRI.Text.ToDouble DtPersonalizarRango.Rows(Index)("RangoFinal") = TxtRF.Text.ToDouble DtPersonalizarRango.Rows(Index)("Tipo") = DdlTipo.SelectedValue DtPersonalizarRango.Rows(Index)("TipoEscrito") = DdlTipo.SelectedItem.Text DtPersonalizarRango.AcceptChanges() End If DtPersonalizarRango = DtPersonalizarRango.FiltraParametros("", "Tipo,RangoInicial,RangoFinal") CargaGv() RegistraScript("$('#DivPersonalizarRangoEditar').modal('hide')") RegistraScript("$('#DivPersonalizarRango').modal()", "SDSD") End Sub Protected Sub BtnCancelarPersonalizarRangoEditar_Click(sender As Object, e As EventArgs) RegistraScript("$('#DivPersonalizarRangoEditar').modal('hide')") RegistraScript("$('#DivPersonalizarRango').modal()", "SDSD") End Sub Protected Sub BtnAgregarRango_Click(sender As Object, e As EventArgs) Modalidad = "A" LimpiaPersonalizarColumna() RegistraScript("$('#DivPersonalizarRangoEditar').modal()") UpPersonalizarRangoEditar.Update() End Sub Protected Sub BtnPersonalizarRango_Click(sender As Object, e As EventArgs) If Not DtPersonalizarRango.COUNT("Tipo", "Tipo=1") > 0 Then Alert("Tiene que haber por lo menos una columna de tipo vencido.", TipoMensaje.MsgAdvertencia) Exit Sub End If If Not DtPersonalizarRango.COUNT("Tipo", "Tipo=2") > 0 Then Alert("Tiene que haber por lo menos una columna de tipo por vencer.", TipoMensaje.MsgAdvertencia) Exit Sub End If If DtPersonalizarRango.Rows.Count > 8 Then Alert("Tiene que haber un maximo de 8 columnas.", TipoMensaje.MsgAdvertencia) Exit Sub End If Dim ObjComp As New ClsCompras ObjComp.IniciaTransacSQL() Dim ErrorTrans As Boolean = False If Not ObjComp.RemoveRepCxCColumnas(UsuarioActual.CveEmpresa) Then ErrorTrans = True End If For Each Dr As DataRow In DtPersonalizarRango.Rows If Not ObjComp.AddRepCxCColumnas(UsuarioActual.CveEmpresa, Dr("RangoInicial").ToString.ToDouble, Dr("RangoFinal").ToString.ToDouble, Dr("Tipo").ToString.ToEntero) Then ErrorTrans = True End If Next If Not ErrorTrans Then ObjComp.Commit() CargaDatos() RegistraScript("$('#DivPersonalizarRango').modal('hide')") Else ObjComp.RollBack() End If ObjComp.Dispose() UPDatos.Update() End Sub #End Region #Region " ENVIAR ESTADO DE CUENTA " Private Sub ActivaEnviarEstadoCuenta() LBEnviarSMS.Visible = DdlGrupo.SelectedValue = "5" And UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12) LBEnviarCorreo.Visible = DdlGrupo.SelectedValue = "5" And UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12) End Sub Protected Sub LBEnviarSMS_Click(sender As Object, e As EventArgs) Dim ObjSMS As New ClsTecnoMovil Dim ObjEventos As New ClsOIEventos Dim Pesos = 0.0 Dim Dolares = 0.0 Dim Telefono As String = "" Dim Mensaje As String = "" Dim StrSaldo As String = "" Dim Contador = 0 'Dim sw As New System.Diagnostics.Stopwatch() 'sw.Start() For Each Dr As DataRow In DtDatos.Rows If Dr("CveCliente").ToString.ToEntero = 0 Then Continue For Mensaje = "" StrSaldo = "" Telefono = Dr("CobranzaTelefono").ToString If Telefono.Length = 10 Then Pesos = If(Dr("CveMoneda").ToString.ToEntero = 1, Dr("Saldo").ToString.ToDouble, 0) Dolares = If(Dr("CveMoneda").ToString.ToEntero = 2, Dr("Saldo").ToString.ToDouble, 0) If Pesos > 0 Then StrSaldo = $" ${Pesos.FormatoNumero} pesos" If Dolares > 0 Then StrSaldo = $" ${Mensaje} ${Dolares.FormatoNumero} dólares" Select Case UsuarioActual.CveEmpresa Case 4 Mensaje = $"Cliente de VSH Seguridad su saldo pendiente es de {StrSaldo} fecha limite 25/{Now.ToString("MM/yyyy")} llamar al 6622106400 #REFERENCIA {If(UsuarioActual.CveEmpresa = 4, Dr("NombreCorto").ToString, Dr("CodigoCliente").ToString)} " End Select If StrSaldo.Length > 0 Then If ObjSMS.EnviarMensajeWS(Telefono, Mensaje) Then Contador += 1 If Not ObjEventos.AddEventoBitacora($"Estado de cuenta enviado al cliente via SMS masivo. Telefono: {Telefono} Mensaje: {Mensaje}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=Dr("CveCliente").ToString.ToEntero) Then Alert($"Se enviarón exitosamente {Contador} mensajes. Pero no se pudo guardar historial por lo cual se abortó la operación. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError) ObjEventos.Dispose() Exit Sub End If End If End If End If Next ObjEventos.Dispose() 'sw.Stop() 'Alert($"Tiempo Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds}") Alert($"Se enviarón exitosamente {Contador} mensajes", TipoMensaje.MsgInformacion) End Sub Protected Sub LBEnviarCorreo_Click(sender As Object, e As EventArgs) Dim ObjEventos As New ClsOIEventos Dim Pesos = 0.0 Dim Dolares = 0.0 Dim Correo As String = "" Dim Mensaje As String = "" Dim Contador = 0 'Dim sw As New System.Diagnostics.Stopwatch() 'sw.Start() For Each Dr As DataRow In DtDatos.Rows If Dr("CveCliente").ToString.ToEntero = 0 Then Continue For Mensaje = "" Correo = Dr("CobranzaCorreo").ToString If Correo.Length > 0 Then Pesos = If(Dr("CveMoneda").ToString.ToEntero = 1, Dr("Saldo").ToString.ToDouble, 0) Dolares = If(Dr("CveMoneda").ToString.ToEntero = 2, Dr("Saldo").ToString.ToDouble, 0) If Pesos > 0 Then Mensaje = $" ${Pesos.FormatoNumero} pesos" If Dolares > 0 Then Mensaje = $" {Mensaje} ${Dolares.FormatoNumero} dólares" If Mensaje.Length > 0 Then Mensaje = $"{UsuarioActual.Empresa.Empresa} Informa: Estimado Cliente su saldo actual es de {Mensaje}" Try Dim Hilo As New System.Threading.Thread(Sub() MandaMails(Correo, Mensaje)) Hilo.Start() Contador += 1 If Not ObjEventos.AddEventoBitacora($"Estado de cuenta enviado al cliente via Correo masivo. Correo: {Correo} Mensaje: {Mensaje}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=Dr("CveCliente").ToString.ToEntero) Then Alert($"Se enviarón exitosamente {Contador} correos. Pero no se pudo guardar historial por lo cual se abortó la operación. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError) ObjEventos.Dispose() Exit Sub End If Catch ex As Exception Alert($"Se enviarón exitosamente {Contador} correos. Pero ocurrió un error inesperado. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError) ObjEventos.Dispose() Exit Sub End Try End If End If Next ObjEventos.Dispose() 'sw.Stop() 'Alert($"Tiempo Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds}") Alert($"Se enviarón exitosamente {Contador} correos", TipoMensaje.MsgInformacion) End Sub Private Sub MandaMails(Correo As String, Mensaje As String) Try Dim ObjMail As New ClsSisMail() If Not ObjMail.SendMail(UsuarioActual.Empresa, Correo, $"Estado de cuenta {UsuarioActual.Empresa.Empresa}", Mensaje) Then GuardaLog("Ocurrió un error al enviar correo masivo de estado de cuenta del cliente. [ CxC/RepCxC ]") End If Catch ex As Exception OnError("Ocurrió error al mandar el Mail", ex) End Try End Sub #End Region #Region "DESCARGA TXT SEGMENTOS" Protected Sub LnkDescargarSegmentos_Click(sender As Object, e As EventArgs) Dim ObjMov As New ClsMovimientos If ObjMov.GetDescargaSegmentos(UsuarioActual.CveEmpresa) Then If ObjMov.DtResultados.Rows.Count > 0 Then Dim SB As New StringBuilder SB.Append($"HDBNCPM0099990100000299903204{Now.ToString("dd")}{Now.ToString("MM")}{Now.Year}05{Now.ToString("MM")}{Now.Year}060307 ") For Each Dr As DataRow In ObjMov.DtResultados.Rows SB.Append("EM") SB.Append("EM") SB.Append("00") SB.Append(Dr("RFC")) SB.Append("01") SB.Append(Dr("CURP")) SB.Append("02") SB.Append(Dr("Reservado")) SB.Append("03") SB.Append(Dr("NombreCompania")) SB.Append("04") SB.Append(Dr("PrimerNombre")) SB.Append("05") SB.Append(Dr("SegundoNombre")) SB.Append("06") SB.Append(Dr("ApellidoPaterno")) SB.Append("07") SB.Append(Dr("ApellidoMaterno")) SB.Append("08") SB.Append(Dr("Nacionalidad")) SB.Append("09") SB.Append(Dr("CalificacionCartera")) SB.Append("10") SB.Append(Dr("ActividadEconomica1")) SB.Append("11") SB.Append(Dr("ActividadEconomica2")) SB.Append("12") SB.Append(Dr("ActividadEconomica3")) SB.Append("13") SB.Append(Dr("PrimerLineaDireccion")) SB.Append("14") SB.Append(Dr("SegundaLineaDireccion")) SB.Append("15") SB.Append(Dr("Colonia")) SB.Append("16") SB.Append(Dr("Municipio")) SB.Append("17") SB.Append(Dr("Ciudad")) SB.Append("18") SB.Append(Dr("CodigoBuroCredito")) SB.Append("19") SB.Append(Dr("CP")) SB.Append("20") SB.Append(Dr("Telefono")) SB.Append("21") SB.Append(Dr("ExtensionTelefonica")) SB.Append("22") SB.Append(Dr("NumeroFAX")) SB.Append("23") SB.Append(Dr("TipoCliente")) SB.Append("24") SB.Append(Dr("NombrePaisExtranjero")) SB.Append("25") SB.Append(Dr("PaisOrigen")) SB.Append("26") SB.Append(Dr("ClaveConsolidacion")) SB.Append("27") SB.Append(Dr("FillerER")) SB.Append("CR") SB.Append("CR") SB.Append("00") SB.Append(Dr("RFC")) SB.Append("01") SB.Append(Dr("NumeroExperienciasCrediticias")) SB.Append("02") SB.Append(Dr("NumeroCuenta")) SB.Append("03") SB.Append(Dr("NumeroCuentaAnterior")) SB.Append("04") SB.Append(Dr("FechaApertura")) SB.Append("05") SB.Append(Dr("Plazo")) SB.Append("06") SB.Append(Dr("TipoCredito")) SB.Append("07") SB.Append(Dr("SaldoInicial")) SB.Append("08") SB.Append(Dr("Moneda")) SB.Append("09") SB.Append(Dr("NumeroPagos")) SB.Append("10") SB.Append(Dr("FrecuenciaPagos")) SB.Append("11") SB.Append(Dr("ImportePago")) SB.Append("12") SB.Append(Dr("FechaUltimoPago")) SB.Append("13") SB.Append(Dr("FechaReestructura")) SB.Append("14") SB.Append(Dr("PagoFinal")) SB.Append("15") SB.Append(Dr("FechaLiquidacion")) SB.Append("16") SB.Append(Dr("Quita")) SB.Append("17") SB.Append(Dr("DacionPago")) SB.Append("18") SB.Append(Dr("Quebranto")) SB.Append("19") SB.Append(Dr("ClaveObservacion")) SB.Append("20") SB.Append(Dr("MarcaCredito")) SB.Append("21") SB.Append(Dr("FechaPrimerIncumplimiento")) SB.Append("22") SB.Append(Dr("SaldoInsoluto")) SB.Append("23") SB.Append(Dr("FillerCR")) SB.Append("DE") SB.Append("DE") SB.Append("00") SB.Append(Dr("RFC")) SB.Append("01") SB.Append(Dr("NumeroCuenta")) SB.Append("02") SB.Append(Dr("DiasVencidos")) SB.Append("03") SB.Append(Dr("SaldoInicialDE")) SB.Append("04") SB.Append(Dr("FillerDE")) Next SB.Append("TS") SB.Append("TS") SB.Append("00") SB.Append(ObjMov.DtResultados.Rows(0)("NumCompanias")) SB.Append("01") SB.Append(ObjMov.DtResultados.Rows(0)("TotSaldo")) SB.Append("02") SB.Append(ObjMov.DtResultados.Rows(0)("FillerTS")) Dim path As String = String.Format("{0}\\{1}", UsuarioActual.Empresa.Ruta, "DescargaSegmentos.txt") Dim fs As FileStream = File.Create(path) Dim info As Byte() = New UTF8Encoding(True).GetBytes(SB.ToString) fs.Write(info, 0, info.Length) fs.Close() Dim toDownload As System.IO.FileInfo = New System.IO.FileInfo(path) If toDownload.Exists Then Response.ClearContent() Response.ClearHeaders() Response.AddHeader("Content-Disposition", "attachment; filename=" + "DescargaSegmentos.txt") Response.ContentType = "application/octet-stream" Response.WriteFile(path) Response.Flush() Response.Close() Response.End() HttpContext.Current.ApplicationInstance.CompleteRequest() End If End If End If ObjMov.Dispose() End Sub #End Region #Region "GRAFICA" Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) If Not DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia) Exit Sub End If LblTituloGrafica.Text = $"Agrupado por: {Agrupador}" UPModalProd.Update() RegistraScript("$('#DivModalGrafica').modal('show')") CargaGraficaVencidoPorVencer(DdlVerGraficaVencidoPorVencer.SelectedValue.ToEntero) CambioGrafica(DdlVer.SelectedValue.ToEntero) End Sub Private Sub CreaDataTableColor() DtColor = New DataTable DtColor.Columns.Add("Color") Dim RowColor As DataRow = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#FF0F00" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#FF6600" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#FF9E01" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#FCD202" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#F8FF01" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#B0DE09" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#04D215" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#0D8ECF" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#0D52D1" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#2A0CD0" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#8A0CCF" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#CD0D74" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#754DEB" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#DDDDDD" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#999999" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#333333" DtColor.Rows.Add(RowColor) RowColor = Nothing RowColor = DtColor.NewRow() RowColor("Color") = "#000000" DtColor.Rows.Add(RowColor) End Sub Private Sub CambioGrafica(Tipo As Integer) Dim Dt As New DataTable() Dt.Columns.Add("Texto") Dt.Columns.Add("Valor") Dt.Columns.Add("Color") Dt.Columns.Add("Moneda") Dim RowColorIndex As Integer = 0 Dim Top As Integer = 1 For Each Dr As DataRow In DtDatos.FiltraParametros("", $"{If(Tipo = 1, "Saldo", If(Tipo = 1, "vencido", "por_vencer"))} DESC").Rows If Not Dr("Orden").ToString = "" Then Dim Row As DataRow = Nothing Row = Dt.NewRow() Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" Select Case Tipo Case 1 Row("Valor") = Dr("Saldo").ToString.FormatoNumero Case 2 Row("Valor") = Dr("vencido").ToString.FormatoNumero Case 3 Row("Valor") = Dr("por_vencer").ToString.FormatoNumero End Select Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString Row("Moneda") = Dr("Moneda").ToString Dt.Rows.Add(Row) RowColorIndex += 1 If RowColorIndex = 17 Then RowColorIndex = 0 End If Top += 1 End If If DdlMostrarGraficaTotales.SelectedValue.ToEntero <> -1 And Top > DdlMostrarGraficaTotales.SelectedValue.ToEntero Then Exit For Next Dim query = From s In Dt.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(query) Select Case DdlGrafica.SelectedValue.ToEntero Case 1 RegistraScript($"CargaGraficaBarras({json})", "22") Case 2 RegistraScript($"CargaGraficaPastel({json})", "22") End Select UpGraficaTotales.Update() End Sub Protected Sub DdlGrafica_SelectedIndexChanged(sender As Object, e As EventArgs) CambioGrafica(DdlVer.SelectedValue.ToEntero) End Sub Protected Sub DdlVer_SelectedIndexChanged(sender As Object, e As EventArgs) CambioGrafica(DdlVer.SelectedValue.ToEntero) End Sub Private Sub CargaGraficaVencidoPorVencer(Tipo As Integer) Dim Dt5 As New DataTable() Dt5.Columns.Add("categoria") Dim Dt6 As New DataTable() Dt6.Columns.Add("balloonText") Dt6.Columns.Add("bullet") Dt6.Columns.Add("title") Dt6.Columns.Add("valueField") Dt6.Columns.Add("fillAlphas") Dim Top As Integer = 1 For Each Dr As DataRow In DtGrafica.FiltraParametros("", $"{If(Tipo = 1, "vencido", "por_vencer")} DESC").Rows If Not Dr("Orden").ToString = "" Then Dim NombreColumna As String = "" If Dt5.Columns.Contains($"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}") Then NombreColumna = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}{"2"}" Else NombreColumna = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" End If Dt5.Columns.Add(NombreColumna) Dim Row6 As DataRow = Nothing Row6 = Dt6.NewRow() Row6("balloonText") = "[[title]] [[category]]: [[value]]" Row6("bullet") = "round" Row6("title") = NombreColumna Row6("valueField") = NombreColumna Row6("fillAlphas") = 0 Dt6.Rows.Add(Row6) Top += 1 End If If DdlMostrarGraficaVencidoPorVencer.SelectedValue.ToEntero <> -1 And Top > DdlMostrarGraficaVencidoPorVencer.SelectedValue.ToEntero Then Exit For Next Dim Dr1 As DataRow = DtGrafica.Rows(0) For Cont = 1 To 8 If Dr1($"TC{Cont}").ToString.ToEntero = Tipo And Not Dr1($"NomC{Cont}").ToString = "Total" Then Top = 1 Dim Row As DataRow = Dt5.NewRow() For Each Dr2 As DataRow In DtGrafica.FiltraParametros("", $"{If(Tipo = 1, "vencido", "por_vencer")} DESC").Rows If Not Dr2("Orden").ToString = "" Then Row($"{Dr2("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr2("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}") = Dr2($"Columna{Cont}").ToString Top += 1 End If If DdlMostrarGraficaVencidoPorVencer.SelectedValue.ToEntero <> -1 And Top > DdlMostrarGraficaVencidoPorVencer.SelectedValue.ToEntero Then Exit For Next Row("categoria") = Dr1($"NomC{Cont}").ToString Dt5.Rows.Add(Row) End If Next RegistraScript($"CargaGraficaVencidoPorVencer({Dt5.ToJson},{Dt6.ToJson})", "33") UpGraficaVencidoPorVencer.Update() End Sub Protected Sub DdlVerGraficaVencidoPorVencer_SelectedIndexChanged(sender As Object, e As EventArgs) CargaGraficaVencidoPorVencer(DdlVerGraficaVencidoPorVencer.SelectedValue.ToEntero) End Sub Protected Sub DdlMostrarGraficaVencidoPorVencer_SelectedIndexChanged(sender As Object, e As EventArgs) CargaGraficaVencidoPorVencer(DdlVerGraficaVencidoPorVencer.SelectedValue.ToEntero) End Sub Protected Sub DdlMostrarGraficaTotales_SelectedIndexChanged(sender As Object, e As EventArgs) CambioGrafica(DdlVer.SelectedValue.ToEntero) End Sub #End Region #Region "SELECTED INDEX CHANGE" Protected Sub DdlClienteClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs) CargaClientes() End Sub Private Sub CargaClientes() If Not UsuarioActual.Empresa.Funcionalidad(105) = "1" Then DdlClientesWS.ddl.Items.Clear() DdlClientesWS.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltraParametros($"CveClienteClasificacion = {DdlClienteClasificacion.SelectedValue.ToEntero} OR {DdlClienteClasificacion.SelectedValue.ToEntero} = -1") DdlClientesWS.DataBind() DdlClientesWS.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If End Sub #End Region End Class