This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2022-11-15 14:18:13 -07:00
parent 49ab1578e1
commit 919a647455
13 changed files with 848 additions and 90 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
@@ -23,6 +24,17 @@ public partial class RH_CalculoSBC : ClsPaginas
if (!IsPostBack)
{
TxtFechaPago.Text = String.Format("{0:01/MM/yyyy}", DateTime.Now);
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);
@@ -34,11 +46,157 @@ public partial class RH_CalculoSBC : ClsPaginas
}
}
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())
{
if (ObjPersonal.ProcesarSUA(SuaFiletext, UsuarioActual.CveEmpresa))
{
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];
}
}
}
}
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))
if (objnom.GetCalculoSBC(UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero(), TxtFechaPago.Text,DdlRegistroPatronal.SelectedValue.ToEntero()))
{
GVCalculosSBC.DataSource = objnom.DTSetResultados.Tables[0];
GVCFija.DataSource = objnom.DTSetResultados.Tables[0];
@@ -92,7 +250,7 @@ public partial class RH_CalculoSBC : ClsPaginas
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)
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");
@@ -103,7 +261,7 @@ public partial class RH_CalculoSBC : ClsPaginas
concater = "";
contador = 0;
}
if (SalarioDiarioSSNuevo != SalarioDiarioSS)
if (SalarioDiarioSSNuevo != SalarioDiarioSS || item.FCCheckBox("chkCon").Checked)
{
MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater, item.DataKey("Movtotxt"));
concater = "\\r\\n";
@@ -249,18 +407,18 @@ public partial class RH_CalculoSBC : ClsPaginas
//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:{DateTime.Now:dd/MM/yyyy}";
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
libro.Range(5, 8, 5, 11).Merge().Value = "Actual";
libro.Range(5, 12, 5, 14).Merge().Value = "Nuevo";
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, 13).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(5, 1, 5, 13).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.None;
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, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(128, 100, 162));
libro.Range(5, 8, 6, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
libro.Range(5, 12, 6, 14).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(136, 214, 205));
libro.Range(5, 12, 6, 14).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
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;