619 lines
21 KiB
C#
619 lines
21 KiB
C#
using Extensiones;
|
|
using System;
|
|
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;
|
|
|
|
public partial class Nomina_CatConcepto : ClsPaginas
|
|
{
|
|
#region "Propiedades"
|
|
private DataTable DTCuentas
|
|
{
|
|
get
|
|
{
|
|
return (DataTable)ViewState["DTCuentas"];
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["DTCuentas"] = value;
|
|
}
|
|
}
|
|
private Boolean EsEditar
|
|
{
|
|
get
|
|
{
|
|
return (Boolean)ViewState["EsEditar"];
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["EsEditar"] = value;
|
|
}
|
|
}
|
|
private int CveConcepto
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveConcepto"].ToEntero();
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["CveConcepto"] = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
//if (UsuarioActual.CveEmpresa ==72 || UsuarioActual.CveEmpresa== 80)
|
|
//{
|
|
// tabFormulaImporte.Visible = false;
|
|
//}
|
|
if (Request["CveConcepto"] != null && !Request["CveConcepto"].ToString().Equals("") && Request["CveConcepto"].ToEntero() > 0)
|
|
{
|
|
ViewState["CveConcepto"] = Request["CveConcepto"];
|
|
EsEditar = true;
|
|
BtnGuardar.Text = "Guardar cambios";
|
|
BtnEliminar.Visible = true;
|
|
ChkTipoCalculo.Checked = false;
|
|
}
|
|
else
|
|
{
|
|
ViewState["CveConcepto"] = -1;
|
|
EsEditar = false;
|
|
LnkActualizarFormula.Visible = false;
|
|
}
|
|
tree_Tables();
|
|
InicializaDatos();
|
|
}
|
|
}
|
|
|
|
#region Arboles conceptos
|
|
DataTable dtrefrencias;
|
|
StringBuilder strKeys;
|
|
StringBuilder strKeys2;
|
|
StringBuilder strKeys3;
|
|
public void tree_Tables()
|
|
{
|
|
strKeys = new StringBuilder();
|
|
strKeys2 = new StringBuilder();
|
|
strKeys3 = new StringBuilder();
|
|
StringBuilder tablaarbol = new StringBuilder();
|
|
using (ClsNominas objnom = new ClsNominas())
|
|
{
|
|
objnom.GetNom_Refencias(UsuarioActual.CveEmpresa);
|
|
dtrefrencias = objnom.DtResultados;
|
|
}
|
|
strKeys.Append("{");
|
|
int tipo = 1;
|
|
#region tablas
|
|
tablaarbol.AppendLine("<ul id=\"tree_1\">");
|
|
foreach (DataRow row in dtrefrencias.FiltraParametros($"Nivel=0 AND Tipo ={tipo}").Rows)
|
|
{
|
|
AddchildtoEnd(ref tablaarbol, row, " ", " ", tipo);
|
|
}
|
|
tablaarbol.AppendLine("</ul>");
|
|
LtlArbolTabla.Text = tablaarbol.ToString();
|
|
#endregion
|
|
|
|
#region Formulas
|
|
tablaarbol.Clear();
|
|
tipo = 2;
|
|
tablaarbol.AppendLine("<ul id=\"tree_2\">");
|
|
foreach (DataRow row in dtrefrencias.FiltraParametros($"Nivel=0 AND Tipo ={tipo}").Rows)
|
|
{
|
|
AddchildtoEnd(ref tablaarbol, row, " ", " ", tipo);
|
|
}
|
|
tablaarbol.AppendLine("</ul>");
|
|
LtlArbolFormulas.Text = tablaarbol.ToString();
|
|
#endregion
|
|
|
|
#region Funciones
|
|
tablaarbol.Clear();
|
|
tipo = 3;
|
|
tablaarbol.AppendLine("<ul id=\"tree_3\">");
|
|
foreach (DataRow row in dtrefrencias.FiltraParametros($"Nivel=0 AND Tipo ={tipo}").Rows)
|
|
{
|
|
AddchildtoEnd(ref tablaarbol, row, " ", " ", tipo);
|
|
}
|
|
tablaarbol.AppendLine("</ul>");
|
|
LtlArbolFunciones.Text = tablaarbol.ToString();
|
|
#endregion
|
|
|
|
|
|
|
|
if (strKeys.Length > 2)
|
|
{
|
|
strKeys.Remove(1, 1);
|
|
}
|
|
strKeys.Append("}");
|
|
LtlKeys.Text = string.Format(" MycurrentT ={0} ; strKeys2='{1}'; strKeys3='{2}'; ", strKeys.ToString(), strKeys2.ToString(), strKeys3.ToString());
|
|
UpTablas.Update();
|
|
//TxtMycurrentT.Text = strKeys.ToString();
|
|
//TxtstrKeys2.Text = strKeys2.ToString();
|
|
//TxtstrKeys3.Text = strKeys3.ToString();
|
|
|
|
}
|
|
public void AddchildtoEnd(ref StringBuilder tablaarbol, DataRow item, string identacion, string identacion2, int tipo)
|
|
{
|
|
string identacion3 = string.Format("{0}{1}", identacion, identacion2);
|
|
DataTable dt = dtrefrencias.FiltraParametros($"CveNomReferenciaPadre={item["CveNomReferencia"].ToString().ToEntero()} AND Nivel= {(item["Nivel"].ToString().ToEntero() + 1)} AND Tipo ={tipo}");
|
|
string data_jstree = "";
|
|
if (dt.Rows.Count == 0)
|
|
{
|
|
data_jstree = "data-jstree='{ \"icon\" : \"fa fa-file icon-state-info \" }'";
|
|
}
|
|
tablaarbol.AppendLine(string.Format("{0}<li {1}>", identacion, data_jstree));
|
|
tablaarbol.AppendLine("");
|
|
tablaarbol.Append(identacion3);
|
|
if (item["EsUltimo"].ToString() == "1" || item["EsUltimo"].ToString().ToUpper() == "TRUE")
|
|
{
|
|
tablaarbol.Append("<a href=\"javascript:addtextFormula('").Append(item["Campo"]).Append("');\"> ");
|
|
string campo = item["Campo"].ToString();
|
|
if (tipo < 3)
|
|
{
|
|
strKeys2.Append(string.Format(" {0}", campo));
|
|
}
|
|
else
|
|
{
|
|
string[] scampos = campo.Split('(');
|
|
campo = "";
|
|
if (scampos.Length > 0)
|
|
{
|
|
campo = scampos[0].Trim();
|
|
}
|
|
strKeys3.Append(string.Format(" {0}", campo));
|
|
}
|
|
strKeys.Append(string.Format(",'{0}':[]", campo));
|
|
}
|
|
tablaarbol.Append(item["Texto"]);
|
|
if (item["EsUltimo"].ToString() == "1" || item["EsUltimo"].ToString().ToUpper() == "TRUE") { tablaarbol.Append("</a>"); }
|
|
tablaarbol.AppendLine("");
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
tablaarbol.AppendLine(string.Format("{0}<ul>", identacion3));
|
|
foreach (DataRow row in dt.Rows)
|
|
{
|
|
AddchildtoEnd(ref tablaarbol, row, identacion3, identacion2, tipo);
|
|
}
|
|
tablaarbol.AppendLine(string.Format("{0}</ul>", identacion3));
|
|
}
|
|
tablaarbol.AppendLine(string.Format("{0}</li>", identacion));
|
|
|
|
}
|
|
#endregion
|
|
protected void InicializaDatos()
|
|
{
|
|
CargaTipo();
|
|
CargaConceptoPadre();
|
|
CargaConceptoContable();
|
|
|
|
CargaClasificacion();
|
|
CargaTipoGasto();
|
|
CargaCtaContable();
|
|
CargaConceptoSAT();
|
|
CargaDatos();
|
|
}
|
|
|
|
protected void CargaTipo()
|
|
{
|
|
DdlTipo.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
DdlTipo.Items.Insert(1, new ListItem("Percepciones", "P"));
|
|
DdlTipo.Items.Insert(2, new ListItem("Deducciones", "D"));
|
|
DdlTipo.Items.Insert(3, new ListItem("Obligaciones", "O"));
|
|
DdlTipo.SelectedValueExist("-1");
|
|
}
|
|
|
|
protected void CargaConceptoPadre()
|
|
{
|
|
DdlConceptoPadre.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa);
|
|
DdlConceptoPadre.DataBind();
|
|
DdlConceptoPadre.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
DdlConceptoPadre.SelectedValueExist("-1");
|
|
}
|
|
protected void CargaConceptoContable()
|
|
{
|
|
DdlConceptoContable.DataSource = get_GlobalDTContaConceptosContables(-1);
|
|
DdlConceptoContable.DataBind();
|
|
DdlConceptoContable.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
DdlConceptoContable.SelectedValueExist("-1");
|
|
}
|
|
protected void CargaClasificacion()
|
|
{
|
|
DdlClasificacion.DataSource = get_GlobalDTClasificaciones(UsuarioActual.CveEmpresa);
|
|
DdlClasificacion.DataBind();
|
|
DdlClasificacion.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
DdlClasificacion.SelectedValueExist("-1");
|
|
}
|
|
|
|
protected void CargaTipoGasto()
|
|
{
|
|
DdlTipoGasto.DataSource = get_GlobalDTTiposGastos(UsuarioActual.CveEmpresa);
|
|
DdlTipoGasto.DataBind();
|
|
DdlTipoGasto.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
DdlTipoGasto.SelectedValueExist("-1");
|
|
}
|
|
protected void CargaConceptoSAT()
|
|
{
|
|
using (ClsNominas objnom = new ClsNominas())
|
|
{
|
|
objnom.GetConceptos();
|
|
DdlConceptoSAT.DataSource = objnom.DtResultados;
|
|
|
|
}
|
|
DdlConceptoSAT.DataBind();
|
|
DdlConceptoSAT.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
DdlConceptoSAT.SelectedValueExist("-1");
|
|
}
|
|
|
|
protected void CargaCtaContable()
|
|
{
|
|
if (UsuarioActual.Empresa.TipoContabilidad == 2)
|
|
{
|
|
DdlCtaContable.DataValueField = "Id";
|
|
using (ClsContPAQi ObjConta = new ClsContPAQi(UsuarioActual.Empresa))
|
|
{
|
|
|
|
if (ObjConta.GetCuentas(-1, "-1", 1))
|
|
{
|
|
DdlCtaContable.DataSource = ObjConta.DtResultados;
|
|
DdlCtaContable.DataBind();
|
|
}
|
|
}
|
|
|
|
DdlCtaContable.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
DdlCtaContable.SelectedValueExist("-1");
|
|
}
|
|
else
|
|
{
|
|
|
|
using (ClsContabilidad ObjConta = new ClsContabilidad())
|
|
{
|
|
if (ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa))
|
|
{
|
|
|
|
DdlCtaContable.DataSource = ObjConta.DtResultados;
|
|
DdlCtaContable.DataBind();
|
|
}
|
|
}
|
|
DdlCtaContable.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
DdlCtaContable.SelectedValueExist("-1");
|
|
}
|
|
}
|
|
|
|
|
|
protected void BtnGuardar_Click(object sender, EventArgs e)
|
|
{
|
|
String codigo = TxtCodigo.Text;
|
|
String concepto = TxtConcepto.Text;
|
|
String tipo = DdlTipo.SelectedValue;
|
|
String formula = TxtFormula.Text;
|
|
|
|
//if (!ValidaFormula(formula).Equals(""))
|
|
//{
|
|
// Alert("Fórmula no válida. Favor de ingresar una correcta.", ModExtensiones.TipoMensaje.MsgError);
|
|
//}
|
|
//else
|
|
//{
|
|
bool retencion;
|
|
if (ChkRetencion.Checked) retencion = true;
|
|
else retencion = false;
|
|
|
|
bool tipoCalculo;
|
|
if (ChkTipoCalculo.Checked) tipoCalculo = true;
|
|
else tipoCalculo = false;
|
|
|
|
int CveConceptoPadre = DdlConceptoPadre.SelectedValue.ToEntero();
|
|
int CveConceptoContable = DdlConceptoContable.SelectedValue.ToEntero();
|
|
|
|
bool estado;
|
|
if (ChkEstado.Checked) estado = true;
|
|
else estado = false;
|
|
|
|
bool sistema;
|
|
if (ChkSistema.Checked) sistema = true;
|
|
else sistema = false;
|
|
|
|
int CveClasificacion = DdlClasificacion.SelectedValue.ToEntero();
|
|
int CveTipoGasto = DdlTipoGasto.SelectedValue.ToEntero();
|
|
int IdCtaContable = DdlCtaContable.SelectedValue.ToEntero();
|
|
int AplicaFiniquito = ChkAutomaticoLiquidacion.Checked ? 1 : 0;
|
|
int AutomaticoGlobal = ChkAutomaticoGlobal.Checked ? 1 : 0;
|
|
int Especie = ChkEspecie.Checked ? 1 : 0;
|
|
int Imprimir = ChkImprimir.Checked ? 1 : 0;
|
|
int CveSATConcepto = DdlConceptoSAT.SelectedValue.ToEntero();
|
|
ClsNominas ObjNomina = new ClsNominas();
|
|
ObjNomina.IniciaTransacSQL();
|
|
|
|
bool TieneError = false;
|
|
|
|
if (EsEditar)
|
|
{
|
|
TieneError = !ObjNomina.UpdateConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, CveConcepto, retencion, CveClasificacion, IdCtaContable, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, CveSATConcepto, UsuarioActual.CveEmpresa);
|
|
|
|
if (!TieneError)
|
|
{
|
|
if (ChkMovtoPermanente.Checked)
|
|
{
|
|
ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes]", 1);
|
|
}
|
|
else
|
|
{
|
|
if (TxtFormulaTotal.Text == "FNC.[MovimientosPermanentes]")
|
|
{
|
|
// ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes] ", 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (TieneError)
|
|
{
|
|
ObjNomina.RollBack();
|
|
}
|
|
else
|
|
{
|
|
ObjNomina.Commit();
|
|
Alert("El concepto de nómina fue actualizado correctamente.", ModExtensiones.TipoMensaje.MsgInformacion, $"document.location.href=\"/Nomina/ConceptoNomina.aspx?CveConcepto={CveConcepto}\"");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CveConcepto = ObjNomina.AddConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, retencion, CveClasificacion, IdCtaContable, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, CveSATConcepto);
|
|
|
|
|
|
|
|
if (CveConcepto > 0)
|
|
{
|
|
if (ChkMovtoPermanente.Checked)
|
|
{
|
|
ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes]", 1);
|
|
}
|
|
else
|
|
{
|
|
if (TxtFormulaTotal.Text == "FNC.[MovimientosPermanentes]")
|
|
{
|
|
// ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes] ", 1);
|
|
}
|
|
}
|
|
}
|
|
if (CveConcepto == -1)
|
|
{
|
|
ObjNomina.RollBack();
|
|
}
|
|
else
|
|
{
|
|
ObjNomina.Commit();
|
|
Alert("El concepto de nómina fue creado correctamente.", ModExtensiones.TipoMensaje.MsgInformacion, $"document.location.href=\"/Nomina/ConceptoNomina.aspx?CveConcepto={CveConcepto}\"");
|
|
}
|
|
//}
|
|
|
|
ObjNomina.Dispose();
|
|
CargaDatos();
|
|
}
|
|
}
|
|
|
|
private string ValidaFormula(string Formula)
|
|
{
|
|
string retorno = "Error en Fórmula";
|
|
|
|
try
|
|
{
|
|
FormulaEvaluator.Expression exp;
|
|
foreach (DataRow dr in GlobalDTNomConceptosFunciones.Rows)
|
|
{
|
|
exp = new FormulaEvaluator.Expression(String.Format("{0}:=1", dr["Funcion"]));
|
|
exp.Eval();
|
|
}
|
|
|
|
exp = new FormulaEvaluator.Expression(Formula);
|
|
if (exp.Errors.Count > 0)
|
|
{
|
|
retorno = exp.Errors[0].Message;
|
|
}
|
|
Object val = exp.Eval();
|
|
if (exp.Errors.Count == 0)
|
|
{
|
|
retorno = "";
|
|
}
|
|
else
|
|
{
|
|
retorno = exp.Errors[0].Message;
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Alert(e.Message, ModExtensiones.TipoMensaje.MsgError);
|
|
}
|
|
|
|
return retorno;
|
|
}
|
|
|
|
protected void CargaDatos()
|
|
{
|
|
if (CveConcepto > 0)
|
|
{
|
|
ClsNominas ObjNomina = new ClsNominas();
|
|
|
|
if (ObjNomina.GetConceptos(UsuarioActual.CveEmpresa, CveConcepto: CveConcepto) && ObjNomina.DtResultados.Rows.Count > 0)
|
|
{
|
|
DataRow drow = ObjNomina.DtResultados.Rows[0];
|
|
TxtCodigo.Text = drow["Codigo"].ToString();
|
|
TxtConcepto.Text = drow["Concepto"].ToString();
|
|
DdlTipo.SelectedValueExist(drow["Tipo"]);
|
|
TxtFormulaImporte.Text = drow["Formula"].ToString();
|
|
TxtFormulaTotal.Text = drow["FormulaTotal"].ToString();
|
|
|
|
ChkMovtoPermanente.Checked = (TxtFormulaTotal.Text == "FNC.[MovimientosPermanentes]");
|
|
ChkMovtoPermanente_CheckedChanged(null, null);
|
|
TxtFormulaGravada.Text = drow["FormulaGravada"].ToString();
|
|
if (drow["EsRetencion"].Equals("1")) ChkRetencion.Checked = true;
|
|
if (drow["TipoCalculo"].Equals("True")) ChkTipoCalculo.Checked = true;
|
|
DdlConceptoPadre.SelectedValueExist(drow["CveConceptoPadre"]);
|
|
DdlConceptoContable.SelectedValueExist(drow["CveConceptoContable"]);
|
|
|
|
ChkEstado.Checked = drow["Estado"].Equals("Activo");
|
|
ChkSistema.Checked = drow["Sistema"].Equals("Sí");
|
|
ChkAutomaticoLiquidacion.Checked = drow["AplicaFiniquito"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" });
|
|
ChkAutomaticoGlobal.Checked = drow["AutomaticoGlobal"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" });
|
|
ChkEspecie.Checked = drow["Especie"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" });
|
|
ChkImprimir.Checked = drow["Imprimir"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" });
|
|
|
|
DdlClasificacion.SelectedValueExist(drow["CveClasificacion"]);
|
|
DdlTipoGasto.SelectedValueExist(drow["CveTipoGasto"]);
|
|
//DdlCtaContable.SelectedValueExist(drow["CveCuenta"]);
|
|
if (DdlCtaContable.DataValueField == "Id")
|
|
{
|
|
DdlCtaContable.SelectedValueExist(drow["IdCtaContable"]);
|
|
}
|
|
else
|
|
{
|
|
DdlCtaContable.SelectedValueExist(drow["CveCuenta"]);
|
|
}
|
|
//if (UsuarioActual.Empresa.TipoContabilidad == 1)
|
|
//{
|
|
//}
|
|
//else
|
|
//{
|
|
// DdlCtaContable.SelectedValueExist(drow["IdCtaContable"]);
|
|
//}
|
|
DdlConceptoSAT.SelectedValueExist(drow["CveSATConcepto"]);
|
|
}
|
|
else
|
|
{
|
|
CveConcepto = 0;
|
|
|
|
}
|
|
ObjNomina.Dispose();
|
|
|
|
}
|
|
else
|
|
{
|
|
CveConcepto = 0;
|
|
TxtCodigo.Text = "";
|
|
TxtConcepto.Text = "";
|
|
DdlTipo.SelectedValueExist("-1");
|
|
TxtFormula.Text = "";
|
|
ChkRetencion.Checked = false;
|
|
DdlConceptoPadre.SelectedValueExist("-1");
|
|
DdlConceptoContable.SelectedValueExist("-1");
|
|
ChkImprimir.Checked = true;
|
|
ChkEstado.Checked = true;
|
|
ChkSistema.Checked = false;
|
|
|
|
DdlClasificacion.SelectedValueExist("-1");
|
|
DdlTipoGasto.SelectedValueExist("-1");
|
|
DdlCtaContable.SelectedValueExist("-1");
|
|
}
|
|
}
|
|
|
|
protected void BtnEliminar_Click(object sender, EventArgs e)
|
|
{
|
|
ClsNominas ObjNomina = new ClsNominas();
|
|
|
|
if (ObjNomina.RemoveConcepto(CveConcepto, UsuarioActual.CveEmpresa))
|
|
{
|
|
Response.Redirect("./CatConceptos.aspx");
|
|
}
|
|
else
|
|
{
|
|
Alert("Ocurrio un error al eliminar el concepto de nómina", ModExtensiones.TipoMensaje.MsgError);
|
|
}
|
|
}
|
|
|
|
protected void LnkActualizarFormula_Click(object sender, EventArgs e)
|
|
{
|
|
tree_Tables();
|
|
string tipo = "Total";
|
|
if (TabsFormulas.ActiveTab == tabFormulaImporte)
|
|
{
|
|
tipo = "Importe";
|
|
TxtFormula.Text = TxtFormulaImporte.Text;
|
|
}
|
|
if (TabsFormulas.ActiveTab == tabFormulaTotal)
|
|
{
|
|
tipo = "Total";
|
|
TxtFormula.Text = TxtFormulaTotal.Text;
|
|
}
|
|
if (TabsFormulas.ActiveTab == tabFormulaGravada)
|
|
{
|
|
tipo = "Gravada";
|
|
TxtFormula.Text = TxtFormulaGravada.Text;
|
|
}
|
|
LtlTituloFormula.Text = $"Actualizar Formula {tipo}";
|
|
RegistraScript("$('#ModalDivFormula').modal()");
|
|
UpModalFormulas.Update();
|
|
}
|
|
|
|
protected void BtnUpFormula_Click(object sender, EventArgs e)
|
|
{
|
|
int TipoFormula = 0;
|
|
if (TabsFormulas.ActiveTab == tabFormulaImporte)
|
|
{
|
|
TipoFormula = 0;
|
|
}
|
|
if (TabsFormulas.ActiveTab == tabFormulaTotal)
|
|
{
|
|
TipoFormula = 1;
|
|
}
|
|
if (TabsFormulas.ActiveTab == tabFormulaGravada)
|
|
{
|
|
TipoFormula = 2;
|
|
}
|
|
string formula = TxtFormula.Text;
|
|
using (ClsNominas objnom = new ClsNominas())
|
|
{
|
|
if (TipoFormula == 0 && !ValidaFormula(formula).Equals(""))
|
|
{
|
|
Alert("Fórmula no válida. Favor de ingresar una correcta.", ModExtensiones.TipoMensaje.MsgError);
|
|
}
|
|
else
|
|
{
|
|
|
|
if (objnom.UpdateConceptoFormula(CveConcepto, formula, TipoFormula))
|
|
{
|
|
|
|
if (TabsFormulas.ActiveTab == tabFormulaImporte)
|
|
{
|
|
TxtFormulaImporte.Text = formula;
|
|
}
|
|
if (TabsFormulas.ActiveTab == tabFormulaTotal)
|
|
{
|
|
TxtFormulaTotal.Text = formula;
|
|
}
|
|
if (TabsFormulas.ActiveTab == tabFormulaGravada)
|
|
{
|
|
TxtFormulaGravada.Text = formula;
|
|
}
|
|
UpFormulas.Update();
|
|
Alert("La formula se ha actualizado Correctamente");
|
|
RegistraScript("$('#ModalDivFormula').modal('hide')");
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void ChkMovtoPermanente_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
Divformula.Visible = !ChkMovtoPermanente.Checked;
|
|
//if (Divformula.Visible)
|
|
//{
|
|
//TxtFormulaTotal.Text = "";
|
|
//}
|
|
//else
|
|
//{
|
|
// TxtFormulaTotal.Text = "FNC.[MovimientosPermanentes]";
|
|
//}
|
|
|
|
}
|
|
} |