116 lines
3.6 KiB
VB.net
116 lines
3.6 KiB
VB.net
Option Strict On
|
|
Option Explicit On
|
|
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class Inventarios_ReporteMaterial
|
|
Inherits ClsPaginas
|
|
|
|
|
|
Property DTDatos As DataTable
|
|
Get
|
|
If ViewState("DTDatos") Is Nothing Then
|
|
Return New DataTable
|
|
Else
|
|
Return DirectCast(ViewState("DTDatos"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTDatos") = value
|
|
End Set
|
|
End Property
|
|
Private Sub Inventarios_ReporteMaterial_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
CargaCombos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaCombos()
|
|
|
|
DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa)
|
|
DdlAlmacen.DataBind()
|
|
DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa)
|
|
DdlPersonal.DataBind()
|
|
DdlPersonal.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim objInv As New ClsInventarios
|
|
|
|
If objInv.GetReporteMaterialRep(DdlPersonal.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = objInv.DtResultados
|
|
DTDatos = objInv.DtResultados
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
DTDatos = Nothing
|
|
End If
|
|
|
|
objInv.Dispose()
|
|
GvDatos.DataBind()
|
|
UpDatos.Update()
|
|
|
|
End Sub
|
|
|
|
Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
If e.Row.DataKey("PS").ToString = "-" Then
|
|
e.Row.Style.Value = "font-weight:bold; background: rgba(103, 128, 159, 0.65) !important;;color:white"
|
|
Else
|
|
' e.Row.Cells(3).Text = $"<a class='Texto' href='EntradasSalidas.aspx?CveMovimiento={e.Row.DataKey("CveMovimiento")}' target='_blank'>{e.Row.DataKey("Folio")}</a>"
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub btnConsultar_Click(sender As Object, e As EventArgs) Handles btnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
|
|
#Region "I M P R I M I R P D F/Excel"
|
|
|
|
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
|
GenerarPDF("Excel")
|
|
End Sub
|
|
Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LinkPDF.Click
|
|
GenerarPDF()
|
|
End Sub
|
|
|
|
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
|
Dim ObjTareas As New ClsOIEventos
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
|
|
|
|
|
|
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)
|
|
|
|
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", $"file://{Imagen.FullName}"))
|
|
Else
|
|
params.Add(New ReportParameter("LogoPath", ""))
|
|
End If
|
|
ImprimirPDF("Empresas\Grales\Formatos\RepReporteMaterial.rdlc", DTDatos, params, $"RepReporteMaterial_{Now.ToString("yyyyMMddmmss")}", Formato:=Formato)
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
End Class
|