Commit inicial Ventas Productivo
This commit is contained in:
150
Inventarios/RepAlmacenCompras.aspx.vb
Normal file
150
Inventarios/RepAlmacenCompras.aspx.vb
Normal file
@@ -0,0 +1,150 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Inventarios_RepAlmacenCompras
|
||||
Inherits ClsPaginas
|
||||
|
||||
|
||||
#Region " PROPIEDADES"
|
||||
Public Property DtDatos() As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtDatos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtAlmacenCompra As DataTable
|
||||
Get
|
||||
Return DirectCast(ViewState("DtAlmacenCompra"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtAlmacenCompra") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
CargaDatos()
|
||||
CargaPermisos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
#Region " CARGA VALORES INICIALES "
|
||||
Private Sub CargaPermisos()
|
||||
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
|
||||
GvDatos.Columns(6).Visible = TienePermisoImportes
|
||||
GvDatos.Columns(7).Visible = TienePermisoImportes
|
||||
GvDatos.Columns(8).Visible = TienePermisoImportes
|
||||
|
||||
If TienePermisoImportes Then
|
||||
CabeceraAlmacen.Width = "35%"
|
||||
CabeceraCompra.Width = "65%"
|
||||
Else
|
||||
CabeceraAlmacen.Width = "45%"
|
||||
CabeceraCompra.Width = "55%"
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
|
||||
TxtFechaFin.Text = Now.ToShortDateString
|
||||
TxtFechaInicio.Text = Now.FirstDayOfMonth.ToShortDateString
|
||||
|
||||
CargaCombos()
|
||||
|
||||
End Sub
|
||||
Private Sub CargaCombos()
|
||||
|
||||
'Llena Almacen
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
DdlAlmacen.DataBind()
|
||||
DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " CONSULTAR - CARGA "
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
Consultar()
|
||||
End Sub
|
||||
|
||||
Private Sub Consultar()
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
|
||||
Dim FechaI As Date = If(TxtFechaInicio.Text = "" Or TxtFechaInicio.Text = "__/__/____", MinFecha, TxtFechaInicio.Text.ToDate)
|
||||
Dim FechaF As Date = If(TxtFechaFin.Text = "" Or TxtFechaFin.Text = "__/__/____", MaxFecha, TxtFechaFin.Text.ToDate)
|
||||
|
||||
|
||||
If ObjInventarios.RepAlmacenCompras(DdlAlmacen.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then
|
||||
DtDatos = ObjInventarios.DtResultados
|
||||
DtAlmacenCompra = ObjInventarios.DtResultados
|
||||
Else
|
||||
DtDatos = Nothing
|
||||
Alert("Ocurrió un error al obtener el reporte de almacen compras. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
ObjInventarios.Dispose()
|
||||
|
||||
If DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then
|
||||
GvDatos.DataSource = DtDatos
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "PDF"
|
||||
|
||||
Private Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
||||
If DtAlmacenCompra IsNot Nothing Then
|
||||
Dim StrFiltro As New StringBuilder
|
||||
If DdlAlmacen.SelectedValue <> "-1" Then StrFiltro.AppendFormat("<b>Almacen</b>: {0}", DdlAlmacen.SelectedItem.Text)
|
||||
|
||||
If TxtFechaInicio.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Inicio </b>: {0}", TxtFechaInicio.Text.ToDate.ToShortDateString)
|
||||
If TxtFechaFin.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Fin </b>: {0}", TxtFechaFin.Text.ToDate.ToShortDateString)
|
||||
|
||||
|
||||
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("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
||||
params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepAlmacenCompras.rdlc", DtAlmacenCompra, params, String.Format("ReporteAlmacenCompras-{0}", Now.ToDateTime.ToShortDateString))
|
||||
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "EXCEL"
|
||||
Private Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
||||
GvDatos.ExportToExcel("Reporte de AlmacenCompras" & Now.ToShortDateString)
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user