This commit is contained in:
@@ -210,8 +210,8 @@ public partial class Nomina_Finiquito : ClsPaginas
|
||||
}
|
||||
protected void LnkConcepto_Click(object sender, EventArgs e)
|
||||
{
|
||||
int SRCveConcepto = ((LinkButton)sender).CommandArgument.ToEntero();
|
||||
string SRTipoConcepto = ((LinkButton)sender).CommandArgument;
|
||||
int SRCveConcepto = ((LinkButton)sender).CommandArgument.ToEntero();
|
||||
string SRTipoConcepto = ((LinkButton)sender).CommandArgument;
|
||||
#region carga conceptos
|
||||
DataTable dtCon;
|
||||
if (SRCveConcepto > 0)
|
||||
@@ -498,6 +498,217 @@ public partial class Nomina_Finiquito : ClsPaginas
|
||||
protected void LnkFormatoRenuncia_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 AND SoloVisible =0");
|
||||
DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 AND SoloVisible =0");
|
||||
dtper.Columns.Add("BorradoLogico", typeof(int));
|
||||
dtded.Columns.Add("BorradoLogico", typeof(int));
|
||||
|
||||
foreach (DataRow row in dtper.Rows)
|
||||
{
|
||||
int BorradoLogico = 0;
|
||||
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
|
||||
if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", CvePersonal)) != 0))
|
||||
{
|
||||
BorradoLogico = 1;
|
||||
}
|
||||
row["BorradoLogico"] = BorradoLogico;
|
||||
}
|
||||
dtper.AcceptChanges();
|
||||
foreach (DataRow row in dtded.Rows)
|
||||
{
|
||||
int BorradoLogico = 0;
|
||||
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
|
||||
if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", CvePersonal)) != 0))
|
||||
{
|
||||
BorradoLogico = 1;
|
||||
}
|
||||
row["BorradoLogico"] = BorradoLogico;
|
||||
}
|
||||
dtded.AcceptChanges();
|
||||
dtper = dtper.FiltraParametros("BorradoLogico=0");
|
||||
dtded = dtded.FiltraParametros("BorradoLogico=0");
|
||||
int maxper = dtper.Rows.Count;
|
||||
int maxded = dtded.Rows.Count;
|
||||
int i = 0;
|
||||
List<NConcepto> lconc = new List<NConcepto>();
|
||||
for (i = 0; i < maxper || i < maxded; i++)
|
||||
{
|
||||
NConcepto nConcepto = new NConcepto();
|
||||
DataRow row;
|
||||
if (maxper > i)
|
||||
{
|
||||
row = dtper.Rows[i];
|
||||
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
|
||||
string Concepto = row["Concepto"].ToString();
|
||||
string Codigo = row["Codigo"].ToString();
|
||||
//bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
|
||||
double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", CvePersonal));
|
||||
nConcepto.CveConceptoP = CveConcepto;
|
||||
nConcepto.ConceptoP = Concepto;
|
||||
nConcepto.NoConceptoP = Codigo;
|
||||
nConcepto.ImporteP = Importe;
|
||||
nConcepto.ValorP = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", CvePersonal));
|
||||
}
|
||||
if (maxded > i)
|
||||
{
|
||||
row = dtded.Rows[i];
|
||||
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
|
||||
string Concepto = row["Concepto"].ToString();
|
||||
string Codigo = row["Codigo"].ToString();
|
||||
//bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
|
||||
double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", CvePersonal));
|
||||
nConcepto.CveConceptoD = CveConcepto;
|
||||
nConcepto.ConceptoD = Concepto;
|
||||
nConcepto.NoConceptoD = Codigo;
|
||||
nConcepto.ImporteD = Importe;
|
||||
nConcepto.ValorD = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", CvePersonal));
|
||||
}
|
||||
lconc.Add(nConcepto);
|
||||
}
|
||||
|
||||
lconc.Add(new NConcepto());
|
||||
|
||||
NConcepto SubTotales = new NConcepto();
|
||||
SubTotales.CveConceptoP = 0;
|
||||
SubTotales.ConceptoP = "Total Percepciones";
|
||||
SubTotales.EstatusP = -2;
|
||||
SubTotales.ImporteP = dtempleados.SUM("SumaPercepciones", string.Format("CvePersonal = {0}", CvePersonal));
|
||||
///Alert(SubTotales.ImporteP.ToString());
|
||||
|
||||
SubTotales.CveConceptoD = 0;
|
||||
SubTotales.ConceptoD = "Total Deducciones";
|
||||
SubTotales.EstatusD = -2;
|
||||
SubTotales.ImporteD = dtempleados.SUM("SumaDeducciones", string.Format("CvePersonal = {0}", CvePersonal));
|
||||
|
||||
NConcepto Totales = new NConcepto();
|
||||
Totales.CveConceptoD = 0;
|
||||
Totales.ConceptoD = "Total";
|
||||
Totales.EstatusD = -3;
|
||||
Totales.ImporteD = dtempleados.SUM("Total", string.Format("CvePersonal = {0}", CvePersonal));
|
||||
|
||||
lconc.Add(SubTotales);
|
||||
lconc.Add(Totales);
|
||||
|
||||
DataTable dtCon = new DataTable();
|
||||
dtCon.Columns.Add(new DataColumn("NoConceptoP", typeof(string)));
|
||||
dtCon.Columns.Add(new DataColumn("ConceptoP", typeof(string)));
|
||||
dtCon.Columns.Add(new DataColumn("LabelValorP", typeof(string)));
|
||||
dtCon.Columns.Add(new DataColumn("CveConceptoP", typeof(int)));
|
||||
dtCon.Columns.Add(new DataColumn("ImporteP", typeof(double)));
|
||||
dtCon.Columns.Add(new DataColumn("ValorP", typeof(double)));
|
||||
dtCon.Columns.Add(new DataColumn("EstatusP", typeof(int)));
|
||||
dtCon.Columns.Add(new DataColumn("isEditedP", typeof(int)));
|
||||
dtCon.Columns.Add(new DataColumn("isOnlyBisibleP", typeof(int)));
|
||||
dtCon.Columns.Add(new DataColumn("NoConceptoD", typeof(string)));
|
||||
dtCon.Columns.Add(new DataColumn("ConceptoD", typeof(string)));
|
||||
dtCon.Columns.Add(new DataColumn("LabelValorD", typeof(string)));
|
||||
dtCon.Columns.Add(new DataColumn("CveConceptoD", typeof(int)));
|
||||
dtCon.Columns.Add(new DataColumn("ImporteD", typeof(double)));
|
||||
dtCon.Columns.Add(new DataColumn("ValorD", typeof(double)));
|
||||
dtCon.Columns.Add(new DataColumn("EstatusD", typeof(int)));
|
||||
dtCon.Columns.Add(new DataColumn("isEditedD", typeof(int)));
|
||||
dtCon.Columns.Add(new DataColumn("isOnlyBisibleD", typeof(int)));
|
||||
foreach (NConcepto itc in lconc)
|
||||
{
|
||||
DataRow dr = dtCon.NewRow();
|
||||
dr["NoConceptoP"] = itc.NoConceptoP;
|
||||
dr["ConceptoP"] = itc.ConceptoP;
|
||||
dr["LabelValorP"] = itc.LabelValorP;
|
||||
dr["CveConceptoP"] = itc.CveConceptoP;
|
||||
dr["ImporteP"] = itc.ImporteP;
|
||||
dr["ValorP"] = itc.ValorP;
|
||||
dr["EstatusP"] = itc.EstatusP;
|
||||
dr["isEditedP"] = itc.isEditedP;
|
||||
dr["isOnlyBisibleP"] = itc.isOnlyBisibleP;
|
||||
dr["NoConceptoD"] = itc.NoConceptoD;
|
||||
dr["ConceptoD"] = itc.ConceptoD;
|
||||
dr["LabelValorD"] = itc.LabelValorD;
|
||||
dr["CveConceptoD"] = itc.CveConceptoD;
|
||||
dr["ImporteD"] = itc.ImporteD;
|
||||
dr["ValorD"] = itc.ValorD;
|
||||
dr["EstatusD"] = itc.EstatusD;
|
||||
dr["isEditedD"] = itc.isEditedD;
|
||||
dr["isOnlyBisibleD"] = itc.isOnlyBisibleD;
|
||||
dtCon.Rows.Add(dr);
|
||||
}
|
||||
dtCon.AcceptChanges();
|
||||
List<Microsoft.Reporting.WebForms.ReportDataSource> lrds = new List<Microsoft.Reporting.WebForms.ReportDataSource>();
|
||||
Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource();
|
||||
rds.Name = "DataSet1";
|
||||
rds.Value = dtCon;// lconc;
|
||||
lrds.Add(rds);
|
||||
List<Microsoft.Reporting.WebForms.ReportParameter> parametros = new List<Microsoft.Reporting.WebForms.ReportParameter>();
|
||||
|
||||
string CodigoEmpleado = "";
|
||||
string NombreCompleto = "";
|
||||
string RFC = "";
|
||||
string CURP = "";
|
||||
string TipoPeriodo = "";
|
||||
string NSS = "";
|
||||
string DiasLaborados = "";
|
||||
string DiasFaltados = "";
|
||||
string DiasVacaciones = "";
|
||||
string FechaInicio = "";
|
||||
string FechaFin = "";
|
||||
string DiasRetardos = "";
|
||||
string DiasIncapacidad = "";
|
||||
string SubProyecto = "";
|
||||
{
|
||||
DataRow drow = dtempleados.FiltroPrimero(string.Format("CvePersonal = {0}", CvePersonal));
|
||||
if (drow != null)
|
||||
{
|
||||
DiasLaborados = string.Format("{0}", drow["DiasLaborados"].ToString().ToEntero());
|
||||
DiasFaltados = string.Format("{0}", drow["DiasFaltados"].ToString().ToEntero());
|
||||
DiasVacaciones = string.Format("{0}", drow["DiasVacaciones"].ToString().ToEntero());
|
||||
FechaInicio = string.Format("{0:dd/MM/yyyy}", drow["FechaInicio"]);
|
||||
FechaFin = string.Format("{0:dd/MM/yyyy}", drow["FechaFin"]);
|
||||
DiasRetardos = string.Format("{0}", drow["DiasRetardos"].ToString().ToEntero());
|
||||
DiasIncapacidad = string.Format("{0}", drow["DiasIncapacidad"].ToString().ToEntero());
|
||||
}
|
||||
}
|
||||
//string Codigo = "";
|
||||
using (ClsRH objrh = new ClsRH())
|
||||
{
|
||||
if (objrh.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) && objrh.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DataRow drow = objrh.DtResultados.Rows[0];
|
||||
SubProyecto = drow["SubProyecto"].ToString();
|
||||
CodigoEmpleado = drow["Codigo"].ToString();
|
||||
NombreCompleto = drow["NombreCompleto"].ToString();
|
||||
RFC = drow["RFC"].ToString();
|
||||
CURP = drow["CURP"].ToString();
|
||||
TipoPeriodo = drow["TipoPeriodo"].ToString();
|
||||
NSS = drow["NSS"].ToString();
|
||||
}
|
||||
}
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasIncapacidad", DiasIncapacidad));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("Codigo", CodigoEmpleado));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("NombreCompleto", NombreCompleto));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("RFC", RFC));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CURP", ""));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("TipoPeriodo", TipoPeriodo));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("NSS", NSS));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasLaborados", DiasLaborados));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasFaltados", DiasFaltados));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasVacaciones", DiasVacaciones));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("FechaInicio", FechaInicio));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("FechaFin", FechaFin));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("DiasRetardos", DiasRetardos));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("Empresa", UsuarioActual.Empresa.Empresa));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("SubProyecto", SubProyecto));
|
||||
parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("FechaPago", ""));
|
||||
//parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
|
||||
//parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
|
||||
//parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
|
||||
//parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
|
||||
//parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("", ""));
|
||||
string urlfile = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, string.Format("Empresas/{0}/Formatos/SobreRecibo.rdlc", UsuarioActual.CveEmpresa));
|
||||
if (!System.IO.File.Exists(urlfile))
|
||||
{
|
||||
urlfile = System.IO.Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas/Grales/Formatos/SobreRecibo.rdlc");
|
||||
}
|
||||
|
||||
ImprimirPDF(urlfile, lrds, parametros, "SobreRecibo", "PDF", null);
|
||||
}
|
||||
|
||||
protected void LnkCambiarEmpleado_Click(object sender, EventArgs e)
|
||||
@@ -868,4 +1079,152 @@ public partial class Nomina_Finiquito : ClsPaginas
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void LnkCancelar_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
{
|
||||
if (onom.RemoveFiniquito(CvePersonal, UsuarioActual.CveEmpresa, CvePersonalAltas))
|
||||
{
|
||||
Alert("se ha eliminado el proceso de finiquito");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void LnkSimular_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (LblFechaAlta.Text.ToDate() > TxtFechaBaja.Text.ToDate())
|
||||
{
|
||||
Alert("la fecha de baja no puede ser menor a la fecha alta", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool continuar = false;
|
||||
|
||||
using (ClsRH ObjPersonal = new ClsRH())
|
||||
using (ClsNominas onom = new ClsNominas(ObjPersonal.IniciaTransacSQL()))
|
||||
{
|
||||
if (ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DataRow da = ObjPersonal.DtResultados.Rows[0];
|
||||
CvePeriodoIndemnizacion = da["CvePeriodoIndemnizacion"].ToString().ToEntero();
|
||||
CvePeriodoFiniquito = da["CvePeriodoFiniquito"].ToString().ToEntero();
|
||||
continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa);
|
||||
}
|
||||
if (continuar)
|
||||
{
|
||||
continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa);
|
||||
}
|
||||
if (continuar)
|
||||
{ loadsobrerecibo(onom); }
|
||||
if (continuar)
|
||||
{
|
||||
ObjPersonal.RollBack();
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjPersonal.RollBack();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
UPDatos.Update();
|
||||
}
|
||||
|
||||
protected void DdlmcConceptos_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void BtnAceptarMC_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool continuar = true;
|
||||
int CveNomina = 0;
|
||||
double Total = 0;
|
||||
int CveMoneda = 1;
|
||||
int CveMetodoPago = 0;
|
||||
int CveConcepto = DdlmcConceptos.SelectedValue.ToEntero();
|
||||
if (CveConcepto > 0 && CvePersonal > 0)
|
||||
{
|
||||
decimal ImporteConcepto = TxtmcImporte.Text.Replace("$", "").Replace(",", "").ToDecimal();
|
||||
decimal ImporteGravadoConcepto = TxtmcImporteGrabado.Text.Replace("$", "").Replace(",", "").ToDecimal();
|
||||
decimal ImporteExentoConcepto = ImporteConcepto - ImporteGravadoConcepto;
|
||||
decimal ImporteValor = Txtmcvalor.Text.Replace("$", "").Replace(",", "").ToDecimal();
|
||||
using (ClsNominas objNomina = new ClsNominas())
|
||||
{
|
||||
objNomina.IniciaTransacSQL();
|
||||
if (continuar)
|
||||
{
|
||||
if (objNomina.GetNom_Nominas(-1, CvePersonal, CvePeriodoIndemnizacion, -1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
if (objNomina.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
CveNomina = objNomina.CveNomina;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (objNomina.AddNom_Nominas(-1, 1, CvePersonal, CvePeriodoIndemnizacion, Total, 0, 0, Total, CveMoneda, 1, CveMetodoPago, DateTime.Now, "Deducciones nómina",
|
||||
"", "", "", "", 0, 0, 0, new DateTime(), new DateTime(), new DateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, false))
|
||||
{
|
||||
CveNomina = objNomina.CveNomina;
|
||||
}
|
||||
else
|
||||
{
|
||||
continuar = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CveNomina == 0)
|
||||
{
|
||||
continuar = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (continuar)
|
||||
{
|
||||
|
||||
if (continuar)
|
||||
{
|
||||
|
||||
if (!objNomina.AddUPNom_NominasDetalles(CveNomina, CvePeriodoIndemnizacion, CvePersonal, CveConcepto, ImporteConcepto, ImporteGravadoConcepto, ImporteExentoConcepto, ImporteValor, UsuarioActual.CveUsuario, true))
|
||||
{
|
||||
continuar = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (continuar)
|
||||
{ objNomina.Commit(); }
|
||||
else
|
||||
{
|
||||
objNomina.RollBack();
|
||||
}
|
||||
}
|
||||
if (continuar)
|
||||
{
|
||||
using (ClsNominas objNomina = new ClsNominas())
|
||||
{
|
||||
loadsobrerecibo(objNomina);
|
||||
}
|
||||
Alert("El cambio se ha guardado correctamente.");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CveConcepto > 0)
|
||||
{
|
||||
Alert("Debe seleccionar un empleado.", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("Debe seleccionar un concepto.", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user