Impresion de reporte de ventas por producto
This commit is contained in:
1319
Empresas/141/Formatos/RepPS.rdlc
Normal file
1319
Empresas/141/Formatos/RepPS.rdlc
Normal file
File diff suppressed because it is too large
Load Diff
@@ -60,6 +60,13 @@
|
|||||||
Reporte de Ventas por Producto
|
Reporte de Ventas por Producto
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||||
|
<li>
|
||||||
|
<asp:LinkButton ID="LnkPdf" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> PDF</asp:LinkButton>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<asp:LinkButton ID="ImgExcel" runat="server"> <i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Excel</asp:LinkButton>
|
||||||
|
</li>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
@@ -76,12 +83,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="titlefiltros caption">
|
<div class="titlefiltros caption">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label runat="server" id="LblSubProyecto" class="col-md-1 truncate">SubProyecto:</label>
|
<label runat="server" id="LblSubProyecto" class="col-md-1 truncate">SubProyecto:</label>
|
||||||
<div runat="server" id="DivSubProyecto" class="col-md-2">
|
<div runat="server" id="DivSubProyecto" class="col-md-2">
|
||||||
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||||
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
|
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
|
||||||
</asp:DropDownList>
|
</asp:DropDownList>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-1 truncate">
|
<div class="col-md-1 truncate">
|
||||||
Fecha Inicio:
|
Fecha Inicio:
|
||||||
|
|
||||||
@@ -120,7 +127,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<label class="col-md-1 ">Grupo:</label>
|
<label class="col-md-1 ">Grupo:</label>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<asp:DropDownList ID="DdlGrupo" runat="server" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
<asp:DropDownList ID="DdlGrupo" runat="server" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||||
<asp:ListItem Selected="True" Text="Familia-Marca-Linea" Value="1"></asp:ListItem>
|
<asp:ListItem Selected="True" Text="Familia-Marca-Linea" Value="1"></asp:ListItem>
|
||||||
</asp:DropDownList>
|
</asp:DropDownList>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,9 +3,22 @@ Option Strict On
|
|||||||
|
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
|
Imports Microsoft.Reporting.WebForms
|
||||||
|
|
||||||
Partial Class Ventas_RepPS
|
Partial Class Ventas_RepPS
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
|
|
||||||
|
#Region "P R O P I E D A D E S"
|
||||||
|
Private Property DtReporte As DataTable
|
||||||
|
Get
|
||||||
|
Return DirectCast(ViewState("DtReporte"), DataTable)
|
||||||
|
End Get
|
||||||
|
Set(value As DataTable)
|
||||||
|
ViewState("DtReporte") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
#End Region
|
||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||||
If Not IsPostBack Then
|
If Not IsPostBack Then
|
||||||
CargaDatosIniciales()
|
CargaDatosIniciales()
|
||||||
@@ -17,6 +30,7 @@ Partial Class Ventas_RepPS
|
|||||||
txtFechaI.Text = $"01/{Now.Month}/{Now.Year}"
|
txtFechaI.Text = $"01/{Now.Month}/{Now.Year}"
|
||||||
txtFechaF.Text = Now.ToString("dd/MM/yyyy")
|
txtFechaF.Text = Now.ToString("dd/MM/yyyy")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaCombos()
|
Private Sub CargaCombos()
|
||||||
CargaTipoCentroCosto()
|
CargaTipoCentroCosto()
|
||||||
End Sub
|
End Sub
|
||||||
@@ -67,8 +81,9 @@ Partial Class Ventas_RepPS
|
|||||||
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
||||||
|
|
||||||
Dim ObjVentas As New ClsVentas()
|
Dim ObjVentas As New ClsVentas()
|
||||||
If ObjVentas.GetRepPSEcono(CveSubProyecto, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then
|
If ObjVentas.GetRepPSEcono(CveSubProyecto, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then
|
||||||
GvDatos.DataSource = ObjVentas.DtResultados
|
DtReporte = ObjVentas.DtResultados.Copy()
|
||||||
|
GvDatos.DataSource = DtReporte
|
||||||
Else
|
Else
|
||||||
GvDatos.DataSource = Nothing
|
GvDatos.DataSource = Nothing
|
||||||
End If
|
End If
|
||||||
@@ -78,8 +93,6 @@ Partial Class Ventas_RepPS
|
|||||||
|
|
||||||
UPDatos.Update()
|
UPDatos.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
Select Case e.Row.DBCampo("Orden").ToString.ToEntero()
|
Select Case e.Row.DBCampo("Orden").ToString.ToEntero()
|
||||||
@@ -99,4 +112,50 @@ Partial Class Ventas_RepPS
|
|||||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
#Region " IMPRIMIR "
|
||||||
|
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
||||||
|
If GvDatos.Rows.Count > 0 Then
|
||||||
|
GenerarPDF()
|
||||||
|
Else
|
||||||
|
Alert("No hay datos para imprimir")
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
||||||
|
GvDatos.ExportToExcel("ReporteProductosServicios" & Now.ToShortDateString)
|
||||||
|
End Sub
|
||||||
|
Private Sub GenerarPDF()
|
||||||
|
Dim FechaI, FechaF As Date
|
||||||
|
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha)
|
||||||
|
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
|
||||||
|
If DtReporte IsNot Nothing AndAlso DtReporte.Rows.Count > 0 Then
|
||||||
|
Dim SbParametros As New StringBuilder
|
||||||
|
SbParametros.AppendFormat("Sucursal:{0}", DdlSubProyecto.SelectedItem.Text)
|
||||||
|
SbParametros.AppendFormat(", Orden:{0}", DdlGrupo.SelectedItem.Text)
|
||||||
|
|
||||||
|
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", If(txtFechaI.Text <> "", FechaI.ToShortDateString, "")))
|
||||||
|
params.Add(New ReportParameter("FechaFin", If(txtFechaF.Text <> "", FechaF.ToShortDateString, "")))
|
||||||
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||||
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||||
|
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
||||||
|
If Imagen.Exists Then
|
||||||
|
params.Add(New ReportParameter("LogoPath", logouri))
|
||||||
|
Else
|
||||||
|
params.Add(New ReportParameter("LogoPath", ""))
|
||||||
|
End If
|
||||||
|
params.Add(New ReportParameter("Parametros", SbParametros.ToString()))
|
||||||
|
ImprimirPDF($"Empresas/{UsuarioActual.CveEmpresa}/Formatos/RepPS.rdlc", DtReporte, params, "ReportePS")
|
||||||
|
Else
|
||||||
|
Alert("No hay información para mostrar.", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
#End Region
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user