This commit is contained in:
@@ -177,6 +177,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
CargarCentrosDeCosto(DdlProyecto, null, LblProyecto, LblSubProyeccto);
|
||||
cargaEjercicios();
|
||||
CargaTiposPeriodo();
|
||||
cargaPeriodos();
|
||||
@@ -872,6 +873,11 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
else
|
||||
{
|
||||
//onclick()
|
||||
e.Row.FCHyperLink("HypPDF").Attributes.Add("onclick", string.Format("GETPDF({0},{1})", cvePersonal, CvePeriodo));
|
||||
e.Row.FCHyperLink("HypXml").Attributes.Add("onclick", string.Format("GETXML({0},{1})", cvePersonal, CvePeriodo));
|
||||
e.Row.FindControl("HypPDF").Visible = true;
|
||||
e.Row.FindControl("HypXml").Visible = true;
|
||||
e.Row.CssClass = "success";
|
||||
}
|
||||
|
||||
@@ -898,6 +904,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
else
|
||||
{
|
||||
|
||||
e.Row.FCHyperLink("HypPDF").Attributes.Add("onclick", string.Format("GETPDF({0},{1})", cvePersonal, CvePeriodo));
|
||||
//e.Row.FindControl("HypPDF").Visible = true;
|
||||
e.Row.CssClass = "SubTotales";
|
||||
}
|
||||
e.Row.FindControl("LnkSobreRecibo").Visible = false;
|
||||
@@ -2285,7 +2293,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
if (cveSupProyecto != -5 && oldcveSupProyecto != -5) { Fila++; newsubproyectoTitulo = true; }
|
||||
}
|
||||
column = 1;
|
||||
libro.Cell(Fila, column).Value = erow["Codigo"];
|
||||
libro.Cell(Fila, column).Value = string.Format("'{0}", erow["Codigo"]);
|
||||
column++;
|
||||
if (newsubproyectoTitulo) { libro.Cell(Fila - 1, column).Value = subproyecto; }
|
||||
if (newsubproyecto) { libro.Cell(Fila - 3, column).Value = "Total"; }
|
||||
@@ -2318,6 +2326,10 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
string Concepto = string.Format("V_{0}", row["CveConcepto"]);
|
||||
libro.Cell(Fila, column).Value = erow[Concepto];
|
||||
|
||||
if (newsubproyecto)
|
||||
{
|
||||
libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
|
||||
}
|
||||
}
|
||||
|
||||
column++;
|
||||
@@ -2340,6 +2352,10 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
string Concepto = string.Format("V_{0}", row["CveConcepto"]);
|
||||
libro.Cell(Fila, column).Value = erow[Concepto];
|
||||
|
||||
if (newsubproyecto)
|
||||
{
|
||||
libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
|
||||
}
|
||||
}
|
||||
|
||||
column++;
|
||||
@@ -3976,7 +3992,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
bool continuar = true;
|
||||
string[] getcolumnas = new string[] { "CvePersonal", "CveMetodoPago", "SumaPercepciones", "Total", "SalarioDiario", "SalarioDiarioIMSS", "SalarioDiarioIntegrado", "DiasLaborados", "DiasFaltados", "DiasVacaciones", "DiasIncapacidad" };
|
||||
|
||||
|
||||
DataTable dtr = dtempleados.FiltraParametros(string.Format("(CvePersonal={0} OR {0}=-1) AND CvePersonal > 0 AND NomAutorizado =0", FiltroCvePersonal), "", getcolumnas);
|
||||
DataTable dtconp = null;
|
||||
int CvePeriodoSeleccionado = DdlPeriodo.SelectedValue.ToEntero();//cambiar reparar
|
||||
@@ -4876,4 +4892,89 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void BtnGeneratepdf_Click(object sender, EventArgs e)
|
||||
{
|
||||
byte[] pdf = new byte[1];
|
||||
string nombre = "recibo";
|
||||
int CvePersonal = TxtCvePersonal.Text.ToEntero(); int CvePeriodo = TxtCvePeriodo.Text.ToEntero();
|
||||
if (CvePersonal > 0)
|
||||
{
|
||||
using (ClsNominas ObjNomina = new ClsNominas())
|
||||
{
|
||||
if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
nombre = ObjNomina.SerieFolio;
|
||||
|
||||
}
|
||||
}
|
||||
pdf = GeneraPDFNomina(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] pdf2 = new byte[1];
|
||||
bool notfirst = false;
|
||||
foreach (DataRow dr in dtempleados.Rows)
|
||||
{
|
||||
if (notfirst)
|
||||
{
|
||||
|
||||
pdf2 = GeneraPDFNomina(dr["CvePersonal"].ToString().ToEntero(), CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta);
|
||||
byte[] newByteArray2 = pdf.Concat(pdf2).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
pdf = GeneraPDFNomina(dr["CvePersonal"].ToString().ToEntero(), CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta);
|
||||
}
|
||||
notfirst = true;
|
||||
}
|
||||
}
|
||||
ImprimirbytesPDF(pdf, nombre);
|
||||
|
||||
}
|
||||
|
||||
protected void BtnGenerateXml_Click(object sender, EventArgs e)
|
||||
{
|
||||
string Ruta = "";
|
||||
string PathXML = "";
|
||||
using (ClsNominas ObjNomina = new ClsNominas())
|
||||
{
|
||||
if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
Ruta = $@"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\";
|
||||
PathXML = $@"{Ruta}XML\Nomina\{ObjNomina.SerieFolio}.xml";
|
||||
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML))
|
||||
{
|
||||
System.IO.FileInfo file = new System.IO.FileInfo(PathXML);
|
||||
string mimeType = "text/plain";
|
||||
try
|
||||
{
|
||||
mimeType = MimeMapping.GetMimeMapping(PathXML);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
// Response.Write(path)
|
||||
Response.Clear();
|
||||
Response.ClearHeaders();
|
||||
Response.ClearContent();
|
||||
Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}");
|
||||
Response.AddHeader("Content-Length", file.Length.ToString());
|
||||
Response.ContentType = mimeType;
|
||||
Response.Flush();
|
||||
Response.TransmitFile(file.FullName);
|
||||
Response.End();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user