This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2021-07-09 17:30:04 -07:00
parent 06e5e922b0
commit a744894bd3
7 changed files with 326 additions and 192 deletions

View File

@@ -719,7 +719,9 @@
<div>
<asp:GridView ID="GvPersonalAltas" runat="server" AutoGenerateColumns="False" CssClass="table table-striped table-advance table-hover Widthall" GridLines="None">
<asp:GridView ID="GvPersonalAltas" runat="server" AutoGenerateColumns="False" OnRowDataBound="GvPersonalAltas_RowDataBound"
CssClass="table table-striped table-advance table-hover Widthall" GridLines="None"
DataKeyNames="CvePersonalAltas,FechaInicio,FechaFin">
<Columns>
<asp:BoundField HeaderText="Fecha Inicio" DataField="FechaInicio" DataFormatString="{0:d}">
<ItemStyle Width="150px" />
@@ -742,6 +744,64 @@
<AlternatingRowStyle CssClass="TextoAlterno" />
<HeaderStyle CssClass="Titulos" />
</asp:GridView>
<div id="ModalUpAltas" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content" >
<div class="modal-header "> <button type="button" class="close" data-dismiss="modal">&times;</button><h4 class="modal-title">Actualiazar alta</h4></div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpAltasUpdate" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright calendarlinealinput" style=" width: 100px !important">
<div class="input-group input-sm date date-picker" data-date-format="dd/mm/yyyy" style=" width: 160px;">
<asp:TextBox ID="TxtFechaInicioUA" runat="server" CausesValidation="true" CssClass="form-control input-sm"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaInicioUA" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaInicioUA" runat="server" TargetControlID="TxtFechaInicioUA" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CeeFechaInicioUA" TargetControlID="TxtFechaInicioUA" PopupButtonID="LnkFechaInicioUA" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<label>Fecha Inicial</label>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright " style=" width: 100px !important">
<div class="input-group input-sm date date-picker" data-date-format="dd/mm/yyyy" style=" width: 160px;">
<asp:TextBox ID="TxtFechaFinUA" runat="server" CausesValidation="true" CssClass="form-control input-sm"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaFinUA" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MeeFechaFinUA" runat="server" TargetControlID="TxtFechaFinUA" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CeeFechaFinUA" TargetControlID="TxtFechaFinUA" PopupButtonID="LnkFechaFinUA" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<label>Fecha Final</label>
</div>
<br />
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="LnkUpAltas" runat="server" Text="Actualizar" OnClick="LnkUpAltas_Click" class="btn btn-primary" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -6507,12 +6507,82 @@ Partial Class RH_Personal
Property CvePersonalAltas As Integer
Get
If ViewState("CvePersonalAltas") Is Nothing Then
Return 0
Else
Return DirectCast(ViewState("CvePersonalAltas"), Integer)
End If
End Get
Set(value As Integer)
ViewState("CvePersonalAltas") = value
End Set
End Property
Protected Sub LnkUpAltass_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
CvePersonalAltas = GvRow.DataKey("CvePersonalAltas").ToEntero()
TxtFechaInicioUA.Text = String.Format("{0:dd/MM/yyyy}", GvRow.DataKey("FechaInicio").ToDateTime())
Dim fechafin As DateTime = GvRow.DataKey("FechaFin").ToDateTime()
If fechafin.Year < 1900 Then
TxtFechaFinUA.Text = ""
Else
TxtFechaFinUA.Text = String.Format("{0:dd/MM/yyyy}", fechafin)
End If
UpAltasUpdate.Update()
RegistraScript("$('#ModalUpAltas').modal();")
End Sub
Protected Sub LnkDAltas_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
CvePersonalAltas = GvRow.DataKey("CvePersonalAltas").ToEntero()
Dim strquery As String = String.Format("DELETE [RH_PersonalAltas] WHERE CvePersonalAltas ={0} AND [CvePersonal] ={1}", CvePersonalAltas, CvePersonal)
Using objbase As New ClsClaseBase
If (objbase.runQuerystr(strquery)) Then
Using objrh As New ClsRH()
If objrh.GetPersonalAltas(CvePersonal) Then
GvPersonalAltas.DataSource = objrh.DtResultados
GvPersonalAltas.DataBind()
UpDatos.Update()
End If
End Using
Alert("Alta eliminada")
End If
End Using
End Sub
Protected Sub LnkUpAltas_Click(sender As Object, e As EventArgs)
Dim strfin As String = ""
Dim fechafin As DateTime = TxtFechaFinUA.Text.ToDateTime()
If fechafin.Year < 1900 Then
strfin = ",[FechaFin]=null"
Else
strfin = String.Format(",[FechaFin]='{0:yyyy-MM-dd}'", fechafin)
End If
Dim strquery As String = String.Format("UPDATE [RH_PersonalAltas] SET [FechaInicio]='{2:yyyy-MM-dd}' {3} WHERE CvePersonalAltas ={0} AND [CvePersonal] ={1}", CvePersonalAltas, CvePersonal, TxtFechaInicioUA.Text.ToDateTime(), strfin)
Using objbase As New ClsClaseBase
If (objbase.runQuerystr(strquery)) Then
Using objrh As New ClsRH()
If objrh.GetPersonalAltas(CvePersonal) Then
GvPersonalAltas.DataSource = objrh.DtResultados
GvPersonalAltas.DataBind()
UpDatos.Update()
End If
End Using
Alert("Alta actualizada")
End If
End Using
End Sub
Protected Sub GvPersonalAltas_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCLinkButton("LnkUpAltass").Visible = UsuarioActual.TienePermisoProceso(327)
e.Row.FCLinkButton("LnkDAltas").Visible = e.Row.FCLinkButton("LnkUpAltass").Visible
End If
End Sub
End Class