160 lines
8.8 KiB
VB.net
160 lines
8.8 KiB
VB.net
Option Strict On
|
|
Option Explicit On
|
|
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
|
|
Partial Class Nomina_RepPreNomina
|
|
Inherits ClsPaginas
|
|
|
|
Private ReadOnly Property DTPeriodos As DataTable
|
|
Get
|
|
Return DirectCast(ViewState("DTPeriodos"), DataTable)
|
|
End Get
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
|
|
Dim ObjNomina As New ClsRH
|
|
|
|
Dim FechaI, FechaF As Date
|
|
FechaI = CDate(Request("FechaI"))
|
|
FechaF = CDate(Request("FechaF"))
|
|
|
|
LtlLunes.Text = If(FechaI.Day.ToString.Length = 1, "0" & FechaI.Day.ToString, FechaI.Day.ToString)
|
|
LtlMartes.Text = If(FechaI.AddDays(1).Day.ToString.Length = 1, "0" & FechaI.AddDays(1).Day.ToString, FechaI.AddDays(1).Day.ToString)
|
|
LtlMiercoles.Text = If(FechaI.AddDays(2).Day.ToString.Length = 1, "0" & FechaI.AddDays(2).Day.ToString, FechaI.AddDays(2).Day.ToString)
|
|
LtlJueves.Text = If(FechaI.AddDays(3).Day.ToString.Length = 1, "0" & FechaI.AddDays(3).Day.ToString, FechaI.AddDays(3).Day.ToString)
|
|
LtlViernes.Text = If(FechaI.AddDays(4).Day.ToString.Length = 1, "0" & FechaI.AddDays(4).Day.ToString, FechaI.AddDays(4).Day.ToString)
|
|
LtlSabado.Text = If(FechaI.AddDays(5).Day.ToString.Length = 1, "0" & FechaI.AddDays(5).Day.ToString, FechaI.AddDays(5).Day.ToString)
|
|
LtlDomingo.Text = If(FechaI.AddDays(6).Day.ToString.Length = 1, "0" & FechaI.AddDays(6).Day.ToString, FechaI.AddDays(6).Day.ToString)
|
|
|
|
If ObjNomina.GetPreNomina(Request("CveProyecto").ToEntero, Request("CveSubProyecto").ToEntero, Request("CveTurno").ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then
|
|
GvDatos.DataSource = ObjNomina.DtResultados
|
|
|
|
Dim Arr() As String = {"", "", "", "", ""}
|
|
GVAnomalias.DataSource = Arr
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
GVAnomalias.DataSource = Nothing
|
|
End If
|
|
|
|
ObjNomina.Dispose()
|
|
|
|
GvDatos.DataBind()
|
|
GVAnomalias.DataBind()
|
|
UPDatos.Update()
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
If e.Row.DBCampo("Turno") = "" AndAlso e.Row.DBCampo("Nombre") = "" Then
|
|
e.Row.FCLiteral("LtlNombre").Text = "<b>Sub Proyecto: " & e.Row.DBCampo("SubProyecto") & "<b>"
|
|
e.Row.Cells(0).ColumnSpan = 22
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
For i As Integer = 1 To 21
|
|
e.Row.Cells(i).Visible = False
|
|
Next
|
|
|
|
e.Row.FCLiteral("LtlAsistencias").Text = CType(CType(sender, GridView).DataSource, DataTable).SUM("Asistencias", "Nombre <> ''").ToString
|
|
e.Row.FCLiteral("LtlFaltas").Text = CType(CType(sender, GridView).DataSource, DataTable).SUM("Faltas", "Nombre <> ''").ToString
|
|
If e.Row.FCLiteral("LtlAsistencias").Text.ToDouble = 0 Then
|
|
e.Row.FCLiteral("LtlAsistencias").Text = ""
|
|
Else
|
|
e.Row.FCLiteral("LtlAsistencias").Text = "<b>" & e.Row.FCLiteral("LtlAsistencias").Text & "</b>"
|
|
End If
|
|
If e.Row.FCLiteral("LtlFaltas").Text.ToDouble = 0 Then
|
|
e.Row.FCLiteral("LtlFaltas").Text = ""
|
|
Else
|
|
e.Row.FCLiteral("LtlFaltas").Text = "<b>" & e.Row.FCLiteral("LtlFaltas").Text & "</b>"
|
|
End If
|
|
If e.Row.FCLiteral("LtlHorasExtras").Text.ToDouble = 0 Then
|
|
e.Row.FCLiteral("LtlHorasExtras").Text = ""
|
|
Else
|
|
e.Row.FCLiteral("LtlHorasExtras").Text = "<b>" & e.Row.FCLiteral("LtlHorasExtras").Text & "</b>"
|
|
End If
|
|
ElseIf e.Row.DBCampo("Turno") <> "" AndAlso e.Row.DBCampo("Nombre") = "" Then
|
|
e.Row.FCLiteral("LtlNombre").Text = "Turno: " & e.Row.DBCampo("Turno")
|
|
e.Row.Cells(0).ColumnSpan = 22
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
For i As Integer = 1 To 21
|
|
e.Row.Cells(i).Visible = False
|
|
Next
|
|
e.Row.FCLiteral("LtlAsistencias").Text = CType(CType(sender, GridView).DataSource, DataTable).SUM("Asistencias", "Turno = '" & e.Row.DBCampo("Turno") & "' AND Nombre <> ''").ToString
|
|
e.Row.FCLiteral("LtlFaltas").Text = CType(CType(sender, GridView).DataSource, DataTable).SUM("Faltas", "Turno = '" & e.Row.DBCampo("Turno") & "' AND Nombre <> ''").ToString
|
|
If e.Row.FCLiteral("LtlAsistencias").Text.ToDouble = 0 Then
|
|
e.Row.FCLiteral("LtlAsistencias").Text = ""
|
|
Else
|
|
e.Row.FCLiteral("LtlAsistencias").Text = "<b>" & e.Row.FCLiteral("LtlAsistencias").Text & "</b>"
|
|
End If
|
|
If e.Row.FCLiteral("LtlFaltas").Text.ToDouble = 0 Then
|
|
e.Row.FCLiteral("LtlFaltas").Text = ""
|
|
Else
|
|
e.Row.FCLiteral("LtlFaltas").Text = "<b>" & e.Row.FCLiteral("LtlFaltas").Text & "</b>"
|
|
End If
|
|
If e.Row.FCLiteral("LtlHorasExtras").Text.ToDouble = 0 Then
|
|
e.Row.FCLiteral("LtlHorasExtras").Text = ""
|
|
Else
|
|
e.Row.FCLiteral("LtlHorasExtras").Text = "<b>" & e.Row.FCLiteral("LtlHorasExtras").Text & "</b>"
|
|
End If
|
|
Else
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
Dim FechaI, FechaF As String
|
|
FechaI = String.Empty : FechaF = String.Empty
|
|
Dim Array() As String = Request("Periodo").Split("-"c)
|
|
If Array.Length > 0 Then
|
|
FechaI = Array(1).Trim
|
|
FechaF = Array(2).Trim
|
|
End If
|
|
'e.Row.FCLiteral("LtlNombre").Text = "<a class=""Texto"" href=""/RH/Personal.aspx?CvePersonal=" & e.Row.DBCampo("CvePersonal") & "&CveSubProyecto=" & e.Row.DBCampo("CveSubProyecto") & "&FechaI=" & FechaI & "&FechaF=" & FechaF & "&CveTurno=" & e.Row.DBCampo("CveTurno") & "&Opt=3"">" & e.Row.FCLiteral("LtlNombre").Text & "</a>"
|
|
If e.Row.DBCampo("Lu_HrsDobles").ToDouble = 0 Then e.Row.FCLiteral("LtlLu_HrsDobles").Text = ""
|
|
If e.Row.DBCampo("Ma_HrsDobles").ToDouble = 0 Then e.Row.FCLiteral("LtlMa_HrsDobles").Text = ""
|
|
If e.Row.DBCampo("Mi_HrsDobles").ToDouble = 0 Then e.Row.FCLiteral("LtlMi_HrsDobles").Text = ""
|
|
If e.Row.DBCampo("Ju_HrsDobles").ToDouble = 0 Then e.Row.FCLiteral("LtlJu_HrsDobles").Text = ""
|
|
If e.Row.DBCampo("Vi_HrsDobles").ToDouble = 0 Then e.Row.FCLiteral("LtlVi_HrsDobles").Text = ""
|
|
If e.Row.DBCampo("Sa_HrsDobles").ToDouble = 0 Then e.Row.FCLiteral("LtlSa_HrsDobles").Text = ""
|
|
If e.Row.DBCampo("Do_HrsDobles").ToDouble = 0 Then e.Row.FCLiteral("LtlDo_HrsDobles").Text = ""
|
|
|
|
If e.Row.DBCampo("Asistencias").ToDouble = 0 Then e.Row.FCLiteral("LtlAsistencias").Text = ""
|
|
If e.Row.DBCampo("Faltas").ToDouble = 0 Then e.Row.FCLiteral("LtlFaltas").Text = ""
|
|
If e.Row.DBCampo("HorasDobles").ToDouble = 0 Then e.Row.FCLiteral("LtlHorasExtras").Text = ""
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
'Protected Sub GVAnomalias_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAnomalias.RowDataBound
|
|
' If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
' If e.Row.DBCampo("Turno") = "" AndAlso e.Row.DBCampo("Nombre") = "" Then
|
|
' e.Row.FCLiteral("LtlNombre").Text = "<b>Sub Proyecto: " & e.Row.DBCampo("SubProyecto") & "<b>"
|
|
' e.Row.Cells(0).ColumnSpan = 4
|
|
' e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
' For i As Integer = 1 To 4
|
|
' e.Row.Cells(i).Visible = False
|
|
' Next
|
|
' ElseIf e.Row.DBCampo("Turno") <> "" AndAlso e.Row.DBCampo("Nombre") = "" Then
|
|
' e.Row.FCLiteral("LtlNombre").Text = "Turno: " & e.Row.DBCampo("Turno")
|
|
' e.Row.Cells(0).ColumnSpan = 4
|
|
' e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
' For i As Integer = 1 To 4
|
|
' e.Row.Cells(i).Visible = False
|
|
' Next
|
|
' Else
|
|
' e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
' End If
|
|
' End If
|
|
'End Sub
|
|
|
|
Protected Sub ImgExcel_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgExcel.Click
|
|
Tbl.ExportToExcel("PreNomina")
|
|
End Sub
|
|
|
|
End Class
|