Commit inicial Ventas Productivo
This commit is contained in:
118
Contratos/RepContratosCostos.aspx.vb
Normal file
118
Contratos/RepContratosCostos.aspx.vb
Normal file
@@ -0,0 +1,118 @@
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Contratos_RepContratosCostos
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "P R O P I E D A D E S"
|
||||
Private Property DtDatos As DataTable
|
||||
Get
|
||||
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
|
||||
End Get
|
||||
|
||||
Set(ByVal value As DataTable)
|
||||
ViewState("DtDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TCEspecifico As Double
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
txtFechaI.Text = Now.FirstDayOfMonth.ToShortDateString
|
||||
txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString
|
||||
|
||||
CargaDatos()
|
||||
|
||||
CargaContratos()
|
||||
CargaEstatus()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjContratos As New ClsContratos
|
||||
If ObjContratos.GetContratosCostos(DdlContratos.SelectedValue.ToEntero, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlEstatus.SelectedValue.ToEntero, DdlTipo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
DtDatos = ObjContratos.DtResultados
|
||||
GvDatos.DataSource = ObjContratos.DtResultados
|
||||
|
||||
End If
|
||||
ObjContratos.Dispose()
|
||||
GvDatos.DataBind()
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
#Region "C O M B O S"
|
||||
Public Sub CargaContratos()
|
||||
DdlContratos.DataSource = GlobalDTContratos().FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}")
|
||||
DdlContratos.DataBind()
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub CargaEstatus()
|
||||
Dim ObjContratos As New ClsContratos
|
||||
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
|
||||
DdlEstatus.DataSource = ObjContratos.DtResultados
|
||||
|
||||
End If
|
||||
ObjContratos.Dispose()
|
||||
DdlEstatus.DataBind()
|
||||
End Sub
|
||||
|
||||
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "R E P O R T E S"
|
||||
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
||||
|
||||
Dim Contrato = DdlContratos.SelectedItem
|
||||
|
||||
Dim FechaI As String = txtFechaI.Text
|
||||
Dim FechaF As String = txtFechaF.Text
|
||||
|
||||
If txtFechaI.Text = "" Then FechaI = "-1"
|
||||
If txtFechaF.Text = "" Then FechaF = "-1"
|
||||
|
||||
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", FechaI))
|
||||
params.Add(New ReportParameter("FechaFin", FechaF))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
||||
params.Add(New ReportParameter("Contrato", Contrato.Text))
|
||||
params.Add(New ReportParameter("Estatus", DdlEstatus.SelectedItem.Text))
|
||||
params.Add(New ReportParameter("Tipo", DdlTipo.SelectedItem.Text))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepContratosCostos.rdlc", DtDatos, params, "ReporteContratosCostos", Formato)
|
||||
|
||||
End Sub
|
||||
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs)
|
||||
GenerarPDF("Excel")
|
||||
End Sub
|
||||
Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs)
|
||||
GenerarPDF()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("NumeroContrato") = "Total" Then
|
||||
e.Row.CssClass = "Totales"
|
||||
e.Row.Cells(0).Controls.RemoveAt(0)
|
||||
e.Row.Cells(0).Text = "Total"
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user