diff --git a/Contabilidad2/RepEstadoActividades.aspx b/Contabilidad2/RepEstadoActividades.aspx
index 86d058305..df5c0b947 100644
--- a/Contabilidad2/RepEstadoActividades.aspx
+++ b/Contabilidad2/RepEstadoActividades.aspx
@@ -132,24 +132,32 @@
-
- <%----%>
+
-
+
+
+
+
+
+
+
+
-
- <%----%>
+
+
+
+
+
+
+
-
-
- <%--
-
- --%>
+
+
@@ -168,24 +176,28 @@
-
- <%----%>
+
-
+
+
+
+
+
-
- <%----%>
+
-
+
+
+
+
+
- <%--
-
- --%>
+
diff --git a/Contabilidad2/RepEstadoActividades.aspx.vb b/Contabilidad2/RepEstadoActividades.aspx.vb
index 1d8d59d9d..4a1bcccf3 100644
--- a/Contabilidad2/RepEstadoActividades.aspx.vb
+++ b/Contabilidad2/RepEstadoActividades.aspx.vb
@@ -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