diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index b97b600fe..30857a704 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -1005,13 +1005,13 @@ Public Class ClsContratos Return Retorno End Function - Public Function AddContratosAvance(CveContratoDetalle As Integer, Cantidad As Double, Fecha As DateTime, CveUsuario As Integer, Optional CveEstimacion As Integer = -1) As Boolean + Public Function AddContratosAvance(CveContratoDetalle As Integer, Cantidad As Double, Fecha As Date, CveUsuario As Integer, Optional CveEstimacion As Integer = -1) As Boolean Dim Retorno = False DataAdapter("PA_Con_ContratosAvanceAdd") With SqlAdapter.SelectCommand.Parameters .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle .Add("@Cantidad", SqlDbType.Int).Value = Cantidad - .Add("@Fecha", SqlDbType.Date).Value = Fecha.ToString("yyyy/MM/dd") + .Add("@Fecha", SqlDbType.Date).Value = Fecha .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEstimacion", SqlDbType.Int).Value = CveEstimacion End With @@ -1078,9 +1078,32 @@ Public Class ClsContratos End Try Return Retorno - End Function + End Function #End Region + +#Region "ESTIMACION" + + Public Function GetContratosAvanceEstimacion(CveContrato As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + DataAdapter("PA_Con_ContratosAvanceEstimacionGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al cargar los avances del Contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + #Region " S E C C I O N E S " Public Function GetSecciones() As Boolean Dim Retorno As Boolean = False diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index 3069747e7..7f41f1fa3 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -555,7 +555,7 @@
diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 7a44163ab..319d8a3b0 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -2697,17 +2697,36 @@ Partial Class Compras_eFacturas namespaces.AddNamespace(XMLDoc.DocumentElement.Prefix, "http://www.sat.gob.mx/cfd/3") namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") - namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos") + + ' namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos") nodeComp = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", XMLDoc.DocumentElement.Prefix), namespaces) + nodeaGral = XMLDoc.SelectSingleNode(String.Format("//{0}:Comprobante", XMLDoc.DocumentElement.Prefix), namespaces) nodeTFD = nodeComp.SelectSingleNode(String.Format("//{0}:TimbreFiscalDigital", "tfd"), namespaces) - nodePagos = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos/{0}:Pago", "pago10"), namespaces) - nodePagos2 = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos", "pago10"), namespaces) - 'Monto = ValorXML(nodePagos, "Monto").ToDecimal - Dim nodePago As XmlNodeList = nodePagos.SelectNodes(String.Format("//{0}:DoctoRelacionado", "pago10"), namespaces) + Dim PrefijoPagos As String = "" + + For Each nodoPrefijo As XmlNode In nodeComp.ChildNodes + If nodoPrefijo.Prefix <> "tfd" Then + PrefijoPagos = nodoPrefijo.Prefix + End If + Next + + namespaces.AddNamespace(PrefijoPagos, "http://www.sat.gob.mx/Pagos") + nodeComp = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", XMLDoc.DocumentElement.Prefix), namespaces) + + + nodePagos = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos/{0}:Pago", PrefijoPagos), namespaces) + nodePagos2 = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos", PrefijoPagos), namespaces) + + + + + + + ' Dim nodePago As XmlNodeList = nodePagos.SelectNodes(String.Format("//{0}:DoctoRelacionado", "pago10"), namespaces) SeriePago = ValorXML(nodeaGral, "Serie") FolioPago = ValorXML(nodeaGral, "Folio") @@ -2735,11 +2754,12 @@ Partial Class Compras_eFacturas DTDocumentosRelacionados.Columns.Add("FechaPago", GetType(Date)) DTDocumentosRelacionados.Columns.Add("CveMetodoPago", GetType(Integer)) DTDocumentosRelacionados.Columns.Add("SerieFolioCompra") + DTDocumentosRelacionados.Columns.Add("CvePrePolizaDetalle", GetType(Integer)) Dim nodePagosN As XmlNodeList - nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", "pago10"), namespaces) + nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", PrefijoPagos), namespaces) @@ -2775,7 +2795,7 @@ Partial Class Compras_eFacturas Dim ObjCompraFolios As New ClsCompras - If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa, OP:=If(CveComplementoPagoCompra > 0, 2, 1), CveFactura:=CveFacturaComplemento) Then + If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace($"{PrefijoPagos}:", ""), UsuarioActual.CveEmpresa, OP:=If(CveComplementoPagoCompra > 0, 2, 1), CveFactura:=CveFacturaComplemento) Then ' '.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then If ObjCompraFolios.DtResultados.Rows.Count > 0 Then @@ -2789,7 +2809,7 @@ Partial Class Compras_eFacturas dRow2("CveFactura") = drow("CveFactura").ToString.ToEntero dRow2("CveMetodoPago") = drow("CveMetodoPago").ToString.ToEntero dRow2("SerieFolioCompra") = drow("SerieFolioCompra").ToString - + dRow2("CvePrePolizaDetalle") = drow("CvePrePolizaDetalle").ToString If drow("CveIE").ToString.ToEntero > 0 Then @@ -2860,7 +2880,7 @@ Partial Class Compras_eFacturas Dim TieneRegistros As Boolean = False - If ObjCompras.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then + If ObjCompras.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", "").Replace("pagos10:", ""), UsuarioActual.CveEmpresa) Then GvVincularPago.DataSource = ObjCompras.DtResultados If ObjCompras.DtResultados.Rows.Count > 0 Then @@ -2982,9 +3002,9 @@ Partial Class Compras_eFacturas ObjCompra.IniciaTransacSQL() - For Each Gv As GridViewRow In GvVincularPago.Rows + For Each Gv As GridViewRow In GVPDocumentosRelacionadosPagos.Rows - If Not ObjCompra.AddComplementoPago(Gv.DataKey("CveIE").ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("Monto").ToDecimal, Gv.DataKey("CvePrePolizaDetalle").ToEntero, CveFacturaPago) > 0 Then + If Not ObjCompra.AddComplementoPago(Gv.DataKey("CveIE").ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("ImpPagado").ToDecimal, Gv.DataKey("CvePrePolizaDetalle").ToEntero, CveFacturaPago) > 0 Then TieneError = True End If diff --git a/Contratos/ContratoAvance.aspx b/Contratos/ContratoAvance.aspx index ab97df630..6b702897e 100644 --- a/Contratos/ContratoAvance.aspx +++ b/Contratos/ContratoAvance.aspx @@ -44,7 +44,13 @@ - + + + + + + +
@@ -70,8 +76,15 @@
-
-
+ + +
+ +
+ Fecha: +
+
+
@@ -82,12 +95,21 @@ -
- +
+
+ + + + +
+
+ @@ -107,13 +129,18 @@
Anexo
- +
+ + - + + @@ -148,27 +175,217 @@ + - + --%> + + + + + + + - -
- - - - - - - - - + + +
+
+ + + +
+ +
+
-
+
+ + + + + + + + + + + +
+
+ +
+ +
+ +
+ + + +
+
+ + +
+
+ +
+
+
+
+
+ + +
+
+ + + + + + + + + + + + <%# Eval("Cantidad", "{0:N2}")%> + + + + + <%# Eval("Importe", "{0:N2}")%> + + + + + <%# Eval("Cantidad_Ultima", "{0:N2}")%> + + + + + <%# Eval("Importe_Ultima", "{0:N2}")%> + + + + <%-- + + + + + + + + + + + + + + + + + + + + + + + + --%> + + + + + +
+
+ + +
+
+
+ + + +
+
+
+ +
+
+ + +
+
+ + + + + + + + + + + + + <%----%>
- diff --git a/Contratos/ContratoAvance.aspx.vb b/Contratos/ContratoAvance.aspx.vb index 54cdf7e7d..db1c3340b 100644 --- a/Contratos/ContratoAvance.aspx.vb +++ b/Contratos/ContratoAvance.aspx.vb @@ -46,22 +46,31 @@ Partial Class Contratos_ContratoAvance Set(value As String) ViewState("fecha") = value End Set - End Property - + End Property + #End Region - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not IsPostBack Then BtnGuardar.Visible = False - btnanexogral.Visible = False - CargaContrato() + btnanexogral.Visible = False + CargaContrato() + + End If + End Sub #Region "Filtros" Private Sub CargaContrato() - DdlContratos.DataSource = GlobalDTContratos.FiltraParametros(String.Format("CveContratoTipo=4")) + DdlContratos.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (4,30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}")) DdlContratos.DataBind() + + DDlContratosEstimaciones.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (4,30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}")) + DDlContratosEstimaciones.DataBind() + + CargaddlAvance() End Sub @@ -124,8 +133,10 @@ Partial Class Contratos_ContratoAvance End Sub Protected Sub GV_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles Gv.RowDataBound If e.Row.RowIndex > -1 Then + e.Row.FCTextBox("TxtCantidad").Visible = (fecha = "") - e.Row.FCLinkButton("LnkAnexo").Visible = Not (fecha = "") + e.Row.FCLinkButton("LnkAnexo").Visible = Not (fecha = "") + If e.Row.DBCampo("CveContratoDetalle").ToString.ToEntero = 0 Then e.Row.FCTextBox("TxtCantidad").Visible = False e.Row.FCLinkButton("LnkAnexo").Visible = False @@ -140,9 +151,32 @@ Partial Class Contratos_ContratoAvance e.Row.CssClass = "SubTotales3" End If End If + + If e.Row.DataKey("CveContratoDetalle").ToEntero > 0 Then + + Dim LnkAnexo As LinkButton = e.Row.FCLinkButton("LnkModalDropzone") + 'LnkAnexo.Visible = True + Dim DVAnexo As Control = DirectCast(e.Row.FindControl("ModalAnexoEvidencia"), Control) + LnkAnexo.OnClientClick = $" $('#{DVAnexo.ClientID}').modal('show'); return false;" + + If DdlAvances.SelectedIndex > 0 Then + LnkAnexo.Visible = False + Else + LnkAnexo.Visible = True + End If + + End If + + + End If End Sub - Protected Sub GetAnexos(sender As Object, e As System.EventArgs) + Protected Sub GetAnexos(sender As Object, e As System.EventArgs) + Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + + LblTituloModalAnexo.Text = "Anexo " & GvRow.DataKey("PS") + 'Get the button that raised the event Dim btn As LinkButton = DirectCast(sender, LinkButton) Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow) @@ -154,22 +188,49 @@ Partial Class Contratos_ContratoAvance GvAnexos.Visible = True Else GvAnexos.Visible = False - End If - objContrato.Dispose() + End If + + objContrato.Dispose() + + UpModalAnexos.Update() + + RegistraScript("$('#ModalAnexos').modal('show');") + End Sub - Protected Sub GvAnexos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvAnexos.RowDataBound + Protected Sub GvAnexos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvAnexos.RowDataBound + If e.Row.RowIndex > -1 Then Dim Archivo As String = e.Row.DBCampo("Archivo").ToString Dim start As Integer = Len(Archivo.Split("-"c)(0)) - Dim link As HyperLink = e.Row.FCHyperLink("HPLArchivo") - link.Text = Archivo.Substring(start + 1) - link.NavigateUrl = String.Format("/Empresas/{0}/Contrato/{1}/Anexos/{2}", UsuarioActual.CveEmpresa, CveContrato, Archivo) + Dim LnkArchivo As LinkButton = e.Row.FCLinkButton("LnkArchivo") + + LnkArchivo.Text = Archivo.Substring(start + 1) + 'link.NavigateUrl = String.Format("/Empresas/{0}/Contrato/{1}/Anexos/{2}", UsuarioActual.CveEmpresa, CveContrato, Archivo) + + ScriptManager.GetCurrent(Me).RegisterPostBackControl(LnkArchivo) End If - End Sub + + End Sub + + Protected Sub LnkArchivo_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim Archivo As String = GvRow.DataKey("Archivo").ToString + + Response.ContentType = "application/octet-stream" + Response.AppendHeader("Content-Disposition", $"attachment; filename={Archivo}") + Response.TransmitFile($"{UsuarioActual.Empresa.Ruta}\Contrato\{DdlContratos.SelectedValue.ToEntero}\Anexos\{Archivo}") + Response.End() + + End Sub + + #End Region - - + + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click + Dim ObjContratos As New ClsContratos ObjContratos.IniciaTransacSQL() Dim TieneError = False @@ -177,47 +238,58 @@ Partial Class Contratos_ContratoAvance Dim Cantidad As Double Dim filesgral As List(Of Archivo) = AnexoGral.getfiles().Archivos Dim guardarArchivos As New List(Of Archivo) - For Each gvr As GridViewRow In Gv.Rows - CveContratoDetalle = gvr.DataKey("CveContratoDetalle").ToEntero - If CveContratoDetalle > 0 Then - Cantidad = gvr.FCTextBox("TxtCantidad").Text.ToDouble + + For Each gvr As GridViewRow In Gv.Rows + + CveContratoDetalle = gvr.DataKey("CveContratoDetalle").ToEntero + + If CveContratoDetalle > 0 Then + + Cantidad = gvr.FCTextBox("TxtCantidad").Text.ToDouble + If Cantidad > 0 Then - If ObjContratos.AddContratosAvance(CveContratoDetalle, Cantidad, TxtFecha.Text.ToDateTime, UsuarioActual.CveUsuario) Then + If ObjContratos.AddContratosAvance(CveContratoDetalle, Cantidad, TxtFecha.Text.ToDateTime, UsuarioActual.CveUsuario) Then + Dim CveContratoAvance As Integer = ObjContratos.DtResultados.Rows(0)("CveContratoAvance").ToString.ToEntero Dim files As List(Of Archivo) = gvr.FCTextBox("TXTAnexo").getfiles().Archivos - For Each fileItem As Archivo In filesgral - guardarArchivos.Add(fileItem) - If Not ObjContratos.AddContratosAvanceAnexo(CveContratoAvance, fileItem.filename, UsuarioActual.CveUsuario) Then - TieneError = True - Exit For - End If - Next - For Each fileItem As Archivo In files + 'For Each fileItem As Archivo In filesgral 'GENERAL + ' guardarArchivos.Add(fileItem) + ' If Not ObjContratos.AddContratosAvanceAnexo(CveContratoAvance, fileItem.filename, UsuarioActual.CveUsuario) Then + ' TieneError = True + ' Exit For + ' End If + 'Next + + For Each fileItem As Archivo In files guardarArchivos.Add(fileItem) If Not ObjContratos.AddContratosAvanceAnexo(CveContratoAvance, fileItem.filename, UsuarioActual.CveUsuario) Then TieneError = True Exit For End If Next + Else TieneError = True Exit For End If End If + End If + Next + If TieneError Then ObjContratos.RollBack() Alert("No se logro guardar el Presupuesto favor de intentarlo mas tarde o comuniquese con soporte", TipoMensaje.MsgAdvertencia) Else - Dim urlsave As String = String.Format("Empresas\{0}\Contrato\{1}\Anexos", UsuarioActual.CveEmpresa, CveContrato) - For Each fileItem As Archivo In filesgral - fileItem.filename.filesMove(fileItem.filename, urlsave) - Next + Dim urlsave As String = String.Format("Empresas\{0}\Contrato\{1}\Anexos", UsuarioActual.CveEmpresa, CveContrato) + For Each fileItem As Archivo In filesgral + fileItem.filename.FilesMove(fileItem.filename, urlsave) + Next For Each fileItem As Archivo In guardarArchivos - fileItem.filename.filesMove(fileItem.filename, urlsave) + fileItem.filename.FilesMove(fileItem.filename.Replace($".{fileItem.Extencion}", ""), urlsave) Next ObjContratos.Commit() Alert("se guardo Correctamente") @@ -226,8 +298,84 @@ Partial Class Contratos_ContratoAvance ObjContratos.Dispose() CargaddlAvance() CargaDatosAvance() - End Sub - + End Sub + + + +#Region "ESTIMACION" + + + Private Sub CargaAvancesParaEstimar() + + + Dim ObjContratos As New ClsContratos() + Dim DTEstimaciones As New DataTable + + + If ObjContratos.GetContratosAvanceEstimacion(DDlContratosEstimaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + DTEstimaciones = ObjContratos.DtResultados + BtnGuardarEstimacion.Visible = True + Else + BtnGuardarEstimacion.Visible = False + End If + + + ObjContratos.Dispose() + + + If DTEstimaciones.Rows.Count > 0 Then + GvEstimaciones.DataSource = DTEstimaciones + Else + GvEstimaciones.DataSource = Nothing + End If + GvEstimaciones.DataBind() + + UpEstimaciones.Update() + End Sub + + Private Sub BtnConsultarEstimaciones_Click(sender As Object, e As EventArgs) Handles BtnConsultarEstimaciones.Click + + CargaAvancesParaEstimar() + + End Sub + + Private Sub GvEstimaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEstimaciones.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveContratoDetalle").ToString.ToEntero = 0 Then + + + If e.Row.DBCampo("CveSubFamilias").ToString.ToEntero = 0 Then + If e.Row.DBCampo("CveFamilias").ToString.ToEntero = 0 Then + e.Row.CssClass = "SubTotales" + Else + e.Row.CssClass = "SubTotales2" + End If + Else + e.Row.CssClass = "SubTotales3" + End If + End If + End If + + + + + End Sub + + Private Sub BtnGuardarEstimacion_Click(sender As Object, e As EventArgs) Handles BtnGuardarEstimacion.Click + + Dim ObjContratos As New ClsContratos() + + + + ObjContratos.Dispose() + + End Sub + + +#End Region + End Class diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx index c8230178d..d42a38359 100644 --- a/Contratos/ContratoObra.aspx +++ b/Contratos/ContratoObra.aspx @@ -929,7 +929,7 @@
@@ -997,7 +997,6 @@ - @@ -1013,12 +1012,18 @@ - - - + + + + + + + + - + diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index 063bf57b7..1dccd7ef6 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -924,9 +924,10 @@ Partial Class Contratos_ContratoObra #Region " CARGA DATOS " Private Sub CargaDatos() Dim ObjContratos As New ClsContratos() - Dim Ruta = Request.ApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" - 'DivTipoContrato.Visible = False - + Dim Ruta = Request.ApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Contratos\" + 'DivTipoContrato.Visible = False + + If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then If ObjContratos.DtResultados.Rows.Count > 0 Then @@ -2042,12 +2043,14 @@ Partial Class Contratos_ContratoObra End Sub Protected Sub GV_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles Gv.RowDataBound - If e.Row.RowIndex > -1 Then - - e.Row.FCCheckBox("CHKPAvance").Visible = Autorizado - 'e.Row.FCCheckBox("CHKPEstimacion").Visible = Autorizado + If e.Row.RowIndex > -1 Then + + Dim LnkHabilitaAvance As LinkButton = e.Row.FCLinkButton("LnkHabilitaAvance") + ' e.Row.FCCheckBox("CHKPAvance").Visible = Autorizado + 'e.Row.FCCheckBox("CHKPEstimacion").Visible = Autorizado If UsuarioActual.TienePermisoProceso(124) Then e.Row.FCCheckBox("CHKPAvance").Enabled = True + LnkHabilitaAvance.Enabled = True End If If e.Row.DBCampo("PermitirAvance").ToString = "1" Then @@ -2065,7 +2068,20 @@ Partial Class Contratos_ContratoObra If CveTipoContrato = 25 Then e.Row.Cells(1).Width = Unit.Pixel(10) e.Row.Cells(6).Width = Unit.Pixel(250) + End If + + + + + If e.Row.DBCampo("PermitirAvance").ToString = "1" Then + LnkHabilitaAvance.Text = "" + LnkHabilitaAvance.Attributes.Add("data-original-title", "¿Deshabilitar avance?") + Else + LnkHabilitaAvance.Text = "" + LnkHabilitaAvance.Attributes.Add("data-original-title", "¿Habilitar avance?") End If + + End If If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then e.Row.FCDropDownList("DdlUMEdit").DataSource = GlobalDTProductosServiciosEquivalencias(e.Row.DataKey("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) @@ -5026,6 +5042,36 @@ Partial Class Contratos_ContratoObra + Protected Sub LnkHabilitaAvance_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim PermitirAvance As Integer = GvRow.DataKey("PermitirAvance").ToEntero + + 'Get the button that raised the event + 'Dim btn As CheckBox = DirectCast(sender, CheckBox) + 'Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow) + + Dim CveContratoDetalle As Integer = GvRow.DataKey("CveContratoDetalle").ToString.ToEntero + Dim objContrato As New ClsContratos + + If objContrato.UpdateContratosDetalleAvance(CveContratoDetalle, IIf(PermitirAvance = 1, 0, 1).ToString.ToEntero) Then + Dim row = TmpDT.Select(String.Format("CveContratoDetalle={0}", CveContratoDetalle))(0) + + row("PermitirAvance") = IIf(PermitirAvance = 1, 0, 1).ToString.ToEntero + + + CargaGVPresupuestos(TmpDT.FiltraParametros("CveTipoPresupuesto=2")) + + + Alert("Se ha permitido levantar avance", TipoMensaje.MsgInformacion) + Else + Alert("no se pudo permitir avance", TipoMensaje.MsgAdvertencia) + End If + + objContrato.Dispose() + + End Sub End Class