This commit is contained in:
@@ -117,7 +117,7 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
{
|
||||
|
||||
column = 1;
|
||||
libro.Cell(row, column++).Value = drow["Aplica"].ToString()=="1"?"Si":"No";
|
||||
libro.Cell(row, column++).Value = drow["Aplica"].ToString() == "1" ? "Si" : "No";
|
||||
libro.Cell(row, column++).Value = drow["causa"];
|
||||
libro.Cell(row, column++).Value = drow["Codigo"];
|
||||
libro.Cell(row, column++).Value = drow["NombreCompleto"];
|
||||
@@ -138,9 +138,9 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
}
|
||||
}
|
||||
|
||||
libro.SheetView.Freeze(initrowdata-1, 5);
|
||||
libro.SheetView.Freeze(initrowdata - 1, 5);
|
||||
libro.ColumnsUsed().AdjustToContents();
|
||||
libro.Range(initrowdata-1, 6, initrowdata-1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
|
||||
libro.Range(initrowdata - 1, 6, initrowdata - 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
|
||||
libro.Range(initrowdata, 8, row, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right;
|
||||
libro.Range(initrowdata, 8, row, column).SetDataType(ClosedXML.Excel.XLDataType.Number);
|
||||
libro.Range(initrowdata, 8, row, column).Style.NumberFormat.Format = "$#,###,###,###,###,###,0.00";
|
||||
@@ -193,7 +193,7 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
{
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
{
|
||||
if(onom.PersonalAplicaCalculoAnual(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, CvePersonal, 0, TxtMotivo.Text))
|
||||
if (onom.PersonalAplicaCalculoAnual(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, CvePersonal, 0, TxtMotivo.Text))
|
||||
{
|
||||
Alert("El empleado sera omitido del calculo anual");
|
||||
RegistraScript("$('#DModalcancelarEmpleado').modal('hide');");
|
||||
@@ -204,15 +204,15 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
|
||||
protected void LnkOpenModalAutoriza_Click(object sender, EventArgs e)
|
||||
{
|
||||
using(ClsNominas onom = new ClsNominas())
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
{
|
||||
if (onom.GetConceptos(UsuarioActual.CveEmpresa, "-1", -1, -1, -1))
|
||||
{
|
||||
DdlConceptoCargo.DataSource = onom.DtResultados;
|
||||
DdlConceptoCompensar.DataSource = onom.DtResultados;
|
||||
DdlConceptoCargo.DataBind();
|
||||
DdlConceptoCompensar.DataBind();
|
||||
DataRow drow = onom.DtResultados.FiltroPrimero(string.Format("CveSistema ={0}",46));
|
||||
DdlConceptoCompensar.DataBind();
|
||||
DataRow drow = onom.DtResultados.FiltroPrimero(string.Format("CveSistema ={0}", 46));
|
||||
if (drow != null)
|
||||
{
|
||||
DdlConceptoCargo.SelectedValueExist(drow["CveConcepto"]);
|
||||
@@ -221,7 +221,7 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
if (drow != null)
|
||||
{
|
||||
DdlConceptoCompensar.SelectedValueExist(drow["CveConcepto"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RegistraScript("$('#DModalAutoriza').modal();");
|
||||
@@ -231,12 +231,12 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
protected void LnkAutoriza_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool continuar = true;
|
||||
int numpagos = TxtNumerodePagos.Text.ToEntero();
|
||||
int numpagos = TxtNumerodePagos.Text.ToEntero();
|
||||
|
||||
|
||||
System.Xml.Linq.XDocument xmlarchivos = new System.Xml.Linq.XDocument();
|
||||
XElement xfolder = new XElement("personal");
|
||||
foreach (GridViewRow item in GVCalculoISRAnual.Rows )
|
||||
foreach (GridViewRow item in GVCalculoISRAnual.Rows)
|
||||
{
|
||||
XElement xempleado = new XElement("empleado");
|
||||
xempleado.SetAttributeValue("CvePersonal", item.DataKey("CvePersonal"));
|
||||
@@ -245,8 +245,8 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
|
||||
xfolder.Add(xempleado);
|
||||
}
|
||||
xmlarchivos.Add(xfolder);
|
||||
string xmlpeople= xmlarchivos.ToString();
|
||||
xmlarchivos.Add(xfolder);
|
||||
string xmlpeople = xmlarchivos.ToString();
|
||||
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
{
|
||||
@@ -260,4 +260,77 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
|
||||
RegistraScript(string.Format("console.log('{0}');debugger", xmlpeople));
|
||||
}
|
||||
|
||||
protected void LnkFormatoCargaAnual_Click(object sender, EventArgs e)
|
||||
{
|
||||
int Ejercicio = DdlEjercicios.SelectedValue.ToEntero();
|
||||
string rutaformato = string.Format("{0}\\Grales\\{1}", Extensiones.ModExtensiones.DirectorioEmpresas, "FormatoCalculoAnual.xlsx").Replace("/", "\\").Replace("\\\\", "\\");
|
||||
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook(rutaformato);
|
||||
var hojaBase = wb.Worksheet(1);
|
||||
var hojaEmpleados = wb.Worksheet(2);
|
||||
hojaEmpleados.Name = "Empleados";
|
||||
// Copy the worksheet to a new sheet in this workbook
|
||||
//hojaBase.CopyTo("E1");
|
||||
hojaBase.Cell(6, 21).Value = Ejercicio;
|
||||
int index = 1;
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
{
|
||||
onom.CalculoISRAnual(Ejercicio, UsuarioActual.Empresa.CveEmpresa);
|
||||
foreach (DataRow droi in onom.DtResultados.Rows)
|
||||
{
|
||||
|
||||
//o15
|
||||
//as45
|
||||
if (droi["Aplica"].ToString() == "1")
|
||||
{
|
||||
var Choja = hojaBase.CopyTo(String.Format("E_{0:000}", index++));
|
||||
hojaEmpleados.Cell(index, 1).Value = droi["NombreCompleto"];
|
||||
hojaEmpleados.Cell(index, 1).Hyperlink = new ClosedXML.Excel.XLHyperlink(Choja.Cell(10, 9));
|
||||
|
||||
Choja.Cell(256, 9).Value = droi["NombreCompleto"];
|
||||
Choja.Cell(10, 37).Value = droi["CURP"];
|
||||
Choja.Cell(10, 6).Value = droi["RFC"];
|
||||
Choja.Cell(13, 2).Value = droi["APaterno"];
|
||||
Choja.Cell(13, 19).Value = droi["AMaterno"];
|
||||
Choja.Cell(13, 36).Value = droi["Nombres"];
|
||||
Choja.Cell(216, 15).Value = droi["BaseGravada"];
|
||||
Choja.Cell(220, 15).Value = droi["BaseExcenta"];
|
||||
Choja.Cell(224, 15).Value = droi["IngresosTotales"];
|
||||
Choja.Cell(233, 15).Value = droi["ISRRetenido"];
|
||||
|
||||
|
||||
Choja.Cell(37, 15).Value = droi["IngresosTotales"];
|
||||
Choja.Cell(48, 15).Value = droi["BaseExcenta"];
|
||||
Choja.Cell(60, 15).Value = droi["BaseGravada"];
|
||||
Choja.Cell(66, 45).Value = droi["ISRRetenido"];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
hojaBase.Delete();
|
||||
|
||||
|
||||
|
||||
System.IO.Stream fs = new System.IO.MemoryStream();
|
||||
wb.SaveAs(fs);
|
||||
fs.Position = 0;
|
||||
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
|
||||
using (System.IO.Stream input = fs)
|
||||
|
||||
{
|
||||
input.CopyTo(memoryStream);
|
||||
}
|
||||
memoryStream.Position = 0;
|
||||
|
||||
Response.Clear();
|
||||
Response.Buffer = true;
|
||||
|
||||
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", "Calculo Anual"));
|
||||
Response.BinaryWrite(memoryStream.ToArray());
|
||||
Response.End();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user