private void chkAcumulador_CheckStateChanged(object sender, EventArgs e) { if ((bool)this.chkAcumulador.EditValue == true) { //this.slkupCentroAcumulador.Enabled = false; if (this.slkupGrupoAcumulador.EditValue == null || this.slkupGrupoAcumulador.EditValue.ToString() == "") { DataView dv = new DataView(); dv.Table = _dtGrupo; dv.RowFilter = string.Format("IDGrupo='{0}' ", 0); DataTable dt = dv.ToTable(); bool EsAcumulador = Convert.ToBoolean((this.chkAcumulador.EditValue == null) ? false : this.chkAcumulador.EditValue); int iProximoConsecutivo = GrupoEstadosFinancierosDAC.GetNextConsecutivo(-1, 0, 0, GetTipoGrupo()); //iProximoConsecutivo++; this.txtNivel3.Text = "0"; this.txtNivel2.Text = "0"; this.txtNivel1.Text = iProximoConsecutivo.ToString(); //this.txtDescripcion.Text = ""; } } //else //{ // this.slkupCentroAcumulador.Enabled = true; //} }
//private void CargarCuentasGruposEstadosFinancieros() //{ // DataTable dtCuentaGrupo = Cuenta_GrupoEstadosFinancierosDAC.GetCuentasGrupoEstadosFinancieros(GetTipoGrupo()); // DataTable dtGrupos = GrupoEstadosFinancierosDAC.GetData(-1, "*", "*", "*", "*", -1, 1, GetTipoGrupo()).Tables[0]; // this.treeGrupoCuenta.Nodes.Clear(); // if (dtCuentaGrupo != null) { // foreach (DataRow Grupo in dtGrupos.Rows) // { // TreeListNode node = this.treeGrupoCuenta.Nodes.Add(Grupo["Grupo"].ToString(), Grupo["Descr"].ToString(),"",Grupo["IDGrupo"].ToString()); // node.Tag = "Root"; // DataView dv = new DataView(); // dv = dtCuentaGrupo.DefaultView; // dv.RowFilter = string.Format("IDGrupo='{0}'", Grupo["IDGrupo"]); // foreach (DataRow fila in dv.ToTable().Rows) { // node.Nodes.Add(fila["Cuenta"].ToString(), fila["Descr"].ToString(),fila["IDCuenta"].ToString(),fila["IDGrupo"].ToString()); // } // } // this.treeGrupoCuenta.ExpandAll(); // } //} private void CargarCuentasGruposEstadosFinancieros() { DataTable dtCuentaGrupo = Cuenta_GrupoEstadosFinancierosDAC.GetCuentasGrupoEstadosFinancieros(GetTipoGrupo()); DataTable dtGrupos = GrupoEstadosFinancierosDAC.GetData(-1, "*", "*", "*", "*", -1, 1, GetTipoGrupo()).Tables[0]; this.treeGrupoCuenta.Nodes.Clear(); if (dtGrupos != null) { TreeListNode nodoAnterior = null; foreach (DataRow Grupo in dtGrupos.Rows) { TreeListNode node = null; if (Grupo["IDGrupoAcumulador"].ToString() == "0") { //Rama principal node = this.treeGrupoCuenta.Nodes.Add(Grupo["Grupo"].ToString(), Grupo["Descr"].ToString(), "", Grupo["IDGrupo"].ToString()); } else { //Validar si el elemento anterior es papa if (nodoAnterior.GetValue("IDGrupo").ToString() == Grupo["IDGrupoAcumulador"].ToString()) { node = nodoAnterior.Nodes.Add(Grupo["Grupo"].ToString(), Grupo["Descr"].ToString(), "", Grupo["IDGrupo"].ToString()); } else { //Buscar el nodo TreeListNode fnode = treeGrupoCuenta.FindNodeByFieldValue("IDGrupo", Grupo["IDGrupoAcumulador"].ToString()); if (fnode != null) { node = fnode.Nodes.Add(Grupo["Grupo"].ToString(), Grupo["Descr"].ToString(), "", Grupo["IDGrupo"].ToString()); } } } if (!Convert.ToBoolean(Grupo["Acumulador"])) { node.Tag = "Root"; node["Tag"] = "Root"; //Cargar las cuentas que tiene asociado el grupo DataView dv = new DataView(); dv = dtCuentaGrupo.DefaultView; dv.RowFilter = string.Format("IDGrupo='{0}'", Grupo["IDGrupo"]); foreach (DataRow fila in dv.ToTable().Rows) { node.Nodes.Add(fila["Cuenta"].ToString(), fila["Descr"].ToString(), fila["IDCuenta"].ToString(), fila["IDGrupo"].ToString()); } } if (Convert.ToBoolean(Grupo["Acumulador"]) == true) { node.Tag = "Padre"; node["Tag"] = "Root"; nodoAnterior = node; } } this.treeGrupoCuenta.ExpandAll(); } }
private void PopulateData() { String sTipo = GetTipoGrupo(); _lstGrupoAcumuladores = GrupoEstadosFinancierosDAC.GetData(-1, "*", "*", "*", "*", 1, -1, sTipo).Tables["Data"]; Util.Util.ConfigLookupEdit(this.slkupGrupoAcumulador, _lstGrupoAcumuladores, "Descr", "IDGrupo"); Util.Util.ConfigLookupEditSetViewColumns(this.slkupGrupoAcumulador, "[{'ColumnCaption':'Grupo','ColumnField':'Grupo','width':30},{'ColumnCaption':'Descripción','ColumnField':'Descr','width':70}]"); }
private void PopulateGrid() { CargarTipoDeGrupo(); String sTipo = GetTipoGrupo(); _dsGrupo = GrupoEstadosFinancierosDAC.GetData(-1, "*", "*", "*", "*", -1, -1, sTipo); _dtGrupo = _dsGrupo.Tables[0]; this.dtg.DataSource = null; this.dtg.DataSource = _dtGrupo; PopulateData(); }
private void btnAgregar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { isEdition = true; HabilitarControles(true); ClearControls(); currentRow = null; //Agregar los consecutivos int iProximoConsecutivo = GrupoEstadosFinancierosDAC.GetNextConsecutivo(-1, 0, 0, GetTipoGrupo()); //iProximoConsecutivo++; this.txtNivel3.Text = "0"; this.txtNivel2.Text = "0"; this.txtNivel1.Text = iProximoConsecutivo.ToString(); this.slkpTipoDeGrupo.Enabled = true; this.chkAcumulador.Enabled = true; this.txtDescripcion.Focus(); }
void slkupGrupoAcumulador_EditValueChanged(object sender, EventArgs e) { try { if (!isEdition) { return; } if (this.slkupGrupoAcumulador.EditValue != null && this.slkupGrupoAcumulador.EditValue.ToString() != "") { DataView dv = new DataView(); dv.Table = _dtGrupo; dv.RowFilter = string.Format("IDGrupo='{0}' ", this.slkupGrupoAcumulador.EditValue); DataTable dt = dv.ToTable(); bool EsAcumulador = Convert.ToBoolean((this.chkAcumulador.EditValue == null) ? false : this.chkAcumulador.EditValue); if (dt.Rows[0]["Nivel2"].ToString() != "0") { int iProximoConsecutivo = GrupoEstadosFinancierosDAC.GetNextConsecutivo(Convert.ToInt32(dt.Rows[0]["Nivel1"]), Convert.ToInt32(dt.Rows[0]["Nivel2"]), -1, GetTipoGrupo()); //iProximoConsecutivo++; this.txtNivel3.Text = iProximoConsecutivo.ToString(); this.txtNivel2.Text = dt.Rows[0]["Nivel2"].ToString(); this.txtNivel1.Text = dt.Rows[0]["Nivel1"].ToString(); } else if (dt.Rows[0]["Nivel1"].ToString() != "0") { int iProximoConsecutivo = GrupoEstadosFinancierosDAC.GetNextConsecutivo(Convert.ToInt32(dt.Rows[0]["Nivel1"]), -1, 0, GetTipoGrupo()); //iProximoConsecutivo++; this.txtNivel3.Text = "0"; this.txtNivel2.Text = iProximoConsecutivo.ToString(); this.txtNivel1.Text = dt.Rows[0]["Nivel1"].ToString(); } //Inactivar los acumuladores if (this.txtNivel3.Text != "0") { this.chkAcumulador.Enabled = false; } else { this.chkAcumulador.Enabled = true; } this.slkpTipoDeGrupo.EditValue = dt.Rows[0]["IDGrupoCuenta"]; if (this.cmbTipoGrupo.SelectedIndex == 0) { this.slkpTipoDeGrupo.Enabled = true; } else { this.slkpTipoDeGrupo.Enabled = false; } this.txtDescripcion.Text = ""; this.txtDescripcion.Focus(); } } catch (Exception ex) { } }