Unidades, rep comisiones
This commit is contained in:
@@ -10,6 +10,18 @@
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
|
||||
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpAcciones">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExportar" runat="server" OnClick="LnkExportar_Click" Visible="false"><i class="fa fa-ad-excel" ></i> Generar Excel</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkExportar" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
@@ -23,20 +35,23 @@
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
<div class="row">
|
||||
<label style="max-width: 80px;" class="col-md-1 truncate">Vendedor:</label>
|
||||
<div class="col-md-2">
|
||||
|
||||
<label class="col-md-1">Vendedor:</label>
|
||||
<div class="col-md-1">
|
||||
<asp:DropDownList ID="DdlVendedor" runat="server" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="select2me" Width="100%">
|
||||
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label style="max-width: 70px;" class="col-md-1 truncate">Sucursal:</label>
|
||||
<div class="col-md-2" style="max-width: 120px;">
|
||||
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="select2me">
|
||||
|
||||
<label class="col-md-1">Sucursal:</label>
|
||||
<div class="col-md-1">
|
||||
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="select2me" Width="100%">
|
||||
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label style="max-width: 90px;" class="col-md-1 truncate">Fecha Inicio:</label>
|
||||
<div class="col-md-2" style="max-width: 140px;">
|
||||
|
||||
<label class="col-md-1">Fecha Inicio:</label>
|
||||
<div class="col-md-1" >
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
|
||||
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" Width="85px" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
@@ -50,7 +65,8 @@
|
||||
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<label style="max-width: 80px;" class="col-md-1 truncate">Fecha Fin:</label>
|
||||
|
||||
<label class="col-md-1">Fecha Fin:</label>
|
||||
<div class="col-md-1">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
|
||||
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" Width="85px" MaxLength="10"></asp:TextBox>
|
||||
@@ -65,6 +81,7 @@
|
||||
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Partial Class Ventas_RepComisionesServec
|
||||
Inherits ClsPaginas
|
||||
@@ -35,17 +37,31 @@ Partial Class Ventas_RepComisionesServec
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
LnkExportar.Visible = False
|
||||
|
||||
Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha)
|
||||
Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha)
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
|
||||
If ObjVentas.GetRepComisionesServec(DdlVendedor.SelectedValue.ToEntero, FechaI, FechaF, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjVentas.DtResultados
|
||||
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
LnkExportar.Visible = True
|
||||
End If
|
||||
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
GvDatos.DataBind()
|
||||
|
||||
|
||||
UpAcciones.Update()
|
||||
UPDatos.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
@@ -60,4 +76,118 @@ Partial Class Ventas_RepComisionesServec
|
||||
e.Row.FCHyperLink("HLVendedor").NavigateUrl = String.Format("/Ventas/RepComisionesServecDetalle.aspx?CveVendedor={0}&CveSubProyecto={1}&FechaI={2:dd/MM/yyy}&FechaF={3:dd/MM/yyy}", e.Row.DBCampo("CveVendedor"), DdlSubProyecto.SelectedValue, If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha), If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim StrFiltro As New StringBuilder
|
||||
|
||||
StrFiltro.AppendFormat(" Vendedor: {0}, ", DdlVendedor.SelectedItem.Text)
|
||||
StrFiltro.AppendFormat(" Sucursal: {0}, ", DdlSubProyecto.SelectedItem.Text)
|
||||
StrFiltro.AppendFormat(" Fecha Inicio: {0}, ", txtFechaI.Text)
|
||||
StrFiltro.AppendFormat(" Fecha Fin: {0}", txtFechaF.Text)
|
||||
|
||||
ExportToExcelG(GvDatos, $"ReporteComisiones{Now.ToString("yyyyMMddhhmmss")}.xlsx", "", UsuarioActual, StrFiltro.ToString, 100, 200)
|
||||
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.Columns("A").Width = 15000
|
||||
|
||||
worksheet.Columns("B").Width = 7500
|
||||
worksheet.Columns("C").Width = 5000
|
||||
worksheet.Columns("D").Width = 5000
|
||||
worksheet.Columns("E").Width = 5000
|
||||
|
||||
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(0).Value = "Usuario Imprimió"
|
||||
worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre
|
||||
|
||||
worksheet.Rows(IndexEndTable).Cells(3).Value = "Fecha Impresión"
|
||||
worksheet.Rows(IndexEndTable + 1).Cells(3).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
|
||||
|
||||
End Class
|
||||
|
||||
@@ -10,6 +10,18 @@
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
|
||||
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpAcciones">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExportar" runat="server" OnClick="LnkExportar_Click" Visible="false"><i class="fa fa-ad-excel" ></i> Generar Excel</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkExportar" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
@@ -23,20 +35,21 @@
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
<div class="row">
|
||||
<label style="max-width: 80px;" class="col-md-1 truncate">Vendedor:</label>
|
||||
<div class="col-md-2">
|
||||
|
||||
<label class="col-md-1 truncate">Vendedor:</label>
|
||||
<div class="col-md-1">
|
||||
<asp:DropDownList ID="DdlVendedor" runat="server" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="select2me" Width="100%">
|
||||
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label style="max-width: 70px;" class="col-md-1 truncate">Sucursal:</label>
|
||||
<div class="col-md-2" style="max-width: 120px;">
|
||||
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="select2me">
|
||||
<label class="col-md-1 truncate">Sucursal:</label>
|
||||
<div class="col-md-1" >
|
||||
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="select2me" Width="100%" >
|
||||
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label style="max-width: 90px;" class="col-md-1 truncate">Fecha Inicio:</label>
|
||||
<div class="col-md-2" style="max-width: 140px;">
|
||||
<label class="col-md-1 truncate">Fecha Inicio:</label>
|
||||
<div class="col-md-1" >
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
|
||||
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" Width="85px" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
@@ -50,7 +63,7 @@
|
||||
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<label style="max-width: 80px;" class="col-md-1 truncate">Fecha Fin:</label>
|
||||
<label class="col-md-1 truncate">Fecha Fin:</label>
|
||||
<div class="col-md-1">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
|
||||
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" Width="85px" MaxLength="10"></asp:TextBox>
|
||||
|
||||
@@ -3,6 +3,8 @@ Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Partial Class Ventas_RepComisionesServecDetalle
|
||||
Inherits ClsPaginas
|
||||
@@ -53,12 +55,22 @@ Partial Class Ventas_RepComisionesServecDetalle
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
LnkExportar.Visible = False
|
||||
|
||||
|
||||
Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha)
|
||||
Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha)
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
|
||||
If ObjVentas.GetRepComisionesServecDetalle(DdlVendedor.SelectedValue.ToEntero, FechaI, FechaF, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjVentas.DtResultados
|
||||
|
||||
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
LnkExportar.Visible = True
|
||||
End If
|
||||
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
End If
|
||||
@@ -82,4 +94,126 @@ Partial Class Ventas_RepComisionesServecDetalle
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim StrFiltro As New StringBuilder
|
||||
|
||||
StrFiltro.AppendFormat(" Vendedor: {0}, ", DdlVendedor.SelectedItem.Text)
|
||||
StrFiltro.AppendFormat(" Sucursal: {0}, ", DdlSubProyecto.SelectedItem.Text)
|
||||
StrFiltro.AppendFormat(" Fecha Inicio: {0}, ", txtFechaI.Text)
|
||||
StrFiltro.AppendFormat(" Fecha Fin: {0}", txtFechaF.Text)
|
||||
|
||||
ExportToExcelG(GvDatos, $"ReporteComisiones{Now.ToString("yyyyMMddhhmmss")}.xlsx", "", UsuarioActual, StrFiltro.ToString, 100, 200)
|
||||
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.Columns("A").Width = 7000
|
||||
worksheet.Columns("B").Width = 3500
|
||||
worksheet.Columns("C").Width = 3500
|
||||
worksheet.Columns("D").Width = 3500
|
||||
worksheet.Columns("E").Width = 3500
|
||||
worksheet.Columns("F").Width = 3500
|
||||
worksheet.Columns("G").Width = 3500
|
||||
worksheet.Columns("H").Width = 3500
|
||||
worksheet.Columns("I").Width = 3500
|
||||
worksheet.Columns("J").Width = 3500
|
||||
worksheet.Columns("K").Width = 3500
|
||||
|
||||
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(0).Value = "Usuario Imprimió"
|
||||
worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre
|
||||
|
||||
worksheet.Rows(IndexEndTable).Cells(8).Value = "Fecha Impresión"
|
||||
worksheet.Rows(IndexEndTable + 1).Cells(8).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
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user