Files
SIG/Nomina/ConceptosEspeciales.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

120 lines
4.8 KiB
VB.net

Option Strict On
Option Explicit On
Imports Extensiones
Imports System.Data
Partial Class Nomina_ConceptosEspeciales
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaProyecto()
CargaTurnos()
End If
End Sub
#Region "CargaCombos"
Private Sub CargaConceptos()
DdlConceptos.DataSource = GlobalDTNomConceptos(UsuarioActual.CveEmpresa)
DdlConceptos.DataBind()
End Sub
Private Sub CargaProyecto()
DdlProyecto.DataSource = GlobalDTProyectos(UsuarioActual.CveEmpresa)
DdlProyecto.DataBind()
End Sub
Private Sub CargaSubProyecto()
DdlSubProyecto.Items.Clear()
DdlSubProyecto.DataSource = GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero)
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Private Sub CargaTurnos()
DdlTurno.DataSource = GlobalDTTurno.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlTurno.DataBind()
End Sub
#End Region
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged
CargaSubProyecto()
End Sub
'Protected Sub DdlTipoPeriodo_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlTipoPeriodo.SelectedIndexChanged
' CargaPeriodos()
'End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
'If DdlPeriodo.SelectedValue <> "-1" Then
' Dim ObjNomina As New ClsRH
' Dim FechaI, FechaF As Date
' FechaI = DTPeriodos.FiltraParametros("CvePeriodo = " & DdlPeriodo.SelectedValue).Rows(0)("FechaInicio").ToString.ToDate
' FechaF = DTPeriodos.FiltraParametros("CvePeriodo = " & DdlPeriodo.SelectedValue).Rows(0)("FechaFin").ToString.ToDate
' If ObjNomina.GetPreNomina(DdlSubProyecto.SelectedValue.ToEntero, DdlTurno.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then
' GvDatos.DataSource = ObjNomina.DtResultados
' Else
' GvDatos.DataSource = Nothing
' End If
' ObjNomina.Dispose()
' GvDatos.DataBind()
' UPDatos.Update()
'Else
' Alert("Debe de seleccionar el Período con el que se desea trabajar", TipoMensaje.MsgAdvertencia)
'End If
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 = "Sub Proyecto: " & e.Row.DBCampo("SubProyecto")
'e.Row.Cells(0).ColumnSpan = 22
e.Row.HorizontalAlign = HorizontalAlign.Left
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.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
GvDatos.ExportToExcel("ConceptosEspeciales")
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
Dim ObjPersonal As New ClsRH
ObjPersonal.IniciaTransacSQL()
Dim OcurrioError As Boolean = False
For Each Row As GridViewRow In GvDatos.Rows
If Row.DataKey("CvePersonal") <> "" Then
If Not ObjPersonal.UpdatePersonalMasivo(Row.FCDropDownList("DdlTurno").SelectedValue.ToEntero, Row.FCDropDownList("DdlGVSubProyecto").SelectedValue.ToEntero, Row.FCDropDownList("DdlSupervisor").SelectedValue.ToEntero,
Row.FCTextBox("TxtSalarioDiario").Text.ToDouble, Row.FCTextBox("TxtSDI").Text.ToDouble, Row.FCTextBox("TxtSalarioCotizado").Text.ToDouble,
Row.DataKey("CvePersonal").ToEntero, UsuarioActual.CveEmpresa) Then
OcurrioError = True
ObjPersonal.RollBack()
Exit For
End If
End If
Next
If Not OcurrioError Then
ObjPersonal.Commit()
Alert("La información se guardó correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al guardar la información.", TipoMensaje.MsgError)
End If
ObjPersonal.Dispose()
End Sub
End Class