Documentacion proveedores
This commit is contained in:
271
Edoc/Contratos.aspx.vb
Normal file
271
Edoc/Contratos.aspx.vb
Normal file
@@ -0,0 +1,271 @@
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Linq
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Proveedores_Contratos
|
||||
Inherits ClsPaginas
|
||||
|
||||
Protected Property CveContrato As Integer
|
||||
Get
|
||||
If ViewState("CveContrato") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return ViewState("CveContrato").ToString.ToEntero
|
||||
End If
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveContrato") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
|
||||
If Not Page.IsPostBack Then
|
||||
CargaDatos()
|
||||
CargaCombos()
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim ObjProv As New ClsCompProveedores
|
||||
|
||||
If ObjProv.GetContrato(-1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjProv.DtResultados
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjProv.Dispose()
|
||||
GvDatos.DataBind()
|
||||
|
||||
UpDatos.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCombos()
|
||||
'CargaProveedores
|
||||
DdlProveedores.setEsWebService(True)
|
||||
DdlProveedores.Attributes.Add("data-metodo", "getproveedores")
|
||||
DdlProveedores.SelectedText = "Todos"
|
||||
DdlProveedores.SelectedValue = "-1"
|
||||
|
||||
|
||||
DdlSubProyecto.Items.Clear()
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
|
||||
DdlSubProyecto.DataBind()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
|
||||
DdlTipoContrato.Items.Clear()
|
||||
|
||||
Dim ObjProveedor As New ClsCompProveedores
|
||||
|
||||
|
||||
If ObjProveedor.GetTiposContratos(-1, UsuarioActual.CveEmpresa, 1) Then
|
||||
DdlTipoContrato.DataSource = ObjProveedor.DtResultados
|
||||
End If
|
||||
|
||||
ObjProveedor.Dispose()
|
||||
DdlTipoContrato.DataBind()
|
||||
|
||||
DdlTipoContrato.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
CargaRepresentantes()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub BtnAgregarContratoModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarContratoModal.Click
|
||||
|
||||
CveContrato = -1
|
||||
ChkEstatus.Checked = True
|
||||
|
||||
TxtContrato.Text = ""
|
||||
|
||||
DdlProveedores.txtValue.Value = ""
|
||||
DdlProveedores.txtText.Value = ""
|
||||
|
||||
DdlTipoContrato.SelectedValueExist("-1")
|
||||
DdlSubProyecto.SelectedValueExist("-1")
|
||||
DDlRePresentanteLegal.SelectedValueExist("-1")
|
||||
|
||||
TxtFechaInicio.Text = ""
|
||||
TxtFechaFin.Text = ""
|
||||
ChkEstatus.Checked = True
|
||||
|
||||
BtnAgregarModalContrato.Text = "Agregar"
|
||||
|
||||
UpModalContrato.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarContrato"))
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
|
||||
CveContrato = GvRow.DataKey("CveContrato").ToEntero
|
||||
|
||||
TxtContrato.Text = GvRow.DataKey("Contrato")
|
||||
|
||||
DdlProveedores.txtValue.Value = GvRow.DataKey("CveProveedor")
|
||||
DdlProveedores.txtText.Value = GvRow.DataKey("NombreComercial")
|
||||
DdlTipoContrato.SelectedValueExist(GvRow.DataKey("CveTipoContrato"))
|
||||
DdlSubProyecto.SelectedValueExist(GvRow.DataKey("CveSubProyecto"))
|
||||
DDlRePresentanteLegal.SelectedValueExist(GvRow.DataKey("CveRepresentanteLegal"))
|
||||
|
||||
TxtFechaInicio.Text = GvRow.DataKey("FechaInicio").ToString.ToDate().ToString("dd/MM/yyyy")
|
||||
TxtFechaFin.Text = GvRow.DataKey("FechaFin").ToString.ToDate().ToString("dd/MM/yyyy")
|
||||
|
||||
ChkEstatus.Checked = Boolean.Parse(GvRow.DataKey("Estatus"))
|
||||
|
||||
|
||||
BtnAgregarModalContrato.Text = "Actualizar"
|
||||
|
||||
UpModalContrato.Update()
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarContrato"))
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnAgregarModalContrato.Click
|
||||
|
||||
If DdlProveedores.txtValue.Value.ToEntero <= 0 Then
|
||||
Alert("Debe seleccionar un proveedor", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim ObjProv As New ClsCompProveedores
|
||||
ObjProv.IniciaTransacSQL()
|
||||
|
||||
Dim ErrorProceso As Boolean = False
|
||||
|
||||
If CveContrato = -1 Then
|
||||
If Not ObjProv.AddContrato(TxtContrato.Text, DdlTipoContrato.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlProveedores.txtValue.Value.ToEntero, DDlRePresentanteLegal.SelectedValue.ToEntero,
|
||||
TxtFechaInicio.Text.ToDate, TxtFechaFin.Text.ToDate, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
ErrorProceso = True
|
||||
End If
|
||||
Else
|
||||
If Not ObjProv.UpdateContrato(CveContrato, TxtContrato.Text, DdlTipoContrato.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlProveedores.txtValue.Value.ToEntero, DDlRePresentanteLegal.SelectedValue.ToEntero,
|
||||
TxtFechaInicio.Text.ToDate, TxtFechaFin.Text.ToDate, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
ErrorProceso = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ErrorProceso Then
|
||||
|
||||
ObjProv.Commit()
|
||||
|
||||
If CveContrato > 0 Then
|
||||
Alert("Contrato Actualizado Correctamente.")
|
||||
Else
|
||||
Alert("Contrato Agregado Correctamente.")
|
||||
End If
|
||||
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarContrato"))
|
||||
CargaDatos()
|
||||
|
||||
Else
|
||||
|
||||
ObjProv.RollBack()
|
||||
End If
|
||||
|
||||
ObjProv.Dispose()
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkGvEliminar_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim ErrorProceso As Boolean = False
|
||||
Dim CveTipoContratoEliminar As Integer = GvRow.DataKey("CveTipoContrato").ToEntero
|
||||
|
||||
Dim ObjProv As New ClsCompProveedores
|
||||
|
||||
If ObjProv.RemoveContrato(CveTipoContratoEliminar, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Tipo Contrato eliminado correctamente")
|
||||
Else
|
||||
ErrorProceso = True
|
||||
End If
|
||||
|
||||
If Not ErrorProceso Then
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
|
||||
ObjProv.Dispose()
|
||||
|
||||
End Sub
|
||||
Protected Sub BtnCatRepresentantes_Click(sender As Object, e As EventArgs)
|
||||
TxtRepresentanteLegal.Text = ""
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAgregarContrato2"), "frm2")
|
||||
UpModalRepresentante.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAgregarRepresentante_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim ObjProv As New ClsCompProveedores
|
||||
|
||||
If ObjProv.AddRePresentanteLegal(TxtRepresentanteLegal.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Se agrego representante correctamente.")
|
||||
TxtRepresentanteLegal.Text = ""
|
||||
End If
|
||||
|
||||
ObjProv.Dispose()
|
||||
|
||||
CargaRepresentantes()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaRepresentantes()
|
||||
|
||||
Dim ObjProv As New ClsCompProveedores
|
||||
|
||||
|
||||
If ObjProv.GetRePresentanteLegal(-1, UsuarioActual.CveEmpresa) Then
|
||||
GvRepresentante.DataSource = ObjProv.DtResultados
|
||||
DDlRePresentanteLegal.DataSource = ObjProv.DtResultados
|
||||
Else
|
||||
GvRepresentante.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjProv.Dispose()
|
||||
|
||||
DDlRePresentanteLegal.Items.Clear()
|
||||
DDlRePresentanteLegal.DataBind()
|
||||
DDlRePresentanteLegal.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
||||
|
||||
GvRepresentante.DataBind()
|
||||
|
||||
UpModalRepresentante.Update()
|
||||
UpModalContrato.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkGvRepresentantesEliminar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
Dim CveRepresentanteLegal As Integer = GvRow.DataKey("CveRepresentanteLegal").ToEntero
|
||||
Dim ObjProv As New ClsCompProveedores
|
||||
|
||||
If ObjProv.RemoveRePresentanteLegal(CveRepresentanteLegal, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Representante eliminado correctamente.")
|
||||
End If
|
||||
|
||||
ObjProv.Dispose()
|
||||
|
||||
CargaRepresentantes()
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user