From 67aba388f54267718e2743d38733fdc56d4a31f4 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Fri, 17 Jul 2020 13:42:46 -0700 Subject: [PATCH 01/11] avance --- App_Code/ClsOIEventos.vb | 283 ++++++++++++++++++++++++++++ App_Code/ClsPaginas.vb | 2 + OI/CatDocumentoCategoria.aspx | 76 ++++++++ OI/CatDocumentoCategoria.aspx.cs | 104 ++++++++++ OI/CatDocumentoSubCategoria.aspx | 76 ++++++++ OI/CatDocumentoSubCategoria.aspx.cs | 114 +++++++++++ OI/Documentos.aspx | 49 +++++ OI/Documentos.aspx.cs | 30 +++ 8 files changed, 734 insertions(+) create mode 100644 OI/CatDocumentoCategoria.aspx create mode 100644 OI/CatDocumentoCategoria.aspx.cs create mode 100644 OI/CatDocumentoSubCategoria.aspx create mode 100644 OI/CatDocumentoSubCategoria.aspx.cs create mode 100644 OI/Documentos.aspx create mode 100644 OI/Documentos.aspx.cs diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 551593b30..8a65a1f30 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -2743,8 +2743,291 @@ Public Class ClsOIEventos Return Retorno End Function + + #End Region +#Region "OI_Documentos" + +#Region "OI_DocumentosCategorias" + Public Function GetDocumentoCategoria(Optional CveCategoria As Integer = -1, Optional Categoria As String = "-1") As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosCategoriasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + .Add("@Categoria", SqlDbType.NVarChar).Value = Categoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la categoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddDocumentoCategoria(Categoria As String, Estado As Boolean) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosCategoriasAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Categoria", SqlDbType.NVarChar).Value = Categoria + .Add("@Estado", SqlDbType.Bit).Value = Estado + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la categoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateDocumentoCategoria(CveCategoria As Integer, Categoria As String, Estado As Boolean) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosCategoriasUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + .Add("@Categoria", SqlDbType.NVarChar).Value = Categoria + .Add("@Estado", SqlDbType.Bit).Value = Estado + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la categoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveDocumentoCategoria(CveCategoria As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosCategoriasRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCategoria", SqlDbType.NVarChar).Value = CveCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la categoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "OI_DocumentosSubCategoria" + Public Function GetDocumentoSubCategoria(Optional CveSubCategoria As Integer = -1, Optional SubCategoria As String = "-1") As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosSubCategoriasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubCategoria", SqlDbType.Int).Value = CveSubCategoria + .Add("@SubCategoria", SqlDbType.NVarChar).Value = SubCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la subcategoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddDocumentoSubCategoria(SubCategoria As String, CveCategoria As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosSubCategoriasAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@SubCategoria", SqlDbType.NVarChar).Value = SubCategoria + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la subcategoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateDocumentoSubCategoria(CveSubCategoria As Integer, SubCategoria As String, CveCategoria As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosSubCategoriasUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubCategoria", SqlDbType.Int).Value = CveSubCategoria + .Add("@SubCategoria", SqlDbType.NVarChar).Value = SubCategoria + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la subcategoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveDocumentoSubCategoria(CveSubCategoria As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosSubCategoriasRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubCategoria", SqlDbType.NVarChar).Value = CveSubCategoria + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la subcategoria", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "Documentos" + Public Function GetDocumento(CveDocumento As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveDocumento", SqlDbType.Int).Value = CveDocumento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddDocumento(CveSubCategoria As Integer, Descripcion As String, Observacion As String, Version As String, CveEstatus As Integer, ArchivoFisico As String, + Responsable As String, FechaAprobacion As Date, CveDocumentoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubCategoria", SqlDbType.Int).Value = CveSubCategoria + .Add("@Descripcion", SqlDbType.NVarChar).Value = Descripcion + .Add("@Observacion", SqlDbType.NVarChar).Value = Observacion + .Add("@Version", SqlDbType.NVarChar).Value = Version + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@ArchivoFisico", SqlDbType.NVarChar).Value = ArchivoFisico + .Add("@Responsable", SqlDbType.NVarChar).Value = Responsable + .Add("@FechaAprobacion", SqlDbType.Date).Value = FechaAprobacion + .Add("@CveDocumentoPadre", SqlDbType.Int).Value = CveDocumentoPadre + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateDocumento(CveDocumento As Integer, CveSubCategoria As Integer, Descripcion As String, Observacion As String, Version As String, CveEstatus As Integer, ArchivoFisico As String, + Responsable As String, FechaAprobacion As Date, CveDocumentoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveDocumento", SqlDbType.Int).Value = CveDocumento + .Add("@CveSubCategoria", SqlDbType.Int).Value = CveSubCategoria + .Add("@Descripcion", SqlDbType.NVarChar).Value = Descripcion + .Add("@Observacion", SqlDbType.NVarChar).Value = Observacion + .Add("@Version", SqlDbType.NVarChar).Value = Version + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@ArchivoFisico", SqlDbType.NVarChar).Value = ArchivoFisico + .Add("@Responsable", SqlDbType.NVarChar).Value = Responsable + .Add("@FechaAprobacion", SqlDbType.Date).Value = FechaAprobacion + .Add("@CveDocumentoPadre", SqlDbType.Int).Value = CveDocumentoPadre + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveDocumento(CveDocumento As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveDocumento", SqlDbType.Int).Value = CveDocumento + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#End Region ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 9a4c0c915..5e207a0c5 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4552,6 +4552,8 @@ Public Class ClsPaginas PaginaDict.Add("/OI/RepDesarrollo.aspx".ToUpper(), 475) PaginaDict.Add("/OI/DesarrolloWizard.aspx".ToUpper(), 474) PaginaDict.Add("/OI/SubidasADS.aspx".ToUpper(), 476) + PaginaDict.Add("/OI/CatDocumentoCategoria.aspx".ToUpper(), 760) + PaginaDict.Add("/OI/CatDocumentoSubCategoria.aspx".ToUpper(), 761) #End Region #Region "Planeacion" 'PLANEACIÓN diff --git a/OI/CatDocumentoCategoria.aspx b/OI/CatDocumentoCategoria.aspx new file mode 100644 index 000000000..e935eec64 --- /dev/null +++ b/OI/CatDocumentoCategoria.aspx @@ -0,0 +1,76 @@ +<%@ Page Title="OI - Catálogo de Categorías de Documentos" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatDocumentoCategoria.aspx.cs" Inherits="OI_CatDocumentoCategoria" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Categorías de Documentos + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + <%----%> + + + + + + + + + + + diff --git a/OI/CatDocumentoCategoria.aspx.cs b/OI/CatDocumentoCategoria.aspx.cs new file mode 100644 index 000000000..8efdf08c4 --- /dev/null +++ b/OI/CatDocumentoCategoria.aspx.cs @@ -0,0 +1,104 @@ +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 OI_CatDocumentoCategoria : ClsPaginas +{ + + private int CveCategoria + { + get + { + return ViewState["CveCategoria"].ToString().ToEntero(); + } + + set + { + ViewState["CveCategoria"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumentoCategoria()) + { + GvDatos.DataSource = ObjOI.DtResultados; + GvDatos.DataBind(); + } + ObjOI.Dispose(); + } + + protected void BtnAgregarCategoria_Click(object sender, EventArgs e) + { + BtnAgregarCategoriaDoc.Text = "Agregar"; + TxtCategoria.Text = ""; + ChkEstatus.Checked = true; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarCategoriaDoc.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCategoria = GvRow.DataKey("CveCategoria").ToEntero(); + TxtCategoria.Text = GvRow.DataKey("Categoria"); + ChkEstatus.Checked = GvRow.DataKey("Estado").ToString() == "True"; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCategoria = GvRow.DataKey("CveCategoria").ToEntero(); + ClsCompras ObjCompras = new ClsCompras(); + if (ObjCompras.RemoveTipoGasto(CveCategoria)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se eliminó la Categoría de Documento correctamente"); + } + ObjCompras.Dispose(); + } + + protected void BtnAgregarCategoriaDoc_Click(object sender, EventArgs e) + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (BtnAgregarCategoriaDoc.Text == "Agregar") + { + if (ObjOI.AddDocumentoCategoria(TxtCategoria.Text,ChkEstatus.Checked)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se agregó la Categoría de Documento correctamente"); + } + }else + { + if (ObjOI.UpdateDocumentoCategoria(CveCategoria,TxtCategoria.Text,ChkEstatus.Checked)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se actualizó la Categoría de Documento correctamente"); + } + } + ObjOI.Dispose(); + } +} \ No newline at end of file diff --git a/OI/CatDocumentoSubCategoria.aspx b/OI/CatDocumentoSubCategoria.aspx new file mode 100644 index 000000000..a7986a1bd --- /dev/null +++ b/OI/CatDocumentoSubCategoria.aspx @@ -0,0 +1,76 @@ +<%@ Page Title="OI - Catálogo de Subcategorías de Documentos" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatDocumentoSubCategoria.aspx.cs" Inherits="OI_CatDocumentoSubCategoria" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Subcategorías de Documentos + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + <%----%> + + + + + + + + + + + diff --git a/OI/CatDocumentoSubCategoria.aspx.cs b/OI/CatDocumentoSubCategoria.aspx.cs new file mode 100644 index 000000000..709f6e89a --- /dev/null +++ b/OI/CatDocumentoSubCategoria.aspx.cs @@ -0,0 +1,114 @@ +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 OI_CatDocumentoSubCategoria : ClsPaginas +{ + private int CveSubCategoria + { + get + { + return ViewState["CveSubCategoria"].ToString().ToEntero(); + } + + set + { + ViewState["CveSubCategoria"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + CargaCategoria(); + } + } + + private void CargaDatos() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumentoSubCategoria()) + { + GvDatos.DataSource = ObjOI.DtResultados; + GvDatos.DataBind(); + } + ObjOI.Dispose(); + } + + private void CargaCategoria() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumentoCategoria()) + { + DdlCategorias.DataSource = ObjOI.DtResultados.FiltraParametros("Estado = 1"); + DdlCategorias.DataBind(); + } + ObjOI.Dispose(); + } + + protected void BtnAgregarSubCategoria_Click(object sender, EventArgs e) + { + BtnAgregarSubCategoriaDoc.Text = "Agregar"; + TxtSubCategoria.Text = ""; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarSubCategoriaDoc.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveSubCategoria = GvRow.DataKey("CveSubCategoria").ToEntero(); + TxtSubCategoria.Text = GvRow.DataKey("SubCategoria"); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveSubCategoria = GvRow.DataKey("CveSubCategoria").ToEntero(); + ClsCompras ObjCompras = new ClsCompras(); + if (ObjCompras.RemoveTipoGasto(CveSubCategoria)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se eliminó la Categoría de Documento correctamente"); + } + ObjCompras.Dispose(); + } + + protected void BtnAgregarSubCategoriaDoc_Click(object sender, EventArgs e) + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (BtnAgregarSubCategoriaDoc.Text == "Agregar") + { + if (ObjOI.AddDocumentoSubCategoria(TxtSubCategoria.Text, DdlCategorias.SelectedValue.ToEntero())) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se agregó la Categoría de Documento correctamente"); + } + } + else + { + if (ObjOI.UpdateDocumentoSubCategoria(CveSubCategoria, TxtSubCategoria.Text, DdlCategorias.SelectedValue.ToEntero())) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se actualizó la Categoría de Documento correctamente"); + } + } + ObjOI.Dispose(); + } +} \ No newline at end of file diff --git a/OI/Documentos.aspx b/OI/Documentos.aspx new file mode 100644 index 000000000..31ddb86a4 --- /dev/null +++ b/OI/Documentos.aspx @@ -0,0 +1,49 @@ +<%@ Page Title="OI - Documentos" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Documentos.aspx.cs" Inherits="OI_Documentos" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Documentos + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + diff --git a/OI/Documentos.aspx.cs b/OI/Documentos.aspx.cs new file mode 100644 index 000000000..e087c71c9 --- /dev/null +++ b/OI/Documentos.aspx.cs @@ -0,0 +1,30 @@ +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 OI_Documentos : ClsPaginas +{ + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumento(-1,UsuarioActual.CveEmpresa)) + { + GvDatos.DataSource = ObjOI.DtResultados; + GvDatos.DataBind(); + } + ObjOI.Dispose(); + } +} \ No newline at end of file From aaed1507dffb78e3974da8722f684e469ade8968 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Fri, 17 Jul 2020 15:31:07 -0700 Subject: [PATCH 02/11] - --- App_Code/ClsPaginas.vb | 2 ++ OI/DocumentoDetalle.aspx | 33 +++++++++++++++++++++++++++++++++ OI/DocumentoDetalle.aspx.cs | 16 ++++++++++++++++ OI/Documentos.aspx | 11 ++++++++--- 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 OI/DocumentoDetalle.aspx create mode 100644 OI/DocumentoDetalle.aspx.cs diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 5e207a0c5..724b8b4e4 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4554,6 +4554,8 @@ Public Class ClsPaginas PaginaDict.Add("/OI/SubidasADS.aspx".ToUpper(), 476) PaginaDict.Add("/OI/CatDocumentoCategoria.aspx".ToUpper(), 760) PaginaDict.Add("/OI/CatDocumentoSubCategoria.aspx".ToUpper(), 761) + PaginaDict.Add("/OI/Documentos.aspx".ToUpper(), 762) + PaginaDict.Add("/OI/DocumentoDetalle.aspx".ToUpper(), 763) #End Region #Region "Planeacion" 'PLANEACIÓN diff --git a/OI/DocumentoDetalle.aspx b/OI/DocumentoDetalle.aspx new file mode 100644 index 000000000..c68c94b1e --- /dev/null +++ b/OI/DocumentoDetalle.aspx @@ -0,0 +1,33 @@ +<%@ Page Title="OI - Documentos detalle" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="DocumentoDetalle.aspx.cs" Inherits="OI_DocumentoDetalle" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Documentos detalle + + + + + <%--
  • + +
  • +
  • + Imprimir PDF +
  • +
  • + Imprimir Excel +
  • --%> +
    +
    +
    + + + + + + \ No newline at end of file diff --git a/OI/DocumentoDetalle.aspx.cs b/OI/DocumentoDetalle.aspx.cs new file mode 100644 index 000000000..bc578cd90 --- /dev/null +++ b/OI/DocumentoDetalle.aspx.cs @@ -0,0 +1,16 @@ +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 OI_DocumentoDetalle : ClsPaginas +{ + protected void Page_Load(object sender, EventArgs e) + { + + } +} \ No newline at end of file diff --git a/OI/Documentos.aspx b/OI/Documentos.aspx index 31ddb86a4..724ec70d8 100644 --- a/OI/Documentos.aspx +++ b/OI/Documentos.aspx @@ -16,15 +16,20 @@
  • - +
  • + Imprimir PDF +
  • +
  • + Imprimir Excel +
  • - From 1868bffe8c21ca98ed41a9082471a6e4d2de51fa Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Mon, 20 Jul 2020 18:22:26 -0700 Subject: [PATCH 03/11] avance de insert y update --- App_Code/ClsOIEventos.vb | 52 +++++++- OI/DocumentoDetalle.aspx | 93 ++++++++++++- OI/DocumentoDetalle.aspx.cs | 253 +++++++++++++++++++++++++++++++++++- 3 files changed, 391 insertions(+), 7 deletions(-) diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 8a65a1f30..4e36ab9e0 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -2944,9 +2944,9 @@ Public Class ClsOIEventos End Function Public Function AddDocumento(CveSubCategoria As Integer, Descripcion As String, Observacion As String, Version As String, CveEstatus As Integer, ArchivoFisico As String, - Responsable As String, FechaAprobacion As Date, CveDocumentoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Responsable As String, CveDocumentoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Integer - Dim Retorno As Boolean = False + Dim Retorno As Integer = -1 DataAdapter("PA_OI_DocumentosAdd") @@ -2958,15 +2958,15 @@ Public Class ClsOIEventos .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus .Add("@ArchivoFisico", SqlDbType.NVarChar).Value = ArchivoFisico .Add("@Responsable", SqlDbType.NVarChar).Value = Responsable - .Add("@FechaAprobacion", SqlDbType.Date).Value = FechaAprobacion .Add("@CveDocumentoPadre", SqlDbType.Int).Value = CveDocumentoPadre .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveDocumento", SqlDbType.Int).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - Retorno = True + Retorno = SqlAdapter.SelectCommand.Parameters("@CveDocumento").Value.ToString().ToEntero() Catch ex As Exception OnError("Ocurrió un error al agregar el Documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try @@ -3027,6 +3027,50 @@ Public Class ClsOIEventos End Function #End Region +#Region "OI_DocumentosAutorizacion" + Public Function AddDocumentoAutorizacion(CveDocumento As Integer, CveUsuario As Integer, Adjunto As String) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("OI_DocumentosAutorizacionesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveDocumento", SqlDbType.Int).Value = CveDocumento + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Adjunto", SqlDbType.NVarChar).Value = Adjunto + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el usuario para autorizar el documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetDocumentoAutorizacion(CveDocumento As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_DocumentosAutorizacionesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveDocumento", SqlDbType.Int).Value = CveDocumento + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el usuario o usuarios para autorizar el documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + #End Region ' IDisposable diff --git a/OI/DocumentoDetalle.aspx b/OI/DocumentoDetalle.aspx index c68c94b1e..f84a72807 100644 --- a/OI/DocumentoDetalle.aspx +++ b/OI/DocumentoDetalle.aspx @@ -26,8 +26,97 @@ - + + +
    +
    + + +
    +
    + + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + +
    +
    +
    + + +
    +
    +
    + + +
    +
    +

    +
    + " style="display: inline-block; margin-right: -20px; width: 150px; height: 25px; border-color: #89C4F4; border:1px solid #e5e5e5" /> + " class="btn btn-circle btn-sm label-info"> +
    + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    - \ No newline at end of file + diff --git a/OI/DocumentoDetalle.aspx.cs b/OI/DocumentoDetalle.aspx.cs index bc578cd90..315d1512b 100644 --- a/OI/DocumentoDetalle.aspx.cs +++ b/OI/DocumentoDetalle.aspx.cs @@ -6,11 +6,262 @@ using System.Web.UI; using System.Web.UI.WebControls; using Extensiones; using System.Data; +using System.IO; public partial class OI_DocumentoDetalle : ClsPaginas { + private int CveDocumento + { + get + { + return ViewState["CveDocumento"].ToString().ToEntero(); + } + + set + { + ViewState["CveDocumento"] = value; + } + } + + private string ErrorMensaje + { + get + { + return ViewState["ErrorMensaje"].ToString(); + } + + set + { + ViewState["ErrorMensaje"] = value; + } + } + protected void Page_Load(object sender, EventArgs e) { - + if (!IsPostBack) + { + //CargarUsuarios(); + //CargarSubCategoria(); + //CargarResponsable(); + //CargarCveDocumento(); + //if (this.CveDocumento > 0) + //{ + // CargarDocumentoYaExistente(); + // CargarUsuariosAutorizo(); + // ConfiguracionActualizar(); + //} + Cargar(); + } } + #region "CARGAS" + private void CargarCveDocumento() + { + string CveDocumentoAux = Page.Request["CveDocumento"]; + if (CveDocumentoAux != null) + { + this.CveDocumento = CveDocumentoAux.ToEntero(); + } + else + { + this.CveDocumento = -1; + } + } + + private void CargarUsuarios() + { + GvUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa); + GvUsuarios.DataBind(); + } + + private void CargarSubCategoria() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumentoSubCategoria()) + { + DdlSubCategoria.DataSource = ObjOI.DtResultados; + DdlSubCategoria.DataBind(); + } + ObjOI.Dispose(); + } + + private void CargarResponsable() + { + TxtResponsable.Text = UsuarioActual.Nombre; + } + + private void CargarDocumentoYaExistente() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumento(this.CveDocumento, UsuarioActual.CveEmpresa)) + { + if (ObjOI.DtResultados.Rows.Count > 0) + { + DataRow Documento = ObjOI.DtResultados.Rows[0]; + + TxtDescripcion.Text = Documento["Descripcion"].ToString(); + DdlSubCategoria.SelectedValue = Documento["CveSubCategoria"].ToString(); + DdlEstatus.SelectedValue = Documento["CveEstatus"].ToString(); + TxtVersion.Text = Documento["Version"].ToString(); + TxtResponsable.Text = Documento["Responsable"].ToString(); + TxtObs.InnerText = Documento["Observacion"].ToString(); + + } + } + ObjOI.Dispose(); + } + + private void CargarUsuariosAutorizo() + { + ClsOIEventos ObjOI = new ClsOIEventos(); + if (ObjOI.GetDocumentoAutorizacion(this.CveDocumento)) + { + DataTable UsuariosAutorizo = ObjOI.DtResultados; + GridViewRowCollection UsuariosRowCollection = GvUsuarios.Rows; + foreach (GridViewRow UsuarioRow in UsuariosRowCollection) + { + int CveUsuarioRow = UsuarioRow.DataKey("CveUsuario").ToEntero(); + UsuarioRow.FCCheckBox("ChkUnir").Checked = UsuariosAutorizo.COUNT("CveUsuario", string.Format("CveUsuario = {0}", CveUsuarioRow)) > 0; + } + } + ObjOI.Dispose(); + } + + private void ConfiguracionActualizar() + { + LkbGuardar.Text = "Actualizar"; + } + + private void Cargar() + { + CargarUsuarios(); + CargarSubCategoria(); + CargarResponsable(); + CargarCveDocumento(); + if (this.CveDocumento > 0) + { + CargarDocumentoYaExistente(); + CargarUsuariosAutorizo(); + ConfiguracionActualizar(); + } + } + #endregion + + #region "GENERAR DOCUMENTO" + private string GuardarArchivo(int CveDocumento) + { + string RutaArchivo = "-1"; + List Filesgral = TxtDocumentoFile.getfiles().Archivos; + + foreach (Archivo fileItem in Filesgral) + { + try + { + string Version = TxtVersion.Text; + string NombreArchivo = fileItem.filenameO; + //Preparamos la ruta donde moveremos el archivo cargado + string NombreArchivoGuardado = string.Format("{0}_{1}_{2}", CveDocumento, Version, NombreArchivo); + string RutaDestino = UsuarioActual.Empresa.Ruta + @"DocumentosRepo\" + NombreArchivoGuardado; + + //Si no existe la carpeta donde se guardan se crea + if (!Directory.Exists(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo")) + { + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo"); + } + //Movemos el archivo de la carpeta temporal hacia la carpeta de la empresa + System.IO.File.Move(fileItem.FileUrl, RutaDestino); + RutaArchivo = RutaDestino; + } + catch (Exception e) + { + Alert(e.Message); + } + } + return RutaArchivo; + } + + 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"; + + 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) { GuardarUsuariosQueAutorizan(CveDocumento, RutaArchivo, ref ObjOI, ref TieneError); }//asignamos a los usuarios que participaran en aprovar este documento + + + //Gestión de errores y resultados + if (!TieneError) + { + ObjOI.Commit(); + Alert("Documento guardado correctamente"); + } + else + { + ObjOI.RollBack(); + Alert(this.ErrorMensaje, ModExtensiones.TipoMensaje.MsgError); + this.CveDocumento = CveDocumento; + Cargar(); + UpCliente.Update(); + } + ObjOI.Dispose(); + } + + private int GuardarDocumento(ref ClsOIEventos ObjOI, ref bool TieneError) + { + int CveDocumentoPadre = this.CveDocumento > 0 ? this.CveDocumento : -1; //Asociamos el nuevo insert con un CveDocumento ya generado en caso de ser una nueva versión del documento + + int CveDocumento = ObjOI.AddDocumento(DdlSubCategoria.SelectedValue.ToEntero(), TxtDescripcion.Text, TxtObs.InnerText, TxtVersion.Text, DdlEstatus.SelectedValue.ToEntero(), + "", TxtResponsable.Text, CveDocumentoPadre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); + if (!(CveDocumento > 0)) + { + TieneError = true; + this.ErrorMensaje = "Hubo un error al guardr el Documento"; + } + return CveDocumento; + } + + private string AsignarArchivoAlDocumento(int CveDocumento, ref ClsOIEventos ObjOI, ref bool TieneError) + { + string RutaArchivo = GuardarArchivo(CveDocumento); + if (RutaArchivo != "-1") + { + if (!ObjOI.UpdateDocumento(CveDocumento, -1, "-1", "-1", "-1", -1, RutaArchivo, "-1", ModExtensiones.MinFecha, -1, -1, -1)) + { + TieneError = true; + this.ErrorMensaje = "Hubo un error al asignar el archivo"; + } + } + else + { + TieneError = true; + this.ErrorMensaje = "Hubo un error al guardar el archivo"; + } + return RutaArchivo; + } + + private void GuardarUsuariosQueAutorizan(int CveDocumento, string RutaArchivo, ref ClsOIEventos ObjOI, ref bool TieneError) + { + GridViewRowCollection GridUsuarios = GvUsuarios.Rows; + foreach (GridViewRow GvRow in GridUsuarios) + { + if (GvRow.FCCheckBox("ChkUnir").Checked && !TieneError) + { + int CveUsuario = GvRow.DataKey("CveUsuario").ToEntero(); + if (!ObjOI.AddDocumentoAutorizacion(CveDocumento, CveUsuario, RutaArchivo)) + { + TieneError = true; + this.ErrorMensaje = "Hubo un error al asignar los usuarios a este documento"; + break; + } + } + } + } + #endregion + + } \ No newline at end of file From 1096d1907d9591787055ca95e22e4b5aac62c5ae Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Tue, 21 Jul 2020 09:03:00 -0700 Subject: [PATCH 04/11] avance aun falta probar cosas --- OI/DocumentoDetalle.aspx | 11 ++++- OI/DocumentoDetalle.aspx.cs | 99 ++++++++++++++++++++++++++----------- 2 files changed, 78 insertions(+), 32 deletions(-) diff --git a/OI/DocumentoDetalle.aspx b/OI/DocumentoDetalle.aspx index f84a72807..fd387dcc1 100644 --- a/OI/DocumentoDetalle.aspx +++ b/OI/DocumentoDetalle.aspx @@ -72,8 +72,15 @@
    - - +
    + + + +
    +
    + + +
    diff --git a/OI/DocumentoDetalle.aspx.cs b/OI/DocumentoDetalle.aspx.cs index 315d1512b..d8a3f2ac5 100644 --- a/OI/DocumentoDetalle.aspx.cs +++ b/OI/DocumentoDetalle.aspx.cs @@ -36,20 +36,23 @@ public partial class OI_DocumentoDetalle : ClsPaginas } } + private string ArchivoAdjuntoNombre + { + get + { + return ViewState["ArchivoAdjuntoNombre"].ToString(); + } + + set + { + ViewState["ArchivoAdjuntoNombre"] = value; + } + } + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { - //CargarUsuarios(); - //CargarSubCategoria(); - //CargarResponsable(); - //CargarCveDocumento(); - //if (this.CveDocumento > 0) - //{ - // CargarDocumentoYaExistente(); - // CargarUsuariosAutorizo(); - // ConfiguracionActualizar(); - //} Cargar(); } } @@ -105,6 +108,10 @@ public partial class OI_DocumentoDetalle : ClsPaginas TxtResponsable.Text = Documento["Responsable"].ToString(); TxtObs.InnerText = Documento["Observacion"].ToString(); + ArchivoAdjuntoNombre = Documento["ArchivoFisico"].ToString(); + string[] ArchivoAux = Documento["ArchivoFisico"].ToString().Split('_'); + string ArchivoAdjunto = ArchivoAux[2]; + LkbDescargarArchivo.Text = string.Format("Descargar Archivo: {0}",ArchivoAdjunto); } } ObjOI.Dispose(); @@ -151,29 +158,31 @@ public partial class OI_DocumentoDetalle : ClsPaginas { string RutaArchivo = "-1"; List Filesgral = TxtDocumentoFile.getfiles().Archivos; - - foreach (Archivo fileItem in Filesgral) + if (TxtDocumentoFile.Text != "") { - try + foreach (Archivo fileItem in Filesgral) { - string Version = TxtVersion.Text; - string NombreArchivo = fileItem.filenameO; - //Preparamos la ruta donde moveremos el archivo cargado - string NombreArchivoGuardado = string.Format("{0}_{1}_{2}", CveDocumento, Version, NombreArchivo); - string RutaDestino = UsuarioActual.Empresa.Ruta + @"DocumentosRepo\" + NombreArchivoGuardado; - - //Si no existe la carpeta donde se guardan se crea - if (!Directory.Exists(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo")) + try { - Directory.CreateDirectory(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo"); + string Version = TxtVersion.Text; + string NombreArchivo = fileItem.filenameO; + //Preparamos la ruta donde moveremos el archivo cargado + string NombreArchivoGuardado = string.Format("{0}_{1}_{2}", CveDocumento, Version, NombreArchivo); + string RutaDestino = UsuarioActual.Empresa.Ruta + @"DocumentosRepo\" + NombreArchivoGuardado; + + //Si no existe la carpeta donde se guardan se crea + if (!Directory.Exists(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo")) + { + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo"); + } + //Movemos el archivo de la carpeta temporal hacia la carpeta de la empresa + System.IO.File.Move(fileItem.FileUrl, RutaDestino); + RutaArchivo = NombreArchivoGuardado; + } + catch (Exception e) + { + Alert(e.Message); } - //Movemos el archivo de la carpeta temporal hacia la carpeta de la empresa - System.IO.File.Move(fileItem.FileUrl, RutaDestino); - RutaArchivo = RutaDestino; - } - catch (Exception e) - { - Alert(e.Message); } } return RutaArchivo; @@ -220,7 +229,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas if (!(CveDocumento > 0)) { TieneError = true; - this.ErrorMensaje = "Hubo un error al guardr el Documento"; + this.ErrorMensaje = "Hubo un error al guardar el Documento"; } return CveDocumento; } @@ -263,5 +272,35 @@ public partial class OI_DocumentoDetalle : ClsPaginas } #endregion + #region "DESCARGAR ARCHIVO" + protected void LkbSubirNuevoArchivo_Click(object sender,EventArgs e) + { + DivDescargarArchivo.Visible = false; + DivSubirArchivo.Visible = true; + UpDerecha.Update(); + } + + protected void LkbDescargarNuevoArchivo_Click(object sender,EventArgs e) + { + DivDescargarArchivo.Visible = true; + DivSubirArchivo.Visible = false; + UpDerecha.Update(); + } + + protected void LkbDescargarArchivo_Click(object sender,EventArgs e) + { + string Ruta = string.Format("{0}Empresas/{1}/Temp/RH/{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, ArchivoAdjuntoNombre); + byte[] archivoBytes = File.ReadAllBytes(Ruta); + + HttpContext.Current.Response.Clear(); + HttpContext.Current.Response.ClearContent(); + HttpContext.Current.Response.ContentType = "application/octet-stream"; + HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", ArchivoAdjuntoNombre)); + HttpContext.Current.Response.AddHeader("Content-Length", archivoBytes.Length.ToString()); + HttpContext.Current.Response.OutputStream.Write(archivoBytes, 0, archivoBytes.Length); + HttpContext.Current.Response.End(); + } + #endregion + } \ No newline at end of file From 3a97888e3d63388b5aafff32091a1aa504f80d02 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Tue, 21 Jul 2020 11:34:26 -0700 Subject: [PATCH 05/11] error con el campo AplicaCaducidad --- Inventarios/EntradasSalidas.aspx.vb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 692b3f871..e914638ac 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -435,6 +435,7 @@ Partial Class Inventarios_EntradasSalidas dt.Columns.Add("Serie", Type.GetType("System.String")) dt.Columns.Add("Lote", Type.GetType("System.String")) dt.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime")) + dt.Columns.Add("AplicaCaducidad", Type.GetType("System.String")) dt.Columns.Add("Observaciones") dt.Columns.Add("CountMovimientoEntradaDetalle") @@ -1256,6 +1257,7 @@ Partial Class Inventarios_EntradasSalidas registro.Item("Lote") = If(Lote <> "", Lote, "") registro.Item("FechaCaducidad") = FechaCaducidad registro.Item("Observaciones") = Observaciones + registro.Item("AplicaCaducidad") = RowPS("AplicaCaducidad").ToString DtMovimientos.Rows.Add(registro) CargaGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' ")) RegistraScript("playsonidito('beep-07.wav')") From 021b3bbd50dfa75f2003b9e5672a91152695b6ae Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 21 Jul 2020 14:16:37 -0700 Subject: [PATCH 06/11] - ajuste de actualizar un dato registrado --- Inventarios/EntradasSalidas.aspx | 2 +- Inventarios/EntradasSalidas.aspx.vb | 67 +++++++++++++++++------------ 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/Inventarios/EntradasSalidas.aspx b/Inventarios/EntradasSalidas.aspx index c1fabff01..6353557d1 100644 --- a/Inventarios/EntradasSalidas.aspx +++ b/Inventarios/EntradasSalidas.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntradasSalidas.aspx.vb" Inherits="Inventarios_EntradasSalidas" EnableEventValidation="false" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntradasSalidas.aspx.vb" Inherits="Inventarios_EntradasSalidas" EnableEventValidation="false" %> <%@ Register Assembly="eWorld.UI" Namespace="eWorld.UI" TagPrefix="ew" %> diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 3b96f7cd6..f297ce97f 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1146,7 +1146,12 @@ Partial Class Inventarios_EntradasSalidas ' AgregarPS() 'End Sub Protected Sub LkAgregarDetalle_Click(sender As Object, e As EventArgs) Handles LkAgregarDetalle.Click - AgregarPS() + If CveMovimientoDetalleEdit > 0 Then + ActualizarPS() + Else + AgregarPS() + End If + End Sub Protected Sub BtnSerieAddNew_Click(sender As Object, e As EventArgs) AgregarPS() @@ -1197,7 +1202,7 @@ Partial Class Inventarios_EntradasSalidas If CveMetodoInventario = 5 And (String.IsNullOrEmpty(SerieLote.Trim()) OrElse SerieLote = "-1") Then Valido = False - Alert("El producto requiere Serie-Lote", TipoMensaje.MsgAdvertencia) + Alert("El producto requiere Serie", TipoMensaje.MsgAdvertencia) End If 'salida @@ -2364,14 +2369,17 @@ Partial Class Inventarios_EntradasSalidas End If End Sub Protected Sub GvM_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvM.RowEditing - GvM.EditIndex = e.NewEditIndex + Dim i As Integer = e.NewEditIndex + GvM.EditIndex = i + Dim Gv As GridView = DirectCast(sender, GridView) - Dim GvRow As GridViewRow = Gv.Rows(0) + Dim GvRow As GridViewRow = Gv.Rows(i) If CveMovimiento > 0 Then CveMovimientoDetalleEdit = GvRow.DataKey("CveMovimientoDetalle").ToEntero - divCantidad.Visible = False - divClasificacionProducto.Visible = False - divUnidadMedida.Visible = False + txtCantidad.Enabled = False + DdlClasificacion.Enabled = False + DdlProducto2.Enabled = False + DdlUnidad.Enabled = False End If txtCantidad.Text = GvRow.DataKey("Cantidad").ToEntero().ToString DdlProducto2.SelectedValue = GvRow.DataKey("CvePS") @@ -2429,30 +2437,30 @@ Partial Class Inventarios_EntradasSalidas End Sub Protected Sub GvM_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvM.RowUpdating - Dim Precio As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDouble - Dim No As Integer = GvM.Rows(e.RowIndex).DataKey("No").ToEntero - Dim serie As String = GvM.Rows(e.RowIndex).FCTextBox("TxtSerie").Text.Replace(" ", String.Empty) - Dim Observaciones As String = GvM.Rows(e.RowIndex).FCTextBox("TxtObservaciones").Text - Dim CveSeccionAlmacen As Integer = GvM.Rows(e.RowIndex).FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero - Dim SeccionAlmacen As String = GvM.Rows(e.RowIndex).FCDropDownList("DdlSeccionAlmacen").SelectedItem.Text - Dim Cantidad As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDouble - Dim Drs As DataRow() = DtMovimientos.Select(String.Format("No = {0}", No)) + 'Dim Precio As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDouble + 'Dim No As Integer = GvM.Rows(e.RowIndex).DataKey("No").ToEntero + 'Dim serie As String = GvM.Rows(e.RowIndex).FCTextBox("TxtSerie").Text.Replace(" ", String.Empty) + 'Dim Observaciones As String = GvM.Rows(e.RowIndex).FCTextBox("TxtObservaciones").Text + 'Dim CveSeccionAlmacen As Integer = GvM.Rows(e.RowIndex).FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero + 'Dim SeccionAlmacen As String = GvM.Rows(e.RowIndex).FCDropDownList("DdlSeccionAlmacen").SelectedItem.Text + 'Dim Cantidad As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDouble + 'Dim Drs As DataRow() = DtMovimientos.Select(String.Format("No = {0}", No)) - If Drs.Count > 0 Then - Drs(0)("Cantidad") = Cantidad - Drs(0)("PU") = Precio - Drs(0)("Total") = Drs(0)("Cantidad").ToString.ToDouble * Precio - Drs(0)("Estatus") = "U" - Drs(0)("Serie") = serie - Drs(0)("Observaciones") = Observaciones - Drs(0)("CveSeccionAlmacen") = CveSeccionAlmacen - Drs(0)("SeccionAlmacen") = SeccionAlmacen - End If + 'If Drs.Count > 0 Then + ' Drs(0)("Cantidad") = Cantidad + ' Drs(0)("PU") = Precio + ' Drs(0)("Total") = Drs(0)("Cantidad").ToString.ToDouble * Precio + ' Drs(0)("Estatus") = "U" + ' Drs(0)("Serie") = serie + ' Drs(0)("Observaciones") = Observaciones + ' Drs(0)("CveSeccionAlmacen") = CveSeccionAlmacen + ' Drs(0)("SeccionAlmacen") = SeccionAlmacen + 'End If - DtMovimientos.AcceptChanges() - GvM.EditIndex = -1 + 'DtMovimientos.AcceptChanges() + 'GvM.EditIndex = -1 - CargaGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' ")) + 'CargaGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' ")) End Sub Protected Sub DeleteRow(ByVal sender As Object, ByVal e As EventArgs) @@ -4301,11 +4309,14 @@ Partial Class Inventarios_EntradasSalidas End Sub Private Sub ActualizarPS() + Dim ObjInventario As New ClsInventarios If Not ObjInventario.UpdateMovimientoDetalle(txtCantidad.Text.ToDouble, DdlUnidad.ToEntero, DdlProducto2.SelectedValue.ToEntero, txtPrecio.Text.ToDouble, CveAFEdit, CveMovimientoDetalleEdit, DdlSeccionAlmacen.SelectedValue.ToEntero, TxtnSerie.Text, TxtObservacionesdetalle.Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then Alert("Error al Actualizar los movimientos") + Else + RegistraScript("$('#ModalAgregar').modal('hide')") End If ObjInventario.Dispose() End Sub From 40de8a7e6c02143a31e65b3a2965223adeee7be4 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Tue, 21 Jul 2020 15:47:55 -0700 Subject: [PATCH 07/11] update listo --- OI/DocumentoDetalle.aspx | 10 ++-- OI/DocumentoDetalle.aspx.cs | 93 +++++++++++++++++-------------------- 2 files changed, 49 insertions(+), 54 deletions(-) diff --git a/OI/DocumentoDetalle.aspx b/OI/DocumentoDetalle.aspx index fd387dcc1..ad0062d3e 100644 --- a/OI/DocumentoDetalle.aspx +++ b/OI/DocumentoDetalle.aspx @@ -72,17 +72,19 @@
    -
    +
    -
    -
    +
    + -
    + + + diff --git a/OI/DocumentoDetalle.aspx.cs b/OI/DocumentoDetalle.aspx.cs index d8a3f2ac5..23c3b49e7 100644 --- a/OI/DocumentoDetalle.aspx.cs +++ b/OI/DocumentoDetalle.aspx.cs @@ -110,8 +110,9 @@ public partial class OI_DocumentoDetalle : ClsPaginas ArchivoAdjuntoNombre = Documento["ArchivoFisico"].ToString(); string[] ArchivoAux = Documento["ArchivoFisico"].ToString().Split('_'); - string ArchivoAdjunto = ArchivoAux[2]; - LkbDescargarArchivo.Text = string.Format("Descargar Archivo: {0}",ArchivoAdjunto); + string ArchivoAdjunto = ArchivoAux[1]; + LkbDescargarArchivo.Text = ArchivoAdjunto; + DivDescargarArchivo.Visible = true; } } ObjOI.Dispose(); @@ -154,39 +155,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas #endregion #region "GENERAR DOCUMENTO" - private string GuardarArchivo(int CveDocumento) - { - string RutaArchivo = "-1"; - List Filesgral = TxtDocumentoFile.getfiles().Archivos; - if (TxtDocumentoFile.Text != "") - { - foreach (Archivo fileItem in Filesgral) - { - try - { - string Version = TxtVersion.Text; - string NombreArchivo = fileItem.filenameO; - //Preparamos la ruta donde moveremos el archivo cargado - string NombreArchivoGuardado = string.Format("{0}_{1}_{2}", CveDocumento, Version, NombreArchivo); - string RutaDestino = UsuarioActual.Empresa.Ruta + @"DocumentosRepo\" + NombreArchivoGuardado; - - //Si no existe la carpeta donde se guardan se crea - if (!Directory.Exists(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo")) - { - Directory.CreateDirectory(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo"); - } - //Movemos el archivo de la carpeta temporal hacia la carpeta de la empresa - System.IO.File.Move(fileItem.FileUrl, RutaDestino); - RutaArchivo = NombreArchivoGuardado; - } - catch (Exception e) - { - Alert(e.Message); - } - } - } - return RutaArchivo; - } + protected void LblGuardar_Click(object sender, EventArgs e) { @@ -208,13 +177,13 @@ public partial class OI_DocumentoDetalle : ClsPaginas { ObjOI.Commit(); Alert("Documento guardado correctamente"); + //this.CveDocumento = CveDocumento; + Response.Redirect(string.Format("/OI/DocumentoDetalle.aspx?CveDocumento={0}",CveDocumento)); } else { ObjOI.RollBack(); Alert(this.ErrorMensaje, ModExtensiones.TipoMensaje.MsgError); - this.CveDocumento = CveDocumento; - Cargar(); UpCliente.Update(); } ObjOI.Dispose(); @@ -236,6 +205,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas private string AsignarArchivoAlDocumento(int CveDocumento, ref ClsOIEventos ObjOI, ref bool TieneError) { + string RutaArchivo = GuardarArchivo(CveDocumento); if (RutaArchivo != "-1") { @@ -245,7 +215,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas this.ErrorMensaje = "Hubo un error al asignar el archivo"; } } - else + else if(RutaArchivo == "Error") { TieneError = true; this.ErrorMensaje = "Hubo un error al guardar el archivo"; @@ -272,24 +242,47 @@ public partial class OI_DocumentoDetalle : ClsPaginas } #endregion - #region "DESCARGAR ARCHIVO" - protected void LkbSubirNuevoArchivo_Click(object sender,EventArgs e) + #region "ARCHIVO ADJUNTO" + private string GuardarArchivo(int CveDocumento) { - DivDescargarArchivo.Visible = false; - DivSubirArchivo.Visible = true; - UpDerecha.Update(); + string RutaArchivo = "-1"; + List Filesgral = TxtDocumentoFile.getfiles().Archivos; + if (TxtDocumentoFile.Text != "[]") + { + foreach (Archivo fileItem in Filesgral) + { + try + { + string Version = TxtVersion.Text; + string NombreArchivo = fileItem.filenameO; + //Preparamos la ruta donde moveremos el archivo cargado + string NombreArchivoGuardado = string.Format("{0}_{1}", CveDocumento, NombreArchivo); + string RutaDestino = UsuarioActual.Empresa.Ruta + @"DocumentosRepo\" + NombreArchivoGuardado; + + //Si no existe la carpeta donde se guardan se crea + if (!Directory.Exists(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo")) + { + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta + @"\DocumentosRepo"); + } + //Movemos el archivo de la carpeta temporal hacia la carpeta de la empresa + System.IO.File.Move(fileItem.FileUrl, RutaDestino); + RutaArchivo = NombreArchivoGuardado; + } + catch (Exception e) + { + Alert(e.Message); + RutaArchivo = "Error"; + } + } + } + return RutaArchivo; } - protected void LkbDescargarNuevoArchivo_Click(object sender,EventArgs e) - { - DivDescargarArchivo.Visible = true; - DivSubirArchivo.Visible = false; - UpDerecha.Update(); - } + protected void LkbDescargarArchivo_Click(object sender,EventArgs e) { - string Ruta = string.Format("{0}Empresas/{1}/Temp/RH/{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, ArchivoAdjuntoNombre); + string Ruta = string.Format("{0}Empresas/{1}/DocumentosRepo/{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, ArchivoAdjuntoNombre); byte[] archivoBytes = File.ReadAllBytes(Ruta); HttpContext.Current.Response.Clear(); From d8dc66900b852286b9e69cc95d34867f1d5fdbba Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Tue, 21 Jul 2020 19:27:50 -0700 Subject: [PATCH 08/11] integrando el endpoint para descargar las firmas --- TareasProgramadas/Tareas72.ashx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/TareasProgramadas/Tareas72.ashx b/TareasProgramadas/Tareas72.ashx index 1edc5d88a..f3d4ba7aa 100644 --- a/TareasProgramadas/Tareas72.ashx +++ b/TareasProgramadas/Tareas72.ashx @@ -66,13 +66,31 @@ public class Tareas72 : IHttpHandler string JsonStringFormat = JsonString.Replace("Resultado(", "{\"Resultado\":").Replace(")", "}"); DataSet dataSet = JsonConvert.DeserializeObject(JsonStringFormat); DataTable dataTable = dataSet.Tables["Resultado"]; - if (dataTable.Rows[0]["eventoId"].ToString() == "Hdc") + string eventoId = dataTable.Rows[0]["eventoId"].ToString(); + if (eventoId == "Hdc" | eventoId == "HDC") { int EstatusEntregado = 3; //MANDAMOS A ACTUALIZAR CON ESTATUS DE ENTREGADO if (ObjGenerales.UpdatePaqueteriasGuias(CvePaqueteriaGuia, -1, -1, -1, EstatusEntregado, "-1", "", "", -1, -1, "-1", "-1", "")) { + #region 'DESCARGAR IMAGEN' + string rastreo = Guia["Rastreo"].ToString(); + string uriConsultaFirma = string.Format("https://cc.paquetexpress.com.mx/ptxws/rest/api/v1/entrega/firma/{0}/@1@2@3@4@5", rastreo); + + HttpClient ClientFirma = new HttpClient(); + HttpResponseMessage ResponseMessageFirma = ClientFirma.GetAsync(uriConsultaFirma).Result; + string JsonStringFirma = ResponseMessageFirma.Content.ReadAsStringAsync().Result; + string JsonStringFormatFirma = JsonStringFirma.Replace("callback(", "{\"callback\":").Replace(")", "}"); + DataSet dataSetFirma = JsonConvert.DeserializeObject(JsonStringFormatFirma); + DataTable dataTableFirma = dataSetFirma.Tables["callback"]; + + string ImagenBase64 = dataTableFirma.Rows[0]["imagen"].ToString(); + byte[] ImagenByteArray = Convert.FromBase64String(ImagenBase64); + string rutaDestino = ModExtensiones.DirectorioEmpresas + "72\\" + "Documentos\\Guias\\" + CvePaqueteriaGuia + ".jpg"; + File.WriteAllBytes(rutaDestino,ImagenByteArray); + #endregion + #region 'MANDAR CORREOS' int CveCliente = Guia["CveCliente"].ToString().ToEntero(); int CveVenta = Guia["CveAgrupador"].ToString().ToEntero(); @@ -123,7 +141,7 @@ public class Tareas72 : IHttpHandler ObjVentas.Dispose(); ObjVendedores.Dispose(); ObjEmpresa.Dispose(); - return false; + return retorno; } public bool IsReusable From d9f3fb126104f5c2f80aa8df72ae08db70a9dedc Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Tue, 21 Jul 2020 19:44:12 -0700 Subject: [PATCH 09/11] =?UTF-8?q?correcci=C3=B3n=20de=20ortograf=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RH/Personal.aspx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RH/Personal.aspx b/RH/Personal.aspx index b9c257e6c..fdad5f44e 100644 --- a/RH/Personal.aspx +++ b/RH/Personal.aspx @@ -4614,7 +4614,7 @@ - +