diff --git a/Empresas/7/Formatos/27_Gafette.docx b/Empresas/7/Formatos/27_Gafette.docx index 2be6d4748..890a13d2d 100644 Binary files a/Empresas/7/Formatos/27_Gafette.docx and b/Empresas/7/Formatos/27_Gafette.docx differ diff --git a/Imagenes/SinImagenB.jpg b/Imagenes/SinImagenB.jpg new file mode 100644 index 000000000..164e05b4f Binary files /dev/null and b/Imagenes/SinImagenB.jpg differ diff --git a/RH/Personal.aspx b/RH/Personal.aspx index 29e7defd5..1458c87e2 100644 --- a/RH/Personal.aspx +++ b/RH/Personal.aspx @@ -50,7 +50,7 @@ Expediente de personal - + <%--
  • Gafete @@ -59,7 +59,7 @@ - + --%>
  • diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index 1c99f6da9..fa5cad21e 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -10,6 +10,8 @@ Imports Microsoft.Reporting.WebForms Imports System.Globalization Imports System.Xml Imports System.Web.Script.Services +Imports System.Linq + Partial Class RH_Personal Inherits ClsPaginas @@ -3897,93 +3899,95 @@ Partial Class RH_Personal End If ObjPersonal.Dispose() End Sub - Private Sub LbGafete_Click(sender As Object, e As EventArgs) Handles LbGafete.Click - Dim PathSource As String = UsuarioActual.Empresa.Ruta & "Formatos\Gafete.docx" - If File.Exists(PathSource) Then + 'Eliminar hasta 15 de septiembre 2023 + 'Private Sub LbGafete_Click(sender As Object, e As EventArgs) Handles LbGafete.Click - Dim PathRoot As String = AppDomain.CurrentDomain.BaseDirectory - Dim pathDesti As String + ' Dim PathSource As String = UsuarioActual.Empresa.Ruta & "Formatos\Gafete.docx" + ' If File.Exists(PathSource) Then - PathSource = UsuarioActual.Empresa.Ruta & "Formatos\Gafete.docx" - pathDesti = PathRoot & "Temp\" & CvePersonal & "Gafete.docx" + ' Dim PathRoot As String = AppDomain.CurrentDomain.BaseDirectory + ' Dim pathDesti As String - If File.Exists(pathDesti) Then - File.Delete(pathDesti) - End If + ' PathSource = UsuarioActual.Empresa.Ruta & "Formatos\Gafete.docx" + ' pathDesti = PathRoot & "Temp\" & CvePersonal & "Gafete.docx" - File.Copy(PathSource, pathDesti) + ' If File.Exists(pathDesti) Then + ' File.Delete(pathDesti) + ' End If - Dim objDoc As New clsGemBoxDocument(pathDesti) - Dim objRH As New ClsRH - Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString() & " del " & Now.Year.ToString() + ' File.Copy(PathSource, pathDesti) + + ' Dim objDoc As New clsGemBoxDocument(pathDesti) + ' Dim objRH As New ClsRH + ' Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString() & " del " & Now.Year.ToString() - objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa)) - objRH.Dispose() + ' objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa)) + ' objRH.Dispose() - objDoc.Guardar(pathDesti) + ' objDoc.Guardar(pathDesti) - Dim fileinfo As New FileInfo(pathDesti) + ' Dim fileinfo As New FileInfo(pathDesti) - If fileinfo.Exists Then + ' If fileinfo.Exists Then - Response.ContentType = "application/docx" - Response.AppendHeader("Content-Disposition", $"attachment; filename=Gafete_{CvePersonal}.docx") - Response.TransmitFile(pathDesti) - Response.End() + ' Response.ContentType = "application/docx" + ' Response.AppendHeader("Content-Disposition", $"attachment; filename=Gafete_{CvePersonal}.docx") + ' Response.TransmitFile(pathDesti) + ' Response.End() - End If + ' End If - 'Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) - 'baseUrl = baseUrl & "/temp/" & fileinfo.Name + ' 'Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) + ' 'baseUrl = baseUrl & "/temp/" & fileinfo.Name - 'RegistraDescargaJavaScript(baseUrl) + ' 'RegistraDescargaJavaScript(baseUrl) - Else + ' Else - Dim params As New List(Of ReportParameter) - Dim ObjPersonal As New ClsRH() + ' Dim params As New List(Of ReportParameter) + ' Dim ObjPersonal As New ClsRH() - If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then + ' If ObjPersonal.GetPersonal(CvePersonal, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then - If ObjPersonal.DtResultados.Rows.Count > 0 Then + ' If ObjPersonal.DtResultados.Rows.Count > 0 Then - params.Add(New ReportParameter("Nombre", String.Format("{0} {1} {2}", TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim))) - params.Add(New ReportParameter("Vigencia", TxtFechaFinContrato.Text)) - params.Add(New ReportParameter("Puesto", If(DdlPuesto.SelectedValue.ToEntero() > 0, DdlPuesto.SelectedItem.Text, ""))) - params.Add(New ReportParameter("CURP", TxtCURP.Text)) - params.Add(New ReportParameter("NoRegistro", "")) - params.Add(New ReportParameter("RegIMSS", TxtNumeroSS.Text)) - params.Add(New ReportParameter("FechaIngreso", TxtFechaIngreso.Text)) - params.Add(New ReportParameter("DomPart", String.Format("{0} NoExt:{1} NoInt:{2} {3}", TxtCalle.Text, TxtNumExt.Text, TxtNumInt.Text, TxtColonia.Text))) - params.Add(New ReportParameter("Emergencia", TxtTelefonoEmergencia.Text)) - params.Add(New ReportParameter("CUIP", "")) - params.Add(New ReportParameter("TipoSangre", DdlTipoSangre.SelectedItem.Text)) - params.Add(New ReportParameter("RFC", TxtRFC.Text)) - params.Add(New ReportParameter("Denominacion", TxtRFC.Text)) + ' params.Add(New ReportParameter("Nombre", String.Format("{0} {1} {2}", TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim))) + ' params.Add(New ReportParameter("Vigencia", TxtFechaFinContrato.Text)) + ' params.Add(New ReportParameter("Puesto", If(DdlPuesto.SelectedValue.ToEntero() > 0, DdlPuesto.SelectedItem.Text, ""))) + ' params.Add(New ReportParameter("CURP", TxtCURP.Text)) + ' params.Add(New ReportParameter("NoRegistro", "")) + ' params.Add(New ReportParameter("RegIMSS", TxtNumeroSS.Text)) + ' params.Add(New ReportParameter("FechaIngreso", TxtFechaIngreso.Text)) + ' params.Add(New ReportParameter("DomPart", String.Format("{0} NoExt:{1} NoInt:{2} {3}", TxtCalle.Text, TxtNumExt.Text, TxtNumInt.Text, TxtColonia.Text))) + ' params.Add(New ReportParameter("Emergencia", TxtTelefonoEmergencia.Text)) + ' params.Add(New ReportParameter("CUIP", "")) + ' params.Add(New ReportParameter("TipoSangre", DdlTipoSangre.SelectedItem.Text)) + ' params.Add(New ReportParameter("RFC", TxtRFC.Text)) + ' params.Add(New ReportParameter("Denominacion", TxtRFC.Text)) - If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.CvePersonal & ".png") Then - params.Add(New ReportParameter("LogoUri", String.Format("{0}://{1}:{2}/Empresas/{3}/RH/Personal/{4}.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, ObjPersonal.CvePersonal))) - Else - params.Add(New ReportParameter("LogoUri", "")) - End If + ' If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & ObjPersonal.CvePersonal & ".png") Then + ' params.Add(New ReportParameter("LogoUri", String.Format("{0}://{1}:{2}/Empresas/{3}/RH/Personal/{4}.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, ObjPersonal.CvePersonal))) + ' Else + ' params.Add(New ReportParameter("LogoUri", "")) + ' End If - ImprimirPDF("Empresas/Grales/Formatos/RHGafete.rdlc", New DataTable, params, String.Format("Gafete_{0}", ObjPersonal.CvePersonal), "PDF") + ' ImprimirPDF("Empresas/Grales/Formatos/RHGafete.rdlc", New DataTable, params, String.Format("Gafete_{0}", ObjPersonal.CvePersonal), "PDF") - End If - End If - ObjPersonal.Dispose() + ' End If + ' End If + ' ObjPersonal.Dispose() - End If + ' End If - End Sub + 'End Sub Private Sub GenerarPDFGastosXComp(Optional Formato As String = "PDF") If CvePersonal > 0 Then If RBLTipoGastos.SelectedValue = "1" Then @@ -4420,10 +4424,94 @@ Partial Class RH_Personal objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(CvePersonal, UsuarioActual.CveEmpresa)) objRH.Dispose() - - objDoc.Guardar(pathDesti) + If pathDesti.ToUpper.Contains("GAFETTE") Or pathDesti.ToUpper.Contains("GAFETE") Then + + GemBox.Document.ComponentInfo.SetLicense(SerialGemBoxDocument) + + Dim document = GemBox.Document.DocumentModel.Load(pathDesti) + + + + + Dim imgPersonalURL As String = "" + If File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpg") Then + imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpg" + ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".png") Then + imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".png" + ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".bmp") Then + imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".bmp" + ElseIf File.Exists(UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpeg") Then + imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".jpeg" + End If + + 'imgPersonalURL = UsuarioActual.Empresa.Ruta & "RH\Personal\" & CvePersonal & ".png" + + If imgPersonalURL.Trim.Length = 0 Then + imgPersonalURL = ModExtensiones.DirectorioBaseEmpresas & "\wwwSIG\Imagenes\SinImagenB.jpg" + End If + + 'Dim document As New GemBox.Document.DocumentModel() + 'Dim section As New GemBox.Document.Section(document) + 'Dim paragraph As New GemBox.Document.Paragraph(document) + 'section.Blocks.Add(paragraph) + + 'Dim picture1 As New GemBox.Document.Picture(document, imgPersonalURL, 61, 53, GemBox.Document.LengthUnit.Pixel) + + 'paragraph.Inlines.Add(picture1) + + 'Dim Zahnrad As String = UsuarioActual.Empresa.Ruta & "RH\Personal\Zahnrad.gif" + 'Dim Dices As String = UsuarioActual.Empresa.Ruta & "RH\Personal\Dices.png" + 'Dim Graphics1 As String = UsuarioActual.Empresa.Ruta & "RH\Personal\Graphics1.svg" + + 'Dim section As New GemBox.Document.Section(document) + 'document.Sections.Add(section) + + 'Dim paragraph As New GemBox.Document.Paragraph(document) + 'section.Blocks.Add(paragraph) + + + 'Dim picture1 As New GemBox.Document.Picture(document, imgPersonalURL, 61, 53, GemBox.Document.LengthUnit.Pixel) + 'paragraph.Inlines.Add(picture1) + + ' Get the first section and the first paragraph (or create them if necessary) + + '************************************************************** + + Dim firstSection As GemBox.Document.Section = document.Sections.FirstOrDefault() + If firstSection Is Nothing Then + firstSection = New GemBox.Document.Section(document) + document.Sections.Add(firstSection) + End If + + Dim firstParagraph As GemBox.Document.Paragraph = firstSection.Blocks.OfType(Of GemBox.Document.Paragraph)().FirstOrDefault() + If firstParagraph Is Nothing Then + firstParagraph = New GemBox.Document.Paragraph(document) + firstSection.Blocks.Add(firstParagraph) + End If + + Dim imageParagraph As New GemBox.Document.Paragraph(document) + Dim picture1 As New GemBox.Document.Picture(document, imgPersonalURL, 83, 100, GemBox.Document.LengthUnit.Pixel) + + Dim layout3 As New GemBox.Document.FloatingLayout( + New GemBox.Document.HorizontalPosition(1.79, GemBox.Document.LengthUnit.Inch, GemBox.Document.HorizontalPositionAnchor.LeftMargin), + New GemBox.Document.VerticalPosition(2.55, GemBox.Document.LengthUnit.Inch, GemBox.Document.VerticalPositionAnchor.TopMargin), + picture1.Layout.Size) + 'layout3.WrappingStyle = GemBox.Document.TextWrappingStyle.Through + + picture1.Layout = layout3 + + imageParagraph.Inlines.Add(picture1) + firstSection.Blocks.Insert(0, imageParagraph) + + document.Sections(0).Blocks.RemoveAt(9) + + document.Save(pathDesti) + + End If + + Dim fileinfo As New FileInfo(pathDesti) Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority)