165 lines
8.2 KiB
VB.net
165 lines
8.2 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class OC_RepRequisiciones
|
|
Inherits ClsPaginas
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
ViewState("Orden") = ""
|
|
CargaCombos()
|
|
CargaDatos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaCombos()
|
|
'CargaProyectos
|
|
Dim DtUsuarioProyectos As DataTable = Nothing
|
|
|
|
Dim objEstatusUsuarios As New ClsOC
|
|
If objEstatusUsuarios.GetEstatusUsuarios(UsuarioActual.CveUsuario, -1, -1, -1, UsuarioActual.CveEmpresa) Then
|
|
DtUsuarioProyectos = objEstatusUsuarios.DtResultados
|
|
End If
|
|
objEstatusUsuarios.Dispose()
|
|
txtFechaI.Text = Now.AddMonths(-1).FirstDayOfMonth.ToShortDateString
|
|
|
|
DdlProyecto.DataSource = DtUsuarioProyectos.FiltraParametros("", "", {"CveProyecto", "Proyecto"}) ' GlobalDTProyectos(UsuarioActual.Empresa.CveEmpresa)
|
|
DdlProyecto.DataBind()
|
|
|
|
'CargaSubProyectos
|
|
DdlSubProyecto.DataSource = DtUsuarioProyectos.FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"}) 'GlobalDTSubProyectos(-1).FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
|
DdlSubProyecto.DataBind()
|
|
|
|
'CargaEstatus de Requisiciones
|
|
DdlEstatus.DataSource = GlobalDTOCEstatus(UsuarioActual.CveEmpresa).FiltraParametros("Tipo = 'REQ' OR CveEstatus = 0 ")
|
|
DdlEstatus.DataBind()
|
|
|
|
'Select Case UsuarioActual.CveRol
|
|
' Case 1017
|
|
' DdlEstatus.SelectedValue = "7"
|
|
' Case 1018
|
|
' DdlEstatus.SelectedValue = "2"
|
|
'End Select
|
|
OrdenaDatos()
|
|
End Sub
|
|
|
|
Public Sub CargaDatos()
|
|
|
|
Dim FI As Date = If(txtFechaI.Text.Trim = "", MinFecha, txtFechaI.Text.Trim.ToDate)
|
|
Dim FF As Date = If(txtFechaF.Text.Trim = "", MaxFecha, txtFechaF.Text.Trim.ToDate)
|
|
|
|
Dim ObjOrdenesCompra As New ClsOC()
|
|
If ObjOrdenesCompra.GetOrdenesCompraRep("REQ", DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, DdlEstatus.SelectedValue.ToEntero, FI, FF, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1) Then
|
|
Me.GVDatos.DataSource = ObjOrdenesCompra.DtResultados.FiltraParametros("", "Folio DESC")
|
|
Else
|
|
Me.GVDatos.DataSource = Nothing
|
|
End If
|
|
ObjOrdenesCompra.Dispose()
|
|
|
|
Me.GVDatos.DataBind()
|
|
UpDatos.Update()
|
|
OrdenaDatos()
|
|
|
|
End Sub
|
|
|
|
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.RowIndex = 0 Then
|
|
' e.Row.Cells(0).Width = Unit.Pixel(50)
|
|
' e.Row.Cells(1).Width = Unit.Pixel(200)
|
|
' e.Row.Cells(2).Width = Unit.Pixel(120)
|
|
' 'e.Row.Cells(3).Width = Unit.Pixel(100)
|
|
' e.Row.Cells(4).Width = Unit.Pixel(100)
|
|
' e.Row.Cells(5).Width = Unit.Pixel(100)
|
|
' 'e.Row.Cells(6).Width = Unit.Pixel(100)
|
|
'End If
|
|
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
|
|
'e.Row.FCLiteral("LtlFolio").Text = $"<a class=""Texto"" href=""/OC/OC.aspx?OC={0:e.Row.DBCampo("CveOrdenCompra")}""">{1:e.Row.FCLiteral("LtlFolio").Text}</a>"
|
|
'e.Row.FCLiteral("LtlProyecto").Text = "<a class=""Texto"" href=""/OC/OC.aspx?OC=" & e.Row.DBCampo("CveOrdenCompra") & """>" & e.Row.FCLiteral("LtlProyecto").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlSubProyecto").Text = "<a class=""Texto"" href=""/OC/OC.aspx?OC=" & e.Row.DBCampo("CveOrdenCompra") & """>" & e.Row.FCLiteral("LtlSubProyecto").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlDescripcion").Text = "<a class=""Texto"" href=""/OC/OC.aspx?OC=" & e.Row.DBCampo("CveOrdenCompra") & """>" & e.Row.FCLiteral("LtlDescripcion").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlFechaEstimadaEntrega").Text = "<a class=""Texto"" href=""/OC/OC.aspx?OC=" & e.Row.DBCampo("CveOrdenCompra") & """>" & e.Row.FCLiteral("LtlFechaEstimadaEntrega").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlUsuario").Text = "<a class=""Texto"" href=""/OC/OC.aspx?OC=" & e.Row.DBCampo("CveOrdenCompra") & """>" & e.Row.FCLiteral("LtlUsuario").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlEstatus").Text = "<a class=""Texto"" href=""/OC/OC.aspx?OC=" & e.Row.DBCampo("CveOrdenCompra") & """>" & e.Row.FCLiteral("LtlEstatus").Text & "</a>"
|
|
e.Row.FCLiteral("HplFolio").Text = String.Format("<a class=""Texto"" href=""/OC/OC.aspx?OC={0}"">{1}</a>", e.Row.DBCampo("CveOrdenCompra"), e.Row.DBCampo("Folio"))
|
|
|
|
Select Case e.Row.DBCampo("TipoTermino") 'e.Row.DBCampo("Estatus")
|
|
Case "0" 'Supervisada
|
|
e.Row.Cells(4).CssClass = "label label-sm label-warning" 'Amarillo
|
|
Case "1" 'Autorizada
|
|
e.Row.Cells(4).CssClass = "label label-sm label-success" 'Verde
|
|
Case "2" 'Rechazada
|
|
e.Row.Cells(4).CssClass = "label label-sm label-danger" 'Rojo
|
|
Case "3" 'Solicitada
|
|
e.Row.Cells(4).CssClass = "label label-sm label-default" 'Gris
|
|
End Select
|
|
e.Row.Cells(5).Attributes.Add("data-order", e.Row.DBCampo("FechaEstimadaEntrega").ToDate.Ticks.ToString)
|
|
|
|
End If
|
|
End Sub
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
Private Sub OrdenaDatos()
|
|
If (GVDatos.Rows.Count > 0) Then
|
|
GVDatos.UseAccessibleHeader = True
|
|
GVDatos.HeaderRow.TableSection = TableRowSection.TableHeader
|
|
RegistraScript("OrdenarGV();")
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
|
|
GVDatos.Columns(7).Visible = ChkCliente.Checked
|
|
GVDatos.Columns(8).Visible = ChkProveedor.Checked
|
|
UpDatos.Update()
|
|
OrdenaDatos()
|
|
End Sub
|
|
|
|
'Protected Sub ImgExcel_Click(sender As Object, e As System.EventArgs) Handles ImgExcel.Click
|
|
' GVDatos.ExportToExcel("ReporteRequisiciones" & Now.ToShortDateString)
|
|
'End Sub
|
|
|
|
|
|
#Region "I M P R I M I R <i class='fa fa-print'></i>"
|
|
Private Sub GenerarPDF()
|
|
Dim ObjOrdenesCompra As New ClsOC()
|
|
Dim FI As Date = If(txtFechaI.Text.Trim = "", MinFecha, txtFechaI.Text.Trim.ToDate)
|
|
Dim FF As Date = If(txtFechaF.Text.Trim = "", MaxFecha, txtFechaF.Text.Trim.ToDate)
|
|
If ObjOrdenesCompra.GetOrdenesCompraRep("REQ", DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, DdlEstatus.SelectedValue.ToEntero, FI, FF, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1) Then
|
|
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 dt As DataTable = ObjOrdenesCompra.DtResultados
|
|
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("Proyecto", DdlProyecto.SelectedItem.Text))
|
|
params.Add(New ReportParameter("SubProyecto", DdlSubProyecto.SelectedItem.Text))
|
|
If Imagen.Exists Then
|
|
params.Add(New ReportParameter("LogoPath", logouri))
|
|
Else
|
|
params.Add(New ReportParameter("LogoPath", ""))
|
|
End If
|
|
ImprimirPDF("Empresas/Grales/Formatos/RepRequisiciones.rdlc", dt, params, "ReporteRequisiciones")
|
|
Else
|
|
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
End Sub
|
|
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
|
|
GenerarPDF()
|
|
End Sub
|
|
#End Region
|
|
|
|
End Class
|