This commit is contained in:
2023-06-26 10:02:08 -07:00
2 changed files with 82 additions and 31 deletions

View File

@@ -132,24 +132,32 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Período Actual">
<ItemTemplate>
<asp:HyperLink ID="HLActual" runat="server" Text='<%# Eval("ImporteActual", "{0:N2}")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
<%--<asp:Label ID="LbActual" runat="server" Text='<%# Eval("ImporteActual", "{0:N2}")%>'></asp:Label>--%>
<asp:HyperLink ID="HLActual" runat="server" Text='<%# Eval("ImporteActual", "{0:N2}")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="150px" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:BoundField HeaderText="%" DataField="PorcentajeActual" DataFormatString="{0:N2}" ItemStyle-Width="100px" />
<asp:TemplateField HeaderText="%" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblPorcentajeActual" runat="server" Text='<%# Eval("PorcentajeActual", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Período Acumulado">
<ItemTemplate>
<asp:HyperLink ID="HLAnterior" runat="server" Text='<%# Eval("ImporteAcumulado", "{0:N2}")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
<%--<asp:Label ID="LbAnterior" runat="server" Text='<%# Eval("ImporteAnterior", "{0:N2}")%>'></asp:Label>--%>
<asp:HyperLink ID="HLAnterior" runat="server" Text='<%# Eval("ImporteAcumulado", "{0:N2}")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="150px" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="%" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblPorcentajeAcumulado" runat="server" Text='<%# Eval("PorcentajeAcumulado", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="%" DataField="PorcentajeAcumulado" DataFormatString="{0:N2}" ItemStyle-Width="100px" />
</Columns>
<%--<HeaderStyle CssClass="TitulosChico"></HeaderStyle>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />--%>
</Columns>
</asp:GridView>
<br />
<br />
@@ -168,24 +176,28 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Período Actual">
<ItemTemplate>
<asp:HyperLink ID="HLActual" runat="server" Text='<%# Eval("ImporteActual", "{0:N2}")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
<%--<asp:Label ID="LbActual" runat="server" Text='<%# Eval("ImporteActual", "{0:N2}")%>'></asp:Label>--%>
<asp:HyperLink ID="HLActual" runat="server" Text='<%# Eval("ImporteActual", "{0:N2}")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="150px" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:BoundField HeaderText="%" DataField="PorcentajeActual" DataFormatString="{0:N2}" ItemStyle-Width="100px" />
<asp:TemplateField HeaderText="%" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblPorcentajeActual" runat="server" Text='<%# Eval("PorcentajeActual", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Período Acumulado">
<ItemTemplate>
<asp:HyperLink ID="HLAnterior" runat="server" Text='<%# Eval("ImporteAcumulado", "{0:N2}")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
<%--<asp:Label ID="LbAnterior" runat="server" Text='<%# Eval("ImporteAnterior", "{0:N2}")%>'></asp:Label>--%>
<asp:HyperLink ID="HLAnterior" runat="server" Text='<%# Eval("ImporteAcumulado", "{0:N2}")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="150px" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:BoundField HeaderText="%" DataField="PorcentajeAcumulado" DataFormatString="{0:N2}" ItemStyle-Width="100px" />
<asp:TemplateField HeaderText="%" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblPorcentajeAcumulado" runat="server" Text='<%# Eval("PorcentajeAcumulado", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<%--<HeaderStyle CssClass="TitulosChico"></HeaderStyle>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />--%>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>

View File

@@ -246,20 +246,46 @@ Partial Class AC_RepEstadoActividades
DtGastos.AcceptChanges()
'DtIngresos
Dim UtilidadBrutaActual, UtilidadBrutaAcumulada As Decimal
Dim UtilidadOperacionActual, UtilidadOperacionAcumulada As Decimal
Dim UtilidadAntesImpuestosActual, UtilidadAntesImpuestosAcumulada As Decimal
Dim UtilidadBrutaActual, UtilidadBrutaAcumulada, UtilidadBrutPorcentajeActual, UtilidadBrutPorcentajeAcumulado As Decimal
UtilidadBrutaActual = DtIngresos.SUMD("ImporteActual", " CtaMayor = 1 ") - DtGastos.SUMD("ImporteActual", " Codigo LIKE '5%' AND CtaMayor = 1 ")
UtilidadBrutaAcumulada = DtIngresos.SUMD("ImporteAcumulado", " CtaMayor = 1 ") - DtGastos.SUMD("ImporteAcumulado", " Codigo LIKE '5%' AND CtaMayor = 1")
Dim UtilidadOperacionActual, UtilidadOperacionAcumulada, UtilidadOperacionPorcentajeActual, UtilidadOperacionPorcentajeAcumulado As Decimal
UtilidadOperacionActual = DtIngresos.SUMD("ImporteActual", " CtaMayor = 1 ") - DtGastos.SUMD("ImporteActual", " Codigo LIKE '5%' AND CtaMayor = 1 ") - DtGastos.SUMD("ImporteActual", " Codigo LIKE '6%' AND CtaMayor = 1 ")
UtilidadOperacionAcumulada = DtIngresos.SUMD("ImporteAcumulado", " CtaMayor = 1 ") - DtGastos.SUMD("ImporteAcumulado", " Codigo LIKE '5%' AND CtaMayor = 1 ") - DtGastos.SUMD("ImporteAcumulado", " Codigo LIKE '6%' AND CtaMayor = 1 ")
Dim UtilidadAntesImpuestosActual, UtilidadAntesImpuestosAcumulada, UtilidadAntesImpuestosPorcentajeActual, UtilidadAntesImpuestosPorcentajeAcumulado As Decimal
Dim IngresoActual As Decimal = DtIngresos.SUMD("ImporteActual", " CtaMayor = 1 ")
Dim IngresoAcumulado As Decimal = DtIngresos.SUMD("ImporteAcumulado", " CtaMayor = 1 ")
Dim CostoActual As Decimal = DtGastos.SUMD("ImporteActual", " Codigo LIKE '5%' AND CtaMayor = 1 ")
Dim CostoAcumulado As Decimal = DtGastos.SUMD("ImporteAcumulado", " Codigo LIKE '5%' AND CtaMayor = 1")
Dim GastoActual As Decimal = DtGastos.SUMD("ImporteActual", " Codigo LIKE '6%' AND CtaMayor = 1 ")
Dim GastoAcumulado As Decimal = DtGastos.SUMD("ImporteAcumulado", " Codigo LIKE '6%' AND CtaMayor = 1 ")
Dim ResultadoIntegralActual As Decimal = DtGastos.SUMD("ImporteActual", " Codigo LIKE '7%' AND CtaMayor = 1 ")
Dim ResultadoIntegralAcumulado As Decimal = DtGastos.SUMD("ImporteAcumulado", " Codigo LIKE '7%' AND CtaMayor = 1 ")
UtilidadBrutaActual = IngresoActual - CostoActual
UtilidadBrutaAcumulada = IngresoAcumulado - CostoAcumulado
UtilidadOperacionActual = IngresoActual - CostoActual - GastoActual
UtilidadOperacionAcumulada = IngresoAcumulado - CostoAcumulado - GastoAcumulado
UtilidadAntesImpuestosActual = IngresoActual - CostoActual - GastoActual - ResultadoIntegralActual
UtilidadAntesImpuestosAcumulada = IngresoAcumulado - CostoAcumulado - GastoAcumulado - ResultadoIntegralAcumulado
UtilidadBrutPorcentajeActual = If(IngresoActual <> 0 And UtilidadBrutaActual <> 0, (UtilidadBrutaActual / IngresoActual * 100), 0)
UtilidadBrutPorcentajeAcumulado = If(IngresoAcumulado <> 0 And UtilidadBrutaAcumulada <> 0, (UtilidadBrutaAcumulada / IngresoAcumulado * 100), 0)
UtilidadOperacionPorcentajeActual = If(IngresoActual <> 0 And UtilidadOperacionActual <> 0, (UtilidadOperacionActual / IngresoActual * 100), 0)
UtilidadOperacionPorcentajeAcumulado = If(IngresoAcumulado <> 0 And UtilidadOperacionAcumulada <> 0, (UtilidadOperacionAcumulada / IngresoAcumulado * 100), 0)
UtilidadAntesImpuestosPorcentajeActual = If(IngresoActual <> 0 And UtilidadAntesImpuestosActual <> 0, (UtilidadAntesImpuestosActual / IngresoActual * 100), 0)
UtilidadAntesImpuestosPorcentajeAcumulado = If(IngresoAcumulado <> 0 And UtilidadAntesImpuestosAcumulada <> 0, (UtilidadAntesImpuestosAcumulada / IngresoAcumulado * 100), 0)
UtilidadAntesImpuestosActual = DtIngresos.SUMD("ImporteActual", " CtaMayor = 1 ") - DtGastos.SUMD("ImporteActual", " Codigo LIKE '5%' AND CtaMayor = 1 ") - DtGastos.SUMD("ImporteActual", " Codigo LIKE '6%' AND CtaMayor = 1 ") - DtGastos.SUMD("ImporteActual", " Codigo LIKE '7%' AND CtaMayor = 1 ")
UtilidadAntesImpuestosAcumulada = DtIngresos.SUMD("ImporteAcumulado", " CtaMayor = 1 ") - DtGastos.SUMD("ImporteAcumulado", " Codigo LIKE '5%' AND CtaMayor = 1 ") - DtGastos.SUMD("ImporteAcumulado", " Codigo LIKE '6%' AND CtaMayor = 1 ") - DtGastos.SUMD("ImporteAcumulado", " Codigo LIKE '7%' AND CtaMayor = 1 ")
Dim dRowUtilidadBruta As DataRow = DtGastos.NewRow
Dim dRowUtilidadBrutaVacio As DataRow = DtGastos.NewRow
@@ -277,6 +303,8 @@ Partial Class AC_RepEstadoActividades
dRowUtilidadBruta("ImporteAcumulado") = UtilidadBrutaAcumulada
dRowUtilidadBruta("CtaMayor") = -1
dRowUtilidadBruta("Orden") = "600"
dRowUtilidadBruta("PorcentajeActual") = UtilidadBrutPorcentajeActual
dRowUtilidadBruta("PorcentajeAcumulado") = UtilidadBrutPorcentajeAcumulado
dRowUtilidadBrutaVacio("CtaMayor") = -1
dRowUtilidadBrutaVacio("Orden") = "600"
@@ -285,6 +313,8 @@ Partial Class AC_RepEstadoActividades
dRowUtilidadOperacion("ImporteAcumulado") = UtilidadOperacionAcumulada
dRowUtilidadOperacion("CtaMayor") = -1
dRowUtilidadOperacion("Orden") = "700"
dRowUtilidadOperacion("PorcentajeActual") = UtilidadOperacionPorcentajeActual
dRowUtilidadOperacion("PorcentajeAcumulado") = UtilidadOperacionPorcentajeAcumulado
dRowUtilidadOperacionVacio("CtaMayor") = -1
dRowUtilidadOperacionVacio("Orden") = "700"
@@ -293,9 +323,14 @@ Partial Class AC_RepEstadoActividades
dRowUtilidadAntesImpuestos("ImporteAcumulado") = UtilidadAntesImpuestosAcumulada
dRowUtilidadAntesImpuestos("CtaMayor") = -1
dRowUtilidadAntesImpuestos("Orden") = "790"
dRowUtilidadAntesImpuestos("PorcentajeActual") = UtilidadAntesImpuestosPorcentajeActual
dRowUtilidadAntesImpuestos("PorcentajeAcumulado") = UtilidadAntesImpuestosPorcentajeAcumulado
dRowUtilidadAntesImpuestosVacio("CtaMayor") = -1
dRowUtilidadAntesImpuestosVacio("Orden") = "790"
'PorcentajeActual
'PorcentajeAcumulado
DtGastos.Rows.InsertAt(dRowUtilidadBruta, idxUtilidadBruta)
DtGastos.Rows.InsertAt(dRowUtilidadBrutaVacio, idxUtilidadBruta + 1)
@@ -352,7 +387,7 @@ Partial Class AC_RepEstadoActividades
Protected Sub GvIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 And Not e.Row.DBCampo("Orden").ToString().Contiene("600", "700", "790") Then
TotalActual += e.Row.DBCampo("ImporteActual").ToString.ToDouble
TotalAnterior += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray
@@ -372,9 +407,11 @@ Partial Class AC_RepEstadoActividades
If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red
e.Row.FCLabel("LblPorcentajeActual").ForeColor = Drawing.Color.Red
End If
If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
e.Row.FCLabel("LblPorcentajeAcumulado").ForeColor = Drawing.Color.Red
End If
If e.Row.DBCampo("CtaMayor").ToEntero = -1 And e.Row.DBCampo("Nombre").ToString.Length > 0 Then
@@ -386,7 +423,7 @@ Partial Class AC_RepEstadoActividades
Protected Sub GvGastos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 And Not e.Row.DBCampo("Orden").ToString().Contiene("600", "700", "790") Then
TotalActual -= e.Row.DBCampo("ImporteActual").ToString.ToDouble
TotalAnterior -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray
@@ -404,9 +441,11 @@ Partial Class AC_RepEstadoActividades
If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red
e.Row.FCLabel("LblPorcentajeActual").ForeColor = Drawing.Color.Red
End If
If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
e.Row.FCLabel("LblPorcentajeAcumulado").ForeColor = Drawing.Color.Red
End If