Commit inicial Ventas Productivo
This commit is contained in:
153
Inventarios/RepOcInv.aspx.vb
Normal file
153
Inventarios/RepOcInv.aspx.vb
Normal file
@@ -0,0 +1,153 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Inventarios_RepOcInv
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
Private Property DtOCXSurtir As DataTable
|
||||
Get
|
||||
Return DirectCast(ViewState("DtOCXSurtir"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtOCXSurtir") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Private Sub Inventarios_RepOcInv_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
InicializaValores()
|
||||
' CargaDatos()
|
||||
CargaPermisos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region " INICIALIZA VALORES "
|
||||
Private Sub CargaPermisos()
|
||||
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
|
||||
|
||||
GvDatos.Columns(5).Visible = TienePermisoImportes
|
||||
End Sub
|
||||
Private Sub InicializaValores()
|
||||
TxtFechaF.Text = Now.ToShortDateString
|
||||
TxtFechaI.Text = Now.AddMonths(-1).ToShortDateString
|
||||
|
||||
'Llenar dropdownlist de proveedores
|
||||
DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
|
||||
DdlProveedor.DataBind()
|
||||
DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa)
|
||||
DdlSubProyecto.DataBind()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
|
||||
'CENTRO COSTO
|
||||
If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then
|
||||
GvDatos.Columns(2).HeaderText = "Sucursal"
|
||||
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then
|
||||
GvDatos.Columns(2).HeaderText = "Proyecto"
|
||||
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then
|
||||
GvDatos.Columns(2).HeaderText = "Proyecto"
|
||||
ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then
|
||||
GvDatos.Columns(2).HeaderText = "Sucursal"
|
||||
End If
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region " CARGA DATOS "
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos()
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
Dim Folio As String
|
||||
Dim FechaInicio As Date
|
||||
Dim FechaFin As Date
|
||||
|
||||
'Folio = If(TxtFolio.Text.Trim.Length > 0, TxtFolio.Text.Trim, "-1")
|
||||
Folio = "-1"
|
||||
FechaInicio = If(IsDate(TxtFechaI.Text), TxtFechaI.Text.ToDate, MinFecha)
|
||||
FechaFin = If(IsDate(TxtFechaF.Text), TxtFechaF.Text.ToDate, MinFecha)
|
||||
|
||||
Dim objInventario As New ClsInventarios
|
||||
If objInventario.RepOcInv(Folio, FechaInicio, FechaFin, DdlProveedor.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa) Then
|
||||
GvDatos.DataSource = objInventario.DtResultados
|
||||
DtOCXSurtir = objInventario.DtResultados
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
End If
|
||||
objInventario.Dispose()
|
||||
|
||||
GvDatos.DataBind()
|
||||
|
||||
|
||||
UPGv.Update()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region " IMPRIMIR "
|
||||
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||
GvDatos.ExportToExcel("OC_X_Surtir")
|
||||
End Sub
|
||||
Private Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LinkPDF.Click
|
||||
If DtOCXSurtir IsNot Nothing Then
|
||||
Dim StrFiltro As New StringBuilder
|
||||
If DdlProveedor.SelectedValue <> "-1" Then StrFiltro.AppendFormat("<b>Proveedor</b>: {0}", DdlProveedor.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)
|
||||
|
||||
If TxtFechaI.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Inicio </b>: {0}", TxtFechaI.Text.ToDate.ToShortDateString)
|
||||
If TxtFechaF.Text <> "" Then StrFiltro.AppendFormat(" <b>Fecha Fin </b>: {0}", TxtFechaF.Text.ToDate.ToShortDateString)
|
||||
'If TxtFolio.Text <> "" Then StrFiltro.AppendFormat(" <b>Folio</b>: {0}", TxtFolio.Text)
|
||||
|
||||
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/RepOCInv.rdlc", DtOCXSurtir, params, String.Format("ReporteOCXSurtir-{0}", Now.ToDateTime.ToShortDateString))
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
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.DBCampo("CveOrdenCompra") = "" Then
|
||||
e.Row.CssClass = "SubTotales2"
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
'Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
' If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
' If UsuarioActual.TienePermisoProceso(201) Then
|
||||
' Dim Css = "Texto"
|
||||
' Dim Liga = $"/OC/OC.aspx?&OC={e.Row.DBCampo("CveOrdenCompra")}"
|
||||
' e.Row.FCLabel("LblFolio").Text = "<a class=" + "" + Css + "" + " href=" + "" + Liga + "" + ">" + e.Row.FCLabel("LblFolio").Text + "</a>"
|
||||
' End If
|
||||
|
||||
' End If
|
||||
'End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user