This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
@@ -7,8 +8,9 @@ using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
|
||||
|
||||
public partial class SAT_SolicitudesNominaSat :ClsPaginas
|
||||
public partial class SAT_SolicitudesNominaSat : ClsPaginas
|
||||
{
|
||||
#region Propiedades
|
||||
|
||||
public string clasegrid
|
||||
{
|
||||
@@ -17,9 +19,27 @@ public partial class SAT_SolicitudesNominaSat :ClsPaginas
|
||||
if (ViewState["clasegrid"] == null) { return ""; }
|
||||
else { return ViewState["clasegrid"].ToString(); }
|
||||
}
|
||||
|
||||
set { ViewState["clasegrid"] = value; }
|
||||
}
|
||||
public string fechaInicio
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["fechaInicio"] == null) { return ""; }
|
||||
else { return ViewState["fechaInicio"].ToString(); }
|
||||
}
|
||||
set { ViewState["fechaInicio"] = value; }
|
||||
}
|
||||
public string fechaFin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["fechaFin"] == null) { return ""; }
|
||||
else { return ViewState["fechaFin"].ToString(); }
|
||||
}
|
||||
set { ViewState["fechaFin"] = value; }
|
||||
}
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
@@ -30,12 +50,60 @@ public partial class SAT_SolicitudesNominaSat :ClsPaginas
|
||||
}
|
||||
}
|
||||
|
||||
protected void LnkDownloadExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
using (ClsNominas nom = new ClsNominas())
|
||||
{
|
||||
nom.SATSolicitudTimbreNominaGral(DdlReporte.SelectedValue.ToString().ToEntero(), UsuarioActual.CveEmpresa, fechaInicio, fechaFin);
|
||||
|
||||
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
|
||||
var libro = wb.AddWorksheet(nom.DtResultados , "Nomina");
|
||||
libro.ColumnsUsed().AdjustToContents();
|
||||
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", "Visor nómina "));
|
||||
Response.BinaryWrite(memoryStream.ToArray());
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
protected void LnkConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (ClsNominas nom = new ClsNominas())
|
||||
{
|
||||
fechaInicio = TxtRpdFechaInicio.Text.ToDateTime().ToString("yyyy/MM/dd");
|
||||
fechaFin = TxtRpdFechaFin.Text.ToDateTime().ToString("yyyy/MM/dd");
|
||||
|
||||
nom.SATSolicitudTimbreNominaGral(DdlReporte.SelectedValue.ToString().ToEntero(), UsuarioActual.CveEmpresa );
|
||||
nom.SATSolicitudTimbreNominaGral(0, UsuarioActual.CveEmpresa, fechaInicio, fechaFin);
|
||||
if (nom.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DataRow drow = nom.DtResultados.Rows[0];
|
||||
|
||||
|
||||
LtlTimbreFiscalTotal.Text = string.Format("{0:N0}", drow["NOXml"]);
|
||||
LtlTimbreFiscalActivos.Text = string.Format("{0:N0}", drow["NOXmlActivos"]);
|
||||
LtlTimbreFiscalCancelados.Text = string.Format("{0:N0}", drow["NOXml"].ToString().ToEntero() - drow["NOXmlActivos"].ToString().ToEntero());
|
||||
LtlSobrerecibosTotal.Text = string.Format("{0:N0}", drow["NOXmlSig"]);
|
||||
LtlSobrerecibosTimbrados.Text = string.Format("{0:N0}", drow["Timbrados"]);
|
||||
LtlSobrerecibosSintimbrar.Text = string.Format("{0:N0}", drow["SinTimbrar"]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
nom.SATSolicitudTimbreNominaGral(DdlReporte.SelectedValue.ToString().ToEntero(), UsuarioActual.CveEmpresa, fechaInicio, fechaFin);
|
||||
GVSolicitudTimbreNominaGral.DataSource = nom.DtResultados;
|
||||
GVSolicitudTimbreNominaGral.DataBind();
|
||||
clasegrid = string.Format("reporte{0}", DdlReporte.SelectedValue);
|
||||
@@ -90,4 +158,5 @@ public partial class SAT_SolicitudesNominaSat :ClsPaginas
|
||||
this.Alert("se a envia la solicitud al sat, le enviaremos un correo en cuanto tengamos una respuesta", ModExtensiones.TipoMensaje.ToastInformacion);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user