126 lines
3.8 KiB
VB.net
126 lines
3.8 KiB
VB.net
Imports Extensiones
|
|
Imports System.Data
|
|
|
|
Partial Class RepContratosObraAvances
|
|
Inherits ClsPaginas
|
|
|
|
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
|
|
CargaClientes()
|
|
CargaContratos()
|
|
CargaDatos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub CargaDatos()
|
|
|
|
Dim CveCliente As Integer = -1
|
|
Dim Con As New ClsContratos
|
|
If DdlCliente.SelectedValue.ToEntero > 0 Then CveCliente = DdlCliente.SelectedValue.ToEntero
|
|
|
|
If Con.GetContratosObraRepAvances(MinFecha, MaxFecha, CveCliente, DdlContrato.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
GVDatos.DataSource = Con.DtResultados
|
|
If Con.DtResultados.Rows.Count > 0 Then
|
|
Indicadores(Con.DtResultados)
|
|
End If
|
|
Else
|
|
GVDatos.DataSource = Nothing
|
|
End If
|
|
|
|
Con.Dispose()
|
|
|
|
GVDatos.DataBind()
|
|
UpDatos.Update()
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub Indicadores(DTDatos As DataTable)
|
|
|
|
Dim NumeroContratos As Integer = DTDatos.Rows.Count
|
|
|
|
'Dim TotalContratos As Decimal = DTDatos.SUM("Importe")
|
|
Dim TotalContratos As Decimal = DTDatos.SUM("ImporteSubTotal")
|
|
|
|
|
|
Dim TotalAvance As Decimal = DTDatos.SUM("AvanceImporte")
|
|
Dim TotalFaltante As Decimal = TotalContratos - TotalAvance
|
|
|
|
|
|
Dim TotalAvancePorcentaje As Decimal = ((TotalAvance * 100) / TotalContratos).RoundAD(2)
|
|
Dim TotalFaltantePorcentaje As Decimal = (100 - TotalAvancePorcentaje).RoundAD(2)
|
|
|
|
|
|
LtlGrafNumeroContratos.Text = NumeroContratos.ToString
|
|
LtlGrafTotal.Text = TotalContratos.ToString("###,###,###.00")
|
|
|
|
|
|
LtlAvanceImporte.Text = $"$ {TotalAvance.ToString("###,###,###.00")}"
|
|
LtlAvanceImporteProcentaje1.Text = $"{TotalAvancePorcentaje.ToString("###.00")} %"
|
|
LtlAvanceImporteProcentaje2.Text = $"{TotalAvancePorcentaje.ToString("###.00")}%"
|
|
SPAvance1.Attributes.Add("style", $"width:{TotalAvancePorcentaje.ToString.ToEntero}%")
|
|
|
|
|
|
LtlFaltanteImporte.Text = $"$ {TotalFaltante.ToString("###,###,###.00")}"
|
|
LtlFaltanteImportePorcentaje1.Text = $"{TotalFaltantePorcentaje.ToString("###.00")} %"
|
|
LtlFaltanteImportePorcentaje2.Text = $"{TotalFaltantePorcentaje.ToString("###.00")}%"
|
|
SPFaltante.Attributes.Add("style", $"width:{TotalFaltantePorcentaje.ToString.ToEntero}%")
|
|
|
|
UpGrafica.Update()
|
|
|
|
End Sub
|
|
|
|
#Region "C O M B O S"
|
|
|
|
|
|
Private Sub CargaContratos()
|
|
DdlContrato.DataSource = GlobalDTContratos(UsuarioActual.CveEmpresa).FiltraParametros(" CveContratoTipo IN(30,31) ")
|
|
DdlContrato.DataBind()
|
|
DdlContrato.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todos", "-1"))
|
|
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 HplContratado As HyperLink = e.Row.FCHyperLink("HplContratado")
|
|
|
|
HplContratado.NavigateUrl = $"./RepContratosObraAvancesDetalle.aspx?CveContrato={e.Row.DataKey("CveContrato")}&NumeroContrato={e.Row.DataKey("NumeroContrato")}"
|
|
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Protected Sub CmdConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
End Class
|