Correciones de ruta
This commit is contained in:
@@ -5171,7 +5171,7 @@ Public Class ClsPaginas
|
||||
sw.Start()
|
||||
Dim Bytes As Byte() = Nothing
|
||||
|
||||
Dim bdir As String = ModExtensiones.DirectorioBaseEmpresas
|
||||
Dim bdir As String = If(RutaReporte.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory)
|
||||
RutaReporte.Replace("/", "\")
|
||||
If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then
|
||||
RutaReporte = String.Format("{0}{1}", bdir, RutaReporte)
|
||||
|
||||
@@ -140,7 +140,7 @@ Namespace Extensiones
|
||||
Dim MensajeFormato = $"{Chr(13)}{Chr(10)}Log: {Mensaje} | Fecha:{Now.ToString("dd/MM/yyyy HH:mm")}"
|
||||
|
||||
Try
|
||||
ArchivoW = New StreamWriter($"{ModExtensiones.DirectorioBaseEmpresas}\Log\{Archivo}.txt", True, System.Text.Encoding.UTF8)
|
||||
ArchivoW = New StreamWriter($"{AppDomain.CurrentDomain.BaseDirectory}\Log\{Archivo}.txt", True, System.Text.Encoding.UTF8)
|
||||
Catch ex As UnauthorizedAccessException
|
||||
'Alert("No hay permisos para guardar en el Log.", Extensiones.TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
@@ -185,7 +185,7 @@ Namespace Extensiones
|
||||
Dim strLineaTMP As String
|
||||
strLineaTMP = String.Format("{0} {1}:{2} {3} {0}", Chr(13), DateTime.Now.ToShortDateString, DateTime.Now.ToShortTimeString, pTexto)
|
||||
Try
|
||||
ArchivoW = New StreamWriter(String.Format("{0}\LogMail.txt", ModExtensiones.DirectorioBaseEmpresas), True, System.Text.Encoding.UTF8)
|
||||
ArchivoW = New StreamWriter(String.Format("{0}\LogMail.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8)
|
||||
Catch ex As Exception
|
||||
Exit Sub
|
||||
End Try
|
||||
@@ -205,7 +205,7 @@ Namespace Extensiones
|
||||
' strLineaTMP = Chr(13) & Chr(10) & Day(Now) & "/" & Month(Now) & "/" & Year(Now) & " " & Hour(Now) & ":" & Minuto & ". " & Str & Chr(13) & Chr(10)
|
||||
strLineaTMP = String.Format("{0}{1} .. PAC: {2} - Modulo: {3} ..{4}:{5}", Chr(13), Chr(10), CvePAC, Modulo, Str, DateTime.Now.ToShortDateString, DateTime.Now.ToShortTimeString)
|
||||
Try
|
||||
ArchivoW = New StreamWriter(String.Format("{0}\LogTimbrado.txt", ModExtensiones.DirectorioBaseEmpresas), True, System.Text.Encoding.UTF8)
|
||||
ArchivoW = New StreamWriter(String.Format("{0}\LogTimbrado.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8)
|
||||
Catch ex As UnauthorizedAccessException
|
||||
'Alert("No hay permisos para guardar en el Log.", Extensiones.TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
@@ -228,7 +228,7 @@ Namespace Extensiones
|
||||
strLineaTMP = String.Format("{0} {1}:{2} {3} {0}", Chr(13), DateTime.Now.ToShortDateString, DateTime.Now.ToShortTimeString, pTexto)
|
||||
|
||||
Try
|
||||
ArchivoW = New StreamWriter(String.Format("{0}\LogCancelacionSAT.txt", ModExtensiones.DirectorioBaseEmpresas), True, System.Text.Encoding.UTF8)
|
||||
ArchivoW = New StreamWriter(String.Format("{0}\LogCancelacionSAT.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8)
|
||||
Catch ex As Exception
|
||||
Exit Sub
|
||||
End Try
|
||||
@@ -1962,7 +1962,7 @@ Namespace Extensiones
|
||||
RecursivoLimpiaControlesExcel(GridView.Controls)
|
||||
|
||||
style.Append("<style> ")
|
||||
style.Append(File.ReadAllText(String.Format("{0}/Styles/EstilosExcel.css", ModExtensiones.DirectorioBaseEmpresas)))
|
||||
style.Append(File.ReadAllText(String.Format("{0}/Styles/EstilosExcel.css", AppDomain.CurrentDomain.BaseDirectory)))
|
||||
style.Append(" </style> ")
|
||||
|
||||
page.EnableEventValidation = False
|
||||
@@ -2002,7 +2002,7 @@ Namespace Extensiones
|
||||
Dim Form As HtmlForm = New HtmlForm()
|
||||
|
||||
style.Append(" <style> ")
|
||||
style.Append(File.ReadAllText(String.Format("{0}/Styles/EstilosExcel.css", ModExtensiones.DirectorioBaseEmpresas)))
|
||||
style.Append(File.ReadAllText(String.Format("{0}/Styles/EstilosExcel.css", AppDomain.CurrentDomain.BaseDirectory)))
|
||||
style.Append(" </style> ")
|
||||
RecursivoLimpiaControlesExcel(GridView.Controls)
|
||||
|
||||
@@ -2183,16 +2183,15 @@ 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))
|
||||
|
||||
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, Usuario.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", AnchoImagen, AlturaImagen, LengthUnit.Pixel)
|
||||
'worksheet.Pictures.Add(stream, GemBox.Spreadsheet.ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, GemBox.Document.LengthUnit.Pixel)
|
||||
End Using
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta))
|
||||
|
||||
If Imagen.Exists Then
|
||||
Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)
|
||||
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
|
||||
|
||||
@@ -2210,7 +2209,7 @@ Namespace Extensiones
|
||||
|
||||
Dim style As StringBuilder = New StringBuilder()
|
||||
style.Append("<style> ")
|
||||
style.Append(File.ReadAllText(String.Format("{0}/Styles/EstilosExcel.css", ModExtensiones.DirectorioBaseEmpresas)))
|
||||
style.Append(File.ReadAllText(String.Format("{0}/Styles/EstilosExcel.css", AppDomain.CurrentDomain.BaseDirectory)))
|
||||
style.Append(" </style> ")
|
||||
'To Export all pages
|
||||
'Gv.AllowPaging = False
|
||||
@@ -3182,7 +3181,7 @@ Namespace Extensiones
|
||||
Public Property descripcion As String
|
||||
Public ReadOnly Property Extencion As String
|
||||
Get
|
||||
Return IO.Path.GetExtension(String.Format("{0}{1}{2}", ModExtensiones.DirectorioBaseEmpresas, patch, filename)).Replace(".", "")
|
||||
Return IO.Path.GetExtension(String.Format("{0}{1}{2}", If(patch.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory), patch, filename)).Replace(".", "")
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property filenameO As String
|
||||
@@ -3192,7 +3191,7 @@ Namespace Extensiones
|
||||
End Property
|
||||
Public ReadOnly Property FileUrl As String
|
||||
Get
|
||||
Return String.Format("{0}{1}{2}", ModExtensiones.DirectorioBaseEmpresas, patch, filename)
|
||||
Return String.Format("{0}{1}{2}", If(patch.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory), patch, filename)
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
|
||||
@@ -930,7 +930,7 @@ Partial Class Bancos_IE
|
||||
|
||||
If ObjIE.Comprobante <> "" Then
|
||||
HplComprobante.Visible = True
|
||||
HplComprobante.NavigateUrl = String.Format("/Empresas/{0}/IE/{1}", UsuarioActual.CveEmpresa, ObjIE.Comprobante)
|
||||
HplComprobante.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta($"OP=IEComprobante&Comprobante={ObjIE.Comprobante}"))
|
||||
End If
|
||||
|
||||
If CveIEDeposito > 0 Then
|
||||
|
||||
@@ -186,9 +186,10 @@ Partial Class PopUpVerFactura
|
||||
|
||||
If Request("REPORTE") IsNot Nothing Then
|
||||
CType(Session("DTPDF"), HtmlTable).ExportToPDF("Reporte")
|
||||
End If
|
||||
|
||||
'OPCIONES
|
||||
End If
|
||||
|
||||
'OPCIONES
|
||||
|
||||
If Request("P") IsNot Nothing AndAlso Decripta((Request("P").ToString)) <> "" Then
|
||||
Dim UrlParametros As Hashtable = Parametros(Decripta((Request("P").ToString)))
|
||||
If UrlParametros("OP") IsNot Nothing AndAlso UrlParametros("OP").ToString <> "" Then
|
||||
@@ -235,10 +236,16 @@ Partial Class PopUpVerFactura
|
||||
UsuarioToken.Empresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Private Sub SeleccionaReporte(UrlParametros As Hashtable)
|
||||
|
||||
'DESCARGA COMPROBANTE
|
||||
If UrlParametros("OP").ToString = "IEComprobante" Then
|
||||
DescargaComprobante(UrlParametros)
|
||||
End If
|
||||
|
||||
Private Sub SeleccionaReporte(UrlParametros As Hashtable)
|
||||
'DESCARGA DOCUMENTO XML O PDF DE LA FACTURA COMPRA
|
||||
If UrlParametros("OP").ToString = "Fact" Then
|
||||
DescargaFactura(UrlParametros)
|
||||
@@ -518,11 +525,30 @@ Partial Class PopUpVerFactura
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepCortes.rdlc", lrds, params, "ReporteCortes", Formato)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " OP = FACTURA - IMPRIME COMPRA"
|
||||
Private Sub DescargaComprobante(Parametros As Hashtable)
|
||||
If Parametros("COMPROBANTE") IsNot Nothing Then
|
||||
|
||||
Dim Path As String = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, Parametros("COMPROBANTE"))
|
||||
Dim Archivo As New System.IO.FileInfo(Path)
|
||||
|
||||
If Archivo.Exists Then
|
||||
HttpContext.Current.Response.Clear()
|
||||
HttpContext.Current.Response.ClearContent()
|
||||
HttpContext.Current.Response.ContentType = "application/octet-stream"
|
||||
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
HttpContext.Current.Response.TransmitFile(Path)
|
||||
'HttpContext.Current.Response.Flush()
|
||||
HttpContext.Current.Response.End()
|
||||
End If
|
||||
Archivo = Nothing
|
||||
End If
|
||||
End Sub
|
||||
Private Sub DescargaFactura(Parametros As Hashtable)
|
||||
If Parametros("CVEFACTURA") IsNot Nothing AndAlso Parametros("CVEFACTURA").ToString.ToEntero > 0 Then
|
||||
Dim Exten As String = If(Parametros("EXT").ToString.ToLower = "xml", "xml", "pdf")
|
||||
|
||||
@@ -246,10 +246,96 @@ Partial Class Inventarios_KardexAlmacen
|
||||
If DdlProveedor.SelectedValue.ToEntero > 0 Then StrFiltro.AppendFormat("Proveedor: {0},", DdlProveedor.SelectedText)
|
||||
If ddlProducto2.SelectedValue.ToEntero > 0 Then StrFiltro.AppendFormat(" Producto/Servicio: {0},", ddlProducto2.SelectedText)
|
||||
If TxtFechaF.Text <> "" Then StrFiltro.AppendFormat(" Fecha Fin: {0}", TxtFechaF.Text)
|
||||
GvDatos.ExportToExcelG("ExistenciasHorizontal.xlsx", "Existencias Almacen", UsuarioActual, StrFiltro.ToString, 100, 200)
|
||||
ExportToExcelG(GvDatos, "ExistenciasHorizontal.xlsx", "Existencias Almacen", UsuarioActual, StrFiltro.ToString, 100, 200)
|
||||
Else
|
||||
Alert("Debe consultar para generar un excel", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub ExportToExcelG(Gv As GridView, 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)
|
||||
Dim sw As New StringWriter()
|
||||
Dim htw As New HtmlTextWriter(sw)
|
||||
Gv.RenderControl(htw)
|
||||
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense("ESWN-4QFD-26JF-1SZ8")
|
||||
|
||||
Dim excel As GemBox.Spreadsheet.ExcelFile
|
||||
Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault
|
||||
Using htmlStream = New MemoryStream(options.Encoding.GetBytes(sw.ToString()))
|
||||
excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream, options)
|
||||
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"
|
||||
|
||||
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
|
||||
|
||||
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 = Gv.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(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta))
|
||||
|
||||
If Imagen.Exists Then
|
||||
Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)
|
||||
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
|
||||
|
||||
End Using
|
||||
htw.Dispose()
|
||||
|
||||
excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx")
|
||||
|
||||
End Sub
|
||||
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user