EMD - Agregar Clasificación a un presupuesto
This commit is contained in:
@@ -10,6 +10,17 @@
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
<asp:UpdatePanel runat="server" ID="UpAcciones" UpdateMode="Conditional">
|
||||
|
||||
<ContentTemplate>
|
||||
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="LnkAccionesAgregarClasificacion" data-toggle="tooltip" Visible ="false" OnClick="LnkAccionesAgregarClasificacion_Click"
|
||||
data-placement="left" title="Agregar Clasificación" Text="<i class='fa fa-plus'></i> Agregar Clasificación"></asp:LinkButton>
|
||||
</li>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
@@ -98,7 +109,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
<div class="rowpadding">
|
||||
<div class="rowpadding" id="content" >
|
||||
<asp:UpdatePanel ID="UpGvClasificaciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvPresupuestos" runat="server" ShowFooter="true" GridLines="None" EmptyDataText="No se encontraron presupuestos" CssClass="table table-hover table-striped Widthall ScrollAD" AutoGenerateColumns="False" data-heighterror="600"
|
||||
@@ -162,12 +173,50 @@
|
||||
<div class="row">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-2">
|
||||
<asp:Button ID="BtnGuardar" runat="server" OnClick="BtnGuardar_Click" Text="Guardar" CssClass="btn btn-primary" ValidationGroup="GrpGuardar" />
|
||||
<asp:Button ID="BtnGuardar" runat="server" OnClick="BtnGuardar_Click" Text="Guardar" CssClass="btn btn-primary" ValidationGroup="GrpGuardar" />
|
||||
</div>
|
||||
<div class="col-md-5"></div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
|
||||
<div id="DVModalAgregarClasificacion" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog" style="width: 450px;">
|
||||
<asp:UpdatePanel runat="server" class="modal-content" ID="UpModalAgregarClasicicacion" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LtlTituloModalAgregarClasificacion" runat="server">Agregar Clasificación</asp:Literal></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlModalClasificacion" CssClass="form-control select2me" runat="server" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="100%" >
|
||||
<asp:ListItem Value="-1">Seleccione Una</asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RfvDdlModalClasificacion" InitialValue="-1" runat="server" ControlToValidate="DdlModalClasificacion" CssClass="help-block errorimput"
|
||||
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Clasificación''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardarMedico"></asp:RequiredFieldValidator>
|
||||
<label for="<%= DdlModalClasificacion.ClientID.ToString()%>">Clasificación:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="LnkModalAgregarClasificacion" runat="server" class="btn btn-success" Text="Agregar" ValidationGroup="GrpAgregarClasificacion" OnClick="LnkModalAgregarClasificacion_Click" />
|
||||
<button id="BtnModalCancelarAgregarClasificacion" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script type="text/javascript">
|
||||
@@ -292,6 +341,23 @@
|
||||
|
||||
return numero;
|
||||
}
|
||||
|
||||
|
||||
//function scrollToTableCell(text) {
|
||||
// const table = document.getElementById('ADSH-C_GvPresupuestos');
|
||||
// const rows = table.getElementsByTagName('tr');
|
||||
// for (let row of rows) {
|
||||
// const cells = row.getElementsByTagName('td');
|
||||
// for (let cell of cells) {
|
||||
// if (cell.textContent.includes(text)) {
|
||||
// cell.scrollIntoView({ behavior: 'smooth' });
|
||||
// cell.classList.add('highlight');
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
|
||||
@@ -88,11 +88,13 @@ Partial Class Contratos_ModificarPresupuesto
|
||||
|
||||
#Region "C A R G A - D A T O S"
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim CvePresupuesto = DdlPresupuesto.SelectedValue.ToEntero
|
||||
Dim Nombre = "-1"
|
||||
Dim CveSubProyecto = -1
|
||||
Dim CveUsuario = -1
|
||||
Dim Agrupador = 1 'CLASIFICACION
|
||||
|
||||
If CvePresupuesto > 0 Then
|
||||
TxtFecha.Text = NowADS().ToString("dd/MM/yyyy")
|
||||
Dim DrPresupuesto = DtPresupuestos.FiltroPrimero($"CvePresupuesto = {CvePresupuesto}")
|
||||
@@ -131,10 +133,22 @@ Partial Class Contratos_ModificarPresupuesto
|
||||
GvPresupuestos.Columns(3).Visible = True
|
||||
GvPresupuestos.Columns(4).Visible = True
|
||||
End Select
|
||||
|
||||
Else
|
||||
DtClasificaciones = New DataTable
|
||||
GvPresupuestos.DataSource = DtClasificaciones
|
||||
GvPresupuestos.DataBind()
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
ValidaAcciones()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub GvPresupuestos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPresupuestos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim StrTipo = DdlTipo.SelectedValue
|
||||
@@ -286,4 +300,74 @@ Partial Class Contratos_ModificarPresupuesto
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub ValidaAcciones()
|
||||
LnkAccionesAgregarClasificacion.Visible = False
|
||||
If DtClasificaciones IsNot Nothing AndAlso DtClasificaciones.Rows.Count > 0 Then
|
||||
LnkAccionesAgregarClasificacion.Visible = True
|
||||
End If
|
||||
UpAcciones.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkAccionesAgregarClasificacion_Click(sender As Object, e As EventArgs)
|
||||
CargaAccionesDdlclasificaciones()
|
||||
RegistraScript("$('#DVModalAgregarClasificacion').modal();")
|
||||
End Sub
|
||||
|
||||
Private Sub CargaAccionesDdlclasificaciones()
|
||||
|
||||
Dim dtClasificaciones As DataTable = Me.DtClasificaciones.Copy
|
||||
Dim globalDtClasificacionesn As DataTable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros("Tipo = 1").Copy
|
||||
|
||||
|
||||
Dim filteredRecords = From globalRow In globalDtClasificacionesn.AsEnumerable()
|
||||
Where Not dtClasificaciones.AsEnumerable().Any(Function(dtRow) dtRow.Field(Of Integer)("CveClasificacion") = globalRow.Field(Of Integer)("CveClasificacion"))
|
||||
Select globalRow
|
||||
|
||||
|
||||
Dim resultTable As DataTable = globalDtClasificacionesn.Clone()
|
||||
For Each row In filteredRecords
|
||||
resultTable.ImportRow(row)
|
||||
Next
|
||||
|
||||
|
||||
DdlModalClasificacion.DataSource = resultTable
|
||||
|
||||
DdlModalClasificacion.DataBind()
|
||||
DdlModalClasificacion.Items.Insert(0, New ListItem("Seleccione Una", "-1"))
|
||||
UpModalAgregarClasicicacion.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkModalAgregarClasificacion_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim CvePresupuesto = DdlPresupuesto.SelectedValue.ToEntero
|
||||
Dim CveClasificacion As Integer = DdlModalClasificacion.SelectedValue.ToEntero
|
||||
|
||||
If CveClasificacion > 0 Then
|
||||
|
||||
Dim ObjCont As New ClsContratos
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
If Not ObjCont.AddPresupuestosDetalle(CvePresupuesto, CveClasificacion, -1, 0, "") Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
ObjCont.Dispose()
|
||||
|
||||
If Not TieneError Then
|
||||
RegistraScript($"$('#DVModalAgregarClasificacion').modal('hide');")
|
||||
Alert($"Clasificación {DdlModalClasificacion.SelectedItem.Text} agregada correctamente.")
|
||||
CargaDatos()
|
||||
UpGvClasificaciones.Update()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user