Contratos, Indicadores reportes
This commit is contained in:
@@ -8,7 +8,6 @@ Partial Class RepContratosObraAvancesDetalle
|
||||
|
||||
|
||||
Property CveContrato As Integer
|
||||
|
||||
Get
|
||||
If ViewState("CveContrato") Is Nothing Then
|
||||
Return -1
|
||||
@@ -18,17 +17,30 @@ Partial Class RepContratosObraAvancesDetalle
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveContrato") = value
|
||||
End Set
|
||||
|
||||
|
||||
End Property
|
||||
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property NumeroContrato As String
|
||||
Get
|
||||
If ViewState("NumeroContrato") Is Nothing Then
|
||||
Return ""
|
||||
Else
|
||||
Return ViewState("NumeroContrato").ToString
|
||||
End If
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("NumeroContrato") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
CveContrato = If(Request("CveContrato") IsNot Nothing AndAlso Request("CveContrato").ToString.ToEntero > 0, Request("CveContrato").ToString.ToEntero, -1)
|
||||
LblNumeroContrato.Text = If(Request("NumeroContrato") IsNot Nothing AndAlso Request("NumeroContrato").ToString.Length > 0, $"Numero Contrato: {Request("NumeroContrato").ToString}", "")
|
||||
NumeroContrato = If(Request("NumeroContrato") IsNot Nothing AndAlso Request("NumeroContrato").ToString.Length > 0, $"{Request("NumeroContrato").ToString}", "")
|
||||
LblNumeroContrato.Text = If(Request("NumeroContrato") IsNot Nothing AndAlso Request("NumeroContrato").ToString.Length > 0, $"Estimaciones del Contrato: {Request("NumeroContrato").ToString}", "")
|
||||
|
||||
If CveContrato > 0 Then
|
||||
CargaDatos()
|
||||
@@ -40,54 +52,72 @@ Partial Class RepContratosObraAvancesDetalle
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim Con As New ClsContratos
|
||||
|
||||
Dim DTDatos As DataTable = New DataTable
|
||||
Dim DTContrato As DataTable = New DataTable
|
||||
|
||||
If Con.GetContratosObraRepAvancesDetalle(CveContrato, UsuarioActual.CveEmpresa) Then
|
||||
GVDatos.DataSource = Con.DtResultados
|
||||
|
||||
DTDatos = Con.DtResultados
|
||||
If Con.DtResultados.Rows.Count = 0 Then
|
||||
Alert("No se encontraron estimaciones.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Else
|
||||
GVDatos.DataSource = Nothing
|
||||
End If
|
||||
|
||||
If Con.GetContratosObraRepAvances(MinFecha, MaxFecha, -1, CveContrato, UsuarioActual.CveEmpresa) Then
|
||||
DTContrato = Con.DtResultados
|
||||
If DTContrato.Rows.Count > 0 Then
|
||||
Indicadores(DTContrato, DTDatos.Rows.Count)
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Con.Dispose()
|
||||
|
||||
GVDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
|
||||
UpDatos.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
'#Region "C O M B O S"
|
||||
Private Sub Indicadores(DTDatos As DataTable, NumeroEstimaciones As Integer)
|
||||
|
||||
LtlGrafNumeroEstimaciones.Text = NumeroEstimaciones
|
||||
|
||||
|
||||
' Private Sub CargaContratos()
|
||||
' DdlContrato.DataSource = GlobalDTContratos.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveContratoTipo IN(30,31) ")
|
||||
' DdlContrato.DataBind()
|
||||
' DdlContrato.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todos", "-1"))
|
||||
' End Sub
|
||||
Dim AvanceImporte As Decimal = DTDatos(0)("AvanceImporte").ToString.ToDecimal
|
||||
Dim TotalContratos As Decimal = DTDatos(0)("Importe").ToString.ToDecimal
|
||||
Dim TotalAvancePorcentaje As Decimal = (AvanceImporte * 100) / TotalContratos
|
||||
Dim TotalFaltantePorcentaje As Decimal = 100 - TotalAvancePorcentaje
|
||||
|
||||
Dim FechaFinal As Date = DTDatos(0)("FechaFinal").ToString.ToDate
|
||||
Dim Dias As Integer = (FechaFinal - Now).Days
|
||||
|
||||
Dias = If(Dias < 0, 0, Dias)
|
||||
|
||||
LtlAvanceImporte.Text = $"$ {AvanceImporte.ToString("###,###,###.00")}"
|
||||
|
||||
LtlAvanceImporteProcentaje1.Text = $"{TotalAvancePorcentaje.ToString("###.00")} %"
|
||||
LtlAvanceImporteProcentaje2.Text = $"{TotalAvancePorcentaje.ToString("###.00")}%"
|
||||
SPAvance1.Attributes.Add("style", $"width:{TotalAvancePorcentaje.ToString.ToEntero}%")
|
||||
|
||||
LtlFechaFin.Text = FechaFinal.ToString("dd/MM/yyyy")
|
||||
LtlDiasRestantes.Text = Dias.ToString("###,###")
|
||||
|
||||
UpGrafica.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
' Private Sub CargaClientes()
|
||||
' Dim dt As DataTable = Nothing
|
||||
' Dim Cli As New ClsClientes
|
||||
' If Cli.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
' dt = Cli.DtResultados
|
||||
' End If
|
||||
' Cli.Dispose()
|
||||
' DdlCliente.DataSource = dt
|
||||
' DdlCliente.DataBind()
|
||||
' DdlCliente.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
' End Sub
|
||||
|
||||
'#End Region
|
||||
|
||||
Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVDatos.RowDataBound
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
Dim HplNumeroEstimacion As HyperLink = e.Row.FCHyperLink("HplNumeroEstimacion")
|
||||
HplNumeroEstimacion.NavigateUrl = $"./RepContratosObraAvancesPartida.aspx?CveEstimacion={e.Row.DataKey("CveEstimacion")}&NumeroEstimacion={ e.Row.DataKey("NumeroEstimacion")}&CveContrato={ CveContrato }"
|
||||
HplNumeroEstimacion.NavigateUrl = $"./RepContratosObraAvancesPartida.aspx?CveEstimacion={e.Row.DataKey("CveEstimacion")}&NumeroEstimacion={ e.Row.DataKey("NumeroEstimacion")}&CveContrato={ CveContrato }&NumeroContrato={NumeroContrato}"
|
||||
|
||||
Dim LnkAnexo As LinkButton = e.Row.FCLinkButton("LnkAnexo")
|
||||
|
||||
@@ -97,9 +127,6 @@ Partial Class RepContratosObraAvancesDetalle
|
||||
|
||||
End Sub
|
||||
|
||||
'Protected Sub CmdConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||
' CargaDatos()
|
||||
'End Sub
|
||||
|
||||
|
||||
Protected Sub LnkAnexo_Click(sender As Object, e As EventArgs)
|
||||
@@ -130,18 +157,23 @@ Partial Class RepContratosObraAvancesDetalle
|
||||
|
||||
Dim DtControl As New DataTable
|
||||
Dim ObjContratos As New ClsContratos
|
||||
|
||||
|
||||
Dim Lugar As String = ""
|
||||
Dim DescripcionContrato As String = ""
|
||||
|
||||
|
||||
If ObjContratos.GetContratosObraAvancesControlAcumulativo(CveContrato, CveEstimacion, UsuarioActual.CveEmpresa) Then
|
||||
DtControl = ObjContratos.DtResultados
|
||||
|
||||
|
||||
If DtControl.Rows.Count > 0 Then
|
||||
Lugar = DtControl(0)("Lugar").ToString
|
||||
DescripcionContrato = DtControl(0)("DescripcionContrato").ToString
|
||||
End If
|
||||
End If
|
||||
ObjContratos.Dispose()
|
||||
|
||||
If DtControl.Rows.Count > 0 Then
|
||||
|
||||
|
||||
Dim WBAnexo = New ClosedXML.Excel.XLWorkbook(PlantillaAnexo)
|
||||
|
||||
Dim WBAnexoSalvar = New ClosedXML.Excel.XLWorkbook
|
||||
@@ -158,10 +190,16 @@ Partial Class RepContratosObraAvancesDetalle
|
||||
|
||||
WSControl.Cell(20, 6).Value = NumeroContrato
|
||||
|
||||
WSControl.Cell(18, 2).Value = "" 'Lugar
|
||||
WSControl.Cell(18, 2).Value = Lugar
|
||||
WSControl.Cell(18, 2).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Left)
|
||||
WSControl.Cell(18, 2).Style.Alignment.SetVertical(XLAlignmentVerticalValues.Top)
|
||||
|
||||
WSControl.Cell(17, 6).Value = "" 'Periodo Fecha Inicial
|
||||
WSControl.Cell(17, 7).Value = "" 'Periuodo Fecha Final
|
||||
WSControl.Cell(20, 2).Value = "" 'Obra
|
||||
WSControl.Cell(20, 2).Value = DescripcionContrato
|
||||
WSControl.Cell(20, 2).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Left)
|
||||
WSControl.Cell(20, 2).Style.Alignment.SetVertical(XLAlignmentVerticalValues.Top)
|
||||
|
||||
WSControl.Cell(22, 7).Value = "" 'Presupuesto segun contrato
|
||||
WSControl.Cell(19, 5).Value = "" 'Contrtatista
|
||||
|
||||
@@ -310,9 +348,7 @@ Partial Class RepContratosObraAvancesDetalle
|
||||
WSDetalle.Cell(4, 10).Value = "" 'Fecha a
|
||||
WSDetalle.Cell(4, 11).Value = NumeroEstimacion
|
||||
|
||||
'WSDetalle.Picture("Logo").Name = $"Logo{Drow("CveContratoDetalle").ToString}"
|
||||
'WSDetalle.Picture("Firma").Name = $"Firma{Drow("CveContratoDetalle").ToString}"
|
||||
|
||||
WSDetalle.Cell(6, 6).Value = DescripcionContrato
|
||||
|
||||
WSDetalle.Cell(14, 2).Value = Drow("Codigo").ToString
|
||||
WSDetalle.Cell(14, 3).Value = Drow("PS").ToString
|
||||
@@ -353,7 +389,7 @@ Partial Class RepContratosObraAvancesDetalle
|
||||
|
||||
Dim ImgWidth As Double = Imagen.Height
|
||||
|
||||
Dim nRowmas As Integer = ImgWidth / RowH
|
||||
Dim nRowmas As Integer = (ImgWidth / RowH).ToEntero
|
||||
|
||||
CurrectRowImg = CurrectRowImg + nRowmas
|
||||
|
||||
@@ -396,13 +432,5 @@ Partial Class RepContratosObraAvancesDetalle
|
||||
|
||||
End Sub
|
||||
|
||||
'Public Function GetStream(excelWorkbook As ClosedXML.Excel.XLWorkbook) As Stream
|
||||
|
||||
' Dim fs = New MemoryStream()
|
||||
' excelWorkbook.SaveAs(fs)
|
||||
' fs.Position = 0
|
||||
' Return fs
|
||||
|
||||
'End Function
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user