969 lines
42 KiB
C#
969 lines
42 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Net.Http.Headers;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using AjaxControlToolkit.HtmlEditor.ToolbarButtons;
|
|
using Extensiones;
|
|
using StackExchange.Redis;
|
|
using Telerik.Web.UI.Widgets;
|
|
using static Extensiones.ModExtensiones;
|
|
using static Stimulsoft.Report.StiOptions.Export;
|
|
|
|
public partial class RH_CalculoSBC : ClsPaginas
|
|
{
|
|
|
|
private DataTable dtsalario
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["dtsalario"] == null) { return null; }
|
|
else { return (DataTable)ViewState["dtsalario"]; }
|
|
}
|
|
|
|
set { ViewState["dtsalario"] = value; }
|
|
}
|
|
private DataTable dtDetalleParteVariable
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["dtDetalleParteVariable"] == null) { return null; }
|
|
else { return (DataTable)ViewState["dtDetalleParteVariable"]; }
|
|
}
|
|
set { ViewState["dtDetalleParteVariable"] = value; }
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
TxtFechaPago.Text = String.Format("{0:01/MM/yyyy}", NowADS());
|
|
|
|
|
|
ClsRH ObjRH = new ClsRH();
|
|
|
|
if (ObjRH.GetRegistrosPatronales(-1, UsuarioActual.CveEmpresa, 1))
|
|
DdlRegistroPatronal.DataSource = ObjRH.DtResultados;
|
|
else
|
|
DdlRegistroPatronal.DataSource = null;
|
|
|
|
DdlRegistroPatronal.DataBind();
|
|
ObjRH.Dispose();
|
|
//string rutarchivos = string.Format("{0}modificacionsalarios\\", UsuarioActual.Empresa.RutaArchivos);
|
|
//Alert(rutarchivos);
|
|
//ADSNetLibrary.SIGAPI.Services.Agropecuaria.IAgropecuariaService servicioAgro = new ADSNetLibrary.SIGAPI.Services.Agropecuaria.AgropecuariaService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString);
|
|
//ADSNetLibrary.SIGAPI.Models.Agropecuaria.Request.ActividadGET acmo = new ADSNetLibrary.SIGAPI.Models.Agropecuaria.Request.ActividadGET();
|
|
//acmo.cveEmpresa = UsuarioActual.CveEmpresa; acmo.cveActividad = -1;
|
|
//var obj = servicioAgro.ActividadesGet(acmo);
|
|
//GVDetalleParteVariable.DataSource = obj.Result;
|
|
//GVDetalleParteVariable.DataBind();
|
|
}
|
|
}
|
|
|
|
protected void LnkDownExcelSua_Click(object sender, EventArgs e)
|
|
{
|
|
}
|
|
protected void LnkUpSuamodal_Click(object sender, EventArgs e)
|
|
{
|
|
TxtArchivoSua.Text = "";
|
|
GVProcesarSUA.DataSource = null;
|
|
GVProcesarSUA.DataBind();
|
|
RegistraScript("$('#DmodalCompareSua').modal();shownew();");
|
|
UpArchivoSua.Update();
|
|
}
|
|
protected void LnkUpSuaFile_Click(object sender, EventArgs e)
|
|
{
|
|
string fileurl = "";
|
|
GVProcesarSUA.DataSource = null;
|
|
Files archivos = TxtArchivoSua.getfiles();
|
|
if (archivos.Archivos.Count > 0)
|
|
{
|
|
fileurl = archivos.Archivos[0].FileUrl;
|
|
string SuaFiletext = System.IO.File.ReadAllText(fileurl, Encoding.GetEncoding("iso-8859-1"));
|
|
using (ClsNominas ObjPersonal = new ClsNominas())
|
|
{
|
|
ObjPersonal.IniciaTransacSQL();
|
|
if (ObjPersonal.ProcesarSUA(SuaFiletext, UsuarioActual.CveEmpresa))
|
|
{
|
|
ObjPersonal.Commit();
|
|
if (ObjPersonal.DTSetResultados.Tables.Count > 4)
|
|
{
|
|
DateTime dateperiodo;
|
|
DateTime.TryParseExact(string.Format("{0}01", ObjPersonal.DTSetResultados.Tables[1].Rows[0]["Periodo"]), "yyyyMMdd", new System.Globalization.CultureInfo("es-MX"), System.Globalization.DateTimeStyles.None, out dateperiodo);
|
|
LtlPeriodo.Text = dateperiodo.Date.ToString("MMMM yyyy", new System.Globalization.CultureInfo("es-MX"));
|
|
//DtSuaProcesado = ObjPersonal.DTSetResultados.Tables[3];
|
|
GVProcesarSUA.DataSource = ObjPersonal.DTSetResultados.Tables[3];
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ObjPersonal.RollBack();
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
GVProcesarSUA.DataBind();
|
|
TxtArchivoSua.Text = "";
|
|
//RegistraScript("showResult();");
|
|
RegistraScript("$('#DmodalCompareSua').modal('hide');shownew();");
|
|
Alert("El archivo se a procesado Correctamente");
|
|
LnkCalcular_Click(null, null);
|
|
UpArchivoSua.Update();
|
|
}
|
|
|
|
protected void GVProcesarSUA_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
if (e.Row.RowIndex == 0)
|
|
{
|
|
e.Row.CssClass = "Totales";
|
|
}
|
|
string SalarioSUA = string.Format("{0:N2}", e.Row.DataKey("SalarioSUA").ToDecimal());
|
|
string SalarioSIG = string.Format("{0:N2}", e.Row.DataKey("SalarioSIG").ToDecimal());
|
|
int celda = 1;
|
|
if (Math.Abs(SalarioSUA.ToDecimal() - SalarioSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 4;
|
|
string CuotaExcedenteSUA = string.Format("{0:N2}", e.Row.DataKey("CuotaExcedenteSUA").ToDecimal());
|
|
string CuotaExcedenteSIG = string.Format("{0:N2}", e.Row.DataKey("CuotaExcedenteSIG").ToDecimal());
|
|
if (Math.Abs(CuotaExcedenteSUA.ToDecimal() - CuotaExcedenteSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 2;
|
|
string PrestacionesDineroSUA = string.Format("{0:N2}", e.Row.DataKey("PrestacionesDineroSUA").ToDecimal());
|
|
string PrestacionesSIG = string.Format("{0:N2}", e.Row.DataKey("PrestacionesSIG").ToDecimal());
|
|
if (Math.Abs(PrestacionesDineroSUA.ToDecimal() - PrestacionesSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 2;
|
|
string GastosMedPenSUA = string.Format("{0:N2}", e.Row.DataKey("GastosMedPenSUA").ToDecimal());
|
|
string GastosMedicosSIG = string.Format("{0:N2}", e.Row.DataKey("GastosMedicosSIG").ToDecimal());
|
|
if (Math.Abs(GastosMedPenSUA.ToDecimal() - GastosMedicosSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 2;
|
|
string InvalidezyVidaSUA = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSUA").ToDecimal());
|
|
string InvalidezyVidaSIG = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSIG").ToDecimal());
|
|
if (Math.Abs(InvalidezyVidaSUA.ToDecimal() - InvalidezyVidaSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 2;
|
|
string CesantiayVejezObreraSUA = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezObreraSUA").ToDecimal());
|
|
string CesantiayVejezObreraSIG = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezObreraSIG").ToDecimal());
|
|
if (Math.Abs(CesantiayVejezObreraSUA.ToDecimal() - CesantiayVejezObreraSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 2;
|
|
string CuotaFijaSUA = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSUA").ToDecimal());
|
|
string CuotaFijaSIG = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSIG").ToDecimal());
|
|
if (Math.Abs(CuotaFijaSUA.ToDecimal() - CuotaFijaSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 2;
|
|
string RiesgosdeTrabajoSUA = string.Format("{0:N2}", e.Row.DataKey("RiesgosdeTrabajoSUA").ToDecimal());
|
|
string RiesgoTrabajoSIG = string.Format("{0:N2}", e.Row.DataKey("RiesgoTrabajoSIG").ToDecimal());
|
|
if (Math.Abs(RiesgosdeTrabajoSUA.ToDecimal() - RiesgoTrabajoSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 2;
|
|
string GuarderiaSUA = string.Format("{0:N2}", e.Row.DataKey("GuarderiaSUA").ToDecimal());
|
|
string GuarderiaSIG = string.Format("{0:N2}", e.Row.DataKey("GuarderiaSIG").ToDecimal());
|
|
if (Math.Abs(GuarderiaSUA.ToDecimal() - GuarderiaSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 2;
|
|
string RetiroSUA = string.Format("{0:N2}", e.Row.DataKey("RetiroSUA").ToDecimal());
|
|
string RetiroSIG = string.Format("{0:N2}", e.Row.DataKey("RetiroSIG").ToDecimal());
|
|
if (Math.Abs(RetiroSUA.ToDecimal() - RetiroSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
celda = celda + 2;
|
|
string CesantiayVejezPatronalSUA = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezPatronalSUA").ToDecimal());
|
|
string CesantiayVejezPatronalSIG = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezPatronalSIG").ToDecimal());
|
|
if (Math.Abs(CesantiayVejezPatronalSUA.ToDecimal() - CesantiayVejezPatronalSIG.ToDecimal()) > 1)
|
|
{
|
|
e.Row.Cells[celda].CssClass = "cellFail";
|
|
e.Row.Cells[celda + 1].CssClass = "cellFail";
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
protected void LnkCalcular_Click(object sender, EventArgs e)
|
|
{
|
|
using (ClsNominas objnom = new ClsNominas())
|
|
{
|
|
if (objnom.GetCalculoSBC(UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero(), TxtFechaPago.Text, DdlRegistroPatronal.SelectedValue.ToEntero()))
|
|
{
|
|
GVCalculosSBC.DataSource = objnom.DTSetResultados.Tables[0];
|
|
dtsalario = objnom.DTSetResultados.Tables[0];
|
|
GVCFija.DataSource = objnom.DTSetResultados.Tables[0];
|
|
GVPV.DataSource = objnom.DTSetResultados.Tables[0];
|
|
if (objnom.DTSetResultados.Tables.Count > 1)
|
|
{
|
|
dtDetalleParteVariable = objnom.DTSetResultados.Tables[1];
|
|
GVDetalleParteVariable.DataSource = dtDetalleParteVariable;
|
|
GVDetalleParteVariable.DataBind();
|
|
}
|
|
}
|
|
}
|
|
GVCalculosSBC.DataBind();
|
|
GVCFija.DataBind();
|
|
GVPV.DataBind();
|
|
}
|
|
|
|
protected void LnkModalCargaMasiva_Click(object sender, EventArgs e)
|
|
{
|
|
txtfechacargamasiva.Text = TxtFechaPago.Text;
|
|
UpCargarm.Update();
|
|
RegistraScript("$('#DmodalCargaMasiva').modal();");
|
|
}
|
|
protected void LnkFormatocMasivaRegistroPatronal_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
bool continuar = true;
|
|
string msgerror = "";
|
|
if (dtsalario == null || dtsalario.Rows.Count == 0)
|
|
{
|
|
msgerror = "favor de calcular primero";
|
|
continuar = false;
|
|
}
|
|
if (continuar)
|
|
{
|
|
|
|
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
|
|
|
|
var libro = wb.AddWorksheet("Salario");
|
|
int column = 1;
|
|
libro.Cell(1, column).Value = "Codigo";
|
|
column++;
|
|
libro.Cell(1, column).Value = "Empleado";
|
|
column++;
|
|
libro.Cell(1, column).Value = "RegistroPatronal";
|
|
//column++;
|
|
//libro.Cell(1, column).Value = "SDI";
|
|
libro.Row(1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
|
|
libro.Row(1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
|
|
|
|
int Fila = 1;
|
|
foreach (DataRow erow in dtsalario.Rows)
|
|
{
|
|
Fila++;
|
|
column = 1;
|
|
libro.Cell(Fila, column).Value = string.Format("'{0}", erow["Codigo"]);
|
|
column++;
|
|
libro.Cell(Fila, column).Value = erow["Nombre"];
|
|
|
|
column++;
|
|
libro.Cell(Fila, column).Value = erow["RegistroPatronal"];
|
|
//column++;
|
|
//////libro.Cell(Fila, column).Value = erow["SDI"];
|
|
////column++;
|
|
////libro.Cell(Fila, column).Value = erow["SalarioVariable"];
|
|
}
|
|
|
|
libro.Columns().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", "Plantilla Salario "));
|
|
Response.BinaryWrite(memoryStream.ToArray());
|
|
Response.End();
|
|
}
|
|
else
|
|
{
|
|
Alert(msgerror, TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString(), TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
protected void LnkFormatocMasiva_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
bool continuar = true;
|
|
string msgerror = "";
|
|
if (dtsalario == null || dtsalario.Rows.Count == 0)
|
|
{
|
|
msgerror = "favor de calcular primero";
|
|
continuar = false;
|
|
}
|
|
if (continuar)
|
|
{
|
|
|
|
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
|
|
|
|
var libro = wb.AddWorksheet("Salario");
|
|
int column = 1;
|
|
libro.Cell(1, column).Value = "Codigo";
|
|
column++;
|
|
libro.Cell(1, column).Value = "Empleado";
|
|
column++;
|
|
libro.Cell(1, column).Value = "Salariodiario";
|
|
//column++;
|
|
//libro.Cell(1, column).Value = "SDI";
|
|
column++;
|
|
libro.Cell(1, column).Value = "Salariovariable";
|
|
libro.Column(column).Width = 35;
|
|
libro.Row(1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
|
|
libro.Row(1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
|
|
|
|
int Fila = 1;
|
|
foreach (DataRow erow in dtsalario.Rows)
|
|
{
|
|
Fila++;
|
|
column = 1;
|
|
libro.Cell(Fila, column).Value = string.Format("'{0}", erow["Codigo"]);
|
|
column++;
|
|
libro.Cell(Fila, column).Value = erow["Nombre"];
|
|
|
|
column++;
|
|
libro.Cell(Fila, column).Value = erow["SalarioDiario"];
|
|
//column++;
|
|
//libro.Cell(Fila, column).Value = erow["SDI"];
|
|
column++;
|
|
libro.Cell(Fila, column).Value = erow["SalarioVariable"];
|
|
}
|
|
|
|
libro.Columns().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", "Plantilla Salario "));
|
|
Response.BinaryWrite(memoryStream.ToArray());
|
|
Response.End();
|
|
}
|
|
else
|
|
{
|
|
Alert(msgerror, TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString(), TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
protected void LnkFormatocMasivaTS_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
bool continuar = true;
|
|
string msgerror = "";
|
|
if (dtsalario == null || dtsalario.Rows.Count == 0)
|
|
{
|
|
msgerror = "favor de calcular primero";
|
|
continuar = false;
|
|
}
|
|
if (continuar)
|
|
{
|
|
|
|
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
|
|
|
|
var libro = wb.AddWorksheet("Salario");
|
|
int column = 1;
|
|
libro.Cell(1, column).Value = "Codigo";
|
|
column++;
|
|
libro.Cell(1, column).Value = "Empleado";
|
|
column++;
|
|
libro.Cell(1, column).Value = "TipodeSalario";
|
|
libro.Row(1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
|
|
libro.Row(1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
|
|
|
|
int Fila = 1;
|
|
foreach (DataRow erow in dtsalario.Rows)
|
|
{
|
|
Fila++;
|
|
column = 1;
|
|
libro.Cell(Fila, column).Value = string.Format("'{0}", erow["Codigo"]);
|
|
column++;
|
|
libro.Cell(Fila, column).Value = erow["Nombre"];
|
|
|
|
column++;
|
|
libro.Cell(Fila, column).Value = erow["TipodeSalario"];
|
|
}
|
|
|
|
libro.Columns().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", "Plantilla Salario "));
|
|
Response.BinaryWrite(memoryStream.ToArray());
|
|
Response.End();
|
|
}
|
|
else
|
|
{
|
|
Alert(msgerror, TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString(), TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
|
|
protected void LnkProcesarArchvo_Click(object sender, EventArgs e)
|
|
{
|
|
if (ddltipoCarga.SelectedValue.ToEntero() == 1)
|
|
{
|
|
|
|
DataTable dttempsalario = null;
|
|
using (ClsNominas objnom = new ClsNominas())
|
|
{
|
|
if (objnom.GetCalculoSBC(UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero(), txtfechacargamasiva.Text, DdlRegistroPatronal.SelectedValue.ToEntero()))
|
|
{
|
|
dttempsalario = objnom.DTSetResultados.Tables[0];
|
|
}
|
|
}
|
|
try
|
|
{
|
|
List<Archivo> Filesgral = TxtArchivoNomina.getfiles().Archivos;
|
|
Archivo fileItem = Filesgral.Count > 0 ? Filesgral[0] : null;
|
|
DataTable DTEXcel = Extensiones.ModExtensiones.ReadExcelFile(fileItem.FileUrl, true);
|
|
|
|
StringBuilder str = new StringBuilder();
|
|
bool rollback = false;
|
|
using (ClsRH objpersonal = new ClsRH())
|
|
using (ClsNominas objNomina = new ClsNominas(objpersonal.IniciaTransacSQL()))
|
|
{
|
|
|
|
foreach (DataRow row in DTEXcel.FiltraParametros("LEN(Codigo)>0 ").Rows)
|
|
{
|
|
string Codigo = row["Codigo"].ToString();
|
|
int CvePersonal = -1; // row["CvePersonal"].ToString().ToEntero();
|
|
decimal Salariodiario = row["Salariodiario"].ToString().ToDecimal();
|
|
decimal SDI = 0;
|
|
decimal Salariovariable = row["Salariovariable"].ToString().ToDecimal();
|
|
decimal SalarioCotizacion = 0;
|
|
int CveMetodoPago = 0;
|
|
if (Codigo != "-1" && objpersonal.GetPersonal(CvePersonal, Codigo, "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) &&
|
|
objpersonal.DtResultados.Rows.Count == 1)
|
|
{
|
|
CvePersonal = objpersonal.CvePersonal;
|
|
CveMetodoPago = objpersonal.CveMetodoPago;
|
|
}
|
|
else
|
|
{
|
|
CvePersonal = 0;
|
|
str.AppendLine(string.Format("No se encontro el codigo {0}<br>", Codigo));
|
|
}
|
|
if (CvePersonal > 0)
|
|
{
|
|
DataRow drw = dttempsalario.FiltroPrimero(string.Format("CvePersonal={0}", CvePersonal));
|
|
decimal factordeintegracion = drw["Factordeintegracion"].ToString().ToDecimal();
|
|
SDI = Salariodiario * factordeintegracion;
|
|
SalarioCotizacion = Salariovariable + SDI;
|
|
if (objpersonal.UpdateSalarios(CvePersonal, txtfechacargamasiva.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
|
|
Salariodiario.ToString().ToDouble(), SDI.ToString().ToDouble(), SalarioCotizacion.ToString().ToDouble(), Salariodiario.ToString().ToDouble()))
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (rollback)
|
|
{
|
|
objpersonal.RollBack();
|
|
}
|
|
else
|
|
{
|
|
objpersonal.Commit();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception) { }
|
|
|
|
}
|
|
if (ddltipoCarga.SelectedValue.ToEntero() == 2)
|
|
{
|
|
|
|
List<Archivo> Filesgral = TxtArchivoNomina.getfiles().Archivos;
|
|
Archivo fileItem = Filesgral.Count > 0 ? Filesgral[0] : null;
|
|
DataTable DTEXcel = Extensiones.ModExtensiones.ReadExcelFile(fileItem.FileUrl, true);
|
|
|
|
StringBuilder str = new StringBuilder();
|
|
//bool rollback = false;
|
|
using (ClsRH objpersonal = new ClsRH())
|
|
{
|
|
|
|
foreach (DataRow row in DTEXcel.FiltraParametros("LEN(Codigo)>0 ").Rows)
|
|
{
|
|
string Codigo = row["Codigo"].ToString();
|
|
int CvePersonal = -1; // row["CvePersonal"].ToString().ToEntero();
|
|
string RegistroPatronal = row["RegistroPatronal"].ToString();
|
|
int CveMetodoPago = 0;
|
|
if (Codigo != "-1" && objpersonal.GetPersonal(CvePersonal, Codigo, "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) &&
|
|
objpersonal.DtResultados.Rows.Count == 1)
|
|
{
|
|
CvePersonal = objpersonal.CvePersonal;
|
|
CveMetodoPago = objpersonal.CveMetodoPago;
|
|
}
|
|
else
|
|
{
|
|
CvePersonal = 0;
|
|
str.AppendLine(string.Format("No se encontro el codigo {0}<br>", Codigo));
|
|
}
|
|
if (CvePersonal > 0)
|
|
{
|
|
objpersonal.PersonalRPUpdate( CvePersonal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa , RegistroPatronal);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
if (ddltipoCarga.SelectedValue.ToEntero() == 3)
|
|
{
|
|
|
|
List<Archivo> Filesgral = TxtArchivoNomina.getfiles().Archivos;
|
|
Archivo fileItem = Filesgral.Count > 0 ? Filesgral[0] : null;
|
|
DataTable DTEXcel = Extensiones.ModExtensiones.ReadExcelFile(fileItem.FileUrl, true);
|
|
|
|
StringBuilder str = new StringBuilder();
|
|
//bool rollback = false;
|
|
using (ClsRH objpersonal = new ClsRH())
|
|
{
|
|
|
|
foreach (DataRow row in DTEXcel.FiltraParametros("LEN(Codigo)>0 ").Rows)
|
|
{
|
|
string Codigo = row["Codigo"].ToString();
|
|
int CvePersonal = -1; // row["CvePersonal"].ToString().ToEntero();
|
|
string TipodeSalario = row["TipodeSalario"].ToString();
|
|
int CveMetodoPago = 0;
|
|
if (Codigo != "-1" && objpersonal.GetPersonal(CvePersonal, Codigo, "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) &&
|
|
objpersonal.DtResultados.Rows.Count == 1)
|
|
{
|
|
CvePersonal = objpersonal.CvePersonal;
|
|
CveMetodoPago = objpersonal.CveMetodoPago;
|
|
}
|
|
else
|
|
{
|
|
CvePersonal = 0;
|
|
str.AppendLine(string.Format("No se encontro el codigo {0}<br>", Codigo));
|
|
}
|
|
if (CvePersonal > 0)
|
|
{
|
|
objpersonal.PersonalTSUpdate(CvePersonal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TipodeSalario);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
RegistraScript("$('#DmodalCargaMasiva').modal('hide');");
|
|
}
|
|
protected void LnkDownArchivosSua_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string concater = "";
|
|
//string MovtosAfil = "";
|
|
string MovtosmodSalario = "";
|
|
string Script = "";
|
|
//string movtosBajas = "";
|
|
using (ClsRH ObjPersonal = new ClsRH())
|
|
{
|
|
if (ObjPersonal.GetMovimientosToSUA(UsuarioActual.CveEmpresa, TxtFechaPago.Text.ToDateTimeExcat("dd/MM/yyyy").ToString("yyyy-MM-dd"), TxtFechaPago.Text.ToDateTimeExcat("dd/MM/yyyy").ToString("yyyy-MM-dd")))
|
|
{
|
|
////01: MovtosAfil
|
|
//concater = "";
|
|
//foreach (var item in ObjPersonal.DtResultados.Select("Tipo=1"))
|
|
//{
|
|
// MovtosAfil = string.Format("{0}{1}{2}", MovtosAfil, concater, item["Movtotxt"]);
|
|
// concater = "\\r\\n";
|
|
//}
|
|
|
|
//02: MovtosmodSalario GVCalculosSBC
|
|
concater = "";
|
|
int contador = 0;
|
|
//foreach (var item in ObjPersonal.DtResultados.Select("Tipo=2"))
|
|
//{
|
|
|
|
// MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater, item["Movtotxt"]);
|
|
// concater = "\\r\\n";
|
|
// contador++;
|
|
//}
|
|
string oldRegistroPatronal = "-1";
|
|
foreach (GridViewRow item in GVCalculosSBC.Rows)
|
|
{
|
|
double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(), 2);
|
|
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2);
|
|
string RegistroPatronal = item.DataKey("RegistroPatronal");
|
|
if (oldRegistroPatronal != "-1" && oldRegistroPatronal != RegistroPatronal)
|
|
{
|
|
MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater,
|
|
$"************* 00{(contador < 1000 ? "0" : "")}{(contador < 100 ? "0" : "")}{(contador < 10 ? "0" : "")}{contador} 00001 9");
|
|
|
|
Script = string.Format("{0}SaveCsv(\"Movtos{3}_{2:ddMMMyyyy}.txt\", '{1}');", Script, MovtosmodSalario, TxtFechaPago.Text.ToDateTimeExcat("dd/MM/yyyy"), oldRegistroPatronal);
|
|
|
|
MovtosmodSalario = "";
|
|
concater = "";
|
|
contador = 0;
|
|
}
|
|
if (item.FCCheckBox("chkUpdate").Checked)//(SalarioDiarioSSNuevo != SalarioDiarioSS || item.FCCheckBox("chkCon").Checked)
|
|
{
|
|
MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater, item.DataKey("Movtotxt"));
|
|
concater = "\\r\\n";
|
|
contador++;
|
|
}
|
|
oldRegistroPatronal = RegistroPatronal;
|
|
|
|
|
|
}
|
|
//if (oldRegistroPatronal != "-1" && oldRegistroPatronal != RegistroPatronal)
|
|
{
|
|
MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater,
|
|
$"************* 00{(contador < 1000 ? "0" : "")}{(contador < 100 ? "0" : "")}{(contador < 10 ? "0" : "")}{contador} 00001 9");
|
|
|
|
Script = string.Format("{0}SaveCsv(\"Movtos{3}_{2:ddMMMyyyy}.txt\", '{1}');", Script, MovtosmodSalario, TxtFechaPago.Text.ToDateTimeExcat("dd/MM/yyyy"), oldRegistroPatronal);
|
|
|
|
MovtosmodSalario = "";
|
|
concater = "";
|
|
contador = 0;
|
|
}
|
|
/*
|
|
MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater,
|
|
$"************* 00{(contador < 1000 ? "0" : "")}{(contador < 100 ? "0" : "")}{(contador < 10 ? "0" : "")}{contador} 00001 9");
|
|
*/
|
|
////03: movtosBajas
|
|
//concater = "";
|
|
//foreach (var item in ObjPersonal.DtResultados.Select("Tipo=3"))
|
|
//{
|
|
// movtosBajas = string.Format("{0}{1}{2}", movtosBajas, concater, item["Movtotxt"]);
|
|
// concater = "\\r\\n";
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
string rutarchivos = string.Format("{0}modificacionsalarios\\", UsuarioActual.Empresa.Ruta);
|
|
if (!System.IO.Directory.Exists(rutarchivos))
|
|
{
|
|
System.IO.Directory.CreateDirectory(rutarchivos);
|
|
}
|
|
string namearchivoO = TxtFechaPago.Text.ToDateTimeExcat("dd/MM/yyyy").ToString("yyyy-MM-dd");
|
|
string namearchivo = namearchivoO;
|
|
int contadorz = 1;
|
|
while (System.IO.File.Exists(string.Format("{0}{1}", rutarchivos, namearchivo)))
|
|
{
|
|
namearchivo = string.Format("{0}({1})", namearchivoO, contadorz++);
|
|
}
|
|
System.IO.StreamWriter archivoW = null;
|
|
try { archivoW = new System.IO.StreamWriter(string.Format("{0}{1}", rutarchivos, namearchivo), true, System.Text.Encoding.UTF8); } catch (Exception) { }
|
|
if (archivoW != null)
|
|
{
|
|
try { archivoW.WriteLine(MovtosmodSalario); } catch (Exception) { }
|
|
try
|
|
{
|
|
archivoW.Close();
|
|
archivoW.Dispose();
|
|
}
|
|
catch (Exception) { }
|
|
}
|
|
RegistraScript(Script);
|
|
|
|
// RegistraScript(string.Format("SaveCsv(\"MovtosmodSalario{1:ddMMMyyyy}.txt\", '{0}');", MovtosmodSalario, TxtFechaPago.Text.ToDateTimeExcat("dd/MM/yyyy")));
|
|
//RegistraScript(string.Format("SaveCsv(\"MovtosAfil.txt\", '{0}');SaveCsv(\"MovtosmodSalario.txt\", '{1}');SaveCsv(\"movtosBajas.txt\", '{2}');", MovtosAfil.Replace("'", "\\'"), MovtosmodSalario.Replace("'", "\\'"), movtosBajas.Replace("'", "\\'")));
|
|
//RegistraScript("$('#DmodalGetSua').modal('hide');");
|
|
}
|
|
}
|
|
|
|
protected void LnkGuardarCambios_Click(object sender, EventArgs e)
|
|
{
|
|
string fecha = TxtFechaPago.Text.ToDateTimeExcat("dd/MM/yyyy").ToString("yyyy/MM/dd");
|
|
bool continuar = true;
|
|
using (ClsRH objrh = new ClsRH())
|
|
{
|
|
objrh.IniciaTransacSQL();
|
|
foreach (GridViewRow item in GVCalculosSBC.Rows)
|
|
{
|
|
int CvePersonal = item.DataKey("CvePersonal").ToEntero();//,,,
|
|
double SalarioDiario = item.DataKey("SalarioDiario").ToDouble();
|
|
double SDINuevo = item.DataKey("SDINuevo").ToDouble();
|
|
double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(), 2);
|
|
double SalarioVariableNuevo = item.DataKey("SalarioVariableNuevo").ToDouble();
|
|
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2);
|
|
if (continuar && (item.FCCheckBox("chkUpdate").Checked) &&//SalarioDiarioSSNuevo != SalarioDiarioSS &&
|
|
(continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario)))
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
if (continuar)
|
|
{
|
|
objrh.Commit();
|
|
}
|
|
else
|
|
{
|
|
objrh.RollBack();
|
|
}
|
|
}
|
|
if (continuar)
|
|
{
|
|
Alert("Se registro la modificación de salario correctamente.");
|
|
LnkDownArchivosSua_Click(null, null);
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
/*
|
|
|
|
Using ObjPersonal As ClsRH = New ClsRH()
|
|
If ObjPersonal.UpdateSalarios(CvePersonal, TxtFechamodSalario.Text.ToDate().ToString("yyyy/MM/dd"),UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtSalarioDiarioM.Text.ToDecimal(), TxtFISalarioDiarioIntegrado.Text.ToDecimal(), TxtFISalarioDiarioIntegrado.Text.ToDecimal(), TxtSalarioDiarioM.Text.ToDecimal()) Then
|
|
|
|
* */
|
|
}
|
|
|
|
protected void LnkDescargar_Click(object sender, EventArgs e)
|
|
{
|
|
DataTable dt = GVToDT(GVCalculosSBC, "Salario");
|
|
DataTable dtPF = GVToDT(GVCFija, "Parte fija");
|
|
DataTable dtPV = GVToDT(GVPV, "Parte variable");
|
|
dtDetalleParteVariable.TableName = "Detalle parte variable";
|
|
DataTable dtPVD = dtDetalleParteVariable;//GVToDT(GVDetalleParteVariable, "Detalle parte variable");
|
|
|
|
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
|
|
var libro = wb.AddWorksheet(dt);
|
|
var libroPF = wb.AddWorksheet(dtPF);
|
|
var libroPV = wb.AddWorksheet(dtPV);
|
|
var libroPVD = wb.AddWorksheet(dtPVD);
|
|
libro.ColumnsUsed().AdjustToContents();
|
|
libroPF.ColumnsUsed().AdjustToContents();
|
|
libroPV.ColumnsUsed().AdjustToContents();
|
|
libroPVD.ColumnsUsed().AdjustToContents();
|
|
|
|
|
|
libro.ColumnsUsed().AdjustToContents();
|
|
libro.Row(1).InsertRowsAbove(5);
|
|
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
|
|
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de calculo de sbc {TxtFechaPago.Text}.";
|
|
libro.Range(1, 2, 2, 6).Style.Font.SetBold(true);
|
|
libro.Range(1, 2, 2, 6).Style.Font.SetFontSize(16);
|
|
libro.Range(2, 2, 2, 6).Style.Font.SetFontSize(14);
|
|
libro.Range(1, 2, 2, 6).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
|
|
//libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
|
|
libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{NowADS():dd/MM/yyyy}";
|
|
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{NowADS():HH:mm}";
|
|
libro.Range(5, 8, 5, 12).Merge().Value = "Actual";
|
|
libro.Range(5, 13, 5, 15).Merge().Value = "Nuevo";
|
|
|
|
libro.Range(5, 1, 6, 14).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
|
|
|
|
libro.Range(5, 1, 6, 16).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
|
|
libro.Range(5, 1, 5, 16).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.None;
|
|
|
|
libro.Range(5, 8, 6, 12).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(128, 100, 162));
|
|
libro.Range(5, 8, 6, 12).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
|
|
libro.Range(5, 13, 6, 15).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(136, 214, 205));
|
|
libro.Range(5, 13, 6, 15).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
|
|
|
|
|
|
libro.Range(7, 8, 7 + dt.Rows.Count, 12).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right;
|
|
libro.Range(7, 8, 7 + dt.Rows.Count, 12).Style.NumberFormat.Format = "$##,###,###,0.00";
|
|
|
|
|
|
|
|
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", "Salario"));
|
|
Response.BinaryWrite(memoryStream.ToArray());
|
|
Response.End();
|
|
|
|
|
|
}
|
|
public string limpiarcelda(string celdatext)
|
|
{
|
|
celdatext = celdatext.Replace("<br />", "\r\n").Replace(" ", " ");
|
|
while (celdatext.Contains(" "))
|
|
{
|
|
celdatext = celdatext.Replace(" ", " ");
|
|
}
|
|
celdatext = celdatext.Replace("\n ", " ");
|
|
celdatext = celdatext.Replace("\r ", " ");
|
|
|
|
return celdatext;
|
|
}
|
|
public DataTable GVToDT(GridView GridView, string NombreArchivoXLSX)
|
|
{
|
|
DataTable dt = new DataTable(NombreArchivoXLSX);
|
|
if (GridView != null && GridView.Rows.Count > 0)
|
|
{
|
|
int i = 0;
|
|
List<int> ArrColumnasVisibles = new List<int>(); // solo recorro las columnas visibles
|
|
|
|
foreach (TableCell cell in GridView.HeaderRow.Cells)
|
|
{
|
|
string titulo = HttpUtility.HtmlDecode(Extensiones.ModExtensiones.TextoCelda(cell)).Trim();
|
|
titulo = limpiarcelda(titulo);
|
|
if (GridView.Columns.Count > i && GridView.Columns[i].Visible && titulo.Length > 0)
|
|
{
|
|
if (dt.Columns.Contains(titulo))
|
|
titulo = titulo + i;
|
|
dt.Columns.Add(titulo);
|
|
ArrColumnasVisibles.Add(i);
|
|
}
|
|
i += 1;
|
|
}
|
|
i = 0;
|
|
|
|
foreach (GridViewRow row in GridView.Rows)
|
|
{
|
|
dt.Rows.Add();
|
|
i = 0;
|
|
foreach (int j in ArrColumnasVisibles)
|
|
{
|
|
dt.Rows[dt.Rows.Count - 1][i] = limpiarcelda(Extensiones.ModExtensiones.TextoCelda(row.Cells[j]).Replace("<br />", "\r\n"));
|
|
i = i + 1;
|
|
}
|
|
}
|
|
}
|
|
return dt;
|
|
}
|
|
|
|
protected void Lnkmostrararchivos_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string rutarchivos = string.Format("{0}\\modificacionsalarios\\", UsuarioActual.Empresa.Ruta);
|
|
List<archivosD> lisaarchivos = new List<archivosD>();
|
|
foreach (var urfile in System.IO.Directory.GetFiles(rutarchivos, "*"))
|
|
{
|
|
if (urfile.Replace(rutarchivos, "").Length > 9)
|
|
{
|
|
string cfecha = urfile.Replace(rutarchivos, "").Substring(0, 10).ToDateTime().ToString("dd/MM/yyyy");
|
|
|
|
|
|
archivosD arch = new archivosD() { nombrearchivo = cfecha, ruta = urfile, fecha = System.IO.File.GetCreationTime(urfile) };
|
|
lisaarchivos.Add(arch);
|
|
|
|
}
|
|
}
|
|
GVDoctos.DataSource = lisaarchivos;
|
|
GVDoctos.DataBind();
|
|
UpModalDoctos.Update();
|
|
RegistraScript("$('#ModalDoctos').modal();");
|
|
}
|
|
|
|
|
|
protected void GVDetalleParteVariable_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if(e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
for (int i = 0; i < e.Row.Cells.Count; i++)
|
|
{
|
|
e.Row.Cells[i].Text = Server.HtmlDecode(e.Row.Cells[i].Text);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
protected void GVCalculosSBC_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
|
|
//Eval("SalarioDiarioSSNuevo", "{0:N2}") == Eval("SalarioDiarioSS", "{0:N2}")
|
|
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
decimal valueold = e.Row.DBCampo("SalarioDiarioSS").ToString().ToDecimal();
|
|
decimal valuenew = e.Row.DBCampo("SalarioDiarioSSNuevo").ToString().ToDecimal();
|
|
decimal diferencia = Math.Abs(valueold - valuenew);
|
|
e.Row.FCCheckBox("chkUpdate").Checked = diferencia > 0.01M;
|
|
e.Row.FCLabel("lblsalarioDiarioSSf").Text = e.Row.FCCheckBox("chkUpdate").Checked ? "Si" : "No";
|
|
}
|
|
|
|
}
|
|
|
|
protected void lnksalariomenoralminimo_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
public class archivosD
|
|
{
|
|
public string nombrearchivo { get; set; }
|
|
public string ruta { get; set; }
|
|
public DateTime fecha { get; set; }
|
|
} |