Commit inicial Ventas Productivo
This commit is contained in:
116
RH/CatPuestosSueldos.aspx.vb
Normal file
116
RH/CatPuestosSueldos.aspx.vb
Normal file
@@ -0,0 +1,116 @@
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Partial Class RH_CatPuestosSueldos
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property DTDatos As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DTDatos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property FiltroPuestos As String
|
||||
Get
|
||||
Return ViewState("FiltroPuestos").ToString
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("FiltroPuestos") = value
|
||||
End Set
|
||||
End Property
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
cargar()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaPuestos(DDL As DropDownList, Optional CvePuesto As Integer = -1)
|
||||
DDL.DataSource = GlobalDTRHPuestos(UsuarioActual.CveEmpresa).FiltraParametros(String.Format(" (CvePuesto NOT IN({0}) OR CvePuesto={1})", FiltroPuestos, CvePuesto))
|
||||
DDL.DataBind()
|
||||
If CvePuesto > 0 Then
|
||||
DDL.SelectedValue = CvePuesto
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub cargar()
|
||||
Dim objRH As New ClsRH
|
||||
Dim Str As New StringBuilder
|
||||
Str.Append("-1")
|
||||
If objRH.GetPuestosSueldos(UsuarioActual.CveEmpresa) Then
|
||||
DTDatos = objRH.DtResultados
|
||||
cargaGVDatos()
|
||||
For Each item As DataRow In DTDatos.Rows
|
||||
Str.Append(String.Format(",{0}", item("CvePuesto").ToString))
|
||||
Next
|
||||
End If
|
||||
FiltroPuestos = Str.ToString
|
||||
objRH.Dispose()
|
||||
TxtSueldo.Text = ""
|
||||
CargaPuestos(DdlPuesto)
|
||||
End Sub
|
||||
#Region "GVDatos"
|
||||
|
||||
Private Sub cargaGVDatos()
|
||||
GvDatos.DataSource = DTDatos
|
||||
GvDatos.DataBind()
|
||||
End Sub
|
||||
Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit
|
||||
GvDatos.EditIndex = -1
|
||||
cargaGVDatos()
|
||||
End Sub
|
||||
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
||||
Dim index As Integer = e.RowIndex
|
||||
Dim cvepuesto As Integer = GvDatos.Rows(index).FCHiddenField("CvePuesto").Value.ToString.ToEntero
|
||||
Dim objRH As New ClsRH
|
||||
If objRH.RemovePuestosSueldos(cvepuesto) Then
|
||||
cargar()
|
||||
Alert("Se eliminó el registro", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert("no se eliminó el registro", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
objRH.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating
|
||||
Dim index As Integer = e.RowIndex
|
||||
Dim cvepuesto As Integer = GvDatos.Rows(index).FCHiddenField("CvePuesto").Value.ToString.ToEntero
|
||||
Dim Importe As Integer = GvDatos.Rows(index).FCTextBox("TxtSueldo").Text.ToString.ToDouble
|
||||
Dim objRH As New ClsRH
|
||||
If objRH.UpdatePuestosSueldos(cvepuesto, Importe) Then
|
||||
GvDatos.EditIndex = -1
|
||||
cargar()
|
||||
Alert("Se actualizó el registro", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert("no se actualizó el registro", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
objRH.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatos.RowEditing
|
||||
Dim index As Integer = e.NewEditIndex
|
||||
GvDatos.EditIndex = index
|
||||
cargaGVDatos()
|
||||
CargaPuestos(GvDatos.Rows(index).FCDropDownList("DdlPuesto"), GvDatos.Rows(index).FCHiddenField("CvePuesto").Value)
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Protected Sub Agregar_Click(sender As Object, e As EventArgs) Handles Agregar.Click
|
||||
Dim CvePuesto As Integer = DdlPuesto.SelectedValue.ToEntero
|
||||
Dim Importe As Double = TxtSueldo.Text.ToDouble
|
||||
If CvePuesto > 0 And Importe > 0 Then
|
||||
Dim objRH As New ClsRH
|
||||
If objRH.AddPuestosSueldos(CvePuesto, Importe) Then
|
||||
cargar()
|
||||
Alert("los datos se guardaron satisfactoriamente", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert("no se guardaron los cambios", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
objRH.Dispose()
|
||||
Else
|
||||
Alert("favor de llenar todos los campos")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user