This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2022-11-30 06:31:14 -07:00
parent cecaf8c8c8
commit 5d597d32ce
5 changed files with 78 additions and 3 deletions

View File

@@ -109,7 +109,14 @@
<li>
<asp:LinkButton ID="LnkModsalario" OnClick="LnkModsalario_Click" runat="server"><i class="fa fa-pencil"></i> Modificar salario </asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkContratoAgropecuaria" OnClick="LnkContratoAgropecuaria_Click" runat="server"><i class="fa fa-list-alt"></i> Contrato </asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkContratoAgropecuaria" />
</Triggers>
</asp:UpdatePanel>

View File

@@ -847,7 +847,7 @@ Partial Class RH_Personal
If UsuarioActual.CveEmpresa = 72 OrElse UsuarioActual.CveEmpresa = 80 Then
pnlSalarioIMSS.Visible = False
End If
'
LnkContratoAgropecuaria.Visible = (UsuarioActual.CveEmpresa.Contiene(1, 158))
Using objno = New ClsNominas
objno.GetConceptos()
dtNomConceptos = objno.DtResultados
@@ -7478,6 +7478,68 @@ Partial Class RH_Personal
Alert("Se guardo correctamente", TipoMensaje.MsgInformacion)
CargaDatos()
End If
End Sub
Protected Sub LnkContratoAgropecuaria_Click(sender As Object, e As EventArgs)
Dim RutaArchivo As String = "C:\Proyectos\SIGGIT\General\CONTRATO.doc"
Dim objGemBoxDocument As New clsGemBoxDocument(RutaArchivo)
Dim ObjRH As New ClsRH
If ObjRH.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) Then
Dim Tags As New List(Of TagsDocumentos)
Tags.Add(New TagsDocumentos("{NombreCompleto}", ObjRH.NombreCompleto))
Tags.Add(New TagsDocumentos("{años}", (DateTime.Now.Year - ObjRH.FechaNacimiento.Year).ToString()))
Tags.Add(New TagsDocumentos("{SubProyecto}", DdlSubProyectoAsignado.SelectedItem.Text))
Tags.Add(New TagsDocumentos("{EstadoCivil}", DdlEstadoCivil.SelectedItem.Text))
Tags.Add(New TagsDocumentos("{CiudadOrigen}", TxtCiudad.Text))
Tags.Add(New TagsDocumentos("{RFC}", ObjRH.RFC))
Tags.Add(New TagsDocumentos("{NumeroDia}", String.Format("{0:dd}", ObjRH.FechaIngreso)))
Tags.Add(New TagsDocumentos("{MesLetra}", String.Format("{0:MMMM}", ObjRH.FechaIngreso)))
Tags.Add(New TagsDocumentos("{Ejercicio}", String.Format("{0:yyyy}", ObjRH.FechaIngreso)))
objGemBoxDocument.SustituirTags(Tags)
End If
ObjRH.Dispose()
objGemBoxDocument.GuardarStreamPDF()
Dim objbyte = objGemBoxDocument.GetBytesDocumento
Try
Response.Buffer = True
Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", String.Format("{0}; filename={1}.{2}", "attachment", "Contrato.pdf", "pdf"))
Response.BinaryWrite(objbyte) ' create the file
Response.Flush() ' send it to the client to download
objbyte = Nothing
HttpContext.Current.Response.SuppressContent = True
HttpContext.Current.ApplicationInstance.CompleteRequest()
'HttpContext.Current.Response.End()
Catch ex As Exception
If UsuarioActual.CveRol = 1 Then
Alert($"Error: {ex.Message} | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))}", TipoMensaje.MsgAdvertencia)
Else
Alert("Ocurrió un error al generar la descarga. Favor de contactar a soporte tecnico cod:'IMPDFclspag'", TipoMensaje.MsgAdvertencia)
End If
End Try
End Sub
End Class