
11/11/2004, 09:26
|
| | Fecha de Ingreso: septiembre-2004
Mensajes: 141
Antigüedad: 20 años, 5 meses Puntos: 0 | |
****PARA TODOS QUIENES DEBEN HACER LOS TOTALES INTERMEDIOS AQUI VA EL CODIGO REWENO
<%@ Page Language="vb" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SQLClient" %>
<script runat="server">
'----- DECLARA LOS SUMADORES DE TOTALES------
Dim viewCountSum as Integer = 0
Dim viewCountSum2 as Integer = 0
Dim viewCountSum3 as Integer = 0
Dim viewCountSum4 as Integer = 0
Dim viewCountSum5 as Integer = 0
Dim viewCountSum6 as Integer = 0
Dim viewCountSum7 as Integer = 0
Sub Page_Load(sender as Object, e as EventArgs)
BindData()
End Sub
Sub BindData()
'1. Create a connection
' Dim myConnection as New SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
Dim MyConnection = New SqlConnection("Persist Security Info=False;User ID=docsadm;pwd=docsadm;Initial Catalog=SBIFBBVA;Data Source=TESTEDMS;Packet Size=4096;Workstation ID=ISRV_EDMS")
'2. Create the command object, passing in the SQL string
Const strSQL as String = "spx"
Dim myCommand as New SqlCommand(strSQL, myConnection)
'Set the datagrid's datasource to the datareader and databind
myConnection.Open()
dgPopularFAQs.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
dgPopularFAQs.DataBind()
End Sub
Sub ComputeSum(sender As Object, e As DataGridItemEventArgs)
'--------------------------------------SUMA TOTALES RECIBIDOS ----------------
'First, make sure we are dealing with an Item or AlternatingItem
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Snip out the ViewCount
Dim viewCount as Integer = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "total"))
viewCountSum += viewCount
ElseIf e.Item.ItemType = ListItemType.Footer then
e.Item.Cells(6).Text = "Total: " & String.Format("{0:#,###}", viewCountSum)
End If
'-------------------SUMA PORCENTAJES--------------------------------------------------------
'First, make sure we are dealing with an Item or AlternatingItem
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Snip out the ViewCount
Dim viewCount2 as Integer = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "porcentaje"))
viewCountSum2 += viewCount2
ElseIf e.Item.ItemType = ListItemType.Footer then
e.Item.Cells(7).Text = "Total: " & String.Format("{0:#,###}", viewCountSum2)
End If
'-------------------SUMA cOLUMNA EN PROCESO--------------------------------------------------------
'First, make sure we are dealing with an Item or AlternatingItem
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Snip out the ViewCount
Dim viewCount3 as Integer = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ENPROCESO"))
viewCountSum3 += viewCount3
ElseIf e.Item.ItemType = ListItemType.Footer then
e.Item.Cells(2).Text = "Total: " & String.Format("{0:#,###}", viewCountSum3)
End If
'-------------------SUMA cOLUMNA ATRASADO-------------------------------------------------------
'First, make sure we are dealing with an Item or AlternatingItem
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Snip out the ViewCount
Dim viewCount4 as Integer = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ATRASADO"))
viewCountSum4 += viewCount4
ElseIf e.Item.ItemType = ListItemType.Footer then
e.Item.Cells(3).Text = "Total: " & String.Format("{0:#,###}", viewCountSum4)
End If
'-------------------SUMA cOLUMNA CERRADO--------------------------------------------------------
'First, make sure we are dealing with an Item or AlternatingItem
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Snip out the ViewCount
Dim viewCount5 as Integer = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "CERRADO"))
viewCountSum5 += viewCount5
ElseIf e.Item.ItemType = ListItemType.Footer then
e.Item.Cells(4).Text = "Total: " & String.Format("{0:#,###}", viewCountSum5)
End If
'-------------------SUMA cOLUMNA CERRADO ATRASADO-------------------------------------------------------
'First, make sure we are dealing with an Item or AlternatingItem
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Snip out the ViewCount
Dim viewCount6 as Integer = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "CERRADOATRASADO"))
viewCountSum6 += viewCount6
ElseIf e.Item.ItemType = ListItemType.Footer then
e.Item.Cells(5).Text = "Total: " & String.Format("{0:#,###}", viewCountSum6)
End If
'-------------------SUMA cOLUMNA RE-ABIERTOS-------------------------------------------------------
'First, make sure we are dealing with an Item or AlternatingItem
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Snip out the ViewCount
Dim viewCount7 as Integer = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "REABIERTO"))
viewCountSum7 += viewCount7
ElseIf e.Item.ItemType = ListItemType.Footer then
e.Item.Cells(8).Text = "Total: " & String.Format("{0:#,###}", viewCountSum7)
End If
'-----------------------------------------------------------------------------------
end sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:DataGrid id="dgPopularFAQs" runat="server" AutoGenerateColumns="False" Font-Name="Verdana" Width="85%" Font-Size="11pt" HorizontalAlign="Center" ShowFooter="True" OnItemDataBound="ComputeSum">
<HeaderStyle backcolor="Navy" forecolor="White" horizontalalign="Center" font-size="14pt" font-bold="True" />
<FooterStyle backcolor="Navy" forecolor="White" font-size="12pt" font-bold="True" horizontalalign="Right" />
<Columns>
<asp:BoundColumn DataField="tema2_email" HeaderText="TEMA2 EMAIL" />
<asp:BoundColumn DataField="tipo_email" HeaderText="TIPO EMAIL" />
<asp:BoundColumn DataField="ENPROCESO" HeaderText="PROCESO" />
<asp:BoundColumn DataField="ATRASADO" HeaderText="ATRASADO" />
<asp:BoundColumn DataField="CERRADO" HeaderText="CERRADO" />
<asp:BoundColumn DataField="CERRADOaTRASADO" HeaderText="CERRADO ATRASADO" />
<asp:BoundColumn DataField="total" HeaderText="TOTALES" DataFormatString="{0:#,###}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="15%" />
<asp:BoundColumn DataField="porcentaje" HeaderText="Porcentaje" />
<asp:BoundColumn DataField="ReAbierto" HeaderText="Reabierto" />
</Columns>
</asp:DataGrid>
</form>
</body>
</html> |