This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2021-08-26 02:48:53 -07:00
parent d8b22cc732
commit 23581967cb
5 changed files with 422 additions and 357 deletions

View File

@@ -1562,6 +1562,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
#region SobreRecibo
#region SobreRecibo propiedades
protected int SRCvePersonal
@@ -1680,6 +1681,17 @@ public partial class Nomina_Nomina2 : ClsPaginas
RegistraScript("$('#ModalConceptos').modal();");
}
#region Vacaciones
protected int CvePersonalVacaciones
{
get
{
if (ViewState["CvePersonalVacaciones"] == null) { return 0; }
else { return ViewState["CvePersonalVacaciones"].ToString().ToEntero(); }
}
set { ViewState["CvePersonalVacaciones"] = value; }
}
private void CargaVacaciones()
{
ClsRH objRH = new ClsRH();
@@ -1692,10 +1704,322 @@ public partial class Nomina_Nomina2 : ClsPaginas
else { GvVacaciones.DataSource = null; }
objRH.Dispose();
LnkSRVacacionesADD.Visible = false;
PnlVacacionesAdd.Visible = false;
GvVacaciones.DataBind();
UpGvVacaciones.Update();
}
protected void LnkShowAddVacaciones_Click(object sender, EventArgs e)
{
LnkSRVacacionesADD.Visible = true;
PnlVacacionesAdd.Visible = true;
DdlFormapagovacaciones_SelectedIndexChanged(null, null);
ChkVacPrimaVacacional.Checked = true;
ChkVacCobrarIMSS.Checked = true;
}
protected void DdlFormapagovacaciones_SelectedIndexChanged(object sender, EventArgs e)
{
PnlVacfechas.Visible = false;
PnlVacDias.Visible = false;
PnlVacFechapago.Visible = false;
PnlVacDiasPago.Visible = false;
PnlVacChecks.Visible = false;
switch (DdlFormapagovacaciones.SelectedValue.ToEntero())
{
case 1://Pagar en fecha
PnlVacfechas.Visible = true;
PnlVacDias.Visible = true;
PnlVacFechapago.Visible = true;
PnlVacDiasPago.Visible = true;
PnlVacChecks.Visible = true;
break;
case 2://Pagar en periodo disfrutadas
PnlVacfechas.Visible = true;
PnlVacDias.Visible = true;
PnlVacChecks.Visible = true;
break;
case 3://Vacaciones trabajadas
PnlVacfechas.Visible = true;
PnlVacDias.Visible = true;
PnlVacDiasPago.Visible = false;
PnlVacFechapago.Visible = true;
//PnlVacChecks.Visible = true;
break;
case 4://Solo pagar
PnlVacFechapago.Visible = true;
PnlVacDiasPago.Visible = true;
PnlVacChecks.Visible = true;
break;
case 5://Solo disfrutar
PnlVacFechapago.Visible = true;
PnlVacDiasPago.Visible = true;
break;
case 6://Solo prima
PnlVacFechapago.Visible = true;
PnlVacDiasPago.Visible = true;
break;
}
/*
*/
}
protected void LnkSRVacacionesUP_Click(object sender, EventArgs e)
{
}
protected void LnkSRVacacionesADD_Click(object sender, EventArgs e)
{
DateTime fInicio = TxtvacFechaInicio.Text.ToDate();
DateTime fFin = TxtvacFechaFin.Text.ToDate();
string fechapago = TxtvacFechaPago.Text.ToDate().ToString("yyyy/MM/dd");
int diasinhabil = TxtvacDiasFeriados.Text.ToEntero();
// Dim motivoVacaciones As String = TxtMotivoVacaciones.Text
int VacCveSupervisor = 0;
int VacFolioActual = 0;
if (fInicio <= fFin)
{
using (ClsRH objRHx = new ClsRH())
{
if (objRHx.VacacionesResumenGet(SRCvePersonal, UsuarioActual.Empresa.CveEmpresa))
{
if (objRHx.DtResultados.Rows.Count > 0)
{
VacCveSupervisor = objRHx.DtResultados.Rows[0]["SupervisorCorreo"].ToString().ToEntero();
}
}
if (objRHx.VacacionesGet(SRCvePersonal, UsuarioActual.Empresa.CveEmpresa))
{
if (objRHx.DtResultados.Rows.Count > 0)
{
VacFolioActual = objRHx.DtResultados.Compute("Max(Folio)", string.Empty).ToString().ToEntero();
}
}
}
VacFolioActual = VacFolioActual + 1;
ClsRH objRH = new ClsRH();
// Dim continuar As Boolean = objRH.SolicitudVacacionesAdd(CvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, motivoVacaciones)
bool continuar = objRH.SolicitudVacacionesAdd(SRCvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, FechaPago: fechapago,
diasinabiles: diasinhabil, CveTipoPago: DdlFormapagovacaciones.SelectedValue.ToEntero(), diasExtras: TxtVacDiasExtra.Text.ToEntero(),
Ejercicio: TxtVacEjercicio.Text.ToEntero(), PrimaVacacional:(ChkVacPrimaVacacional.Checked?1:0),CobrarImss: (ChkVacCobrarIMSS.Checked ? 1 : 0), diasPago: TxtVacDiasPago.Text.ToEntero()
);
if (objRH.DtResultados.Rows.Count > 0)
{
string ShowError = objRH.DtResultados.Rows[0]["ShowError"].ToString();
if (ShowError.Length > 0)
{
Alert(ShowError, TipoMensaje.MsgAdvertencia);
continuar = false;
}
}
objRH.Dispose();
if (continuar)
{
TxtvacFechaInicio.Text = "";
TxtvacFechaFin.Text = "";
TxtvacFechaPago.Text = "";
TxtvacDiasFeriados.Text = "";
CargaVacaciones();
//CargaVacacionesResumenPeriodoActual();
//VacacionesMandaCorreoSupervisor("Solicitud Vacaciones " + NombreCompleto, VacSupervisorCorreo, VacSupervisorNombre, NombreCompleto, fInicio, fFin);
Alert("Las vacaciones se han solicitado");
}
}
else { Alert("La fecha Inicial debe ser inferior a la fecha final.", TipoMensaje.MsgAdvertencia); }
}
protected void GvVacaciones_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
bool _Estatus = bool.Parse(e.Row.DBCampo("Estatus").ToString());
string _Documento = e.Row.DataKey("Documento");
int _CveAutoriza = e.Row.DataKey("CveAutoriza").ToEntero();
string RutaDocuemntoAutorizacion = string.Format(@"{0}Personal\{1}\Vacaciones\{2}", UsuarioActual.Empresa.Ruta, SRCvePersonal, _Documento);
LinkButton lnkDescargaFormato = e.Row.FCLinkButton("ImgDescargaFormato");
LinkButton lnkDescargaAutorizacion = e.Row.FCLinkButton("ImgDescargaAutorizacion");
LinkButton lnkEditar = e.Row.FCLinkButton("ImgEditar");
lnkEditar.Visible = true;
lnkDescargaFormato.Visible = true;
if (_CveAutoriza > 0 | !_Estatus)
{
lnkEditar.Visible = false;
lnkDescargaFormato.Visible = false;
}
// ScriptManager.GetCurrent(Me).RegisterAsyncPostBackControl(lnkDescargaFormato)
if (File.Exists(RutaDocuemntoAutorizacion) & _Estatus) { lnkDescargaAutorizacion.Visible = true; }
else { lnkDescargaAutorizacion.Visible = false; }
if (lnkDescargaAutorizacion != null && lnkDescargaAutorizacion.Visible) { ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkDescargaAutorizacion); }
if (lnkDescargaFormato != null && lnkDescargaFormato.Visible) { ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkDescargaFormato); }
}
}
protected void LnkEliminarSolicitud_Click(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
int CvePersonalVacaciones = GvRow.DataKey("CvePersonalVacaciones").ToEntero();
ClsRH objRH = new ClsRH();
if (objRH.RemoverSolicitudVacaciones(CvePersonalVacaciones))
{
CargaVacaciones();
Alert("Las vacaciones se ha eliminado");
}
objRH.Dispose();
}
public void Edit_ClickVacacionDia(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
CvePersonalVacaciones = GvRow.DataKey("CvePersonalVacaciones").ToEntero();
//VacFolio = GvRow.DataKey("Folio").ToString().ToEntero;
TxtFechaDiaVacacion.Text = GvRow.DataKey("FechaInicio").ToString().ToDate().ToString("dd/MM/yyyy");
TxtFechaDiaVacacionFin.Text = GvRow.DataKey("FechaFin").ToString().ToDate().ToString("dd/MM/yyyy");
RegistraScript("$('#divEditarDiaVacacion').modal({ backdrop: 'static', keyboard: false});");
UpModalEditarDiaVacacion.Update();
}
protected void BtnEditarDiaVacacionModal_Click(object sender, EventArgs e)
{
using (ClsRH objRH = new ClsRH())
{
string FileExtension = "-1";
List<Archivo> Filesgral = TxtFileFormatoVacaciones.getfiles().Archivos;
string Documento = "";
foreach (Archivo fileItem in Filesgral)
{
try
{
FileExtension = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
Documento = $"Vacaciones_{CvePersonalVacaciones}.{FileExtension}";
string[] tempArray;
tempArray = fileItem.filename.ToString().Split("-".ToCharArray());
string rutaDestino = $@"{UsuarioActual.Empresa.Ruta}Personal\{SRCvePersonal}\Vacaciones\{Documento}";
if (!System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta + @"Personal\" + SRCvePersonal + @"\Vacaciones\"))
System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta + @"Personal\" + SRCvePersonal + @"\Vacaciones\");
if (System.IO.File.Exists(rutaDestino))
System.IO.File.Delete(rutaDestino);
System.IO.File.Move(fileItem.FileUrl, rutaDestino);
TxtFileFormatoVacaciones.Text = "";
}
catch (Exception ex)
{
this.OnError("Error al cargar Formato vacaciones", ex);
}
}
if (Documento.Length > 0)
{
if (objRH.SolicitudVacacionesAddUpdate(CvePersonalVacaciones, SRCvePersonal, UsuarioActual.CveUsuario, Documento))
Alert("Las vacaciones se han autorizado.");
UpModalEditarDiaVacacion.Update();
CargaVacaciones();
// CargaVacacionesResumenPeriodoActual();
RegistraScript("$('#divEditarDiaVacacion').modal('hide');");
}
else { Alert("debe ingresar un documento para poder autorizar la solicitud", TipoMensaje.MsgAdvertencia); }
}
}
public void DownLoad_ClickSolicitudVacaciones(object sender, EventArgs e)
{
/*
GridViewRow GvRow = (GridViewRow)(LinkButton)sender.NamingContainer;
// Dim Folio As Integer = GvRow.DataKey("Folio").ToEntero
// DescarSolicitudVacaciones(Folio)
string RutaFormato = string.Format(@"{0}Formatos\SolicitudVacaciones.docx", UsuarioActual.Empresa.Ruta);
string NombreEmpleado = string.Format("{0} {1} {2}", TxtAPaterno.Text, TxtAMaterno.Text, TxtNombres.Text);
string Codigo = TxtCodigo.Text;
string Departamento = DdlDepartamento.SelectedItem.Text;
string JefeInmediato = DdlSupervisorOrganigrama.SelectedItem.Text;
DateTime fechaIngreso = TxtFechaIngreso.Text.ToDate();
int Periodoingreso = fechaIngreso.ToString("MMdd").ToEntero();
int PeriodoInicio = GvRow.DataKey("FechaInicio").ToDate().ToString("MMdd").ToEntero();
string FechaInicio = GvRow.DataKey("FechaInicio").ToDateTime().ToString("dd/MM/yyyy");
string FechaFin = GvRow.DataKey("FechaFin").ToDateTime().ToString("dd/MM/yyyy");
string diasPermiso = GvRow.DataKey("Dias");
string MotivoPermiso = GvRow.DataKey("Motivo");
string Puesto = DdlPuesto.SelectedItem.Value;
string Fecha = DateTime.Now.ToString("dd/MM/yyyy");
string Solicitante = UsuarioActual.Nombre;
int anio = GvRow.DataKey("FechaInicio").ToDate().Year;
string FechaPeriodo = GvRow.DataKey("Periodo");
if (Periodoingreso > PeriodoInicio)
anio = anio - 1;
if (File.Exists(RutaFormato))
{
clsGemBoxDocument objGemDocument = new clsGemBoxDocument(RutaFormato);
List<TagsDocumentos> ListaTags = new List<TagsDocumentos>();
ListaTags = GetDatosTagsDocumentos();
ListaTags.Add(new TagsDocumentos("{Solicitante}", Solicitante));
ListaTags.Add(new TagsDocumentos("{Fecha}", Fecha));
ListaTags.Add(new TagsDocumentos("{NombreEmpleado}", NombreEmpleado));
ListaTags.Add(new TagsDocumentos("{Codigo}", Codigo));
ListaTags.Add(new TagsDocumentos("{Departamento}", Departamento));
ListaTags.Add(new TagsDocumentos("{JefeInmediato}", JefeInmediato));
ListaTags.Add(new TagsDocumentos("{FechaInicio}", FechaInicio));
ListaTags.Add(new TagsDocumentos("{FechaFin}", FechaFin));
ListaTags.Add(new TagsDocumentos("{diasPermiso}", diasPermiso));
ListaTags.Add(new TagsDocumentos("{MotivoPermiso}", MotivoPermiso));
ListaTags.Add(new TagsDocumentos("{Puesto}", Puesto));
ListaTags.Add(new TagsDocumentos("{anio}", anio.ToString()));
ListaTags.Add(new TagsDocumentos("{FechaPeriodo}", FechaPeriodo));
objGemDocument.SustituirTags(ListaTags);
// objGemDocument.GuardarStream()
objGemDocument.GuardarStreamPDF();
byte[] bytesInStream = objGemDocument.GetBytesDocumento();
// Dim bytesInStream As Byte() = objGemDocument.memoryStream.ToArray
objGemDocument.Dispose();
Response.Clear();
Response.ContentType = "application/force-download";
Response.AddHeader("content-disposition", "attachment; filename=" + CvePersonal + "_Solicitud_Vacaciones_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".pdf");
Response.BinaryWrite(bytesInStream);
Response.End();
}
else
Alert("No se encontro el Formato, favor de revisarlo con soporte tecnico.", TipoMensaje.MsgAdvertencia);*/
}
#endregion
protected void LnkImportexCalculo_Click(object sender, EventArgs e)
{
@@ -5741,266 +6065,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
#endregion
protected void LnkSRVacacionesUP_Click(object sender, EventArgs e)
{
}
protected void LnkSRVacacionesADD_Click(object sender, EventArgs e)
{
DateTime fInicio = TxtvacFechaInicio.Text.ToDate();
DateTime fFin = TxtvacFechaFin.Text.ToDate();
string fechapago = TxtvacFechaPago.Text.ToDate().ToString("yyyy/MM/dd");
int diasinhabil = TxtvacDiasFeriados.Text.ToEntero();
// Dim motivoVacaciones As String = TxtMotivoVacaciones.Text
int VacCveSupervisor = 0;
int VacFolioActual = 0;
if (fInicio <= fFin)
{
using (ClsRH objRHx = new ClsRH())
{
if (objRHx.VacacionesResumenGet(SRCvePersonal, UsuarioActual.Empresa.CveEmpresa))
{
if (objRHx.DtResultados.Rows.Count > 0)
{
VacCveSupervisor = objRHx.DtResultados.Rows[0]["SupervisorCorreo"].ToString().ToEntero();
}
}
if (objRHx.VacacionesGet(SRCvePersonal, UsuarioActual.Empresa.CveEmpresa))
{
if (objRHx.DtResultados.Rows.Count > 0)
{
VacFolioActual = objRHx.DtResultados.Compute("Max(Folio)", string.Empty).ToString().ToEntero();
}
}
}
VacFolioActual = VacFolioActual + 1;
ClsRH objRH = new ClsRH();
// Dim continuar As Boolean = objRH.SolicitudVacacionesAdd(CvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, motivoVacaciones)
bool continuar = objRH.SolicitudVacacionesAdd(SRCvePersonal, fInicio, fFin, 0, UsuarioActual.CveUsuario, VacCveSupervisor, VacFolioActual, FechaPago: fechapago,
diasinabiles: diasinhabil, CveTipoPago: DdlFormapagovacaciones.SelectedValue.ToEntero(), diasExtras: TxtVacDiasExtra.Text.ToEntero());
if (objRH.DtResultados.Rows.Count > 0)
{
string ShowError = objRH.DtResultados.Rows[0]["ShowError"].ToString();
if (ShowError.Length > 0)
{
Alert(ShowError, TipoMensaje.MsgAdvertencia);
continuar = false;
}
}
objRH.Dispose();
if (continuar)
{
TxtvacFechaInicio.Text = "";
TxtvacFechaFin.Text = "";
TxtvacFechaPago.Text = "";
TxtvacDiasFeriados.Text = "";
CargaVacaciones();
//CargaVacacionesResumenPeriodoActual();
//VacacionesMandaCorreoSupervisor("Solicitud Vacaciones " + NombreCompleto, VacSupervisorCorreo, VacSupervisorNombre, NombreCompleto, fInicio, fFin);
Alert("Las vacaciones se han solicitado");
}
}
else { Alert("La fecha Inicial debe ser inferior a la fecha final.", TipoMensaje.MsgAdvertencia); }
}
protected void GvVacaciones_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
bool _Estatus = bool.Parse(e.Row.DBCampo("Estatus").ToString());
string _Documento = e.Row.DataKey("Documento");
int _CveAutoriza = e.Row.DataKey("CveAutoriza").ToEntero();
string RutaDocuemntoAutorizacion = string.Format(@"{0}Personal\{1}\Vacaciones\{2}", UsuarioActual.Empresa.Ruta, SRCvePersonal, _Documento);
LinkButton lnkDescargaFormato = e.Row.FCLinkButton("ImgDescargaFormato");
LinkButton lnkDescargaAutorizacion = e.Row.FCLinkButton("ImgDescargaAutorizacion");
LinkButton lnkEditar = e.Row.FCLinkButton("ImgEditar");
lnkEditar.Visible = true;
lnkDescargaFormato.Visible = true;
if (_CveAutoriza > 0 | !_Estatus)
{
lnkEditar.Visible = false;
lnkDescargaFormato.Visible = false;
}
// ScriptManager.GetCurrent(Me).RegisterAsyncPostBackControl(lnkDescargaFormato)
if (File.Exists(RutaDocuemntoAutorizacion) & _Estatus) { lnkDescargaAutorizacion.Visible = true; }
else { lnkDescargaAutorizacion.Visible = false; }
if (lnkDescargaAutorizacion != null && lnkDescargaAutorizacion.Visible) { ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkDescargaAutorizacion); }
if (lnkDescargaFormato != null && lnkDescargaFormato.Visible) { ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkDescargaFormato); }
}
}
protected void LnkEliminarSolicitud_Click(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
int CvePersonalVacaciones = GvRow.DataKey("CvePersonalVacaciones").ToEntero();
ClsRH objRH = new ClsRH();
if (objRH.RemoverSolicitudVacaciones(CvePersonalVacaciones))
{
CargaVacaciones();
Alert("Las vacaciones se ha eliminado");
}
objRH.Dispose();
}
protected int CvePersonalVacaciones
{
get
{
if (ViewState["CvePersonalVacaciones"] == null) { return 0; }
else { return ViewState["CvePersonalVacaciones"].ToString().ToEntero(); }
}
set { ViewState["CvePersonalVacaciones"] = value; }
}
public void Edit_ClickVacacionDia(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
CvePersonalVacaciones = GvRow.DataKey("CvePersonalVacaciones").ToEntero();
//VacFolio = GvRow.DataKey("Folio").ToString().ToEntero;
TxtFechaDiaVacacion.Text = GvRow.DataKey("FechaInicio").ToString().ToDate().ToString("dd/MM/yyyy");
TxtFechaDiaVacacionFin.Text = GvRow.DataKey("FechaFin").ToString().ToDate().ToString("dd/MM/yyyy");
RegistraScript("$('#divEditarDiaVacacion').modal({ backdrop: 'static', keyboard: false});");
UpModalEditarDiaVacacion.Update();
}
protected void BtnEditarDiaVacacionModal_Click(object sender, EventArgs e)
{
using (ClsRH objRH = new ClsRH())
{
string FileExtension = "-1";
List<Archivo> Filesgral = TxtFileFormatoVacaciones.getfiles().Archivos;
string Documento = "";
foreach (Archivo fileItem in Filesgral)
{
try
{
FileExtension = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
Documento = $"Vacaciones_{CvePersonalVacaciones}.{FileExtension}";
string[] tempArray;
tempArray = fileItem.filename.ToString().Split("-".ToCharArray());
string rutaDestino = $@"{UsuarioActual.Empresa.Ruta}Personal\{SRCvePersonal}\Vacaciones\{Documento}";
if (!System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta + @"Personal\" + SRCvePersonal + @"\Vacaciones\"))
System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta + @"Personal\" + SRCvePersonal + @"\Vacaciones\");
if (System.IO.File.Exists(rutaDestino))
System.IO.File.Delete(rutaDestino);
System.IO.File.Move(fileItem.FileUrl, rutaDestino);
TxtFileFormatoVacaciones.Text = "";
}
catch (Exception ex)
{
this.OnError("Error al cargar Formato vacaciones", ex);
}
}
if (Documento.Length > 0)
{
if (objRH.SolicitudVacacionesAddUpdate(CvePersonalVacaciones, SRCvePersonal, UsuarioActual.CveUsuario, Documento))
Alert("Las vacaciones se han autorizado.");
UpModalEditarDiaVacacion.Update();
CargaVacaciones();
// CargaVacacionesResumenPeriodoActual();
RegistraScript("$('#divEditarDiaVacacion').modal('hide');");
}
else { Alert("debe ingresar un documento para poder autorizar la solicitud", TipoMensaje.MsgAdvertencia); }
}
}
public void DownLoad_ClickSolicitudVacaciones(object sender, EventArgs e)
{
/*
GridViewRow GvRow = (GridViewRow)(LinkButton)sender.NamingContainer;
// Dim Folio As Integer = GvRow.DataKey("Folio").ToEntero
// DescarSolicitudVacaciones(Folio)
string RutaFormato = string.Format(@"{0}Formatos\SolicitudVacaciones.docx", UsuarioActual.Empresa.Ruta);
string NombreEmpleado = string.Format("{0} {1} {2}", TxtAPaterno.Text, TxtAMaterno.Text, TxtNombres.Text);
string Codigo = TxtCodigo.Text;
string Departamento = DdlDepartamento.SelectedItem.Text;
string JefeInmediato = DdlSupervisorOrganigrama.SelectedItem.Text;
DateTime fechaIngreso = TxtFechaIngreso.Text.ToDate();
int Periodoingreso = fechaIngreso.ToString("MMdd").ToEntero();
int PeriodoInicio = GvRow.DataKey("FechaInicio").ToDate().ToString("MMdd").ToEntero();
string FechaInicio = GvRow.DataKey("FechaInicio").ToDateTime().ToString("dd/MM/yyyy");
string FechaFin = GvRow.DataKey("FechaFin").ToDateTime().ToString("dd/MM/yyyy");
string diasPermiso = GvRow.DataKey("Dias");
string MotivoPermiso = GvRow.DataKey("Motivo");
string Puesto = DdlPuesto.SelectedItem.Value;
string Fecha = DateTime.Now.ToString("dd/MM/yyyy");
string Solicitante = UsuarioActual.Nombre;
int anio = GvRow.DataKey("FechaInicio").ToDate().Year;
string FechaPeriodo = GvRow.DataKey("Periodo");
if (Periodoingreso > PeriodoInicio)
anio = anio - 1;
if (File.Exists(RutaFormato))
{
clsGemBoxDocument objGemDocument = new clsGemBoxDocument(RutaFormato);
List<TagsDocumentos> ListaTags = new List<TagsDocumentos>();
ListaTags = GetDatosTagsDocumentos();
ListaTags.Add(new TagsDocumentos("{Solicitante}", Solicitante));
ListaTags.Add(new TagsDocumentos("{Fecha}", Fecha));
ListaTags.Add(new TagsDocumentos("{NombreEmpleado}", NombreEmpleado));
ListaTags.Add(new TagsDocumentos("{Codigo}", Codigo));
ListaTags.Add(new TagsDocumentos("{Departamento}", Departamento));
ListaTags.Add(new TagsDocumentos("{JefeInmediato}", JefeInmediato));
ListaTags.Add(new TagsDocumentos("{FechaInicio}", FechaInicio));
ListaTags.Add(new TagsDocumentos("{FechaFin}", FechaFin));
ListaTags.Add(new TagsDocumentos("{diasPermiso}", diasPermiso));
ListaTags.Add(new TagsDocumentos("{MotivoPermiso}", MotivoPermiso));
ListaTags.Add(new TagsDocumentos("{Puesto}", Puesto));
ListaTags.Add(new TagsDocumentos("{anio}", anio.ToString()));
ListaTags.Add(new TagsDocumentos("{FechaPeriodo}", FechaPeriodo));
objGemDocument.SustituirTags(ListaTags);
// objGemDocument.GuardarStream()
objGemDocument.GuardarStreamPDF();
byte[] bytesInStream = objGemDocument.GetBytesDocumento();
// Dim bytesInStream As Byte() = objGemDocument.memoryStream.ToArray
objGemDocument.Dispose();
Response.Clear();
Response.ContentType = "application/force-download";
Response.AddHeader("content-disposition", "attachment; filename=" + CvePersonal + "_Solicitud_Vacaciones_" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".pdf");
Response.BinaryWrite(bytesInStream);
Response.End();
}
else
Alert("No se encontro el Formato, favor de revisarlo con soporte tecnico.", TipoMensaje.MsgAdvertencia);*/
}
private List<TagsDocumentos> GetDatosTagsDocumentos()
{
var ListaTagsDocumentost = new List<TagsDocumentos>();
@@ -6782,10 +6846,4 @@ public partial class Nomina_Nomina2 : ClsPaginas
Response.End();
}
protected void LnkShowAddVacaciones_Click(object sender, EventArgs e)
{
LnkSRVacacionesADD.Visible = true;
}
}