Contratos Autorizacion
This commit is contained in:
@@ -91,16 +91,43 @@ Partial Class Contratos_ContratoAvance
|
||||
End Property
|
||||
|
||||
|
||||
Property CveEstimacionActual As Integer
|
||||
Get
|
||||
If ViewState("CveEstimacionActual") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("CveEstimacionActual").ToString.ToEntero
|
||||
End If
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveEstimacionActual") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property NuemeroEstimacionActual As Integer
|
||||
Get
|
||||
If ViewState("NuemeroEstimacionActual") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("NuemeroEstimacionActual").ToString.ToEntero
|
||||
End If
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("NuemeroEstimacionActual") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
|
||||
If Not IsPostBack Then
|
||||
|
||||
BtnGuardar.Visible = False
|
||||
|
||||
CargaContrato()
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@@ -112,54 +139,34 @@ Partial Class Contratos_ContratoAvance
|
||||
DdlContratos.DataBind()
|
||||
|
||||
DDlContratosEstimaciones.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}"))
|
||||
DDlContratosEstimaciones.DataBind()
|
||||
|
||||
|
||||
CargaddlAvance()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlContratos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlContratos.SelectedIndexChanged
|
||||
CargaddlAvance()
|
||||
End Sub
|
||||
Private Sub CargaddlAvance()
|
||||
DdlAvances.Items.Clear()
|
||||
Dim ObjContratos As New ClsContratos()
|
||||
If ObjContratos.GetContratosAvanceFecha(DdlContratos.SelectedValue.ToEntero, 2) Then
|
||||
DdlAvances.DataSource = ObjContratos.DtResultados
|
||||
End If
|
||||
ObjContratos.Dispose()
|
||||
DdlAvances.DataBind()
|
||||
DdlAvances.Items.Insert(0, New ListItem(" ---- ", "-1"))
|
||||
DDlContratosEstimaciones.DataBind()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||
CveContrato = DdlContratos.SelectedValue.ToEntero
|
||||
CargaDatosAvance()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatosAvance()
|
||||
|
||||
GvAnexos.Visible = False
|
||||
Dim ObjContratos As New ClsContratos()
|
||||
If DdlAvances.SelectedValue = "-1" Then
|
||||
If ObjContratos.GetContratosAvanceTodos(CveContrato, 2) Then
|
||||
fecha = ""
|
||||
DtDatos = ObjContratos.DtResultados
|
||||
If ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||
BtnGuardar.Visible = True
|
||||
Dim ObjContratos As New ClsContratos()
|
||||
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If ObjContratos.GetContratosAvanceHistoricos(CveContrato, 2, DdlAvances.SelectedValue) Then
|
||||
fecha = DdlAvances.SelectedValue
|
||||
DtDatos = ObjContratos.DtResultados
|
||||
BtnGuardar.Visible = False
|
||||
If ObjContratos.GetContratosAvanceTodos(CveContrato, 2) Then
|
||||
fecha = ""
|
||||
DtDatos = ObjContratos.DtResultados
|
||||
If ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||
BtnGuardar.Visible = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
ObjContratos.Dispose()
|
||||
CargaGrid()
|
||||
|
||||
End Sub
|
||||
|
||||
#Region "GV"
|
||||
@@ -175,7 +182,8 @@ Partial Class Contratos_ContratoAvance
|
||||
Alert("no se encontraron productos en el presupuesto")
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GV_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles Gv.RowDataBound
|
||||
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 = "")
|
||||
@@ -209,10 +217,12 @@ Partial Class Contratos_ContratoAvance
|
||||
LnkAnexo.Visible = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Dim LnkGuardarAvance As LinkButton = e.Row.FCLinkButton("LnkGuardarAvance")
|
||||
LnkGuardarAvance.Visible = True
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GetAnexos(sender As Object, e As System.EventArgs)
|
||||
@@ -226,7 +236,7 @@ Partial Class Contratos_ContratoAvance
|
||||
Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow)
|
||||
Dim CveContratoDetalle As Integer = gvr.DataKey("CveContratoDetalle").ToString.ToEntero
|
||||
Dim objContrato As New ClsContratos
|
||||
If objContrato.GetContratosAvanceAnexos(CveContratoDetalle, fecha, UsuarioActual.CveUsuario) Then
|
||||
If objContrato.GetContratosAvanceAnexos(CveContratoDetalle, UsuarioActual.CveUsuario, -1) Then
|
||||
GvAnexos.DataSource = objContrato.DtResultados
|
||||
GvAnexos.DataBind()
|
||||
GvAnexos.Visible = True
|
||||
@@ -277,10 +287,13 @@ Partial Class Contratos_ContratoAvance
|
||||
|
||||
Dim ObjContratos As New ClsContratos
|
||||
ObjContratos.IniciaTransacSQL()
|
||||
|
||||
Dim TieneError = False
|
||||
Dim CveContratoDetalle As Integer
|
||||
Dim Cantidad As Double
|
||||
'Dim filesgral As List(Of Archivo) = AnexoGral.getfiles().Archivos
|
||||
Dim Cantidad As Double
|
||||
|
||||
Dim NumeroEstimacionActual As Integer = 0
|
||||
|
||||
Dim guardarArchivos As New List(Of Archivo)
|
||||
|
||||
For Each gvr As GridViewRow In Gv.Rows
|
||||
@@ -292,19 +305,14 @@ Partial Class Contratos_ContratoAvance
|
||||
Cantidad = gvr.FCTextBox("TxtCantidad").Text.ToDouble
|
||||
|
||||
If Cantidad > 0 Then
|
||||
If ObjContratos.AddContratosAvance(CveContratoDetalle, Cantidad, TxtFecha.Text.ToDateTime, UsuarioActual.CveUsuario) Then
|
||||
|
||||
If ObjContratos.AddContratosObraAvance(DdlContratos.SelectedValue.ToEntero, CveContratoDetalle, Cantidad, TxtFecha.Text.ToDateTime, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
NumeroEstimacionActual = ObjContratos.NumeroEstimacionActual
|
||||
|
||||
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 'GENERAL
|
||||
' guardarArchivos.Add(fileItem)
|
||||
' If Not ObjContratos.AddContratosAvanceAnexo(CveContratoAvance, fileItem.filename, UsuarioActual.CveUsuario) Then
|
||||
' TieneError = True
|
||||
' Exit For
|
||||
' End If
|
||||
'Next
|
||||
|
||||
Dim files As List(Of Archivo) = gvr.FCTextBox("TXTAnexo").getfiles().Archivos
|
||||
|
||||
For Each fileItem As Archivo In files
|
||||
guardarArchivos.Add(fileItem)
|
||||
If Not ObjContratos.AddContratosAvanceAnexo(CveContratoAvance, fileItem.filename, UsuarioActual.CveUsuario) Then
|
||||
@@ -326,26 +334,100 @@ Partial Class Contratos_ContratoAvance
|
||||
If TieneError Then
|
||||
ObjContratos.RollBack()
|
||||
Alert("No se logro guardar el Presupuesto favor de intentarlo mas tarde o comuniquese con soporte", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
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
|
||||
|
||||
For Each fileItem As Archivo In guardarArchivos
|
||||
fileItem.filename.FilesMove(fileItem.filename.Replace($".{fileItem.Extencion}", ""), urlsave)
|
||||
Next
|
||||
Next
|
||||
|
||||
|
||||
ObjContratos.Commit()
|
||||
Alert("se guardo Correctamente")
|
||||
|
||||
'Alert("se avance guardado correctamente")
|
||||
Alert("se avance guardado correctamente en estimacion numero " & NumeroEstimacionActual)
|
||||
|
||||
End If
|
||||
'AnexoGral.Text = "[]"
|
||||
ObjContratos.Dispose()
|
||||
CargaddlAvance()
|
||||
'CargaddlAvance()
|
||||
CargaDatosAvance()
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub LnkGuardarAvance_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
|
||||
|
||||
Dim ObjContratos As New ClsContratos
|
||||
ObjContratos.IniciaTransacSQL()
|
||||
Dim TieneError = False
|
||||
Dim CveContratoDetalle As Integer
|
||||
Dim Cantidad As Double
|
||||
Dim guardarArchivos As New List(Of Archivo)
|
||||
|
||||
Dim NumeroEstimacionActual As Integer = 0
|
||||
|
||||
CveContratoDetalle = GvRow.DataKey("CveContratoDetalle").ToEntero
|
||||
|
||||
If CveContratoDetalle > 0 Then
|
||||
|
||||
Cantidad = GvRow.FCTextBox("TxtCantidad").Text.ToDouble
|
||||
|
||||
If Cantidad > 0 Then
|
||||
If ObjContratos.AddContratosObraAvance(DdlContratos.SelectedValue.ToEntero, CveContratoDetalle, Cantidad, TxtFecha.Text.ToDateTime, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
NumeroEstimacionActual = ObjContratos.NumeroEstimacionActual
|
||||
|
||||
Dim CveContratoAvance As Integer = ObjContratos.DtResultados.Rows(0)("CveContratoAvance").ToString.ToEntero
|
||||
Dim files As List(Of Archivo) = GvRow.FCTextBox("TXTAnexo").getfiles().Archivos
|
||||
|
||||
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
|
||||
End If
|
||||
|
||||
|
||||
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 guardarArchivos
|
||||
fileItem.filename.FilesMove(fileItem.filename.Replace($".{fileItem.Extencion}", ""), urlsave)
|
||||
Next
|
||||
ObjContratos.Commit()
|
||||
|
||||
'Alert("se avance guardado correctamente")
|
||||
Alert("se avance guardado correctamente en estimacion numero " & NumeroEstimacionActual)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
End If
|
||||
Else
|
||||
ObjContratos.RollBack()
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
ObjContratos.Dispose()
|
||||
CargaDatosAvance()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#Region "ESTIMACION"
|
||||
|
||||
@@ -355,9 +437,9 @@ Partial Class Contratos_ContratoAvance
|
||||
|
||||
Dim ObjContratos As New ClsContratos()
|
||||
Dim DTEstimaciones As New DataTable
|
||||
Dim NumeroEstimacionActual As Integer = 0
|
||||
|
||||
|
||||
If ObjContratos.GetContratosAvanceEstimacion(DDlContratosEstimaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
If ObjContratos.GetContratosAvanceEstimacion(DDlContratosEstimaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1) Then
|
||||
DTEstimaciones = ObjContratos.DtResultados
|
||||
|
||||
CveContratoEstimacion = DDlContratosEstimaciones.SelectedValue.ToEntero
|
||||
@@ -465,7 +547,6 @@ Partial Class Contratos_ContratoAvance
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub GeneraAnexo(CveEstimacion As Integer, NumeroEstimacion As Integer, FechaEstimacion As Date, NumeroContrato As String)
|
||||
|
||||
Dim PlantillaAnexo As String = $"{UsuarioActual.Empresa.Ruta}\Formatos\Anexo.xlsx"
|
||||
@@ -683,7 +764,7 @@ Partial Class Contratos_ContratoAvance
|
||||
Dim objContrato As New ClsContratos
|
||||
Dim DTArchivos As New DataTable
|
||||
|
||||
If objContrato.GetContratosAvanceAnexos(Drow("CveContratoDetalle").ToString.ToEntero, Drow("Fecha").ToString, UsuarioActual.CveUsuario, CveEstimacion:=CveEstimacion) Then
|
||||
If objContrato.GetContratosAvanceAnexos(Drow("CveContratoDetalle").ToString.ToEntero, UsuarioActual.CveUsuario, CveEstimacion:=CveEstimacion) Then
|
||||
DTArchivos = objContrato.DtResultados
|
||||
End If
|
||||
objContrato.Dispose()
|
||||
@@ -748,6 +829,10 @@ Partial Class Contratos_ContratoAvance
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user