contratos

This commit is contained in:
Rakcsle Supertramp
2020-11-04 10:31:50 -07:00
parent cc86167206
commit 7f34791f36
9 changed files with 240 additions and 33 deletions

View File

@@ -273,7 +273,7 @@
<div class="col-md-12">
<asp:GridView ID="GvEstimaciones" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron partidas para levantar avance"
DataKeyNames="CveFamilias,CveSubFamilias,CveContratoDetalle,PS,Cantidad,Importe,Cantidad_Ultima,Importe_Ultima,PU,CantidadMax,Avance"
DataKeyNames="CveContratoAvance,CveFamilias,CveSubFamilias,CveContratoDetalle,PS,Cantidad,Importe,Cantidad_Ultima,Importe_Ultima,PU,CantidadMax,Avance"
CssClass="table GVEstimacion table-advance table-hover" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="">

View File

@@ -33,7 +33,22 @@ Partial Class Contratos_ContratoAvance
Set(value As Integer)
ViewState("CveContrato") = value
End Set
End Property
Private Property CveContratoEstimacion As Integer
Get
If ViewState("CveContratoEstimacion") Is Nothing Then
Return Nothing
Else
Return ViewState("CveContratoEstimacion").ToString.ToEntero
End If
End Get
Set(value As Integer)
ViewState("CveContratoEstimacion") = value
End Set
End Property
'fecha seleccionada del historico de avances
Private Property fecha As String
Get
@@ -306,7 +321,7 @@ Partial Class Contratos_ContratoAvance
Private Sub CargaAvancesParaEstimar()
CveContratoEstimacion = -1
Dim ObjContratos As New ClsContratos()
Dim DTEstimaciones As New DataTable
@@ -314,9 +329,10 @@ Partial Class Contratos_ContratoAvance
If ObjContratos.GetContratosAvanceEstimacion(DDlContratosEstimaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
DTEstimaciones = ObjContratos.DtResultados
BtnGuardarEstimacion.Visible = True
Else
BtnGuardarEstimacion.Visible = False
CveContratoEstimacion = DDlContratosEstimaciones.SelectedValue.ToEntero
End If
@@ -325,8 +341,10 @@ Partial Class Contratos_ContratoAvance
If DTEstimaciones.Rows.Count > 0 Then
GvEstimaciones.DataSource = DTEstimaciones
BtnGuardarEstimacion.Visible = True
Else
GvEstimaciones.DataSource = Nothing
BtnGuardarEstimacion.Visible = False
End If
GvEstimaciones.DataBind()
@@ -358,16 +376,46 @@ Partial Class Contratos_ContratoAvance
End If
End If
End Sub
Private Sub BtnGuardarEstimacion_Click(sender As Object, e As EventArgs) Handles BtnGuardarEstimacion.Click
Dim ObjContratos As New ClsContratos()
Dim ErrorProceso As Boolean = False
Dim NuemeroEstimacion As Integer = -1
ObjContratos.IniciaTransacSQL()
If ObjContratos.AddContratosAvanceEstimacion(CveContratoEstimacion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
NuemeroEstimacion = ObjContratos.NumeroEstimacionNueva
For Each GvRow As GridViewRow In GvEstimaciones.Rows
If GvRow.DataKey("CveContratoAvance").ToEntero > 0 Then
If Not ObjContratos.UpdateContratosAvanceEstimacion(GvRow.DataKey("CveContratoAvance").ToEntero, ObjContratos.CveEstimacionNueva, UsuarioActual.CveEmpresa) Then
ErrorProceso = True
Exit For
End If
End If
Next
Else
ErrorProceso = True
End If
'AddContratosAvanceEstimacion
'UpdateContratosAvanceEstimacion
If Not ErrorProceso Then
ObjContratos.Commit()
Alert($"Estimación {NuemeroEstimacion} agregada correctamente.")
Else
ObjContratos.RollBack()
End If
ObjContratos.Dispose()