From bf4614061d799fe2dac025ea9e07acac3996cc0d Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Sat, 18 Apr 2020 16:35:05 -0700 Subject: [PATCH] primera subida del nuevo modulo --- App_Code/ClsOIEventos.vb | 9 ++-- General/CATIEPSxEntidadFed.aspx.cs | 18 ------- OI/CircularDetalle.aspx | 17 +++++-- OI/CircularDetalle.aspx.vb | 78 +++++++++++++++++++++++++++++- 4 files changed, 96 insertions(+), 26 deletions(-) diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 1f2f3f51c..7b6bf94c7 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -1386,9 +1386,10 @@ Public Class ClsOIEventos Return Retorno End Function - Public Function AddCircular(Asunto As String, Circular As String, CorreosInternos As String, FechaIng As String, CveUsuario As Integer, CveEmpresa As Integer, Optional CorreosExternos As String = "-1") As Boolean + Public Function AddCircular(Asunto As String, Circular As String, CorreosInternos As String, FechaIng As String, CveUsuario As Integer, CveEmpresa As Integer, + Optional CorreosExternos As String = "-1", Optional Adjunto As String = "-1") As Integer - Dim Retorno As Boolean = False + Dim Retorno As Integer = -1 DataAdapter("PA_OI_CircularesAdd") @@ -1400,12 +1401,14 @@ Public Class ClsOIEventos .Add("@CorreosExternos", SqlDbType.VarChar).Value = CorreosExternos .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto + .Add("@CveCircular", SqlDbType.Int).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - Retorno = True + Retorno = SqlAdapter.SelectCommand.Parameters("@CveCircular").Value.ToString.ToEntero Catch ex As Exception OnError("Ocurrió un error al agregar el Circular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try diff --git a/General/CATIEPSxEntidadFed.aspx.cs b/General/CATIEPSxEntidadFed.aspx.cs index ceecf4ce6..5d9a71a71 100644 --- a/General/CATIEPSxEntidadFed.aspx.cs +++ b/General/CATIEPSxEntidadFed.aspx.cs @@ -106,30 +106,12 @@ public partial class General_CATIEPSxEntidadFed : ClsPaginas protected void LnkExcel_Click(object sender, EventArgs e) { - //GVIEPSxEntidadFed.ExportToExcelx("IEPS porEntidad Federativa"); Imprimir("Excel"); } protected void LnkPDF_Click(object sender, EventArgs e) { Imprimir("PDF"); - //string FechaInicio = $" Fecha Inicio: {TxtIEPSfechaInicio.Text}"; - //string FechaFin = $" Fecha Inicio: {TxtIEPSfechaFin.Text}"; - //string Estado = DdlEstado.SelectedValue.ToEntero() > -1 ? $" Estado: {DdlEstado.SelectedItem}" : ""; - //string IEPS = DdlIeps.SelectedValue.ToEntero() > -1 ? $" IEPS: {DdlIeps.SelectedItem}" : ""; - //string Agrupador = DdlAgrupador.SelectedValue.ToEntero() > -1 ? $" Agrupador: {DdlAgrupador.SelectedItem}" : ""; - //List paramList = new List(); - //paramList.Add(new ReportParameter("Logo", String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa))); - //paramList.Add(new ReportParameter("FechaInicio", FechaInicio)); - //paramList.Add(new ReportParameter("FechaFin", TxtIEPSfechaFin.Text)); - //paramList.Add(new ReportParameter("Agrupador", DdlAgrupador.SelectedValue)); - //paramList.Add(new ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)); - //paramList.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)); - //paramList.Add(new ReportParameter("FechaImpresion", DateTime.Now.ToString())); - //paramList.Add(new ReportParameter("Filtros", $"{FechaInicio}{FechaFin}{IEPS}{Estado}{Agrupador}")); - - - //ImprimirPDF("Empresas/Grales/Formatos/CatIepsEntidadFed.rdlc", DtIEPS, paramList,"IEPS por entidades federativa",RDSName:"DsInventarios"); } private void Imprimir(string formato) diff --git a/OI/CircularDetalle.aspx b/OI/CircularDetalle.aspx index 5a2c42c86..1d9bbdec7 100644 --- a/OI/CircularDetalle.aspx +++ b/OI/CircularDetalle.aspx @@ -14,7 +14,7 @@
  • - Agregar Circular +
  • @@ -58,7 +58,7 @@
    - Buscar + Buscar

    @@ -76,7 +76,16 @@ Circular:
    - + +
    + +
    +
    +
    + Adjuntar archivo: +
    +
    +

    @@ -115,7 +124,7 @@ -
    +
    0 Then + GuardarArchivo(CircularInsertado) Alert("Ingresado correctamente") End If End If @@ -129,4 +132,77 @@ Partial Class OI_CircularDetalle RegistraScript("$('#ModalDescuento').modal('hide')") UpCliente.Update() End Sub + + Private Function GuardarArchivo(CircularInsertado As Integer) As String + + Dim respuesta As String = "" + + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = TxtFileDocumentacion.getfiles().Archivos + Dim Filename As String = "" + + For Each fileItem As Archivo In Filesgral + Try + respuesta = fileItem.filenameO + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Dim tempArray() As String + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + + Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "Formatos\" & CircularInsertado & "_" & fileItem.filenameO + 'Dim docAnterior As String = UsuarioActual.Empresa.Ruta & "Formatos\" & _CveDocumentacion & "_" & DocumentacionFormato + + 'If DocumentacionFormato.Trim.Length > 0 Then + ' If File.Exists(docAnterior) Then + ' File.Delete(docAnterior) + ' End If + 'End If + + If Not Directory.Exists(UsuarioActual.Empresa.Ruta & "\Formatos") Then + Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "\Formatos") + + End If + + If System.IO.File.Exists(rutaDestino) Then + System.IO.File.Delete(rutaDestino) + End If + + System.IO.File.Move(fileItem.FileUrl, rutaDestino) + + Catch ex As Exception + OnError("Error al cargar archivo", ex) + End Try + TxtFileDocumentacion.Text = "" + Next + + + Return respuesta + End Function + + Protected Sub LnkMandarCorreo_Click() Handles LnkMandarCorreo.Click + Dim correos() As String + correos = TxtCorreo.Value.Split(Environment.NewLine) + 'MandaCorreo() + End Sub + + Private Sub MandaCorreo(Asunto As String, Para As String, ArrayCC As String, body As String, ArchivoBinario As Byte()) + + Dim a As String = String.Format("{0} -- {1} --- {2}", Asunto, Para, ArrayCC) + a.GuardaLog() + + Dim Mail As New ClsSisMail() + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + Dim itemMail As New ClsSisMail.ArchivoMail + + With itemMail + itemMail.ArchivoBinario = ArchivoBinario + itemMail.NombreArchivo = "Invitación.pdf" + + End With + + LSRutasMail.Add(itemMail) + + + Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, body, ArrayCC, LSRutasMail) + Mail = Nothing + End Sub End Class