Contratos

This commit is contained in:
rakcsle
2021-09-27 08:30:31 -07:00
parent 394be5e7c6
commit 8e11ed91c4
6 changed files with 294 additions and 33 deletions

View File

@@ -389,6 +389,19 @@ Partial Class Contratos_ContratoObra
End Property
Property BloquearTodo As Boolean
Get
If ViewState("BloquearTodo") Is Nothing Then
Return False
Else
Return Boolean.Parse(ViewState("BloquearTodo").ToString)
End If
End Get
Set(value As Boolean)
ViewState("BloquearTodo") = value
End Set
End Property
#End Region
@@ -483,6 +496,9 @@ Partial Class Contratos_ContratoObra
CargaDLLCargaGVCentrosConsto()
tabalCentrosdecotso()
BloquearControles()
End If
@@ -626,12 +642,38 @@ Partial Class Contratos_ContratoObra
'DdlProyecto.SelectedValue = "-1"
TxtCantidad.Text = ""
RGVControlCantidadVentas.Visible = False
TxtPU.Text = ""
TmpDT.Clear()
CargaGVPresupuestos(TmpDT)
CargaGVPresupuestosInsumos(TmpDT)
LbTotalGeneral.Text = "0.00"
End Sub
Private Sub BloquearControles()
If BloquearTodo Then
LnkModalAddPSVentas.Visible = False
LnkModalAddPSControl.Visible = False
LnkModalAddPresupuestoVentas.Visible = False
LnkModalAddPresupuestoControl.Visible = False
LnkModalAddGastos.Visible = False
LnkModalAddMaquinariaFlotilla.Visible = False
BtnDescargar.Enabled = False
A1.Visible = False
BtnGuardar.Enabled = False
BtnEliminar.Enabled = False
BtnCancelar.Enabled = False
End If
End Sub
#End Region
#Region " CONFIGURA TIPOS CONTRATO "
@@ -739,6 +781,24 @@ Partial Class Contratos_ContratoObra
DdlCliente.SelectedValue = ObjContratos.CveCliente.ToString
DdlCliente.SelectedText = ObjContratos.NombreComercial.ToString
LnkAbrirContrato.Visible = False
LnkCerrarContrato.Visible = False
If UsuarioActual.TienePermisoProceso(330) Then
If ObjContratos.TipoEstatus = 1 Then
LnkCerrarContrato.Visible = True
Else
LnkAbrirContrato.Visible = True
BloquearTodo = True
End If
End If
If ObjContratos.CveProveedor > 0 Then
' TrProveedor.Visible = True
TrCliente.Visible = False
@@ -873,6 +933,11 @@ Partial Class Contratos_ContratoObra
Alert("El Contrato Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
BtnGuardar.Enabled = False
End If
Else
CveContrato = -1
Alert("Ocurrió un error al cargar el Contrato. Por favor vuelva a intentar.", TipoMensaje.MsgError)
@@ -1000,10 +1065,14 @@ Partial Class Contratos_ContratoObra
TipoContrato = DdlTipoContratoObra.SelectedValue.ToEntero
'Crear Contrato
Dim ImporteSubTotal As Decimal = TmpDT.SUM("Total", " CveContratoDetalle > 0 AND CveTipoPresupuesto=2 ").ToDecimal
If Not CveContrato > 0 Then
Dim EstatusContrato As Integer = 1
CveContrato = ObjContratos.AddContratosObra(TxtNumeroContrato.Text, TxtDescripcionContrato.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, TxtFechaInicial.Text.ToDate, TxtFechaFinal.Text.ToDate,
TxtUbicacion.Text, TxtResponsable.Text, DdlProyecto.SelectedValue.ToEntero, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble,
TxtPorGarantia.Text.ToDouble, "." & Session("FileExtension").ToString, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total,
@@ -1011,7 +1080,7 @@ Partial Class Contratos_ContratoObra
TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1,
PorcentajeComision:=0, TipoGarantia:=-1, Folio:=0, FechaVenc:=Nothing, EstatusFianza:=1,
CvePeriodo:=-1, CveCuentaEquipo:=-1, CveContratoPlantilla:=-1, CveVendedor:=-1,
Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False, CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim, LimiteDeGasto:=TxtLimiteGastos.Text.ToDouble)
Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False, CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim, LimiteDeGasto:=TxtLimiteGastos.Text.ToDouble, ImporteSubTotal:=ImporteSubTotal)
TieneError = Not GuardaFianzas(ObjContratos)
@@ -1074,7 +1143,7 @@ Partial Class Contratos_ContratoObra
CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1, PorcentajeComision:=0,
TipoGarantia:=-1, Folio:=-1, FechaVenc:=Nothing, EstatusFianza:=-1, CveContratoPlantilla:=-1,
CveCuentaEquipo:=-1, CveVendedor:=-1, Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False,
CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim, LimiteDeGasto:=TxtLimiteGastos.Text.ToDouble) Then
CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim, LimiteDeGasto:=TxtLimiteGastos.Text.ToDouble, ImporteSubTotal:=ImporteSubTotal) Then
TieneError = Not GuardaFianzas(ObjContratos)
@@ -1698,6 +1767,21 @@ Partial Class Contratos_ContratoObra
End If
If e.Row.RowType = DataControlRowType.DataRow Then
If BloquearTodo Then
e.Row.FCLinkButton("LnkEditarPresupuestoVentaDetalle").Visible = False
e.Row.FCLinkButton("imgD").Visible = False
End If
If e.Row.DataKey("CveContratoDetalle").ToEntero <= 0 Then
e.Row.FCLinkButton("LnkEditarPresupuestoVentaDetalle").Visible = False
e.Row.FCLinkButton("imgD").Visible = False
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)
e.Row.FCDropDownList("DdlUMEdit").DataBind()
@@ -2078,6 +2162,23 @@ Partial Class Contratos_ContratoObra
e.Row.FCDropDownList("DdlUMEdit").SelectedValue = e.Row.DataKey("CveUM")
End If
If e.Row.RowType = DataControlRowType.DataRow Then
If BloquearTodo Then
e.Row.FCLinkButton("LnkEditarPresupuestoControlDetalle").Visible = False
e.Row.FCLinkButton("imgD").Visible = False
End If
If e.Row.DataKey("CveContratoDetalle").ToEntero <= 0 Then
e.Row.FCLinkButton("LnkEditarPresupuestoControlDetalle").Visible = False
e.Row.FCLinkButton("imgD").Visible = False
End If
End If
End Sub
Protected Sub GVInsumos_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvInsumos.RowEditing
GvInsumos.EditIndex = e.NewEditIndex
@@ -2726,8 +2827,8 @@ Partial Class Contratos_ContratoObra
End Sub
Protected Sub GvContratoGastos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvContratosGastos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Or e.Row.DBCampo("CveVenta").ToString.ToEntero > 0 Then
If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Then e.Row.CssClass = "SubTotales" : e.Row.Cells(0).Text = e.Row.DBCampo("Cantidad").FormatoNumero(0)
e.Row.FCLinkButton("imgE").Visible = False
@@ -2738,6 +2839,16 @@ Partial Class Contratos_ContratoObra
ScriptManager.GetCurrent(Me).RegisterAsyncPostBackControl(lb)
End If
End If
If e.Row.RowType = DataControlRowType.DataRow Then
If BloquearTodo Then
e.Row.FCLinkButton("imgU").Visible = False
e.Row.FCLinkButton("imgE").Visible = False
e.Row.FCLinkButton("imgD").Visible = False
End If
End If
End Sub
Protected Sub GvContratoGastos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvContratosGastos.RowDeleting
@@ -3185,6 +3296,15 @@ Partial Class Contratos_ContratoObra
End If
End If
If e.Row.RowType = DataControlRowType.DataRow Then
If BloquearTodo Then
e.Row.FCLinkButton("LinkEliminarBitacora").Visible = False
End If
End If
End Sub
Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click
@@ -4181,12 +4301,38 @@ Partial Class Contratos_ContratoObra
Dim CantidadMinimo As Integer = 0
Dim ObjContrtato As New ClsContratos
If ObjContrtato.GetContratosDetalleAvance(CveContratoDetalleEditar) Then
CantidadMinimo = ObjContrtato.DtResultados.Rows(0)(0).ToString.ToEntero
If CantidadMinimo = 0 Then
RGVControlCantidadVentas.Visible = False
Else
RGVControlCantidadVentas.Visible = True
RGVControlCantidadVentas.MinimumValue = CantidadMinimo.ToString
End If
End If
ObjContrtato.Dispose()
ModalVentasPSAdd = False
ChkContinualAgregandoVentas.Visible = False
ChkContinualAgregandoVentas.Checked = False
UpModalVentasAddPS.Update()
RegistraScript("$('#ModalVentasAddPS').modal('show')")
End Sub
Protected Sub LnkEditarPresupuestoControlDetalle_Click(sender As Object, e As EventArgs)
@@ -4276,6 +4422,7 @@ Partial Class Contratos_ContratoObra
'TxtOCInterna.Text = ""
TxtCantidad.Text = ""
RGVControlCantidadVentas.Visible = False
'ChkLimitarVenta.Checked = False
'TxtNoIdentificacionv.Text = ""
DdlClasificacionAdd.SelectedValueExist(-1)
@@ -5088,7 +5235,6 @@ Partial Class Contratos_ContratoObra
Private Sub GvGastosVeiculos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvGastosVeiculos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DataKey("ORDEN").ToEntero = 1 Then
e.Row.CssClass = "Totales"
e.Row.Cells(1).Text = "Total"
@@ -5097,8 +5243,16 @@ Partial Class Contratos_ContratoObra
End If
End If
If e.Row.RowType = DataControlRowType.DataRow Then
If BloquearTodo Then
e.Row.FCLinkButton("LnkEliminarGasto").Visible = False
End If
End If
End Sub
@@ -5433,6 +5587,39 @@ Partial Class Contratos_ContratoObra
AddtabalCentrosdecotso(DdlCentroCostos.SelectedValue.ToEntero, DdlCentroCostos.SelectedItem.Text, TxtCentroCostosPorcentaje.Text.ToDecimal)
End Sub
Protected Sub LnkAbrirContrato_Click(sender As Object, e As EventArgs)
AbrirCerrarContrto(False)
End Sub
Protected Sub LnkCerrarContrato_Click(sender As Object, e As EventArgs)
AbrirCerrarContrto(True)
End Sub
Private Sub AbrirCerrarContrto(Cerrar As Boolean)
Dim ObjConrtato As New ClsContratos
If ObjConrtato.AbrirCerrarContrato(CveContrato, UsuarioActual.CveEmpresa, Cerrar, UsuarioActual.CveUsuario) Then
Alert($"Contrato { If(Cerrar, "Cerrado", "Abierto")} Correctamente", TipoMensaje.MsgInformacion, $"window.location.href=""./ContratoObra.aspx?CveContrato={CveContrato}"";")
End If
End Sub
Private Sub GvInt_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvInt.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If BloquearTodo Then
'e.Row.FCLinkButton("LinkButton1").Enabled = False
'e.Row.FCLinkButton("LinkButton2").Enabled = False
e.Row.FCLinkButton("LinkButton3").Visible = False
e.Row.FCLinkButton("LinkButton4").Visible = False
End If
End If
End Sub
End Class