diff --git a/AF/CatCheckList.aspx b/AF/CatCheckList.aspx new file mode 100644 index 000000000..c7c954225 --- /dev/null +++ b/AF/CatCheckList.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CatCheckList.aspx.cs" Inherits="AF_CatCheckList" %> + + + + + + + + +
+
+ +
+
+ + diff --git a/AF/CatCheckList.aspx.cs b/AF/CatCheckList.aspx.cs new file mode 100644 index 000000000..4742625b9 --- /dev/null +++ b/AF/CatCheckList.aspx.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +public partial class AF_CatCheckList : System.Web.UI.Page +{ + protected void Page_Load(object sender, EventArgs e) + { + + } +} \ No newline at end of file diff --git a/AF/CatCheckListActividades.aspx b/AF/CatCheckListActividades.aspx new file mode 100644 index 000000000..e4179f25a --- /dev/null +++ b/AF/CatCheckListActividades.aspx @@ -0,0 +1,76 @@ +<%@ Page Title="AF - Catálogo de Actividades de CheckList" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatCheckListActividades.aspx.cs" Inherits="AF_CatCheckListActividades" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Actividades de CheckList + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AF/CatCheckListActividades.aspx.cs b/AF/CatCheckListActividades.aspx.cs new file mode 100644 index 000000000..f21d58f7a --- /dev/null +++ b/AF/CatCheckListActividades.aspx.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatCheckListActividades : ClsPaginas +{ + private int CveCheckListActividad + { + get + { + return ViewState["CveCheckListActividad"].ToString().ToEntero(); + } + + set + { + ViewState["CveCheckListActividad"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetCheckListActividad(-1, -1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + if (ObjAF.GetCheckListActividadGrupo(-1)) + { + DdlCheckListActividadGrupo.DataSource = ObjAF.DtResultados; + DdlCheckListActividadGrupo.DataBind(); + DdlCheckListActividadGrupo.Items.Insert(0, new ListItem("Seleccione", "-1")); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadCheckListD_Click(object sender, EventArgs e) + { + BtnAgregarActividadCheckList.Text = "Agregar"; + TxtCheckListActividad.Text = ""; + DdlCheckListActividadGrupo.SelectedValueExist(-1); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarActividadCheckList.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividad = GvRow.DataKey("CveCheckListActividad").ToEntero(); + TxtCheckListActividad.Text = GvRow.DataKey("CheckListActividad"); + DdlCheckListActividadGrupo.SelectedValueExist(GvRow.DataKey("CveCheckListActividadGrupo")); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividad = GvRow.DataKey("CveCheckListActividad").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteCheckListActividad(CveCheckListActividad)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + Alert("Se eliminó la Actividad de CheckList correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadCheckList_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + if (BtnAgregarActividadCheckList.Text == "Agregar") + { + if (ObjAF.AddCheckListActividad(TxtCheckListActividad.Text, DdlCheckListActividadGrupo.SelectedValue.ToEntero())) + { + Alert("Se agregó la Actividad de CheckList correctamente"); + } + } + else + { + if (ObjAF.UpdateCheckListActividad(CveCheckListActividad, TxtCheckListActividad.Text, DdlCheckListActividadGrupo.SelectedValue.ToEntero())) + { + Alert("Se actualizó la Actividad de CheckList correctamente"); + } + } + ObjAF.Dispose(); + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + } +} \ No newline at end of file diff --git a/App_Code/ClsAF.vb b/App_Code/ClsAF.vb index c8f341270..ebb78452a 100644 --- a/App_Code/ClsAF.vb +++ b/App_Code/ClsAF.vb @@ -3995,6 +3995,167 @@ Public Class ClsAF Return Retorno End Function + Public Function GetCheckListActividad(CveCheckListActividad As Integer, CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListActividad(CheckListActividad As String, CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListActividad(CveCheckListActividad As Integer, CheckListActividad As String, CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListActividad(CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckList(CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckList(CveCheckList As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #End Region diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index ddee3fb68..0b5f11d3e 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3958,6 +3958,7 @@ Public Class ClsPaginas PaginaDict.Add("/AF/CatActividades.aspx".ToUpper(), 768) PaginaDict.Add("/AF/CatCheckListActividadesGrupos.aspx".ToUpper(), 769) PaginaDict.Add("/AF/CatCheckListTipo.aspx".ToUpper(), 770) + PaginaDict.Add("/AF/CatCheckListActividades.aspx".ToUpper(), 771) PaginaDict.Add("/AF/TipoOrdenTrabajo.aspx".ToUpper(), -1) PaginaDict.Add("/AF/OrdenTrabajo.aspx".ToUpper(), -1) diff --git a/App_Code/DtDatos.xsd b/App_Code/DtDatos.xsd index f4839bec3..f64700eb6 100644 --- a/App_Code/DtDatos.xsd +++ b/App_Code/DtDatos.xsd @@ -12,7 +12,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -153,7 +153,7 @@ - + @@ -170,7 +170,7 @@ - + @@ -179,7 +179,7 @@ - + @@ -215,7 +215,7 @@ - + @@ -235,12 +235,12 @@ - + - + @@ -256,7 +256,7 @@ - + diff --git a/App_Code/DtDatos.xss b/App_Code/DtDatos.xss index 3d21fe6c6..e0a664890 100644 --- a/App_Code/DtDatos.xss +++ b/App_Code/DtDatos.xss @@ -4,7 +4,7 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + @@ -16,7 +16,7 @@ - + diff --git a/Empresas/Grales/Formatos/RepIVA.rpt b/Empresas/Grales/Formatos/RepIVA.rpt index 9010bd468..d3b3d6240 100644 Binary files a/Empresas/Grales/Formatos/RepIVA.rpt and b/Empresas/Grales/Formatos/RepIVA.rpt differ diff --git a/Empresas/Grales/Formatos/RepIVAAcreditable.rpt b/Empresas/Grales/Formatos/RepIVAAcreditable.rpt index eb0fede9e..d29e92534 100644 Binary files a/Empresas/Grales/Formatos/RepIVAAcreditable.rpt and b/Empresas/Grales/Formatos/RepIVAAcreditable.rpt differ diff --git a/OI/CatDocumentoCategoria.aspx b/OI/CatDocumentoCategoria.aspx index e935eec64..96ca36b67 100644 --- a/OI/CatDocumentoCategoria.aspx +++ b/OI/CatDocumentoCategoria.aspx @@ -14,7 +14,7 @@
  • - +
  • @@ -25,8 +25,8 @@ - - + + @@ -44,7 +44,7 @@
    diff --git a/OI/DocumentoDetalle.aspx b/OI/DocumentoDetalle.aspx index fd583dbd4..43ef51987 100644 --- a/OI/DocumentoDetalle.aspx +++ b/OI/DocumentoDetalle.aspx @@ -29,8 +29,8 @@
    - - +
    +

    @@ -47,18 +47,9 @@
    -
    +
    -
    -
    -
    - - - - - -
    -
    +
    @@ -83,7 +74,7 @@
    - +
    @@ -104,7 +95,7 @@ @@ -144,6 +135,7 @@ +
    diff --git a/OI/DocumentoDetalle.aspx.cs b/OI/DocumentoDetalle.aspx.cs index a2119cdbb..c832920f0 100644 --- a/OI/DocumentoDetalle.aspx.cs +++ b/OI/DocumentoDetalle.aspx.cs @@ -11,6 +11,7 @@ using System.Text; public partial class OI_DocumentoDetalle : ClsPaginas { + #region "PROPIEDADES" private int CveUsuarioResponsable { get @@ -96,6 +97,8 @@ public partial class OI_DocumentoDetalle : ClsPaginas Cargar(); } } + #endregion + #region "CARGAS" private void CargarCveDocumento() { @@ -107,6 +110,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas else { this.CveDocumento = -1; + this.CveUsuarioResponsable = -1; } } @@ -124,6 +128,9 @@ public partial class OI_DocumentoDetalle : ClsPaginas case "Publicado": Alert("Documento publicado"); break; + case "Rechazado": + Alert("Documento rechazado"); + break; } } @@ -157,8 +164,11 @@ public partial class OI_DocumentoDetalle : ClsPaginas foreach (GridViewRow Usuario in UsuariosEnGrid) { int CveUsuario = Usuario.DataKey("CveUsuario").ToEntero(); - string FechaAprobacion = Usuarios.FiltroPrimeroValor("FechaAprobacion", string.Format("CveUsuario = {0}", CveUsuario)); + string Filtro = string.Format("CveUsuario = {0}", CveUsuario); + string FechaAprobacion = Usuarios.FiltroPrimeroValor("FechaAprobacion", Filtro); Usuario.FCCheckBox("ChkAprobar").Checked = FechaAprobacion != "" || (UsuarioActual.CveUsuario == CveUsuarioResponsable && CveUsuario == UsuarioActual.CveUsuario); + string Adjunto = Usuarios.FiltroPrimeroValor("Adjunto", Filtro); + Usuario.FCLinkButton("LkbDescargarPropuesta").Visible = Adjunto != ""; } } } @@ -207,7 +217,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas DdlCategoria.SelectedValue = Documento["CveCategoria"].ToString(); CargarSubCategoria(); DdlSubCategoria.SelectedValue = Documento["CveSubCategoria"].ToString(); - DdlEstatus.SelectedValue = Documento["CveEstatus"].ToString(); + LblEstatus.Text =$"Estatus: {Documento["Estatus"].ToString()}"; TxtVersion.Text = Documento["Version"].ToString(); TxtResponsable.Text = Documento["Responsable"].ToString(); TxtObs.InnerText = Documento["Observacion"].ToString(); @@ -246,7 +256,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas { LkbGuardar.Visible = false; LkbActualizar.Visible = true; - LkbPublicar.Visible = true; + LkbPublicar.Visible = VerificarAprobaciónParticipantes() && UsuarioActual.CveUsuario == CveUsuarioResponsable; GvUsuarios.Columns[1].Visible = false; GvUsuarios.Columns[2].Visible = true; GvUsuarios.Columns[3].Visible = true; @@ -273,7 +283,6 @@ public partial class OI_DocumentoDetalle : ClsPaginas { TxtDescripcion.Enabled = false; DdlSubCategoria.Enabled = false; - DdlEstatus.Enabled = false; TxtVersion.Enabled = false; TxtResponsable.Enabled = false; TxtObs.Disabled = true; @@ -284,8 +293,11 @@ public partial class OI_DocumentoDetalle : ClsPaginas private void ConfigurarSegunEstatus() { - bool MostrarSegunAprobado = (DdlEstatus.SelectedValue == "2"); - DivBotonesAcciones.Visible = !MostrarSegunAprobado; + bool MostrarSegunAprobado = (LblEstatus.Text == "Estatus: Aprobado"); + bool MostrarSegunRechazado = (LblEstatus.Text == "Estatus: Rechazado"); + bool MostrarSegunEnProceso = (LblEstatus.Text == "Estatus: En Proceso"); + LkbActualizar.Visible = !(MostrarSegunRechazado) && (UsuarioActual.CveUsuario == this.CveUsuarioResponsable); + DivBotonesAcciones.Visible = !(MostrarSegunAprobado || MostrarSegunRechazado); UpAgregar.Visible = MostrarSegunAprobado; } @@ -310,12 +322,9 @@ public partial class OI_DocumentoDetalle : ClsPaginas } } - private void EstatusMostrar(bool Mostrar) + private void MostrarBotonRechazar() { - DivEstatus.Visible = Mostrar; - brEstatus.Visible = Mostrar; - DivEstatusInicial.Visible = !Mostrar; - brEstatusInicial.Visible = !Mostrar; + LkbRechazar.Visible = (LblEstatus.Text == "Estatus: En Proceso" && this.CveUsuarioResponsable == UsuarioActual.CveUsuario); } private void Cargar() @@ -326,7 +335,6 @@ public partial class OI_DocumentoDetalle : ClsPaginas CargarUsuarios(); if (this.CveDocumento > 0) { - EstatusMostrar(true); if (CargarDocumentoYaExistente()) { CargarUsuariosParticipantes(); @@ -335,6 +343,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas ConfigurarGridUsuariosParticipantes(); ConfigurarCamposDetalleSegunUsuario(); CargarMensajeNuevoEditado(); + MostrarBotonRechazar(); } } ConfigurarSegunEstatus(); @@ -344,39 +353,45 @@ public partial class OI_DocumentoDetalle : ClsPaginas #region "GENERAR DOCUMENTO" protected void LblGuardar_Click(object sender, EventArgs e) { - ClsOIEventos ObjOI = new ClsOIEventos(); - ObjOI.IniciaTransacSQL(); - bool TieneError = false; - - //Esta variable es requerida más adelante - int CveDocumento = 0; - string RutaArchivo = "-1"; - string CorreosNotificacion = ""; - byte[] ArchivoNotifiacion = null; - - CveDocumento = GuardarDocumento(ref ObjOI, ref TieneError);//Se crea el Documento - if (!TieneError) { RutaArchivo = AsignarArchivoAlDocumento(CveDocumento, ref ObjOI, ref TieneError); }//Se guarda el archivo fisico y se asigna al Documento generado - if (!TieneError) { CorreosNotificacion = GuardarUsuariosQueAutorizan(CveDocumento, RutaArchivo, ref ObjOI, ref TieneError); }//asignamos a los usuarios que participaran en aprovar este documento - if (!TieneError) + if(TxtDocumentoFile.Text != "[]") { - ArchivoNotifiacion = GenerarArchivoByte(CveDocumento, RutaArchivo); - NotificarPorCorreo(CorreosNotificacion, RutaArchivo, ArchivoNotifiacion); - } + ClsOIEventos ObjOI = new ClsOIEventos(); + ObjOI.IniciaTransacSQL(); + bool TieneError = false; - //Gestión de errores y resultados - if (!TieneError) + //Esta variable es requerida más adelante + int CveDocumento = 0; + string RutaArchivo = "-1"; + string CorreosNotificacion = ""; + byte[] ArchivoNotifiacion = null; + + CveDocumento = GuardarDocumento(ref ObjOI, ref TieneError);//Se crea el Documento + if (!TieneError) { RutaArchivo = AsignarArchivoAlDocumento(CveDocumento, ref ObjOI, ref TieneError); }//Se guarda el archivo fisico y se asigna al Documento generado + if (!TieneError) { CorreosNotificacion = GuardarUsuariosQueAutorizan(CveDocumento, RutaArchivo, ref ObjOI, ref TieneError); }//asignamos a los usuarios que participaran en aprovar este documento + if (!TieneError) + { + ArchivoNotifiacion = GenerarArchivoByte(CveDocumento, RutaArchivo); + NotificarPorCorreo(CorreosNotificacion, RutaArchivo, ArchivoNotifiacion, CveDocumento); + } + + //Gestión de errores y resultados + if (!TieneError) + { + ObjOI.Commit(); + string ParamMensaje = LkbGuardar.Text == "Guardar" ? "Nuevo" : "NuevaVersion";//Esto indica la acción de usuario la cual se mostrará como alert al cargar la página + Response.Redirect(string.Format("/OI/DocumentoDetalle.aspx?CveDocumento={0}&Mensaje={1}", CveDocumento, ParamMensaje)); + } + else + { + ObjOI.RollBack(); + Alert(this.ErrorMensaje, ModExtensiones.TipoMensaje.MsgError); + UpCliente.Update(); + } + ObjOI.Dispose(); + }else { - ObjOI.Commit(); - string ParamMensaje = LkbGuardar.Text == "Guardar" ? "Nuevo" : "NuevaVersion";//Esto indica la acción de usuario la cual se mostrará como alert al cargar la página - Response.Redirect(string.Format("/OI/DocumentoDetalle.aspx?CveDocumento={0}&Mensaje={1}", CveDocumento, ParamMensaje)); + Alert("Es necesario cargar un Documento",ModExtensiones.TipoMensaje.MsgAdvertencia); } - else - { - ObjOI.RollBack(); - Alert(this.ErrorMensaje, ModExtensiones.TipoMensaje.MsgError); - UpCliente.Update(); - } - ObjOI.Dispose(); } private int GuardarDocumento(ref ClsOIEventos ObjOI, ref bool TieneError) @@ -444,6 +459,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas { string Archivo = ActualizarArchivoEnDirectorio(); ActualizarDocumentoYaExistente(Archivo); + TxtDocumentoFile.Text = ""; Cargar(); UpCliente.Update(); Alert("Documento actualizado"); @@ -468,8 +484,8 @@ public partial class OI_DocumentoDetalle : ClsPaginas private void ActualizarDocumentoYaExistente(string ArchivoFisico) { ClsOIEventos ObjOI = new ClsOIEventos(); - if (!ObjOI.UpdateDocumento(this.CveDocumento, DdlSubCategoria.SelectedValue.ToEntero(), TxtDescripcion.Text, TxtObs.InnerText, TxtVersion.Text, DdlEstatus.SelectedValue.ToEntero(), - ArchivoFisico, UsuarioActual.Nombre, ModExtensiones.MinFecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + if (!ObjOI.UpdateDocumento(this.CveDocumento, DdlSubCategoria.SelectedValue.ToEntero(), TxtDescripcion.Text, TxtObs.InnerText, TxtVersion.Text, 1, ArchivoFisico, + UsuarioActual.Nombre, ModExtensiones.MinFecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) { Alert("Error al actualizar", ModExtensiones.TipoMensaje.MsgError); } @@ -554,9 +570,21 @@ public partial class OI_DocumentoDetalle : ClsPaginas #endregion #region "NOTIFICACIONES CORREO" - private void NotificarPorCorreo(string Para, string NombreArchivo, byte[] Adjunto) + private string GenerarCuerpoCorreo(int CveDocumento) { - string Descripcion = TxtDescripcion.Text; + string URL = string.Format("{0}/OI/DocumentoDetalle.aspx?CveDocumento={1}", HttpContext.Current.Request.Url.Host,CveDocumento); + StringBuilder body = new StringBuilder(); + body.Append("Ha sido invitado a revisar la generación de un documento
    "); + body.Append($"Documento: {TxtDescripcion.Text},
    "); + body.Append($"Categoria: {DdlCategoria.SelectedItem.Text},
    "); + body.Append($"Subcategoria: {DdlSubCategoria.SelectedItem.Text},
    "); + body.Append($"Detalles del Documento"); + return body.ToString(); + } + + private void NotificarPorCorreo(string Para, string NombreArchivo, byte[] Adjunto, int CveDocumento) + { + string Descripcion = GenerarCuerpoCorreo(CveDocumento); string Asunto = "Se le ha agregado como participante en el desarrollo de un Documento"; string a = string.Format("{0} -- {1} --- {2}", Descripcion, Para, ""); a.GuardaLog(); @@ -658,7 +686,16 @@ public partial class OI_DocumentoDetalle : ClsPaginas { string Archivo = SubirPropuestaEnDirectorio(this.CveUsuarioSeleccionado); - ActualizarUsuario(this.CveAsignacion, Archivo); + bool UsuarioActualizado = ActualizarUsuario(this.CveAsignacion, Archivo); + if (UsuarioActualizado) + { + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarPropuesta")); + Alert("La propuesta se realizó correctamente"); + CargarUsuariosParticipantes(); + CargarUsuariosAutorizo(); + ConfigurarGridUsuariosParticipantes(); + UpDatosUsuarios.Update(); + } } private string SubirPropuestaEnDirectorio(int CveUsuario) @@ -671,6 +708,12 @@ public partial class OI_DocumentoDetalle : ClsPaginas { try { + string AdjuntoYaCargado = GetUsuarioParticipante(CveUsuario)["Adjunto"] == null ? "": GetUsuarioParticipante(CveUsuario)["Adjunto"].ToString(); + string RutaBuscar = string.Format(@"{0}DocumentosRepo\{1}\{2}", UsuarioActual.Empresa.Ruta, this.CveDocumento, AdjuntoYaCargado); + if (File.Exists(RutaBuscar)) + { + File.Delete(RutaBuscar); + } string NombreArchivo = fileItem.filenameO; fileNameReturn = string.Format("{0}_{1}", CveUsuario, NombreArchivo); string RutaDestino = string.Format(@"{0}DocumentosRepo\{1}\{2}_{3}", UsuarioActual.Empresa.Ruta, this.CveDocumento, CveUsuario, NombreArchivo); @@ -685,14 +728,16 @@ public partial class OI_DocumentoDetalle : ClsPaginas return fileNameReturn; } - private void ActualizarUsuario(int CveAutorizacion, string Archivo) + private bool ActualizarUsuario(int CveAutorizacion, string Archivo) { ClsOIEventos ObjOI = new ClsOIEventos(); if (!ObjOI.UpdateDocumentoAutorizacion(CveAutorizacion, this.CveDocumento, TxtComentarios.InnerText, Archivo, ModExtensiones.MinFecha)) { Alert("Error al actualizar el archivo subido propuesto por el usuario"); + return false; } ObjOI.Dispose(); + return true; } #endregion @@ -705,6 +750,10 @@ public partial class OI_DocumentoDetalle : ClsPaginas DataRow Usuario = GetUsuarioParticipante(CveUsuario); AprobacionDeUsuario(Usuario, SelectedCheckBox.Checked); + + LkbPublicar.Visible = VerificarAprobaciónParticipantes() && UsuarioActual.CveUsuario == CveUsuarioResponsable; + UpCliente.Update(); + } private void AprobacionDeUsuario(DataRow Usuario, bool Autorizar) @@ -728,7 +777,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas ObjOI.Dispose(); } - protected void LkbPublicar_Click(object sender, EventArgs e) + private bool VerificarAprobaciónParticipantes() { GridViewRowCollection Usuarios = GvUsuarios.Rows; bool Aprobado = true; @@ -740,6 +789,12 @@ public partial class OI_DocumentoDetalle : ClsPaginas break; } } + return Aprobado; + } + + protected void LkbPublicar_Click(object sender, EventArgs e) + { + bool Aprobado = VerificarAprobaciónParticipantes(); if (Aprobado) { @@ -771,8 +826,21 @@ public partial class OI_DocumentoDetalle : ClsPaginas GvUsuarios.Columns[1].Visible = true; GvUsuarios.Columns[2].Visible = false; GvUsuarios.Columns[3].Visible = false; - EstatusMostrar(false); UpCliente.Update(); } #endregion + + #region "Rechazar" + protected void LkbRechazar_Click(object sender, EventArgs e) + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.UpdateDocumento(this.CveDocumento, DdlSubCategoria.SelectedValue.ToEntero(), TxtDescripcion.Text, TxtObs.InnerText, TxtVersion.Text, 3, "-1", TxtResponsable.Text, + DateTime.Now, -1, -1, UsuarioActual.CveEmpresa)) + { + Alert("Documento cancelado"); + } + ObjOI.Dispose(); + Response.Redirect(string.Format("/OI/DocumentoDetalle.aspx?CveDocumento={0}&Mensaje={1}", this.CveDocumento, "Rechazado")); + } + #endregion } \ No newline at end of file diff --git a/OI/Documentos.aspx b/OI/Documentos.aspx index 5e37a8679..2e54f8905 100644 --- a/OI/Documentos.aspx +++ b/OI/Documentos.aspx @@ -14,13 +14,13 @@
  • - +
  • - Imprimir PDF + PDF
  • - Imprimir Excel + Excel
  • @@ -32,13 +32,14 @@ EmptyDataText="No se encontraron Documentos Registrados" ToolTip="Listado de Documentos" CssClass="table table-striped table-advance table-hover" Style="margin-top: -10px; text-align: center; width: 100%" GridLines="None" OnRowDataBound="GvDatos_RowDataBound"> - + - - - + + + - + +