This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2021-05-19 10:42:08 -07:00
parent a92f48dc3b
commit 2b1cf3ccae
21 changed files with 3119 additions and 1065 deletions

View File

@@ -181,11 +181,14 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
if (!IsPostBack)
{
LnkVerCalculoISR.Visible = (UsuarioActual.CveUsuario == 100);
TxtPeriodo.Text = $"{DateTime.Now:yyyyMM}";
CargarCentrosDeCosto(DdlProyecto, null, LblProyecto, LblSubProyeccto);
CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyeccto);
cargaEjercicios();
CargaTiposPeriodo();
cargaPeriodos();
DdlTurno.DataSource = GlobalDTTurno.FiltraParametros($"CveEmpresa = { UsuarioActual.CveEmpresa}");
DdlTurno.DataBind();
//Permisos
if (UsuarioActual.TienePermisoProceso(82))
{
@@ -348,6 +351,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
FiltCveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero();
FiltCveTurno = DdlTurno.SelectedValue.ToEntero();
FiltCvePeriodo = DdlPeriodo.SelectedValue.ToEntero();
LtlPeriodoseleccionado.Text = DdlPeriodo.SelectedItem.Text;
FiltAgrupador = 1;
HypPDFSTimbrados.Attributes.Add("onclick", string.Format("GETPDF({0},{1})", -1, FiltCvePeriodo));
cargaDatos();
@@ -904,6 +908,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
int CvePeriodo = e.Row.DataKey("CvePeriodo").ToEntero();
int CveNomina = e.Row.DataKey("CveNomina").ToEntero();
string SeTimbro = e.Row.DataKey("SeTimbro").ToString();
string SeTimbroFiniquito = e.Row.DataKey("SeTimbroFiniquito").ToString();
string EsRenuncia = e.Row.DataKey("EsRenuncia").ToString();
string NomAutorizado = e.Row.DataKey("NomAutorizado").ToString();
string Nombre = e.Row.DataKey("Nombre").ToString();
string Codigo = e.Row.DataKey("Codigo").ToString();
@@ -923,7 +929,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
else
{
if (SeTimbro == "False")
if (!SeTimbro.ToUpper().Contiene("TRUE", "1"))
{
LnkTimbrar.Visible = true;
e.Row.CssClass = "info";
@@ -937,6 +943,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
e.Row.FindControl("HypPDF").Visible = true;
e.Row.FindControl("HypXml").Visible = true;
e.Row.CssClass = "success";
if (EsRenuncia.ToUpper().Contiene("TRUE", "1") && !SeTimbroFiniquito.ToUpper().Contiene("TRUE", "1"))
{
LnkTimbrar.Visible = true;
e.Row.CssClass = "danger";
e.Row.ToolTip = "sin timbrar conceptos de indemnización";
}
}
}
@@ -1487,6 +1499,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
protected void LnkSobreRecibo_Click(object sender, EventArgs e)
{
GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer);
LnkSRVacacionesADD.Visible = false;
if (DdlCtaContable.Items.Count == 0)
{
@@ -2343,10 +2356,14 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
LnkImporte.CommandArgument = (CveConcepto > 0 ? CveConcepto.ToString() : "P");
LnkImporteD.CommandArgument = (CveConceptoD > 0 ? CveConceptoD.ToString() : "D");
LnkImportexCalculo.CommandArgument = LnkImporte.CommandArgument;
LnkImporteDxCalculo.CommandArgument = LnkImporteD.CommandArgument;
LnkImportexCalculo.Visible = isEditedP;
LnkImporteDxCalculo.Visible = isEditedD;
if (LnkImportexCalculo != null)
{
LnkImportexCalculo.CommandArgument = LnkImporte.CommandArgument;
LnkImporteDxCalculo.CommandArgument = LnkImporteD.CommandArgument;
LnkImportexCalculo.Visible = isEditedP;
LnkImporteDxCalculo.Visible = isEditedD;
}
LnkImporte.Text = (CveConcepto > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteP").ToDecimal()) : (CveConceptoPolgvc > 0 ? "<i class=\"fa fa-plus\"></i>" : ""));
LnkImporteD.Text = (CveConceptoD > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteD").ToDecimal()) : (CveConceptoDolgvc > 0 ? "<i class=\"fa fa-plus\"></i>" : ""));
@@ -2651,6 +2668,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
GVInfonavitSegViv.DataSource = objnom.DTSetResultados.Tables[3];
GVVigISRMensual.DataSource = objnom.DTSetResultados.Tables[4];
GVVigSubEmpMensual.DataSource = objnom.DTSetResultados.Tables[5];
GVVigISRSemanal.DataSource = objnom.DTSetResultados.Tables[7];
GVVigISRDecenal.DataSource = objnom.DTSetResultados.Tables[8];
GVVigISRQuincenal.DataSource = objnom.DTSetResultados.Tables[9];
}
if (objnom.RH_TablasValoresGet(UsuarioActual.CveEmpresa, 1))
{
@@ -2664,7 +2687,9 @@ public partial class Nomina_Nomina2 : ClsPaginas
GVInfonavitSegViv.DataBind();
GVVigISRMensual.DataBind();
GVVigSubEmpMensual.DataBind();
GVVigSubEmpMensual.DataBind();
GVVigISRSemanal.DataBind();
GVVigISRDecenal.DataBind();
GVVigISRQuincenal.DataBind();
GVUma.DataBind();
UpModalTablas.Update();
}
@@ -2710,6 +2735,91 @@ public partial class Nomina_Nomina2 : ClsPaginas
loadtablas();
RegistraScript("$('#ModalTablas').modal();");
}
protected void LnkVerCalculoISR_Click(object sender, EventArgs e)
{
DataTable dt = dtempleados.FiltraParametros("CvePersonal >0", "", new string[] { "CvePersonal", "Nombre", "Codigo", "SumaPercepcionesG" });
//dt.Columns.Add("SumaPercepcionesG");
dt.Columns.Add("LimiteInferior");
dt.Columns.Add("ExedenteLI");
dt.Columns.Add("PorcentajeSE");
dt.Columns.Add("ImpuestoMarginal");
dt.Columns.Add("cuotafija");
dt.Columns.Add("Impuestoantessubs");
dt.Columns.Add("subsidio");
dt.Columns.Add("Impuesto");
DataTable dtquin = null;
using (ClsNominas objnom = new ClsNominas())
{
if (objnom.GetTablasNomina(UsuarioActual.CveEmpresa) && objnom.DTSetResultados.Tables.Count > 1)
{
//GVFactorDesctInfonavit.DataSource = objnom.DTSetResultados.Tables[0];
//GVSalariosMinimos.DataSource = objnom.DTSetResultados.Tables[1];
//GVIMMSRiesgot.DataSource = objnom.DTSetResultados.Tables[2];
//GVInfonavitSegViv.DataSource = objnom.DTSetResultados.Tables[3];
//GVVigISRMensual.DataSource = objnom.DTSetResultados.Tables[4];
//GVVigSubEmpMensual.DataSource = objnom.DTSetResultados.Tables[5];
//GVVigISRSemanal.DataSource = objnom.DTSetResultados.Tables[7];
//GVVigISRDecenal.DataSource = objnom.DTSetResultados.Tables[8];
//GVVigISRQuincenal.DataSource = objnom.DTSetResultados.Tables[9];
dtquin = objnom.DTSetResultados.Tables[9];
}
//if (objnom.RH_TablasValoresGet(UsuarioActual.CveEmpresa, 1))
//{
// GVUma.DataSource = objnom.DtResultados;
//}
}
if (dtquin != null)
{
foreach (DataRow item in dt.Rows)
{
decimal SumaPercepcionesG = item["SumaPercepcionesG"].ToString().ToDecimal();
decimal Limiteinferior = 0;
decimal CuotaFija = 0;
decimal Porcentaje = 0;
foreach (DataRow drow in dtquin.Rows)
{
decimal limite = drow["Limite inferior"].ToString().ToDecimal();
if (limite > SumaPercepcionesG) {
break;
}
else
{
Limiteinferior = drow["Limite inferior"].ToString().ToDecimal();
CuotaFija = drow["Cuota fija"].ToString().ToDecimal();
Porcentaje = drow["Porcentaje"].ToString().ToDecimal();
}
}
decimal Impuestomarginal = (SumaPercepcionesG - Limiteinferior) * (Porcentaje / 100);
decimal Impuestoantessubs= Impuestomarginal+ CuotaFija;
item["LimiteInferior"] = Limiteinferior;
item["ExedenteLI"] = SumaPercepcionesG - Limiteinferior;
item["PorcentajeSE"] = Porcentaje;
item["ImpuestoMarginal"] = Impuestomarginal;
item["cuotafija"] = CuotaFija;
item["Impuestoantessubs"] = Impuestoantessubs;
item["subsidio"] =0;
item["Impuesto"] = Impuestoantessubs;
//[Limite inferior],FORMAT(CuotaFija,'###,####,###0.00') [Cuota fija],FORMAT(Porcentaje,'###,####,###0.00') Porcentaje
}
dt.AcceptChanges();
}
UpCalculoISR.Update();
GVCalculoISR.DataSource = dt;
GVCalculoISR.DataBind();
RegistraScript("$('#ModalCalculoISR').modal();");
}
private void ImprimirReporte()
{
@@ -4093,13 +4203,13 @@ public partial class Nomina_Nomina2 : ClsPaginas
protected void CargaConcepto()
{
DdlConcepto.Items.Clear();
if (DdlTipo.SelectedValue == "-1")
if (DdlTipo.SelectedValue.Contiene("P", "D", "O"))
{
DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa);
DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa).FiltraParametros(string.Format("Tipo ='{0}' AND FormulaTotal = 'FNC.[MovimientosPermanentes]'", DdlTipo.SelectedValue));
}
else
{
DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa).FiltraParametros(string.Format("Tipo ='{0}'", DdlTipo.SelectedValue));
DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa).FiltraParametros(" FormulaTotal = 'FNC.[MovimientosPermanentes]'");
}
DdlConcepto.DataBind();
DdlConcepto.Items.Insert(0, new ListItem("Seleccione", "-1"));
@@ -4220,6 +4330,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
DdlTipo.SelectedValueExist(tipo);
DdlTipo_SelectedIndexChanged(null, null);
}
CargaConcepto();
DdlConcepto.SelectedValueExist(cveConcepto);
TxtDescripcion.Text = descripcion.ToString();
DdlTipoDescto.SelectedValueExist(tipoDescuento.ToString());
@@ -4534,6 +4645,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
GvConceptossimulador.DataSource = new DataTable();
GvConceptossimulador.DataBind();
DdlTipoPeriodoSim.SelectedValue = "1";
RegistraScript("$('#DSimulador').modal()");
UpSimulador.Update();
}
@@ -4544,12 +4656,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
int CveProyecto = -1;
int CveSubProyecto = 1;
int CveTurno = -1;
int CvePeriodo = 12551;
int CvePeriodo = (DdlTipoPeriodoSim.SelectedValue == "1") ? 12706 : 12551;
int CveEmpresa = UsuarioActual.CveEmpresa;
int Agrupador = -1;
decimal Neto = TxtNetoaPagar.Text.ToDecimal();
decimal NetoSimulado = 0;
decimal SDI = (Neto * 1.25M) / 15;
decimal SDI = (Neto * 1.25M) / (DdlTipoPeriodoSim.SelectedValue == "1" ? 7 : 15);
decimal SDIOLD = 0;
decimal sumador = 100;
decimal multiplicador = 1;
@@ -4567,7 +4679,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
while (Neto != NetoSimulado && continuarV)
{
if (objnom.GetNominaEmpleadoSimulador(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, CveEmpresa, Agrupador, SDI) && objnom.DTSetResultados.Tables.Count > 1)
if (objnom.GetNominaEmpleado(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, CveEmpresa, Agrupador, -1, 1, SDI)
&& objnom.DTSetResultados.Tables.Count > 1)
{
dtempleados = objnom.DTSetResultados.Tables[3];
dtempleadosConceptos = objnom.DTSetResultados.Tables[4];
@@ -4620,12 +4733,13 @@ public partial class Nomina_Nomina2 : ClsPaginas
if (continuar)
{
{
DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ");
DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ");
DataTable dtObl = dtConceptos.FiltraParametros("Tipo IN ('O') AND EsPadre = 1 ");
dtper.Columns.Add("BorradoLogico", typeof(int));
dtded.Columns.Add("BorradoLogico", typeof(int));
dtObl.Columns.Add("BorradoLogico", typeof(int));
DataTable dtx = dtConceptos.Copy();
dtx.Columns.Add("BorradoLogico", typeof(int));
DataTable dtper = dtx.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ");
DataTable dtded = dtx.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ");
DataTable dtObl = dtx.FiltraParametros("Tipo IN ('O') AND EsPadre = 1 ");
////dtded.Columns.Add("BorradoLogico", typeof(int));
////dtObl.Columns.Add("BorradoLogico", typeof(int));
foreach (DataRow row in dtper.Rows)
{
@@ -4862,6 +4976,10 @@ public partial class Nomina_Nomina2 : ClsPaginas
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;
@@ -4871,14 +4989,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
celda = celda + 4;
string CuotaFijaSUA = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSUA").ToDecimal());
string CuotaFijaSIG = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSIG").ToDecimal());
if (CuotaFijaSUA != CuotaFijaSIG)
{
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
celda = celda + 2;
string CuotaExcedenteSUA = string.Format("{0:N2}", e.Row.DataKey("CuotaExcedenteSUA").ToDecimal());
string CuotaExcedenteSIG = string.Format("{0:N2}", e.Row.DataKey("CuotaExcedenteSIG").ToDecimal());
if (CuotaExcedenteSUA != CuotaExcedenteSIG)
@@ -4903,17 +5013,33 @@ public partial class Nomina_Nomina2 : ClsPaginas
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 (RiesgosdeTrabajoSUA != RiesgoTrabajoSIG)
string InvalidezyVidaSUA = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSUA").ToDecimal());
string InvalidezyVidaSIG = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSIG").ToDecimal());
if (InvalidezyVidaSUA != InvalidezyVidaSIG)
{
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 (InvalidezyVidaSUA != InvalidezyVidaSIG)
string CesantiayVejezObreraSUA = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezObreraSUA").ToDecimal());
string CesantiayVejezObreraSIG = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezObreraSIG").ToDecimal());
if (CesantiayVejezObreraSUA != CesantiayVejezObreraSIG)
{
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 (CuotaFijaSUA != CuotaFijaSIG)
{
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 (RiesgosdeTrabajoSUA != RiesgoTrabajoSIG)
{
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
@@ -4934,6 +5060,14 @@ public partial class Nomina_Nomina2 : ClsPaginas
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 (CesantiayVejezPatronalSUA != CesantiayVejezPatronalSIG)
{
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
}
}
@@ -5113,7 +5247,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
int cveControlIncapacidad = gvRow.DataKey("CveControlIncapacidad").ToEntero();
string descripcion = gvRow.DataKey("Descripcion");
#endregion
TxtSRINCfolio.Text = folio.ToString();
TxtSRINCfechaInicio.Text = $"{fechaInicio:dd/MM/yyyy}";
TxtSRINCdiasAutorizados.Text = diasAutorizados.ToString();
@@ -5459,6 +5592,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
byte[] pdf = new byte[1];
string nombre = "recibo";
bool confiniquito = false;
int CvePersonal = TxtCvePersonal.Text.ToEntero(); int CvePeriodo = TxtCvePeriodo.Text.ToEntero();
if (CvePersonal > 0)
{
@@ -5469,8 +5603,20 @@ public partial class Nomina_Nomina2 : ClsPaginas
nombre = ObjNomina.SerieFolio;
}
if (ObjNomina.GetNom_NominasDetalles(-1, CvePersonal, CvePeriodo, "-1"))
{
confiniquito = ObjNomina.DtResultados.COUNT("CveConcepto", " CveSistema IN(10,11,32,47) AND Importe <>0") > 0;
}
}
pdf = GeneraPDFNomina(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta);
if (confiniquito)
{
List<byte[]> pdfs = new List<byte[]>();
pdfs.Add(pdf);
pdfs.Add(GeneraPDFNomina(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta, true));
pdf = MergeFiles(pdfs);
}
}
else
{
@@ -5581,41 +5727,66 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
string Ruta = "";
string PathXML = "";
string PathXMLF = "";
string Xmlname = "";
string XmlnameF = "";
string empleado = "";
DataRow dr = dtempleados.FiltroPrimero(string.Format("CvePersonal ={0}", TxtCvePersonal.Text.ToEntero()));
if (dr != null)
{
empleado = string.Format("{0} - {1}", dr["Codigo"], dr["Nombre"]);
}
using (ClsNominas ObjNomina = new ClsNominas())
{
if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa))
{
Ruta = $@"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\";
PathXML = $@"{Ruta}XML\Nomina\{ObjNomina.SerieFolio}.xml";
Ruta = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\\{UsuarioActual.CveEmpresa}\\";
PathXML = $"{Ruta}XML\\Nomina\\{ObjNomina.SerieFolio}.xml";
PathXMLF = $"{Ruta}XML\\Nomina\\{ObjNomina.Serie}F-{ObjNomina.Folio}.xml";
Xmlname = ObjNomina.SerieFolio;
XmlnameF = $"{ObjNomina.Serie}F-{ObjNomina.Folio}";
}
}
try
{
string script = "";
if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML))
{
System.IO.FileInfo file = new System.IO.FileInfo(PathXML);
string mimeType = "text/plain";
try
{
mimeType = MimeMapping.GetMimeMapping(PathXML);
}
catch (Exception)
{
}
// Response.Write(path)
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}");
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = mimeType;
Response.Flush();
Response.TransmitFile(file.FullName);
Response.End();
LtlXml.Text = System.IO.File.ReadAllText(PathXML);
script = string.Format("Savexml(\"{0} {1}.xml\", $('.ltlxml').html());", Xmlname, empleado);
//System.IO.FileInfo file = new System.IO.FileInfo(PathXML);
//string mimeType = "text/plain";
//try
//{
// mimeType = MimeMapping.GetMimeMapping(PathXML);
//}
//catch (Exception)
//{
//}
//// Response.Write(path)
//Response.Clear();
//Response.ClearHeaders();
//Response.ClearContent();
//Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}");
//Response.AddHeader("Content-Length", file.Length.ToString());
//Response.ContentType = mimeType;
//Response.Flush();
//Response.TransmitFile(file.FullName);
//Response.End();
}
if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXMLF))
{
LtlXmlfin.Text = System.IO.File.ReadAllText(PathXMLF);
script = string.Format("{1}Savexml(\"{0}(Indemnización) {2}.xml\", $('.ltlxmlfin').html());", Xmlname, script, empleado);
}
if (script.Trim().Length > 0)
{
RegistraScript(script);
}
else
{
Alert("No se encontro el archivo");
}
}
catch (Exception)
@@ -5825,12 +5996,54 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
if (nom.ReportedeAcumuladosGET(UsuarioActual.CveEmpresa, TxtPeriodo.Text.ToEntero(), 4))
{
DateTime datei = new DateTime();
DateTime datef = datei;
try
{
datei = $"{TxtPeriodo.Text}01".ToDateTime();
datef = datei.AddMonths(1).AddDays(-1);
}
catch (Exception) { }
DataTable dt = nom.DTSetResultados.Tables[0];
var libro = wb.AddWorksheet(dt, "Acumulados");
libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None;
int crow = 1;
foreach (DataRow item in dt.Rows)
{
crow++;
//220,230,241
//79,129,189
switch (item["Grupoid"].ToString())
{
case "1":
libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "2":
libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(220, 230, 241));
//libro.Range(crow, 1, crow, 10).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "3":
break;
case "4":
libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "5":
var libro = wb.AddWorksheet(nom.DTSetResultados.Tables[0], "Acumulados");
libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
}
}
libro.Range(2, 3, crow, 11).Style.NumberFormat.Format = "$##,###,###,0.00";
libro.Range(2, 3, crow, 11).DataType = ClosedXML.Excel.XLDataType.Number;
libro.Column(1).Delete();
libro.ColumnsUsed().AdjustToContents();
libro.Row(1).InsertRowsAbove(4);
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Range(2, 2, 2, 6).Merge().Value = "Reporte de Acumulados";
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de Acumulados del {datei:dd/MM/yyyy} al {datef:dd/MM/yyyy}";
//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}";
@@ -5869,25 +6082,77 @@ public partial class Nomina_Nomina2 : ClsPaginas
protected void LinkButton1_Click(object sender, EventArgs e)
{
}
protected void LnkrRepPercpDed_Click(object sender, EventArgs e)
{
DateTime fechai = TxtRIFechaInicio.Text.ToDateTime();
DateTime fechaf = TxtRIFechaFin.Text.ToDateTime();
DateTime fechai = TxtRpdFechaInicio.Text.ToDateTime();
DateTime fechaf = TxtRpdFechaFin.Text.ToDateTime();
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
using (ClsNominas nom = new ClsNominas())
{
if (nom.ReportedePercepcionesDeduccionesGet(UsuarioActual.CveEmpresa, fechai, fechaf, 4))
{
DataTable dt = nom.DTSetResultados.Tables[0];
var libro = wb.AddWorksheet(nom.DTSetResultados.Tables[0], "Percepciones y deducciones");
libro.ColumnsUsed().AdjustToContents();
libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None;
int crow = 1;
foreach (DataRow item in dt.Rows)
{
crow++;
//220,230,241
//79,129,189
switch (item["Grupoid"].ToString())
{
case "10":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228));
break;
case "8":
case "11":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "6":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188));
break;
case "5":
case "7":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 187, 89));
libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "2":
//libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188));
break;
case "1":
case "3":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(75, 172, 198));
libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
}
}
libro.Range(2, 4, crow, 9).Style.NumberFormat.Format = "$##,###,###,0.00";
libro.Range(2, 4, crow, 9).DataType = ClosedXML.Excel.XLDataType.Number;
libro.Column(1).Delete();
libro.ColumnsUsed().AdjustToContents();
libro.Row(1).InsertRowsAbove(4);
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de percepciones y deducciones del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
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:{DateTime.Now:dd/MM/yyyy}";
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
//ws.Row(1).InsertRowsAbove(1);
}
}
@@ -5912,4 +6177,9 @@ public partial class Nomina_Nomina2 : ClsPaginas
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
protected void LnkShowAddVacaciones_Click(object sender, EventArgs e)
{
LnkSRVacacionesADD.Visible = true;
}
}