-- mejoras en presupuesto EMD

This commit is contained in:
2024-05-17 16:13:25 -07:00
parent 8aac3d3451
commit 1e7651bec9
2 changed files with 70 additions and 44 deletions

View File

@@ -330,9 +330,9 @@
<tr>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 20%; border-right: 3px solid white;">Agrupador</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 10%; border-right: 3px solid white;">Autorizado</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 10%; border-right: 3px solid white;">Comprometido</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 25%; border-right: 3px solid white;">Ejercido</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 25%; border-right: 3px solid white;">Por Ejercer</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 20%; border-right: 3px solid white;" runat="server" id="thComprometido" visible="false">En proceso de compra</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 20%; border-right: 3px solid white;"><asp:Literal ID="LtlthEjercido" runat="server" Text="Ejercido"></asp:Literal></td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 20%; border-right: 3px solid white;">Por Ejercer</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 15%; border-right: 3px solid white;">Pagado</td>
</tr>
</table>
@@ -343,11 +343,11 @@
<%--<asp:HyperLinkField HeaderText="Descripcion" DataTextField="Agrupador" ItemStyle-Width="20%"--%>
<asp:BoundField HeaderText="Descripción" DataField="Agrupador" ItemStyle-Width="20%" />
<asp:BoundField HeaderText="Importe" DataField="Autorizado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Importe" DataField="Comprometido" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Importe" DataField="Comprometido" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="20%" Visible="false" />
<asp:BoundField HeaderText="Importe" DataField="Ejercido" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="%" DataField="EjercidoPorcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="%" DataField="EjercidoPorcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="5%" ItemStyle-Font-Size="7pt" ItemStyle-Font-Italic="true" />
<asp:BoundField HeaderText="Importe" DataField="PorEjercer" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="%" DataField="PorEjercerPorcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="%" DataField="PorEjercerPorcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="5%" ItemStyle-Font-Size="7pt" ItemStyle-Font-Italic="true" />
<asp:BoundField HeaderText="Importe" DataField="Pagado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="15%" />
</Columns>
</asp:GridView>

View File

@@ -2,7 +2,6 @@
Option Strict On
Imports System.Data
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Imports Extensiones
Imports Microsoft.Reporting.WebForms
@@ -20,6 +19,15 @@ Partial Class Contratos_RepPresupuestos
End Set
End Property
Public Property UsaComprometido() As Boolean
Get
Return DirectCast(ViewState("UsaComprometido"), Boolean)
End Get
Set(ByVal value As Boolean)
ViewState("UsaComprometido") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
@@ -29,7 +37,7 @@ Partial Class Contratos_RepPresupuestos
#Region " INICIALIZA VALORES "
Private Sub InicializaValores()
UsaComprometido = False
If UsuarioActual.Empresa.Funcionalidad(267) = "1" Then 'emp citrícola
TxtFiltrosFechaInicio.Text = $"01/08/{NowADS().Year - 1}"
TxtFiltrosFechaFin.Text = $"31/07/{NowADS().Year}"
@@ -54,6 +62,8 @@ Partial Class Contratos_RepPresupuestos
DdlProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
DdlProyecto.DataBind()
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then UsaComprometido = True
CargaSubProyecto()
UpFiltros.Update()
End Sub
@@ -78,7 +88,13 @@ Partial Class Contratos_RepPresupuestos
Dim Agrupador = DdlAgrupador.SelectedValue.ToEntero
Dim FechaInicio = If(IsDate(TxtFiltrosFechaInicio.Text), TxtFiltrosFechaInicio.Text.ToDate, MinFecha)
Dim FechaFin = If(IsDate(TxtFiltrosFechaFin.Text), TxtFiltrosFechaFin.Text.ToDate, MaxFecha)
Dim EsMensual = ChkMensual.Checked
Dim EsMensual = ChkMensual.Checked
If UsaComprometido Then
thComprometido.Visible = True
GvDatos.Columns(2).Visible = True
LtlthEjercido.Text = "Facturado"
End If
If Not EsMensual Then
Dim ObjPresupuestos As New ClsContratos
@@ -127,7 +143,6 @@ Partial Class Contratos_RepPresupuestos
If EsMensual Then
RegistraScript($"CargaChartMensual({HdnJsonProyecto.Value},{HdnJsonGraficos.Value});", "2")
Else
RegistraScript($"CargaChartProyecto({HdnJsonProyecto.Value});", "2")
End If
@@ -286,27 +301,35 @@ Partial Class Contratos_RepPresupuestos
Else
Dim DrPresupuesto = DtPresupuestos.FiltroPrimero("Tipo = 0 AND CveAgrupador IS NULL")
Dim Autorizado = DrPresupuesto("Autorizado").ToString.ToDecimal
Dim Ejercido = DrPresupuesto("Ejercido").ToString.ToDecimal
Dim PorEjercer = DrPresupuesto("PorEjercer").ToString.ToDecimal
Dim EjercidoPorcentaje = DrPresupuesto("EjercidoPorcentaje").ToString.ToDecimal
Dim PorEjercerPorcentaje = DrPresupuesto("PorEjercerPorcentaje").ToString.ToDecimal
LtlAutorizado.Text = Autorizado.FormatoNumero
LtlEjercido.Text = Ejercido.FormatoNumero
LtlPorEjercer.Text = PorEjercer.FormatoNumero
PBEjercido.Style.Remove("width")
PBEjercido.Style.Add("width", $"{EjercidoPorcentaje.ToString}%")
PBPorEjercer.Style.Remove("width")
PBPorEjercer.Style.Add("width", $"{PorEjercerPorcentaje.ToString}%")
LtlPorcentajeEjercido.Text = EjercidoPorcentaje.FormatoNumero + " %"
LtlPorcentajePorEjercer.Text = PorEjercerPorcentaje.FormatoNumero + " %"
Dim json = New JArray(
Dim Autorizado As Decimal = DrPresupuesto("Autorizado").ToString.ToDecimal
Dim Ejercido As Decimal = DrPresupuesto("Ejercido").ToString.ToDecimal
Dim PorEjercer As Decimal = DrPresupuesto("PorEjercer").ToString.ToDecimal
Dim EjercidoPorcentaje = DrPresupuesto("EjercidoPorcentaje").ToString.ToDecimal
Dim PorEjercerPorcentaje = DrPresupuesto("PorEjercerPorcentaje").ToString.ToDecimal
If UsaComprometido Then
Ejercido = DrPresupuesto("Comprometido").ToString.ToDecimal
PorEjercer = Autorizado - Ejercido
EjercidoPorcentaje = Ejercido / Autorizado * 100
PorEjercerPorcentaje = PorEjercer / Autorizado * 100
thComprometido.Visible = True
GvDatos.Columns(2).Visible = True
End If
LtlAutorizado.Text = Autorizado.FormatoNumero
LtlEjercido.Text = Ejercido.FormatoNumero
LtlPorEjercer.Text = PorEjercer.FormatoNumero
PBEjercido.Style.Remove("width")
PBEjercido.Style.Add("width", $"{EjercidoPorcentaje.ToString}%")
PBPorEjercer.Style.Remove("width")
PBPorEjercer.Style.Add("width", $"{PorEjercerPorcentaje.ToString}%")
LtlPorcentajeEjercido.Text = EjercidoPorcentaje.FormatoNumero + " %"
LtlPorcentajePorEjercer.Text = PorEjercerPorcentaje.FormatoNumero + " %"
Dim json = New JArray(
From dr In DtDatos
Select New JObject(
New JProperty("Agrupador", dr("Agrupador").ToString()),
@@ -316,13 +339,13 @@ Partial Class Contratos_RepPresupuestos
New JProperty("AutorizadoProporcion", 100),
New JProperty("EjercidoProporcion", dr("EjercidoPorcentaje").ToString().ToDecimal()),
New JProperty("PorEjercerProporcion", dr("PorEjercerPorcentaje").ToString().ToDecimal()))
)
HdnJsonProyecto.Value = json.ToString
End If
Else
)
HdnJsonProyecto.Value = json.ToString
End If
Else
LtlAutorizado.Text = ""
LtlEjercido.Text = ""
LtlPorEjercer.Text = ""
@@ -342,21 +365,24 @@ Partial Class Contratos_RepPresupuestos
If e.Row.DBCampo("Autorizado").ToDecimal = 0 Then
e.Row.Cells(1).Text = "-"
End If
If e.Row.DBCampo("Ejercido").ToDecimal = 0 Then
e.Row.Cells(2).Text = "-"
If e.Row.DBCampo("Comprometido").ToDecimal = 0 Then
e.Row.Cells(1).Text = "-"
End If
If e.Row.DBCampo("EjercidoPorcentaje").ToDecimal = 0 Then
If e.Row.DBCampo("Ejercido").ToDecimal = 0 Then
e.Row.Cells(3).Text = "-"
End If
If e.Row.DBCampo("PorEjercer").ToDecimal = 0 Then
If e.Row.DBCampo("EjercidoPorcentaje").ToDecimal = 0 Then
e.Row.Cells(4).Text = "-"
End If
If e.Row.DBCampo("PorEjercerPorcentaje").ToDecimal = 0 Then
If e.Row.DBCampo("PorEjercer").ToDecimal = 0 Then
e.Row.Cells(5).Text = "-"
End If
If e.Row.DBCampo("Pagado").ToDecimal = 0 Then
If e.Row.DBCampo("PorEjercerPorcentaje").ToDecimal = 0 Then
e.Row.Cells(6).Text = "-"
End If
If e.Row.DBCampo("Pagado").ToDecimal = 0 Then
e.Row.Cells(7).Text = "-"
End If
If e.Row.RowIndex > 0 Then
Dim CveAgrupador = e.Row.DBCampo("CveAgrupador").ToEntero