From c82039652abb6dfe0d33710ae47bc0925afa2e61 Mon Sep 17 00:00:00 2001 From: MLopez Date: Wed, 18 Jan 2023 17:59:31 -0700 Subject: [PATCH 01/12] =?UTF-8?q?Mod=20Extensiones:=20Optimizar=20y=20mejo?= =?UTF-8?q?rar=20ExportToExcelG=20-Ahora=20se=20puede=20usar=20en=20DataTa?= =?UTF-8?q?bles=20tambi=C3=A9n=20-Se=20mejor=C3=B3=20el=20estilo,=20quitan?= =?UTF-8?q?do=20los=20bordes=20innecesarios=20a=20las=20tablas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/modExtensiones.vb | 125 ++++++++++++++++++++++++++++++++----- 1 file changed, 108 insertions(+), 17 deletions(-) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 9685028a6..c05a379a4 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -2516,7 +2516,7 @@ Namespace Extensiones Dim sw As New StringWriter() Dim htw As New HtmlTextWriter(sw) Gv.RenderControl(htw) - GemBox.Spreadsheet.SpreadsheetInfo.SetLicense("ESWN-4QFD-26JF-1SZ8") + GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet) Dim excel As GemBox.Spreadsheet.ExcelFile Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault @@ -2527,9 +2527,11 @@ Namespace Extensiones Dim TotalRowFooter As Integer = 2 Dim worksheet = excel.Worksheets(0) + worksheet.Name = NombreArchivoXLSx worksheet.Rows.InsertEmpty(0, TotalRowHeader) Dim celdasConTexto = worksheet.GetUsedCellRange(True) celdasConTexto.Style.Font.Name = "Calibri Light" + celdasConTexto.Style.Borders = Nothing Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) RangoNombreEmpresa.Merged = True @@ -2539,7 +2541,6 @@ Namespace Extensiones RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) RangoFiltros.Merged = True RangoFiltros.Value = Filtros @@ -2548,27 +2549,28 @@ Namespace Extensiones RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) RangoTitulo.Merged = True RangoTitulo.Value = Titulo RangoTitulo.Style.Font.Size = 20 * 20 RangoTitulo.Style.Font.Name = "Calibri Light" RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + Dim RangoColTitulos = worksheet.Cells.GetSubrangeAbsolute(8, celdasConTexto.FirstColumnIndex, 8, celdasConTexto.LastColumnIndex) + RangoColTitulos.Style.Font.Size = 12 * 20 + RangoColTitulos.Style.Font.Name = "Calibri" + RangoColTitulos.Style.Font.Weight = GemBox.Spreadsheet.ExcelFont.BoldWeight + RangoColTitulos.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoColTitulos.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + RangoColTitulos.Style.FillPattern.SetSolid(GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190)) + RangoColTitulos.Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex - worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 - worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) - worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) - If i > 0 Then - Try - worksheet.Columns(i).AutoFit(1) - Catch ex As Exception - End Try - End If + Try + worksheet.Columns(i).AutoFit(0.95) + Catch ex As Exception + End Try Next Dim IndexEndTable As Integer = Gv.Rows.Count + TotalRowHeader + TotalRowFooter @@ -2579,10 +2581,10 @@ Namespace Extensiones worksheet.Rows(IndexEndTable).Cells(6).Value = "Fecha Impresión" worksheet.Rows(IndexEndTable + 1).Cells(6).Value = DateTime.Now.ToString("dd/MM/yyyy") - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) + Dim Imagen As New System.IO.FileInfo($"{Usuario.Empresa.Ruta}/Logo.png") If Imagen.Exists Then - Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) + Dim Ruta As String = $"{Usuario.Empresa.Ruta}/Logo.png" Using sr As New StreamReader(Ruta) Dim ms As New MemoryStream() sr.BaseStream.CopyTo(ms) @@ -2597,6 +2599,95 @@ Namespace Extensiones excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx") End Sub + + + Public Sub ExportToExcelG(Dt As DataTable, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing, Optional Filtros As String = "", Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100) + GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet) + If Dt.TableName Is Nothing Then Dt.TableName = NombreArchivoXLSx + + Dim excel As New GemBox.Spreadsheet.ExcelFile + Dim item = excel.Worksheets.Add(Dt.TableName) + + item.InsertDataTable(Dt, New InsertDataTableOptions() With + { + .ColumnHeaders = True, + .StartRow = 0, + .StartColumn = 0 + }) + + If Usuario IsNot Nothing Then + Dim TotalRowHeader As Integer = 8 + Dim TotalRowFooter As Integer = 2 + + Dim worksheet = excel.Worksheets(0) + worksheet.Rows.InsertEmpty(0, TotalRowHeader) + Dim celdasConTexto = worksheet.GetUsedCellRange(True) + celdasConTexto.Style.Font.Name = "Calibri Light" + celdasConTexto.Style.Borders = Nothing + + Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) + RangoNombreEmpresa.Merged = True + RangoNombreEmpresa.Value = Usuario.Empresa.Empresa + RangoNombreEmpresa.Style.Font.Size = 18 * 20 + RangoNombreEmpresa.Style.Font.Name = "Calibri Light" + RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) + RangoFiltros.Merged = True + RangoFiltros.Value = Filtros + RangoFiltros.Style.Font.Size = 15 * 20 + RangoFiltros.Style.Font.Name = "Calibri Light" + RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left + RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) + RangoTitulo.Merged = True + RangoTitulo.Value = Titulo + RangoTitulo.Style.Font.Size = 20 * 20 + RangoTitulo.Style.Font.Name = "Calibri Light" + RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + Dim RangoColTitulos = worksheet.Cells.GetSubrangeAbsolute(8, celdasConTexto.FirstColumnIndex, 8, celdasConTexto.LastColumnIndex) + RangoColTitulos.Style.Font.Size = 12 * 20 + RangoColTitulos.Style.Font.Name = "Calibri" + RangoColTitulos.Style.Font.Weight = GemBox.Spreadsheet.ExcelFont.BoldWeight + RangoColTitulos.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoColTitulos.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + RangoColTitulos.Style.FillPattern.SetSolid(GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190)) + RangoColTitulos.Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + + For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + Try + worksheet.Columns(i).AutoFit(0.95) + Catch ex As Exception + End Try + Next + + Dim IndexEndTable As Integer = Dt.Rows.Count + TotalRowHeader + TotalRowFooter + + worksheet.Rows(IndexEndTable).Cells(2).Value = "Usuario Imprimió" + worksheet.Rows(IndexEndTable + 1).Cells(2).Value = Usuario.Nombre + + worksheet.Rows(IndexEndTable).Cells(6).Value = "Fecha Impresión" + worksheet.Rows(IndexEndTable + 1).Cells(6).Value = DateTime.Now.ToString("dd/MM/yyyy") + + Dim Imagen As New System.IO.FileInfo($"{Usuario.Empresa.Ruta}/Logo.png") + + If Imagen.Exists Then + Dim Ruta As String = $"{Usuario.Empresa.Ruta}/Logo.png" + Using sr As New StreamReader(Ruta) + Dim ms As New MemoryStream() + sr.BaseStream.CopyTo(ms) + worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + End Using + End If + End If + + excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx") + + End Sub Private Sub RecursivoLimpiaControlesExcel(Controls As ControlCollection) For Each c As Control In Controls From 5f7752f8b8998ae7fd06c39d5d365c5a255a46af Mon Sep 17 00:00:00 2001 From: MLopez Date: Wed, 18 Jan 2023 18:07:01 -0700 Subject: [PATCH 02/12] =?UTF-8?q?Cat=20Proveedores:=20Fix=20Rep=20Proveedo?= =?UTF-8?q?res=20sin=20cuentas=20bancarias=20Mostraba=20una=20imagen=20rot?= =?UTF-8?q?a=20en=20el=20encabezado=20Soluci=C3=B3n:=20-=20Usar=20ExportEx?= =?UTF-8?q?celG=20de=20modExtensiones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Compras/CatProveedores.aspx.vb | 103 ++------------------------------- 1 file changed, 5 insertions(+), 98 deletions(-) diff --git a/Compras/CatProveedores.aspx.vb b/Compras/CatProveedores.aspx.vb index 1c159186d..590491c59 100644 --- a/Compras/CatProveedores.aspx.vb +++ b/Compras/CatProveedores.aspx.vb @@ -271,7 +271,7 @@ Partial Class Compras_CatProveedores params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) - ImprimirPDF("Empresas/Grales/Formatos/RepCuentasBancarias.rdlc", DtDatos, params, "RepCuentasBancarias", "Excel") + ImprimirPDF("Empresas/Grales/Formatos/RepClientesCuentasBancarias.rdlc", DtDatos, params, "RepClientesCuentasBancarias", "Excel") Else Alert("No se encontraron datos con los filtros especificados", TipoMensaje.MsgAdvertencia) End If @@ -280,114 +280,21 @@ Partial Class Compras_CatProveedores Protected Sub LnkCtasBancSinProveedor_Click(sender As Object, e As EventArgs) Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - 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.Copy() + DtDatos = ObjComp.DtResultados + 'GvDatosSC.DataBind() End If ObjComp.Dispose() If DtDatos IsNot Nothing Then DtDatos.TableName = "Proveedores" - GenerarReporteProveedoresSinCuentaExcel("Proveedores sin Cuentas Bancarias", DtDatos) + DtDatos.ExportToExcelG("Proveedores Sin Cuentas", "Proveedores sin Cuentas Bancarias", UsuarioActual) End If End Sub - Private Sub GenerarReporteProveedoresSinCuentaExcel(Titulo As String, DtDatos As DataTable) - Dim Retorno As New MemoryStream() - SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) - - Dim excel As ExcelFile = New ExcelFile - - Dim item = excel.Worksheets.Add(DtDatos.TableName) - item.InsertDataTable(DtDatos, New InsertDataTableOptions() With - { - .ColumnHeaders = True, - .StartRow = 0, - .StartColumn = 0 - }) - item.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255)) - item.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255) - - Dim columnCount = item.CalculateMaxUsedColumns() - For i = 0 To columnCount - item.Columns(i).AutoFit(1, item.Rows(i), item.Rows(item.Rows.Count - 1)) - Next - - Dim TotalRowHeader As Integer = 8 - Dim TotalRowFooter As Integer = 2 - - Dim worksheet = excel.Worksheets(0) - worksheet.Rows.InsertEmpty(0, TotalRowHeader) - Dim celdasConTexto = worksheet.GetUsedCellRange(True) - celdasConTexto.Style.Font.Name = "Calibri Light" - - Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) - RangoNombreEmpresa.Merged = True - RangoNombreEmpresa.Value = UsuarioActual.Empresa.Empresa - RangoNombreEmpresa.Style.Font.Size = 18 * 20 - RangoNombreEmpresa.Style.Font.Name = "Calibri Light" - RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - - 'Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) - 'RangoFiltros.Merged = True - 'RangoFiltros.Value = Filtros - 'RangoFiltros.Style.Font.Size = 15 * 20 - 'RangoFiltros.Style.Font.Name = "Calibri Light" - 'RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left - 'RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - - Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) - RangoTitulo.Merged = True - RangoTitulo.Value = Titulo - RangoTitulo.Style.Font.Size = 20 * 20 - RangoTitulo.Style.Font.Name = "Calibri Light" - RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex - worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 - worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) - worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) - If i > 0 Then - Try - worksheet.Columns(i).AutoFit(1) - Catch ex As Exception - End Try - End If - Next - - Dim IndexEndTable As Integer = DtDatos.Rows.Count + TotalRowHeader + TotalRowFooter - - worksheet.Rows(IndexEndTable).Cells(2).Value = "Usuario Imprimió" - worksheet.Rows(IndexEndTable + 1).Cells(2).Value = UsuarioActual.Nombre - - worksheet.Rows(IndexEndTable).Cells(6).Value = "Fecha Impresión" - worksheet.Rows(IndexEndTable + 1).Cells(6).Value = DateTime.Now.ToString("dd/MM/yyyy") - - Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") - - If Imagen.Exists Then - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, UsuarioActual.CveEmpresa) - Using webClient As New Net.WebClient() - Dim imageBytes = webClient.DownloadData(logouri) - Dim stream As New MemoryStream(imageBytes) - worksheet.Pictures.Add(stream, ExcelPictureFormat.Png, "A1", 100, 100, LengthUnit.Pixel) - 'worksheet.Pictures.Add(stream, GemBox.Spreadsheet.ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, GemBox.Document.LengthUnit.Pixel) - End Using - End If - - - excel.Save(Response, "Proveedores Sin Cuentas.xlsx", SaveOptions.XlsxDefault) - - End Sub End Class From c21a34b822f9687ad1c0008fa5239a54c20a51f6 Mon Sep 17 00:00:00 2001 From: MLopez Date: Wed, 18 Jan 2023 18:29:48 -0700 Subject: [PATCH 03/12] =?UTF-8?q?ModExtensiones:=20Validar=20que=20el=20no?= =?UTF-8?q?mbre=20de=20la=20hoja=20sea=20v=C3=A1lido,=20si=20no,=20sustitu?= =?UTF-8?q?ir=20caracteres=20y/o=20truncar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/modExtensiones.vb | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index c05a379a4..c11e6ed30 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -145,6 +145,23 @@ Namespace Extensiones End If End Function + Public Function Truncate(value As String, length As Integer) As String + ' If argument is too big, return the original string. + ' ... Otherwise take a substring from the string's start index. + If length > value.Length Then + Return value + Else + Return value.Substring(0, length) + End If + End Function + + Public Function ValidFileName(ByVal name As String) As String + For Each c As Char In System.IO.Path.GetInvalidFileNameChars() + name = name.Replace(c.ToString(), "_") + Next + Return Truncate(name, 31) + End Function + Public Class RespuestaCancelacionSAT Public Property Verificado As Boolean = False Public Property CveEstatus As Integer = 0 @@ -2527,7 +2544,7 @@ Namespace Extensiones Dim TotalRowFooter As Integer = 2 Dim worksheet = excel.Worksheets(0) - worksheet.Name = NombreArchivoXLSx + worksheet.Name = ValidFileName(NombreArchivoXLSx) worksheet.Rows.InsertEmpty(0, TotalRowHeader) Dim celdasConTexto = worksheet.GetUsedCellRange(True) celdasConTexto.Style.Font.Name = "Calibri Light" @@ -2603,10 +2620,10 @@ Namespace Extensiones Public Sub ExportToExcelG(Dt As DataTable, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing, Optional Filtros As String = "", Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100) GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet) - If Dt.TableName Is Nothing Then Dt.TableName = NombreArchivoXLSx + If Dt.TableName Is Nothing Then Dt.TableName = ValidFileName(NombreArchivoXLSx) Dim excel As New GemBox.Spreadsheet.ExcelFile - Dim item = excel.Worksheets.Add(Dt.TableName) + Dim item = excel.Worksheets.Add(Truncate(Dt.TableName, 31)) item.InsertDataTable(Dt, New InsertDataTableOptions() With { @@ -2620,6 +2637,7 @@ Namespace Extensiones Dim TotalRowFooter As Integer = 2 Dim worksheet = excel.Worksheets(0) + 'worksheet.Name = ValidFileName(NombreArchivoXLSx) worksheet.Rows.InsertEmpty(0, TotalRowHeader) Dim celdasConTexto = worksheet.GetUsedCellRange(True) celdasConTexto.Style.Font.Name = "Calibri Light" From f6575852c5f70c97ba5af94fe9174f93d21ed3ed Mon Sep 17 00:00:00 2001 From: MLopez Date: Wed, 18 Jan 2023 19:23:02 -0700 Subject: [PATCH 04/12] Cat proveedores revertir cambio filename rdlc --- Compras/CatProveedores.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Compras/CatProveedores.aspx.vb b/Compras/CatProveedores.aspx.vb index 590491c59..a46ae19af 100644 --- a/Compras/CatProveedores.aspx.vb +++ b/Compras/CatProveedores.aspx.vb @@ -271,7 +271,7 @@ Partial Class Compras_CatProveedores params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) - ImprimirPDF("Empresas/Grales/Formatos/RepClientesCuentasBancarias.rdlc", DtDatos, params, "RepClientesCuentasBancarias", "Excel") + ImprimirPDF("Empresas/Grales/Formatos/RepCuentasBancarias.rdlc", DtDatos, params, "RepCuentasBancarias", "Excel") Else Alert("No se encontraron datos con los filtros especificados", TipoMensaje.MsgAdvertencia) End If From ba76f2ca31738a28edcecd427f98b152bf20b14f Mon Sep 17 00:00:00 2001 From: MLopez Date: Wed, 18 Jan 2023 19:33:25 -0700 Subject: [PATCH 05/12] =?UTF-8?q?ModExtensiones:=20se=20me=20pas=C3=B3=20u?= =?UTF-8?q?sar=20ValidFileName=20tambi=C3=A9n=20para=20Dt.TableName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/modExtensiones.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index c11e6ed30..b1cc3606d 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -2623,7 +2623,7 @@ Namespace Extensiones If Dt.TableName Is Nothing Then Dt.TableName = ValidFileName(NombreArchivoXLSx) Dim excel As New GemBox.Spreadsheet.ExcelFile - Dim item = excel.Worksheets.Add(Truncate(Dt.TableName, 31)) + Dim item = excel.Worksheets.Add(ValidFileName(Dt.TableName)) item.InsertDataTable(Dt, New InsertDataTableOptions() With { From 619bf4670aa6509c3ed3022375ea0caa78b1ea83 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 18 Jan 2023 19:54:03 -0700 Subject: [PATCH 06/12] parametro de cliente. en entrega almacen --- App_Code/ClsGenerales.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 77f4301c1..10c90cc59 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -3910,7 +3910,7 @@ Public Class ClsGenerales Public Function AddInvEntregaAlmacenRuta(CveSubProyecto As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, CveMovimientoAlmacen As Integer, CveChofer As Integer, CveCamion As Integer, FechaEntrega As Date, FechaLlegada As DateTime, Tipo As String, FolioReferencia As String, Referencia As String, FechaLimite As Date, Orden As Integer, Estatus As Integer, Distancia As Integer, Optional CveConfigAutoTransporte As Integer = -1, - Optional CveCamionRemolque1 As Integer = -1, Optional CveCamionRemolque2 As Integer = -1) As Integer + Optional CveCamionRemolque1 As Integer = -1, Optional CveCamionRemolque2 As Integer = -1, Optional CveCliente As Integer = -1) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Inv_EntregaAlmacenRutaAdd") @@ -3936,6 +3936,7 @@ Public Class ClsGenerales .Add("@CveCamionRemolque1", SqlDbType.Int).Value = CveCamionRemolque1 .Add("@CveCamionRemolque2", SqlDbType.Int).Value = CveCamionRemolque2 .Add("@CveConfigAutoTransporte", SqlDbType.Int).Value = CveConfigAutoTransporte + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveEntregaAlmacen", SqlDbType.Int).Direction = ParameterDirection.Output End With From 3137b8f8ce12f94afc5d74e9cd7cd81ab1fc9529 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 18 Jan 2023 19:54:37 -0700 Subject: [PATCH 07/12] -- docuemntos por pagar --- App_Code/ClsMovimientos.vb | 174 ++++++++++++++++++++++--------------- 1 file changed, 104 insertions(+), 70 deletions(-) diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 0cbfb0931..cfdf5421e 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -2,16 +2,17 @@ Option Explicit On Option Strict On +Imports System Imports System.Data Imports System.Data.SqlClient Imports Extensiones Public Class ClsMovimientos - Implements IDisposable - + Implements IDisposable + #Region "Campos" - - 'SQL + + 'SQL Private SqlConexion As SqlConnection Private SqlAdapter As SqlDataAdapter Private SqlTransacc As SqlTransaction @@ -20,12 +21,12 @@ Public Class ClsMovimientos Private DS As DataSet 'Atributos de la clase - Private disposedValue As Boolean = False ' Para detectar llamadas redundantes - 'REGISTRAR CONEXIONES ABIERTAS - Private CveConexion As Integer = 0 - + Private disposedValue As Boolean = False ' Para detectar llamadas redundantes + 'REGISTRAR CONEXIONES ABIERTAS + Private CveConexion As Integer = 0 + + #End Region - #Region "Propiedades" Public ReadOnly Property DtResultados() As DataTable Get @@ -36,12 +37,13 @@ Public Class ClsMovimientos Public ReadOnly Property DSResultados() As DataSet Get DSResultados = DS - End Get + End Get End Property - Public Property AlertaMensaje As New StringBuilder + Public Property AlertaMensaje As New StringBuilder + #End Region - + Sub New() SqlConexion = New SqlConnection SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString @@ -62,9 +64,10 @@ Public Class ClsMovimientos End With If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc Data = New DataTable - End Sub + End Sub + #Region "Conexiones" - + Private Sub ConexionAdd() If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try @@ -97,9 +100,9 @@ Public Class ClsMovimientos CveConexion = 0 End If - End Sub + End Sub #End Region - + Public Sub IniciaTransacSQL() SqlTransacc = SqlConexion.BeginTransaction() End Sub @@ -485,13 +488,13 @@ Public Class ClsMovimientos Retorno = True Catch ex As SqlException OnError("Ocurrió un error al descargar los segmentos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try + End Try Return Retorno - End Function - - + End Function + + + #End Region - #Region "Anticipos de Clientes" Public Function GetAnticiposCliente(CveCliente As Integer, Optional SelectTop As Integer = -1, Optional CveMoneda As Integer = 1) As Boolean Dim Retorno As Boolean = False @@ -569,12 +572,14 @@ Public Class ClsMovimientos End Try Return Retorno - End Function - + End Function + + + + #End Region - #Region "CxP" - + Public Function GetCxPEmpresa(CveProveedor As Integer, FechaVencimientoInicio As String, FechaVencimientoFin As String, CveSubProyecto As Integer, DiasVencidos As Integer, CveUsuarioRegistro As Integer, CveUsuarioProgramo As Integer, CveUsuarioResponsable As Integer, CveClasificacion As Integer, CveMoneda As Integer, CveTipoPagoProgramo As Integer, CveEstatusFactura As Integer, CveAplicaNC As Integer, CveEmpresa As Integer, Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional CodigoProgramacion As String = "-1", Optional CveTipoProveedor As Integer = 0, @@ -1201,6 +1206,29 @@ Public Class ClsMovimientos Return Retorno End Function + Public Function GetDocumentosxPagarDetalle(CveCliente As Integer, CveMoneda As Integer, Opcion As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_DocumentosxPagarSaldosDetalle") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de documentos por pagar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function GetCajaChicaDetalle(CveCajaChica As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -1462,9 +1490,9 @@ Public Class ClsMovimientos End Try Return Retorno - End Function + End Function #End Region - + #Region "Anticipos de Proveedores" Public Function GetAnticiposProveedor(CveProveedor As Integer, CveProveedorSucursal As Integer, Optional CveMoneda As Integer = -1, Optional SelectTop As Integer = -1, Optional FechaI As String = "-1", Optional FechaF As String = "-1", Optional TipoDocto As String = "-1") As Boolean Dim Retorno As Boolean = False @@ -1486,33 +1514,32 @@ Public Class ClsMovimientos Retorno = True Catch ex As SqlException OnError("Ocurrió un error al consultar los Anticipos del proveedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - - 'Public Function GetAnticiposClienteAuxiliar(CveCliente As Integer, CveVenta As Integer) As Boolean - ' Dim Retorno As Boolean = False - ' 'Data = New DataTable - ' 'SqlAdapter = New SqlDataAdapter("PA_ClienteAnticiposAuxiliar", SqlConexion) - ' 'SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure - ' DataAdapter("PA_ClienteAnticiposAuxiliar") - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - ' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta - ' End With - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As SqlException - ' OnError("Ocurrió un error al consultar el Auxiliar Contable de Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - - ' Return Retorno - 'End Function - + End Try + Return Retorno + End Function + + + 'Public Function GetAnticiposClienteAuxiliar(CveCliente As Integer, CveVenta As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' 'Data = New DataTable + ' 'SqlAdapter = New SqlDataAdapter("PA_ClienteAnticiposAuxiliar", SqlConexion) + ' 'SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure + ' DataAdapter("PA_ClienteAnticiposAuxiliar") + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + ' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As SqlException + ' OnError("Ocurrió un error al consultar el Auxiliar Contable de Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + #End Region - #Region "REP RECUPERACION" Public Function GetRepRecuperacion(FechaI As Date, FechaF As Date, CveCliente As Integer, CveSubProyecto As Integer, CveVendedor As Integer, CveUsuario As Integer, CveEstatus As Integer, IVA As String, @@ -1658,9 +1685,9 @@ Public Class ClsMovimientos End Try Return Retorno - End Function + End Function + #End Region - #Region "REP COBRADO" Public Function GetRepCobrado(FechaI As Date, FechaF As Date, CveProveedor As Integer, CveSubProyecto As Integer, CveUsuario As Integer, IVA As String, CveEmpresa As Integer, Gpo As Integer, CveResponsable As Integer, @@ -1730,11 +1757,13 @@ Public Class ClsMovimientos End Try Return Retorno - End Function + End Function + + + #End Region - #Region "EDITAR FECHA DE MOVIMIENTO" - + Public Function UpdateMovimientoFecha(Fecha As DateTime, CveMovimiento As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Mov_MovimientoFechaUpdate") @@ -1749,12 +1778,16 @@ Public Class ClsMovimientos OnError("Ocurrió un error al actualizar la fecha del movimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function + End Function + + + + + #End Region - #Region "Registros Contables" - - + + Public Function AddMovimiento(CveConcepto As Integer, Tipo As String, Referencia1 As String, Referencia2 As String, CveMoneda As Integer, Cargo As Double, Abono As Double, Fecha As Date, FechaVencimiento As Date, Folio As String, IdCtaContable As Integer, CveUsuario As Integer, CveEmprea As Integer) As Boolean Dim Retorno As Boolean = False @@ -1828,14 +1861,14 @@ Public Class ClsMovimientos End Try Return Retorno - End Function - + End Function + + #End Region - #Region "IDisposable Support" - - - ' IDisposable + + + ' IDisposable Protected Overridable Sub Dispose(disposing As Boolean) If Not Me.disposedValue Then If disposing Then @@ -1868,9 +1901,10 @@ Public Class ClsMovimientos ConexionClose() Dispose(True) GC.SuppressFinalize(Me) - End Sub + End Sub + #End Region - + Public Function GetPersonalCajaChica(CveEmpresa As Integer, CveCompra As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_PersonalCajaChica") From e1598d56a8d474a164bb2581b875d1ddde093281 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 18 Jan 2023 19:55:07 -0700 Subject: [PATCH 08/12] parametro cvecliente --- Inventarios/EntradasSalidas.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index c62b4a2ae..274092d25 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -2055,7 +2055,7 @@ Partial Class Inventarios_EntradasSalidas Dim Fechallegada As DateTime = (TxtFechaLlegada.Text & " 23:59:59").ToDateTime Dim CveEntregaAlmacen As Integer = ObjGral.AddInvEntregaAlmacenRuta(CveSubProyectoTimbre, -1, DdlDireccionEnvio.SelectedValue.ToEntero, CveMovimiento, DdlChofer.SelectedValue.ToEntero, DdlUnidadCamion.SelectedValue.ToEntero, TxtFechaEntrega.Text.ToDate, TxtFechaLlegada.Text.ToDate, "T", "", "", MinFecha, 1, 1, TxtDistancia.Text.ToEntero, - CveConfigAutoTransporte:=DdlConfigAuto.SelectedValue.ToEntero, CveCamionRemolque1:=DdlRemolque1.SelectedValue.ToEntero, CveCamionRemolque2:=DdlRemolque2.SelectedValue.ToEntero) + CveConfigAutoTransporte:=DdlConfigAuto.SelectedValue.ToEntero, CveCamionRemolque1:=DdlRemolque1.SelectedValue.ToEntero, CveCamionRemolque2:=DdlRemolque2.SelectedValue.ToEntero, CveCliente:=DdlClientes.SelectedValue.ToEntero) If CveEntregaAlmacen > 0 Then CveTimbre = ObjGral.AddGralTimbre("Tra", CveSubProyectoTimbre, TxtFechaEntrega.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=ChkEmitirCartaPorte.Checked) From dfb458478451f7bf48b86b6675752efcb404ada6 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 18 Jan 2023 19:55:26 -0700 Subject: [PATCH 09/12] --- foliofiscal, oculto de inicio --- Compras/RepComprasDetalle.aspx | 2 +- Compras/RepComprasDetalle.aspx.vb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Compras/RepComprasDetalle.aspx b/Compras/RepComprasDetalle.aspx index 231fa4291..7810abe27 100644 --- a/Compras/RepComprasDetalle.aspx +++ b/Compras/RepComprasDetalle.aspx @@ -311,7 +311,7 @@ - + Folio Fiscal diff --git a/Compras/RepComprasDetalle.aspx.vb b/Compras/RepComprasDetalle.aspx.vb index 5536f524d..69b15621a 100644 --- a/Compras/RepComprasDetalle.aspx.vb +++ b/Compras/RepComprasDetalle.aspx.vb @@ -165,8 +165,7 @@ Partial Class Compras_RepComprasDetalle ChkDesc.Checked = True ChkTotal.Checked = True ChkAbre.Checked = True - ChkRazon.Checked = True - ChkFolio.Checked = True + ChkRazon.Checked = True ChkFecha.Checked = True ChkObs.Checked = True From 741ad85b188b85c6b88397cd26ab2ce1562456d9 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 18 Jan 2023 19:56:49 -0700 Subject: [PATCH 10/12] - --- Ventas/Ventas.aspx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 8ee7e4337..20d693d46 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -3479,7 +3479,7 @@ Forma de entrega: - + From e93071c8b34c1a59acff0d1fc7d86254e363c60b Mon Sep 17 00:00:00 2001 From: MLopez Date: Wed, 18 Jan 2023 20:01:23 -0700 Subject: [PATCH 11/12] =?UTF-8?q?ModExtensiones:=20Hacer=20ValidFileName?= =?UTF-8?q?=20de=20prop=C3=B3sito=20general=20Por=20si=20se=20llega=20a=20?= =?UTF-8?q?ocupar=20en=20otra=20cosa,=20que=20no=20solo=20sea=20para=20las?= =?UTF-8?q?=20hojas=20de=20excel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/modExtensiones.vb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index b1cc3606d..63ff870df 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -155,11 +155,14 @@ Namespace Extensiones End If End Function - Public Function ValidFileName(ByVal name As String) As String + Public Function ValidFileName(name As String, Optional maxChars As Integer = -1) As String For Each c As Char In System.IO.Path.GetInvalidFileNameChars() name = name.Replace(c.ToString(), "_") Next - Return Truncate(name, 31) + If maxChars > 0 AndAlso maxChars < 256 Then + Return Truncate(name, maxChars) + End If + Return Truncate(name, 255) End Function Public Class RespuestaCancelacionSAT @@ -2544,7 +2547,7 @@ Namespace Extensiones Dim TotalRowFooter As Integer = 2 Dim worksheet = excel.Worksheets(0) - worksheet.Name = ValidFileName(NombreArchivoXLSx) + worksheet.Name = ValidFileName(NombreArchivoXLSx, 31) worksheet.Rows.InsertEmpty(0, TotalRowHeader) Dim celdasConTexto = worksheet.GetUsedCellRange(True) celdasConTexto.Style.Font.Name = "Calibri Light" @@ -2620,10 +2623,10 @@ Namespace Extensiones Public Sub ExportToExcelG(Dt As DataTable, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing, Optional Filtros As String = "", Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100) GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet) - If Dt.TableName Is Nothing Then Dt.TableName = ValidFileName(NombreArchivoXLSx) + If Dt.TableName Is Nothing Then Dt.TableName = NombreArchivoXLSx Dim excel As New GemBox.Spreadsheet.ExcelFile - Dim item = excel.Worksheets.Add(ValidFileName(Dt.TableName)) + Dim item = excel.Worksheets.Add(ValidFileName(Dt.TableName, 31)) item.InsertDataTable(Dt, New InsertDataTableOptions() With { @@ -2637,7 +2640,7 @@ Namespace Extensiones Dim TotalRowFooter As Integer = 2 Dim worksheet = excel.Worksheets(0) - 'worksheet.Name = ValidFileName(NombreArchivoXLSx) + 'worksheet.Name = ValidFileName(NombreArchivoXLSx, 31) worksheet.Rows.InsertEmpty(0, TotalRowHeader) Dim celdasConTexto = worksheet.GetUsedCellRange(True) celdasConTexto.Style.Font.Name = "Calibri Light" From 69c69f321831068da147f71249d21359713702f1 Mon Sep 17 00:00:00 2001 From: MLopez Date: Wed, 18 Jan 2023 21:54:52 -0700 Subject: [PATCH 12/12] E172 Rep Indicador Resumen: Mostrar Saldo Conjunto de CxP --- General/RepIndicadorResumen.aspx | 15 +++++++++++++++ General/RepIndicadorResumen.aspx.vb | 20 +++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/General/RepIndicadorResumen.aspx b/General/RepIndicadorResumen.aspx index 6b1c27c79..6606fafa5 100644 --- a/General/RepIndicadorResumen.aspx +++ b/General/RepIndicadorResumen.aspx @@ -418,6 +418,21 @@ + + + +
+
+ + Saldo conjunto de Cuentas por Pagar +
+
+ + +
+
+
+
diff --git a/General/RepIndicadorResumen.aspx.vb b/General/RepIndicadorResumen.aspx.vb index b2bf87ec9..8808e6002 100644 --- a/General/RepIndicadorResumen.aspx.vb +++ b/General/RepIndicadorResumen.aspx.vb @@ -83,6 +83,8 @@ Partial Class General_RepIndicadorResumen GvCxC.HeaderRow.Cells(2).Text = "Recuperado" End If + Dim SaldoConjCxP = 0 + 'Mostrar gráficos y totales en portlets solo si hay datos en su respectiva tabla If GvVxP.Rows.Count > 0 Then UPGraficaVxP.Visible = True @@ -110,26 +112,38 @@ Partial Class General_RepIndicadorResumen UPGraficaCxC.Visible = True PLCxCTot.InnerHtml = "" + "Saldo: " + "" + String.Format("{0:c} MXN", CType(GvCxC.DataSource, DataTable).SUM("SaldoMN", "CveCliente IS NOT NULL")) Dim Recuper As Double = CType(GvCxC.DataSource, DataTable).SUM("RecuperadoMN", "CveCliente IS NOT NULL") - If (Recuper > 0) Then PLCxCTot.InnerHtml += "" + "Rec: " + "" + String.Format("{0:c} MXN", CType(GvCxC.DataSource, DataTable).SUM("RecuperadoMN", "CveCliente IS NOT NULL")) + If (Recuper > 0) Then PLCxCTot.InnerHtml += "" + "Rec: " + "" + String.Format("{0:c} MXN", Recuper) Else UPGraficaCxC.Visible = False PLCxCTot.InnerHtml = Nothing End If If GvCxP192.Rows.Count > 0 Then UPGraficaCxP192.Visible = True - PLCxP192Tot.InnerHtml = "" + "Saldo: " + "" + String.Format("{0:c} MXN", CType(GvCxP192.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL")) + Dim SaldoCxP192 = CType(GvCxP192.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL") + SaldoConjCxP += SaldoCxP192 + PLCxP192Tot.InnerHtml = "" + "Saldo: " + "" + String.Format("{0:c} MXN", SaldoCxP192) Else UPGraficaCxP192.Visible = False PLCxP192Tot.InnerHtml = Nothing End If If GvCxP.Rows.Count > 0 Then UPGraficaCxP.Visible = True - PLCxPTot.InnerHtml = "" + "Saldo: " + "" + String.Format("{0:c} MXN", CType(GvCxP.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL")) + Dim SaldoCxP = CType(GvCxP.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL") + SaldoConjCxP += SaldoCxP + PLCxPTot.InnerHtml = "" + "Saldo: " + "" + String.Format("{0:c} MXN", SaldoCxP) Else UPGraficaCxP.Visible = False PLCxPTot.InnerHtml = Nothing End If + If SaldoConjCxP > 0 Then + UPSaldoCxP.Visible = True + PLSaldoCxPTot.InnerHtml = String.Format("{0:c} MXN", SaldoConjCxP) + Else + UPSaldoCxP.Visible = False + PLSaldoCxPTot.InnerHtml = Nothing + End If + 'Si no había datos en ninguna tabla no cargar función de gráficos If GvVxP.Rows.Count = 0 _ AndAlso GvCompProductores.Rows.Count = 0 _