Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style>
|
||||
/* .GVGetMovtoPermanenteRep .headerHide:not(Titulos) th:nth-child(2) {
|
||||
/* .GVGetMovtoPermanenteRep .headerHide:not(Titulos) th:nth-child(2) {
|
||||
display: none;
|
||||
}
|
||||
*/
|
||||
@@ -15,17 +15,18 @@
|
||||
.GVGetMovtoPermanenteRep tr.cvetipo0 {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
|
||||
/*.GVGetMovtoPermanenteRep tr:not(.cvetipo0) td:nth-child(1) {
|
||||
display: none;
|
||||
}
|
||||
.GVGetMovtoPermanenteRep tr:.cvetipo0 td:nth-child(2) {
|
||||
display: none;
|
||||
}*/
|
||||
|
||||
|
||||
.GVGetMovtoPermanenteRep tr:not(.cvetipo0) td .lblconcepto {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.GVGetMovtoPermanenteRep tr.cvetipo0 td .lblcodigo {
|
||||
display: none;
|
||||
}
|
||||
@@ -51,8 +52,9 @@
|
||||
.GVGetMovtoPermanenteRep td:nth-child(14) {
|
||||
text-align: right
|
||||
}
|
||||
|
||||
.GVGetMovtoPermanenteRep td:nth-child(14) {
|
||||
white-space:nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
@@ -63,15 +65,15 @@
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
|
||||
|
||||
|
||||
<asp:UpdatePanel ID="UpAccciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkFormatoxls" OnClick="LnkFormatoxls_Click" CssClass="" runat="server"><i class="fa fa-file-excel"></i> Formato Excel</asp:LinkButton>
|
||||
<asp:LinkButton ID="LnkFormatoxls" OnClick="LnkFormatoxls_Click" CssClass="" runat="server"><i class="fa fa-file-excel"></i> Formato Excel</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkFormatoxls" />
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkFormatoxls" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
@@ -86,8 +88,8 @@
|
||||
<div class="portlet-title portlet-filterT smalltitle">
|
||||
<div class="titlefiltros caption">
|
||||
<div class="row">
|
||||
<label class="col-md-1 compoonenlabel" style="max-width: 65px; display:none;">Tipo: </label>
|
||||
<div class="col-md-1" style=" display:none;">
|
||||
<label class="col-md-1 compoonenlabel" style="max-width: 65px; display: none;">Tipo: </label>
|
||||
<div class="col-md-1" style="display: none;">
|
||||
<asp:DropDownList ID="DDlTipo" runat="server" Style="width: 100% !important;" CssClass="select2me">
|
||||
<asp:ListItem Text="Todos" Value="-1" Selected="True"></asp:ListItem>
|
||||
<asp:ListItem Text="Movimientos Permanentes" Value="1"></asp:ListItem>
|
||||
@@ -95,16 +97,16 @@
|
||||
<asp:ListItem Text="Infonavit" Value="3"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label class="col-md-1 compoonenlabel" style="max-width: 65px; display:none;">Saldo: </label>
|
||||
<div class="col-md-1" style=" display:none;">
|
||||
<label class="col-md-1 compoonenlabel" style="max-width: 65px; display: none;">Saldo: </label>
|
||||
<div class="col-md-1" style="display: none;">
|
||||
<asp:DropDownList ID="DDLSaldo" runat="server" Style="width: 100% !important;" CssClass="select2me">
|
||||
<asp:ListItem Text="Todos" Value="-1" Selected="True"></asp:ListItem>
|
||||
<asp:ListItem Text="Pendiente" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Pagado" Value="2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label class="col-md-1 compoonenlabel" style="max-width: 65px; display:none;">Estatus: </label>
|
||||
<div class="col-md-1" style=" display:none;">
|
||||
<label class="col-md-1 compoonenlabel" style="max-width: 65px; display: none;">Estatus: </label>
|
||||
<div class="col-md-1" style="display: none;">
|
||||
<asp:DropDownList ID="DDLEstatus" runat="server" Style="width: 100% !important;" CssClass="select2me">
|
||||
<asp:ListItem Text="Todos" Value="-1" Selected="True"></asp:ListItem>
|
||||
<asp:ListItem Text="Activo" Value="1"></asp:ListItem>
|
||||
@@ -125,7 +127,7 @@
|
||||
<asp:ListItem Text="Todos" Value="-1" Selected="True"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
|
||||
|
||||
<label class="col-md-1 mediocol">del:</label>
|
||||
<div class="col-md-1">
|
||||
<%--<asp:TextBox ID="TxtPeriodoInicio" Text="0" CssClass="form-control" runat="server"></asp:TextBox>--%>
|
||||
@@ -186,15 +188,16 @@
|
||||
</asp:TemplateField>--%>
|
||||
<asp:TemplateField HeaderText="">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblcodigo" runat="server" Text='<%# Eval("Codigo")%>'> </asp:Label>
|
||||
<asp:HyperLink ID="lblcodigo" runat="server" Text='<%# Eval("Codigo")%>' NavigateUrl='<%# string.Format("/RH/Personal.aspx?CvePersonal={0}",Eval("CvePersonal"))%>' ></asp:HyperLink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Nombre Completo">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblnombreCompleto" CssClass="lblcodigo" runat="server" Text='<%# Eval("NombreCompleto")%>'> </asp:Label>
|
||||
<asp:Label ID="lblconcepto" CssClass="lblconcepto" runat="server" Text='<%# Eval("Concepto")%>'> </asp:Label>
|
||||
<asp:HyperLink ID="lblnombreCompleto" CssClass="lblcodigo" runat="server" Text='<%# Eval("NombreCompleto")%>' NavigateUrl='<%# string.Format("/RH/Personal.aspx?CvePersonal={0}",Eval("CvePersonal"))%>' ></asp:HyperLink>
|
||||
<asp:Label ID="lblconcepto" CssClass="lblconcepto" runat="server" Text='<%# Eval("Concepto")%>'> </asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="Fecha">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblFecha" runat="server" Text='<%# Eval("FechaInicioAplicacion","{0:d}")%>'> </asp:Label>
|
||||
@@ -215,12 +218,12 @@
|
||||
<asp:Label ID="lblsaldo" runat="server" Text='<%# Eval("Acumulado","{0:N2}")%>'> </asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%-- <asp:TemplateField HeaderText="Tipo">
|
||||
<%-- <asp:TemplateField HeaderText="Tipo">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lbltipo" runat="server" Text='<%# Eval("Tipo")%>'> </asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>--%>
|
||||
<%-- <asp:TemplateField HeaderText="# Credito">
|
||||
<%-- <asp:TemplateField HeaderText="# Credito">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblnumeroCredito" runat="server" Text='<%# Eval("NumeroCredito")%>'> </asp:Label>
|
||||
</ItemTemplate>
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using ClosedXML.Excel;
|
||||
using Extensiones;
|
||||
|
||||
public partial class Nomina_RepMovtosPermanentes : ClsPaginas
|
||||
@@ -48,7 +51,7 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas
|
||||
{
|
||||
get { return TxtRpdFechaFin.Text; }
|
||||
set { TxtRpdFechaFin.Text = value; }
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -60,7 +63,7 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas
|
||||
RcveEstatus = Request["cveEstatus"] != null ? Convert.ToInt32(Request["cveEstatus"]) : -1;
|
||||
RcveConcepto = Request["cveConcepto"] != null ? Convert.ToInt32(Request["cveConcepto"]) : -1;
|
||||
fechaInicio = DateTime.Now.ToString("01/MM/yyyy");
|
||||
fechaFin=DateTime.Now.ToString("01/MM/yyyy").ToDateTime().AddMonths(1).AddDays(1).ToString("01/MM/yyyy");
|
||||
fechaFin = DateTime.Now.ToString("01/MM/yyyy").ToDateTime().AddMonths(1).AddDays(1).ToString("01/MM/yyyy");
|
||||
CargaCombos();
|
||||
cargardatos();
|
||||
|
||||
@@ -80,11 +83,11 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas
|
||||
}
|
||||
DDLConcepto.DataBind();
|
||||
}
|
||||
DDlPersonal.SelectedValueExist( RcvePersonal.ToString());
|
||||
DDlTipo.SelectedValueExist( RcveTipo.ToString());
|
||||
DDLSaldo.SelectedValueExist( RcveSaldo.ToString());
|
||||
DDLEstatus.SelectedValueExist( RcveEstatus.ToString());
|
||||
DDLConcepto.SelectedValueExist( RcveConcepto.ToString());
|
||||
DDlPersonal.SelectedValueExist(RcvePersonal.ToString());
|
||||
DDlTipo.SelectedValueExist(RcveTipo.ToString());
|
||||
DDLSaldo.SelectedValueExist(RcveSaldo.ToString());
|
||||
DDLEstatus.SelectedValueExist(RcveEstatus.ToString());
|
||||
DDLConcepto.SelectedValueExist(RcveConcepto.ToString());
|
||||
}
|
||||
protected void cargardatos()
|
||||
{
|
||||
@@ -92,7 +95,7 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas
|
||||
{
|
||||
//string fechaInicio = "";
|
||||
//string fechaFin = "";
|
||||
ObjGetM.GetMovtoPermanenteRepFechas(RcvePersonal, UsuarioActual.CveEmpresa, RcveTipo, RcveSaldo, RcveEstatus, RcveConcepto, fechaInicio, fechaFin);
|
||||
ObjGetM.GetMovtoPermanenteRepFechas(RcvePersonal, UsuarioActual.CveEmpresa, RcveTipo, RcveSaldo, RcveEstatus, RcveConcepto, fechaInicio.ToDateTime().ToString("yyyy-MM-dd"), fechaFin.ToDateTime().ToString("yyyy-MM-dd"));
|
||||
GVGetMovtoPermanenteRep.DataSource = ObjGetM.DtResultados;
|
||||
GVGetMovtoPermanenteRep.DataBind();
|
||||
|
||||
@@ -114,8 +117,8 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas
|
||||
{
|
||||
|
||||
if (e.Row.RowType == DataControlRowType.Header)
|
||||
{
|
||||
e.Row.CssClass = "headerHide";
|
||||
{
|
||||
e.Row.CssClass = "headerHide";
|
||||
}
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
@@ -132,7 +135,7 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas
|
||||
//e.Row.Cells[1].Attributes.Add("colspan", "7");
|
||||
cssclass = string.Format("{0} cvetipo0", cssclass);
|
||||
}
|
||||
e.Row.CssClass = cssclass;
|
||||
e.Row.CssClass = cssclass;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +169,84 @@ public partial class Nomina_RepMovtosPermanentes : ClsPaginas
|
||||
|
||||
protected void LnkFormatoxls_Click(object sender, EventArgs e)
|
||||
{
|
||||
GVGetMovtoPermanenteRep.ExportToExcelX("Movimientos Permanente");
|
||||
using (ClsNominas ObjGetM = new ClsNominas())
|
||||
{
|
||||
//string fechaInicio = "";
|
||||
//string fechaFin = "";
|
||||
ObjGetM.GetMovtoPermanenteRepFechas(RcvePersonal, UsuarioActual.CveEmpresa, RcveTipo, RcveSaldo, RcveEstatus, RcveConcepto, fechaInicio.ToDateTime().ToString("yyyy-MM-dd"), fechaFin.ToDateTime().ToString("yyyy-MM-dd"));
|
||||
ExportarExcel(ObjGetM.DtResultados);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void ExportarExcel(DataTable dt)
|
||||
{
|
||||
using (var wb = new XLWorkbook())
|
||||
{
|
||||
var ws = wb.Worksheets.Add("Descuentos");
|
||||
|
||||
// Encabezados
|
||||
ws.Cell(1, 1).Value = "Código";
|
||||
ws.Cell(1, 2).Value = "Nombre Completo";
|
||||
ws.Cell(1, 3).Value = "Descuento Acordado";
|
||||
ws.Cell(1, 4).Value = "Descuento Aplicado";
|
||||
ws.Cell(1, 5).Value = "Acumulado";
|
||||
|
||||
// Estilo del encabezado
|
||||
var headerRange = ws.Range("A1:E1");
|
||||
headerRange.Style.Fill.BackgroundColor = XLColor.LightGray;
|
||||
headerRange.Style.Font.Bold = true;
|
||||
headerRange.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
int row = 2;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
int cveTipo = Convert.ToInt32(dr["CveTipo"]);
|
||||
|
||||
string codigo = dr["Codigo"].ToString();
|
||||
string nombre = cveTipo == 0 ? dr["Concepto"].ToString() : dr["NombreCompleto"].ToString();
|
||||
decimal valor = Convert.ToDecimal(dr["Valor"]);
|
||||
decimal aplicado = Convert.ToDecimal(dr["MontoAplicado"]);
|
||||
decimal acumulado = Convert.ToDecimal(dr["Acumulado"]);
|
||||
|
||||
ws.Cell(row, 1).Value = codigo;
|
||||
ws.Cell(row, 2).Value = nombre;
|
||||
ws.Cell(row, 3).Value = valor;
|
||||
ws.Cell(row, 4).Value = aplicado;
|
||||
ws.Cell(row, 5).Value = acumulado;
|
||||
|
||||
// Formato numérico a columnas de dinero
|
||||
ws.Cell(row, 3).Style.NumberFormat.Format = "#,##0.00";
|
||||
ws.Cell(row, 4).Style.NumberFormat.Format = "#,##0.00";
|
||||
ws.Cell(row, 5).Style.NumberFormat.Format = "#,##0.00";
|
||||
|
||||
// Color especial si CveTipo = 0
|
||||
if (cveTipo == 0)
|
||||
{
|
||||
var range = ws.Range(row, 1, row, 5);
|
||||
range.Style.Fill.BackgroundColor = XLColor.FromArgb(221, 221, 221);
|
||||
range.Style.Font.Bold = true;
|
||||
}
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
// Ajustar columnas al contenido
|
||||
ws.Columns().AdjustToContents();
|
||||
|
||||
// Exportar el archivo
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
wb.SaveAs(ms);
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
Response.AddHeader("content-disposition", "attachment;filename=Movimietnospermanenetea.xlsx");
|
||||
Response.BinaryWrite(ms.ToArray());
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user