diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 07b14f13b..87f743432 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5175,7 +5175,7 @@ Public Class ClsPaginas sw.Start() Dim Bytes As Byte() = Nothing - Dim bdir As String = ModExtensiones.DirectorioBaseEmpresas + Dim bdir As String = If(RutaReporte.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory) RutaReporte.Replace("/", "\") If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then RutaReporte = String.Format("{0}{1}", bdir, RutaReporte) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index f06c81603..e9e3f36b6 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -140,7 +140,7 @@ Namespace Extensiones Dim MensajeFormato = $"{Chr(13)}{Chr(10)}Log: {Mensaje} | Fecha:{Now.ToString("dd/MM/yyyy HH:mm")}" Try - ArchivoW = New StreamWriter($"{ModExtensiones.DirectorioBaseEmpresas}\Log\{Archivo}.txt", True, System.Text.Encoding.UTF8) + ArchivoW = New StreamWriter($"{AppDomain.CurrentDomain.BaseDirectory}\Log\{Archivo}.txt", True, System.Text.Encoding.UTF8) Catch ex As UnauthorizedAccessException 'Alert("No hay permisos para guardar en el Log.", Extensiones.TipoMensaje.MsgError) Exit Sub @@ -185,7 +185,7 @@ Namespace Extensiones Dim strLineaTMP As String strLineaTMP = String.Format("{0} {1}:{2} {3} {0}", Chr(13), DateTime.Now.ToShortDateString, DateTime.Now.ToShortTimeString, pTexto) Try - ArchivoW = New StreamWriter(String.Format("{0}\LogMail.txt", ModExtensiones.DirectorioBaseEmpresas), True, System.Text.Encoding.UTF8) + ArchivoW = New StreamWriter(String.Format("{0}\LogMail.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8) Catch ex As Exception Exit Sub End Try @@ -205,7 +205,7 @@ Namespace Extensiones ' strLineaTMP = Chr(13) & Chr(10) & Day(Now) & "/" & Month(Now) & "/" & Year(Now) & " " & Hour(Now) & ":" & Minuto & ". " & Str & Chr(13) & Chr(10) strLineaTMP = String.Format("{0}{1} .. PAC: {2} - Modulo: {3} ..{4}:{5}", Chr(13), Chr(10), CvePAC, Modulo, Str, DateTime.Now.ToShortDateString, DateTime.Now.ToShortTimeString) Try - ArchivoW = New StreamWriter(String.Format("{0}\LogTimbrado.txt", ModExtensiones.DirectorioBaseEmpresas), True, System.Text.Encoding.UTF8) + ArchivoW = New StreamWriter(String.Format("{0}\LogTimbrado.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8) Catch ex As UnauthorizedAccessException 'Alert("No hay permisos para guardar en el Log.", Extensiones.TipoMensaje.MsgError) Exit Sub @@ -228,7 +228,7 @@ Namespace Extensiones strLineaTMP = String.Format("{0} {1}:{2} {3} {0}", Chr(13), DateTime.Now.ToShortDateString, DateTime.Now.ToShortTimeString, pTexto) Try - ArchivoW = New StreamWriter(String.Format("{0}\LogCancelacionSAT.txt", ModExtensiones.DirectorioBaseEmpresas), True, System.Text.Encoding.UTF8) + ArchivoW = New StreamWriter(String.Format("{0}\LogCancelacionSAT.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8) Catch ex As Exception Exit Sub End Try @@ -1962,7 +1962,7 @@ Namespace Extensiones RecursivoLimpiaControlesExcel(GridView.Controls) style.Append(" ") page.EnableEventValidation = False @@ -2002,7 +2002,7 @@ Namespace Extensiones Dim Form As HtmlForm = New HtmlForm() style.Append(" ") RecursivoLimpiaControlesExcel(GridView.Controls) @@ -2183,16 +2183,15 @@ Namespace Extensiones worksheet.Rows(IndexEndTable).Cells(6).Value = "Fecha Impresión" worksheet.Rows(IndexEndTable + 1).Cells(6).Value = DateTime.Now.ToString("dd/MM/yyyy") - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) - - If Imagen.Exists Then - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Usuario.CveEmpresa) - Using webClient As New Net.WebClient() - Dim imageBytes = webClient.DownloadData(logouri) - Dim stream As New MemoryStream(imageBytes) - worksheet.Pictures.Add(stream, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) - 'worksheet.Pictures.Add(stream, GemBox.Spreadsheet.ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, GemBox.Document.LengthUnit.Pixel) - End Using + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) + + If Imagen.Exists Then + Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) + Using sr As New StreamReader(Ruta) + Dim ms As New MemoryStream() + sr.BaseStream.CopyTo(ms) + worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + End Using End If End If @@ -2210,7 +2209,7 @@ Namespace Extensiones Dim style As StringBuilder = New StringBuilder() style.Append(" ") 'To Export all pages 'Gv.AllowPaging = False @@ -3182,7 +3181,7 @@ Namespace Extensiones Public Property descripcion As String Public ReadOnly Property Extencion As String Get - Return IO.Path.GetExtension(String.Format("{0}{1}{2}", ModExtensiones.DirectorioBaseEmpresas, patch, filename)).Replace(".", "") + Return IO.Path.GetExtension(String.Format("{0}{1}{2}", If(patch.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory), patch, filename)).Replace(".", "") End Get End Property Public ReadOnly Property filenameO As String @@ -3192,7 +3191,7 @@ Namespace Extensiones End Property Public ReadOnly Property FileUrl As String Get - Return String.Format("{0}{1}{2}", ModExtensiones.DirectorioBaseEmpresas, patch, filename) + Return String.Format("{0}{1}{2}", If(patch.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory), patch, filename) End Get End Property End Class diff --git a/Ashx/SigFiles.ashx b/Ashx/SigFiles.ashx new file mode 100644 index 000000000..bb4a91d48 --- /dev/null +++ b/Ashx/SigFiles.ashx @@ -0,0 +1,64 @@ +<%@ WebHandler Language="C#" Class="SigFiles" %> + +using System; +using System.Web; +using Extensiones; + +public class SigFiles : IHttpHandler +{ + + public void ProcessRequest(HttpContext context) + { + //context.Response.ContentType = "text/plain"; + //context.Response.Write("Hello World"); + string path = ""; + if (context.Request["FileUrl"] != null) + { + path = string.Format("{0}{1}", ModExtensiones.DirectorioBaseEmpresas, context.Request["FileUrl"]); + } + if (context.Request["P"] != null) + { + path = string.Format("{0}{1}", ModExtensiones.DirectorioBaseEmpresas,ModExtensiones.Decripta( context.Request["P"])); + } + if (path != null && path.Length>0) + { + + try + { + if (System.IO.File.Exists(path)) + { + System.IO.FileInfo file = new System.IO.FileInfo(path); + string mimeType = "text/plain"; + try + { + mimeType = MimeMapping.GetMimeMapping(path); + } + catch (Exception) { }//si truena no existe el arhivo + context.Response.Clear(); + context.Response.ClearHeaders(); + context.Response.ClearContent(); + context.Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}"); + context.Response.AddHeader("Content-Length", file.Length.ToString()); + context.Response.ContentType = mimeType; + context.Response.Flush(); + context.Response.TransmitFile(file.FullName); + + } + } + catch (Exception ex) + { + this.GuardaLog(ex.ToString()); + } + } + context.Response.End(); + } + + public bool IsReusable + { + get + { + return false; + } + } + +} \ No newline at end of file diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index c787fdd5c..beb0c14e3 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -930,7 +930,7 @@ Partial Class Bancos_IE If ObjIE.Comprobante <> "" Then HplComprobante.Visible = True - HplComprobante.NavigateUrl = String.Format("/Empresas/{0}/IE/{1}", UsuarioActual.CveEmpresa, ObjIE.Comprobante) + HplComprobante.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta($"OP=IEComprobante&Comprobante={ObjIE.Comprobante}")) End If If CveIEDeposito > 0 Then diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 5d0a34f8c..ddb90e086 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -186,9 +186,10 @@ Partial Class PopUpVerFactura If Request("REPORTE") IsNot Nothing Then CType(Session("DTPDF"), HtmlTable).ExportToPDF("Reporte") - End If - - 'OPCIONES + End If + + 'OPCIONES + If Request("P") IsNot Nothing AndAlso Decripta((Request("P").ToString)) <> "" Then Dim UrlParametros As Hashtable = Parametros(Decripta((Request("P").ToString))) If UrlParametros("OP") IsNot Nothing AndAlso UrlParametros("OP").ToString <> "" Then @@ -235,10 +236,16 @@ Partial Class PopUpVerFactura UsuarioToken.Empresa = ObjEmpresa.Empresa End If ObjEmpresa.Dispose() - End Sub + End Sub #End Region + + Private Sub SeleccionaReporte(UrlParametros As Hashtable) + + 'DESCARGA COMPROBANTE + If UrlParametros("OP").ToString = "IEComprobante" Then + DescargaComprobante(UrlParametros) + End If - Private Sub SeleccionaReporte(UrlParametros As Hashtable) 'DESCARGA DOCUMENTO XML O PDF DE LA FACTURA COMPRA If UrlParametros("OP").ToString = "Fact" Then DescargaFactura(UrlParametros) @@ -518,11 +525,30 @@ Partial Class PopUpVerFactura ImprimirPDF("Empresas/Grales/Formatos/RepCortes.rdlc", lrds, params, "ReporteCortes", Formato) End If - End Sub - + End Sub + #End Region - + #Region " OP = FACTURA - IMPRIME COMPRA" + Private Sub DescargaComprobante(Parametros As Hashtable) + If Parametros("COMPROBANTE") IsNot Nothing Then + + Dim Path As String = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, Parametros("COMPROBANTE")) + Dim Archivo As New System.IO.FileInfo(Path) + + If Archivo.Exists Then + HttpContext.Current.Response.Clear() + HttpContext.Current.Response.ClearContent() + HttpContext.Current.Response.ContentType = "application/octet-stream" + HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name)) + HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) + HttpContext.Current.Response.TransmitFile(Path) + 'HttpContext.Current.Response.Flush() + HttpContext.Current.Response.End() + End If + Archivo = Nothing + End If + End Sub Private Sub DescargaFactura(Parametros As Hashtable) If Parametros("CVEFACTURA") IsNot Nothing AndAlso Parametros("CVEFACTURA").ToString.ToEntero > 0 Then Dim Exten As String = If(Parametros("EXT").ToString.ToLower = "xml", "xml", "pdf") diff --git a/Inventarios/KardexAlmacenHorizontal.aspx.vb b/Inventarios/KardexAlmacenHorizontal.aspx.vb index 2b5325e8f..46040fdab 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx.vb +++ b/Inventarios/KardexAlmacenHorizontal.aspx.vb @@ -246,10 +246,96 @@ Partial Class Inventarios_KardexAlmacen If DdlProveedor.SelectedValue.ToEntero > 0 Then StrFiltro.AppendFormat("Proveedor: {0},", DdlProveedor.SelectedText) If ddlProducto2.SelectedValue.ToEntero > 0 Then StrFiltro.AppendFormat(" Producto/Servicio: {0},", ddlProducto2.SelectedText) If TxtFechaF.Text <> "" Then StrFiltro.AppendFormat(" Fecha Fin: {0}", TxtFechaF.Text) - GvDatos.ExportToExcelG("ExistenciasHorizontal.xlsx", "Existencias Almacen", UsuarioActual, StrFiltro.ToString, 100, 200) + ExportToExcelG(GvDatos, "ExistenciasHorizontal.xlsx", "Existencias Almacen", UsuarioActual, StrFiltro.ToString, 100, 200) Else Alert("Debe consultar para generar un excel", TipoMensaje.MsgAdvertencia) End If + End Sub + + Public Sub ExportToExcelG(Gv As GridView, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing, Optional Filtros As String = "", Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100) + Dim sw As New StringWriter() + Dim htw As New HtmlTextWriter(sw) + Gv.RenderControl(htw) + GemBox.Spreadsheet.SpreadsheetInfo.SetLicense("ESWN-4QFD-26JF-1SZ8") + + Dim excel As GemBox.Spreadsheet.ExcelFile + Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault + Using htmlStream = New MemoryStream(options.Encoding.GetBytes(sw.ToString())) + excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream, options) + If Usuario IsNot Nothing Then + Dim TotalRowHeader As Integer = 8 + Dim TotalRowFooter As Integer = 2 + + Dim worksheet = excel.Worksheets(0) + worksheet.Rows.InsertEmpty(0, TotalRowHeader) + Dim celdasConTexto = worksheet.GetUsedCellRange(True) + celdasConTexto.Style.Font.Name = "Calibri Light" + + Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) + RangoNombreEmpresa.Merged = True + RangoNombreEmpresa.Value = Usuario.Empresa.Empresa + RangoNombreEmpresa.Style.Font.Size = 18 * 20 + RangoNombreEmpresa.Style.Font.Name = "Calibri Light" + RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) + RangoFiltros.Merged = True + RangoFiltros.Value = Filtros + RangoFiltros.Style.Font.Size = 15 * 20 + RangoFiltros.Style.Font.Name = "Calibri Light" + RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left + RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) + RangoTitulo.Merged = True + RangoTitulo.Value = Titulo + RangoTitulo.Style.Font.Size = 20 * 20 + RangoTitulo.Style.Font.Name = "Calibri Light" + RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 + worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + If i > 0 Then + Try + worksheet.Columns(i).AutoFit(1) + Catch ex As Exception + End Try + End If + Next + + Dim IndexEndTable As Integer = Gv.Rows.Count + TotalRowHeader + TotalRowFooter + + worksheet.Rows(IndexEndTable).Cells(2).Value = "Usuario Imprimió" + worksheet.Rows(IndexEndTable + 1).Cells(2).Value = Usuario.Nombre + + worksheet.Rows(IndexEndTable).Cells(6).Value = "Fecha Impresión" + worksheet.Rows(IndexEndTable + 1).Cells(6).Value = DateTime.Now.ToString("dd/MM/yyyy") + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) + + If Imagen.Exists Then + Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) + Using sr As New StreamReader(Ruta) + Dim ms As New MemoryStream() + sr.BaseStream.CopyTo(ms) + worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + End Using + End If + End If + + End Using + htw.Dispose() + + excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx") + End Sub Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) End Sub diff --git a/OI/CircularDetalleB.aspx.cs b/OI/CircularDetalleB.aspx.cs index b21ec8aaa..38f79bbe0 100644 --- a/OI/CircularDetalleB.aspx.cs +++ b/OI/CircularDetalleB.aspx.cs @@ -185,7 +185,7 @@ public partial class OI_CircularDetalleB : ClsPaginas { Filename = fileItem.filename; } - catch (Exception ) + catch (Exception ex) { ModExtensiones.OnError(this, "Ocurrió un error al obtener al archivo", ex); Filename = "-1"; diff --git a/OI/ConvocatoriaDetalle.aspx.cs b/OI/ConvocatoriaDetalle.aspx.cs index a2556f476..7bc0d0027 100644 --- a/OI/ConvocatoriaDetalle.aspx.cs +++ b/OI/ConvocatoriaDetalle.aspx.cs @@ -14,6 +14,7 @@ public partial class OI_ConvocatoriaDetalle : ClsPaginas public const string iddivAgregarTema = "divModalAgregartema"; public const string iddivAgregarMiembros = "iddivAgregarMiembros"; public int RCveEvento { get { return ViewState["RCveEvento"] != null ? ViewState["RCveEvento"].ToString().ToEntero() : 0; } set { ViewState["RCveEvento"] = value; } } + public int RCveEventoPadre { get { return ViewState["RCveEventoPadre"] != null ? ViewState["RCveEventoPadre"].ToString().ToEntero() : 0; } set { ViewState["RCveEventoPadre"] = value; } } public bool EsNuevo { get { return Convert.ToBoolean(ViewState["EsNuevo"]); } set { ViewState["EsNuevo"] = value; } } public List LCveUsuarioCCP { get { if (ViewState["LCveUsuarioCCP"] == null) { ViewState["LCveUsuarioCCP"] = new List(); } return (List)ViewState["LCveUsuarioCCP"]; } set { ViewState["LCveUsuarioCCP"] = value; } } public List LcveuserVisto { get { if (ViewState["LcveuserVisto"] == null) { ViewState["LcveuserVisto"] = new List(); } return (List)ViewState["LcveuserVisto"]; } set { ViewState["LcveuserVisto"] = value; } } @@ -29,8 +30,13 @@ public partial class OI_ConvocatoriaDetalle : ClsPaginas cargaUsuarios(); if (Request["CveEvento"] != null) + { + RCveEvento = Request["CveEvento"].ToString().ToEntero(); + } + if (Request["CveEventoPadre"] != null) { - RCveEvento = Request["CveEvento"].ToString().ToEntero(); + + RCveEventoPadre = Request["CveEventoPadre"].ToString().ToEntero(); } if (RCveEvento > 0) { @@ -349,7 +355,7 @@ public partial class OI_ConvocatoriaDetalle : ClsPaginas using (ClsOIEventos objOI = new ClsOIEventos()) { objOI.IniciaTransacSQL(); - Continuar = objOI.AddOI_Eventos2(cveTipoEvento, asunto, descripcion, prioridad, cveUsuarioDe, cveUsuarioPara, fechaInicio, fechaFin, cveRevision, archivoname, listaCCP, chkList, cveUsuarioIng, cveEmpresa, CorreoExterno: TxtCorreoExterno.Text, Acuerdos: TxtOrdendeldia.Text.Replace("< ", "<"), Lugar: TxtLugar.Text); + Continuar = objOI.AddOI_Eventos2(cveTipoEvento, asunto, descripcion, prioridad, cveUsuarioDe, cveUsuarioPara, fechaInicio, fechaFin, cveRevision, archivoname, listaCCP, chkList, cveUsuarioIng, cveEmpresa, CorreoExterno: TxtCorreoExterno.Text, Acuerdos: TxtOrdendeldia.Text.Replace("< ", "<"), Lugar: TxtLugar.Text,CveEventoPadre: (RCveEventoPadre>0? RCveEventoPadre:-1)); CveEvento = objOI.CveEvento; Folio = objOI.Folio; diff --git a/OI/MinutaDetalle.aspx.cs b/OI/MinutaDetalle.aspx.cs index ca90c9953..8630d0ac0 100644 --- a/OI/MinutaDetalle.aspx.cs +++ b/OI/MinutaDetalle.aspx.cs @@ -766,7 +766,12 @@ public partial class OI_MinutaDetalle : ClsPaginas if (HuboError == false) { - Alert("La minuta se termino con exito.", ModExtensiones.TipoMensaje.MsgInformacion); + string script = ""; + if (agendar) + { + script = string.Format("location.replace(\"/OI/ConvocatoriaDetalle.aspx?CveEventoPadre={0}\");",RCveEvento ); + } + Alert("La minuta se termino con exito.", ModExtensiones.TipoMensaje.MsgInformacion,script); objOI.Commit(); } else @@ -1160,93 +1165,93 @@ public partial class OI_MinutaDetalle : ClsPaginas { cargarAgenda(); } - + bool agendar = false; protected void BtnTerminarYAgendar_Click(object sender, EventArgs e) { - string errorMessage = ""; + //string errorMessage = ""; - int cveUsuarioDe = UsuarioActual.CveUsuario; - List listaCCP = new List(); - //int cveUsuarioPara = CveUsuarioPara; + //int cveUsuarioDe = UsuarioActual.CveUsuario; + //List listaCCP = new List(); + ////int cveUsuarioPara = CveUsuarioPara; - OITipoEventos cveTipoEvento = OITipoEventos.Agenda; - string asunto = TxtAgendaAsunto.Text; - string descripcion = string.Format("siguiente reunión Minuta \"{0}\"", TxtAsunto.Text); - int prioridad = 1; - int cveAgendaTipo = 4; - string fechaInicio = ""; - string fechaFin = "1900/01/01 00:00"; - if (txtFechaI.Text.ToDateTimeExcat().Year <= 1999) - { - if (txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").Year <= 1999) - { - errorMessage = "No se ingresó una fecha de inicio valida"; + //OITipoEventos cveTipoEvento = OITipoEventos.Agenda; + //string asunto = TxtAgendaAsunto.Text; + //string descripcion = string.Format("siguiente reunión Minuta \"{0}\"", TxtAsunto.Text); + //int prioridad = 1; + //int cveAgendaTipo = 4; + //string fechaInicio = ""; + //string fechaFin = "1900/01/01 00:00"; + //if (txtFechaI.Text.ToDateTimeExcat().Year <= 1999) + //{ + // if (txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").Year <= 1999) + // { + // errorMessage = "No se ingresó una fecha de inicio valida"; - } - else - { - fechaInicio = txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").ToString("yyyy/MM/dd HH:mm"); - fechaFin = txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").AddHours(2).ToString("yyyy/MM/dd HH:mm"); - } - } - else - { - fechaInicio = txtFechaI.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm"); - fechaFin = txtFechaI.Text.ToDateTimeExcat().AddHours(2).ToString("yyyy/MM/dd HH:mm"); - } - int cveRevision = -1; - string archivoname = ""; + // } + // else + // { + // fechaInicio = txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").ToString("yyyy/MM/dd HH:mm"); + // fechaFin = txtFechaI.Text.ToDateTimeExcat("dd/MM/yyyy").AddHours(2).ToString("yyyy/MM/dd HH:mm"); + // } + //} + //else + //{ + // fechaInicio = txtFechaI.Text.ToDateTimeExcat().ToString("yyyy/MM/dd HH:mm"); + // fechaFin = txtFechaI.Text.ToDateTimeExcat().AddHours(2).ToString("yyyy/MM/dd HH:mm"); + //} + //int cveRevision = -1; + //string archivoname = ""; - int cveUsuarioIng = UsuarioActual.CveUsuario; - int cveEmpresa = UsuarioActual.CveEmpresa; - bool Continuar = true; - int Folio = -1; - int CveEvento = -1; + //int cveUsuarioIng = UsuarioActual.CveUsuario; + //int cveEmpresa = UsuarioActual.CveEmpresa; + //bool Continuar = true; + //int Folio = -1; + //int CveEvento = -1; - if (errorMessage.Length == 0) - { + //if (errorMessage.Length == 0) + //{ - List chkList = new List(); - using (ClsOIEventos objOI = new ClsOIEventos()) - { - objOI.IniciaTransacSQL(); - foreach (var cveUsuarioPara in LCveUsuarioCCP) - { - if (Continuar) - { - Continuar = objOI.AddOI_Eventos2(cveTipoEvento, asunto, descripcion, prioridad, cveUsuarioDe, cveUsuarioPara, fechaInicio, fechaFin, cveRevision, archivoname, listaCCP, chkList, cveUsuarioIng, cveEmpresa, RCveEvento, null, cveAgendaTipo); - CveEvento = objOI.CveEvento; - Folio = objOI.Folio; - if (CveEvento == 0) - { - Continuar = false; - } - } - } - if (Continuar) - { - objOI.Commit(); + // List chkList = new List(); + // using (ClsOIEventos objOI = new ClsOIEventos()) + // { + // objOI.IniciaTransacSQL(); + // foreach (var cveUsuarioPara in LCveUsuarioCCP) + // { + // if (Continuar) + // { + // Continuar = objOI.AddOI_Eventos2(cveTipoEvento, asunto, descripcion, prioridad, cveUsuarioDe, cveUsuarioPara, fechaInicio, fechaFin, cveRevision, archivoname, listaCCP, chkList, cveUsuarioIng, cveEmpresa, RCveEvento, null, cveAgendaTipo); + // CveEvento = objOI.CveEvento; + // Folio = objOI.Folio; + // if (CveEvento == 0) + // { + // Continuar = false; + // } + // } + // } + // if (Continuar) + // { + // objOI.Commit(); - } - else - { - objOI.RollBack(); - Continuar = false; - } - } - if (Continuar && CveEvento > 0) - { - - LnkTerminarMinuta_Click(null, null); - //this.Alert("Se ha agregadó la nueva agenda", ModExtensiones.TipoMensaje.MsgInformacion, string.Format("window.open(\"/OI/TareaDetalle.aspx?CveEvento={0}\", \"_blank\");", CveEvento)); - } - } + // } + // else + // { + // objOI.RollBack(); + // Continuar = false; + // } + // } + //if (Continuar && CveEvento > 0) + //{ + agendar = true; + LnkTerminarMinuta_Click(null, null); + //this.Alert("Se ha agregadó la nueva agenda", ModExtensiones.TipoMensaje.MsgInformacion, string.Format("window.open(\"/OI/TareaDetalle.aspx?CveEvento={0}\", \"_blank\");", CveEvento)); + // } + //} } diff --git a/OI/RepReuniones.aspx b/OI/RepReuniones.aspx index 75b7345d2..f0169055b 100644 --- a/OI/RepReuniones.aspx +++ b/OI/RepReuniones.aspx @@ -20,58 +20,186 @@ - + + + - - - - - - - - - - - - - - <%----%> - - - - - - - - - - - - + + + Reuniones + + + + + +
+
+
+ +
+
+
    +
  • Fecha Inicio:
  • +
  • +
    + + + + + + + + + + +
    +
  • +
  • Fecha Fin:
  • +
  • +
    + + + + + + + + + + +
    +
  • +
+
+
+
+
+
+ + + + + + <%#Eval("Asunto")%> + + + + + + + + <%----%> + + + + + + +
+
+ + + Minutas + + - - - - - - - - - - <%----%> - - - - - - - + + +
+
+
+ +
+
+
    +
  • Fecha Inicio:
  • +
  • +
    + + + + + + + + + + +
    +
  • +
  • Fecha Fin:
  • +
  • +
    + + + + + + + + + + +
    +
  • +
  • Estatus:
  • +
  • + + + + + +
  • +
+
+
+ +
+
+
+ + + + + + <%#Eval("Asunto")%> + + + + + + + + + <%----%> + + + + + + + -
-
-
+
+ +
+ +
diff --git a/OI/RepReuniones.aspx.cs b/OI/RepReuniones.aspx.cs index d242e8b60..3d96f3f8c 100644 --- a/OI/RepReuniones.aspx.cs +++ b/OI/RepReuniones.aspx.cs @@ -1,14 +1,144 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using Extensiones; public partial class OI_RepReuniones : ClsPaginas { protected void Page_Load(object sender, EventArgs e) { + if (!Page.IsPostBack) + { + // ORDEN ASIGNADAS + ViewState["Orden"] = ""; + + CargaFiltros(); + CargaDatosOIMinutas(); + CargaDatosReunion(); + } + + } + + + + + private void CargaFiltros() + { + TxtFechaI.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToShortDateString(); + TxtFechaF.Text = DateTime.Now.ToShortDateString(); + TxtCFechaInicio.Text = TxtFechaI.Text; + TxtCFechaFin.Text = TxtFechaF.Text; + } + + public void CargaDatosReunion() + { + GVConvocatoria.DataSource = new DataTable(); + using (ClsOIEventos ObjProspectos = new ClsOIEventos()) + { + DateTime FechaI, FechaF; + FechaI = TxtCFechaInicio.Text.ToDate(); + FechaF = TxtCFechaFin.Text.ToDate(); + + if (ObjProspectos.GetRepEventos(-1, 11, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FechaI, FechaF)) + { GVConvocatoria.DataSource = ObjProspectos.DtResultados.FiltraParametros("","FechaInicio DESC"); } + } + + GVConvocatoria.DataBind(); + UpContenido.Update(); + } + public void CargaDatosOIMinutas() + { + using (ClsOIEventos ObjProspectos = new ClsOIEventos()) + { + + + DateTime FechaI, FechaF; + int CveEventoEstatus; + FechaI = TxtFechaI.Text.ToDate(); + FechaF = TxtFechaF.Text.ToDate(); + if (DdlEventoEstatus.SelectedValue.ToEntero() > 0) + CveEventoEstatus = DdlEventoEstatus.SelectedValue.ToEntero(); + else + CveEventoEstatus = -1; + + if (ObjProspectos.GetRepEventos(-1, 5, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FechaI, FechaF)) + ViewState["DTOIMinutas"] = ObjProspectos.DtResultados; + + } + + if (ViewState["Orden"].ToString() != string.Empty) { CargaGridOIMinutas(ViewState["Orden"].ToString()); } + else { CargaGridOIMinutas(""); } + + UpContenido.Update(); + } + + protected void GvDatosOIMinutas_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + // e.Row.Cells(0).Width = Unit.Pixel(100) 'FechaInicio + // e.Row.Cells(1).Width = Unit.Pixel(200) 'Asunto + // e.Row.Cells(2).Width = Unit.Pixel(550) 'Descripcion + // e.Row.Cells(3).Width = Unit.Pixel(70) 'TareasTotal + + //e.Row.FCLiteral("LtlFechaInicio").Text = string.Format("{1}", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("FechaInicio").ToDateTime().ToString("dd/MM/yyyy")); + //e.Row.FCLiteral("LtlAsunto").Text = string.Format("{1}", e.Row.DBCampo("CveEvento"), e.Row.DBCampo("Asunto")); + } + } + + //protected void LbOrden_Click(object sender, EventArgs e) + //{ + // string Orden = ""; + // string Campo = ""; + // Literal Literal = null/* TODO Change to default(_) if this is not a reference type */; + // const string OrdenInicial = ""; + // string[] Arg = new string[3]; + + // Arg = (LinkButton)sender.CommandArgument().ToString.Split(';'); + // Campo = Arg[0]; + // Literal = (Literal)(LinkButton)sender.NamingContainer.FindControl("Img" + Campo.Replace(",", "_")); + + // if (ViewState(string.Format("O{0}", Campo)) != null && ViewState(string.Format("O{0}", Campo)).ToString == string.Format("{0} DESC", Campo)) + // { + // ViewState(string.Format("O{0}", Campo)) = string.Format("{0} ASC", Campo); + // Literal.Text = string.Format(""); + // } + // else + // { + // ViewState(string.Format("O{0}", Campo)) = string.Format("{0} DESC", Campo); + // Literal.Text = string.Format(""); + // } + // Orden = OrdenInicial + ViewState(string.Format("O{0}", Campo)).ToString; + // ViewState("Orden") = Orden; + // CargaGridOIMinutas(Orden); + //} + + private void CargaGridOIMinutas(string Orden) + { + if (Orden != string.Empty) + { + DataView DV = new DataView((DataTable)ViewState["DTOIMinutas"], "", Orden, DataViewRowState.CurrentRows); + GvDatosOIMinutas.DataSource = DV.ToTable(); + DV.Dispose(); + } + else { GvDatosOIMinutas.DataSource = (DataTable)ViewState["DTOIMinutas"]; } + GvDatosOIMinutas.DataBind(); + } + + protected void BtnConsultar_Click(object sender, EventArgs e) + { + CargaDatosOIMinutas(); + UpContenido.Update(); + } + + protected void Button1_Click(object sender, EventArgs e) + { + CargaDatosReunion(); + UpContenido.Update(); } } \ No newline at end of file