This commit is contained in:
@@ -220,12 +220,16 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
CvePeriodoSeleccionado = 0;
|
||||
dtempleados = null;
|
||||
dtConceptos = null;
|
||||
DataTable dtPeriodo = new DataTable();
|
||||
DataTable dtasistencia = new DataTable();
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
if (objnom.GetNominaEmpleado(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, CveEmpresa, Agrupador) && objnom.DTSetResultados.Tables.Count > 1)
|
||||
{
|
||||
dtempleados = objnom.DTSetResultados.Tables[0];
|
||||
dtConceptos = objnom.DTSetResultados.Tables[1];
|
||||
dtPeriodo = objnom.DTSetResultados.Tables[2];
|
||||
dtasistencia = objnom.DTSetResultados.Tables[3];
|
||||
CvePeriodoSeleccionado = CvePeriodo;
|
||||
continuar = true;
|
||||
}
|
||||
@@ -512,6 +516,56 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
GvNominas.DataBind();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
/*
|
||||
DateTime FechaInicio = (DateTime)dtPeriodo.Rows[0]["FechaInicio"];
|
||||
DateTime FechaFin = (DateTime)dtPeriodo.Rows[0]["FechaFin"];
|
||||
StringBuilder gvasistencia = new StringBuilder();
|
||||
gvasistencia.Append("<table class=\"table table-striped table-hover mysmallbtn Widthall ScrollAD\">");
|
||||
if (true)
|
||||
{
|
||||
DateTime fecha = FechaInicio;
|
||||
|
||||
gvasistencia.Append("<tr class=\"Titulos\">");
|
||||
gvasistencia.Append("<td>Nombre</td>");
|
||||
while (fecha <= FechaFin)
|
||||
{
|
||||
gvasistencia.AppendFormat("<td>{0:dd/MM/yyyy}</td>", fecha);
|
||||
fecha= fecha.AddDays(1);
|
||||
}
|
||||
gvasistencia.Append("</tr>");
|
||||
}
|
||||
foreach (DataRow rempl in dtempleados.Rows)
|
||||
{
|
||||
int CvePersonal = rempl["CvePersonal"].ToString().ToEntero();
|
||||
string nombre = rempl["Nombre"].ToString();
|
||||
DateTime fecha = FechaInicio;
|
||||
gvasistencia.Append("<tr>");
|
||||
gvasistencia.AppendFormat("<td>{0}</td>", nombre);
|
||||
while (fecha <= FechaFin)
|
||||
{
|
||||
DataRow drow = dtasistencia.FiltroPrimero(string.Format("Fecha='{0:yyyy/MM/dd}' AND CvePersonal={1}", fecha, CvePersonal));
|
||||
fecha=fecha.AddDays(1);
|
||||
string tipo = "-";
|
||||
if (drow != null)
|
||||
{
|
||||
tipo = drow["Tipo"].ToString();
|
||||
drow.Delete();
|
||||
}
|
||||
gvasistencia.AppendFormat("<td>{0}</td>", tipo);
|
||||
}
|
||||
gvasistencia.Append("</tr>");
|
||||
}
|
||||
gvasistencia.Append("</table>");
|
||||
ltlGvAsistencia.Text = gvasistencia.ToString();*/
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
#endregion
|
||||
UpDatos.Update();
|
||||
}
|
||||
@@ -573,13 +627,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region SobreRecibo
|
||||
|
||||
protected void LnkSobreRecibo_Click(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
protected void LnkTimbrar_Click(object sender, EventArgs e)
|
||||
@@ -770,6 +817,137 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region SobreRecibo
|
||||
|
||||
protected void LnkSobreRecibo_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
|
||||
string Nombre = gvrow.DataKey("Nombre").ToString();
|
||||
int cvePersonal = gvrow.DataKey("CvePersonal").ToEntero();
|
||||
int CvePeriodo = gvrow.DataKey("CvePeriodo").ToEntero();
|
||||
int CveNomina = gvrow.DataKey("CveNomina").ToEntero();
|
||||
LblEmpleado.Text = Nombre;
|
||||
DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ");
|
||||
DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ");
|
||||
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)) > 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)) > 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();
|
||||
//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.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();
|
||||
//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.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);
|
||||
GvConceptos.DataSource = lconc;
|
||||
GvConceptos.DataBind();
|
||||
UpModalConceptos.Update();
|
||||
RegistraScript("$('#ModalConceptos').modal();");
|
||||
//if (true)
|
||||
//{
|
||||
// BoundField field = (BoundField)GvNominas.Columns[CurrentColumn];
|
||||
|
||||
// field.HeaderText = "Percepciones";
|
||||
// field.DataField = "SumaPercepciones";
|
||||
// field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
|
||||
// GvNominas.Columns[CurrentColumn].Visible = true;
|
||||
// CurrentColumn++;
|
||||
//}
|
||||
|
||||
//if (true)
|
||||
//{
|
||||
// BoundField field = (BoundField)GvNominas.Columns[CurrentColumn];
|
||||
// field.HeaderText = "Deducciones";
|
||||
// field.DataField = "SumaDeducciones";
|
||||
// field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
|
||||
// GvNominas.Columns[CurrentColumn].Visible = true;
|
||||
// CurrentColumn++;
|
||||
|
||||
// field = (BoundField)GvNominas.Columns[CurrentColumn];
|
||||
// field.HeaderText = "Total";
|
||||
// field.DataField = "Total";
|
||||
// field.ItemStyle.BackColor = System.Drawing.Color.LightGray;
|
||||
// GvNominas.Columns[CurrentColumn].Visible = true;
|
||||
// CurrentColumn++;
|
||||
//}
|
||||
}
|
||||
|
||||
protected void LnkFormato_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
@@ -852,4 +1030,80 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString());
|
||||
}
|
||||
}
|
||||
private class NConcepto
|
||||
{
|
||||
public string ConceptoP { get; set; }
|
||||
public int CveConceptoP { get; set; }
|
||||
public double ImporteP { get; set; }
|
||||
public double ValorP { get; set; }
|
||||
public int EstatusP { get; set; }
|
||||
|
||||
|
||||
public string ConceptoD { get; set; }
|
||||
public int CveConceptoD { get; set; }
|
||||
public double ImporteD { get; set; }
|
||||
public double ValorD { get; set; }
|
||||
public int EstatusD { get; set; }
|
||||
}
|
||||
|
||||
protected void GvConceptos_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
// Datakeys
|
||||
// Concepto,CveConcepto,Importe,Estatus,ConceptoD,CveConceptoD,ImporteD,EstatusD
|
||||
int CveConcepto = e.Row.DataKey("CveConceptoP").ToEntero();
|
||||
int CveConceptoD = e.Row.DataKey("CveConceptoD").ToEntero();
|
||||
// Dim Importe As Decimal = e.Row.DataKey("Importe").ToDecimal()
|
||||
// Dim ImporteD As Decimal = e.Row.DataKey("ImporteD").ToDecimal()
|
||||
int Estatus = e.Row.DataKey("EstatusP").ToEntero();
|
||||
int EstatusD = e.Row.DataKey("EstatusD").ToEntero();
|
||||
|
||||
// Controles
|
||||
Label LtlConcepto = e.Row.FCLabel("LtlConcepto");
|
||||
LinkButton LnkConcepto = e.Row.FCLinkButton("LnkConcepto");
|
||||
Label LtlConceptoD = e.Row.FCLabel("LtlConceptoD");
|
||||
LinkButton LnkConceptoD = e.Row.FCLinkButton("LnkConceptod");
|
||||
Label LtlImporte = e.Row.FCLabel("LtlImporte");
|
||||
LinkButton LnkImporte = e.Row.FCLinkButton("LnkImporte");
|
||||
Label LtlImporteD = e.Row.FCLabel("LtlImporteD");
|
||||
LinkButton LnkImporteD = e.Row.FCLinkButton("LnkImporteD");
|
||||
|
||||
if (Estatus < -1 | EstatusD < -1)
|
||||
e.Row.CssClass = "ConceptosTotales";
|
||||
if (CveConcepto == 0 && (Estatus == 0 || Estatus == -1 || Estatus == -3))
|
||||
LtlImporte.Text = "";
|
||||
|
||||
if (CveConceptoD == 0 && (EstatusD == 0 || EstatusD == -1))
|
||||
LtlImporteD.Text = "";
|
||||
|
||||
if (Estatus == -1)
|
||||
LtlConcepto.Visible = false;
|
||||
else if (Estatus > 0)
|
||||
LtlImporte.Visible = false;
|
||||
|
||||
if (EstatusD == -1)
|
||||
LtlConceptoD.Visible = false;
|
||||
else if (EstatusD > 0)
|
||||
LtlImporteD.Visible = false;
|
||||
|
||||
|
||||
LnkConcepto.Visible = !LtlConcepto.Visible;
|
||||
LnkConceptoD.Visible = !LtlConceptoD.Visible;
|
||||
LnkImporte.Visible = !LtlImporte.Visible;
|
||||
LnkImporteD.Visible = !LtlImporteD.Visible;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void LnkConcepto_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void LnkConceptoD_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user