private void validacuentaLetra()
        {
            sw_novaluechange = true;
            bool zhallado = false;
            string xcodartic = txtCuentaletra.Text;
            if (xcodartic.Trim().Length == 0)
            {
                txtCuentaletra.Text = "";
                txtDcuentaletra.Text = "";
                zhallado = true;
            }
            else
            {
                tb_co_plancontableBL BL = new tb_co_plancontableBL();
                tb_co_plancontable BE = new tb_co_plancontable();

                BE.perianio = VariablesPublicas.perianio;
                BE.cuentaid = xcodartic;
                tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
                //tmptabla = ocapa.cag0200_consulta(GlobalVars.GetInstance.Company, xcodartic, "", "", "", "", "", 1, GlobalVars.GetInstance.CuentasContablesTodas, "");
                if (tmptabla.Rows.Count > 0)
                {
                    txtCuentaletra.Text = tmptabla.Rows[0]["cuentaid"].ToString();
                    txtDcuentaletra.Text = tmptabla.Rows[0]["cuentaname"].ToString();
                    zhallado = true;
                }
                if (!zhallado & xcodartic.Length > 0)
                {
                    txtCuentaletra.Text = j_CuentaLetra;
                }
            }
            sw_novaluechange = false;
        }
        public void validacuentaGastoAdicional()
        {
            sw_novaluechange = true;
            Int16 lc_cont = default(Int16);
            bool zhallado = false;
            string VMNROITEM = gridgastos.Rows[gridgastos.CurrentRow.Index].Cells["asientoitems"].Value.ToString();
            string xcodartic = "..";
            if ((!object.ReferenceEquals(gridgastos.Rows[gridgastos.CurrentRow.Index].Cells["gasto_cuentaid"].Value, DBNull.Value)))
            {
                xcodartic = gridgastos.Rows[gridgastos.CurrentRow.Index].Cells["gasto_cuentaid"].Value.ToString();
            }
            if (xcodartic.Trim().Length == 0)
            {
                gridgastos.Rows[gridgastos.CurrentRow.Index].Cells["gasto_cuentaid"].Value = "";
                gridgastos.Rows[gridgastos.CurrentRow.Index].Cells["gasto_cuentaname"].Value = "";
                zhallado = true;
            }
            else
            {
                tb_co_plancontableBL BL = new tb_co_plancontableBL();
                tb_co_plancontable BE = new tb_co_plancontable();

                BE.perianio = VariablesPublicas.perianio;
                BE.cuentaid = xcodartic;
                tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
                //tmptabla = ocapa.cag0200_consulta(GlobalVars.GetInstance.Company, xcodartic, "", "", "", "", "", 1, GlobalVars.GetInstance.CuentasContablesTodas, "");
                for (lc_cont = 0; lc_cont <= TabCac3p00GastosAdic.Rows.Count - 1; lc_cont++)
                {
                    if (TabCac3p00GastosAdic.Rows[lc_cont]["asientoitems"].ToString() == VMNROITEM)
                    {
                        if (tmptabla.Rows.Count > 0)
                        {
                            TabCac3p00GastosAdic.Rows[lc_cont]["cuentaid"] = tmptabla.Rows[0]["cuentaid"];
                            TabCac3p00GastosAdic.Rows[lc_cont]["cuentaname"] = tmptabla.Rows[0]["cuentaname"];
                            zhallado = true;
                            break;
                        }
                        break;
                    }
                }
            }
            if (!zhallado & xcodartic.Length > 0)
            {
                gridgastos.Rows[gridgastos.CurrentRow.Index].Cells["gasto_cuentaid"].Value = j_CuentaContable;
            }
            gridgastos.Refresh();
            sw_novaluechange = false;
        }
        private void validacuenta()
        {
            sw_novaluechange = true;
            bool zhallado = false;
            string xcodartic = txtCuenta.Text;
            if (xcodartic.Trim().Length == 0)
            {
                txtCuenta.Text = "";
                txtCuentaname.Text = "";
                zhallado = true;
            }
            else
            {
                tb_co_plancontableBL BL = new tb_co_plancontableBL();
                tb_co_plancontable BE = new tb_co_plancontable();

                BE.perianio = VariablesPublicas.perianio;
                BE.cuentaid = xcodartic;
                tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
                if (tmptabla.Rows.Count > 0)
                {
                    txtCuenta.Text = tmptabla.Rows[0]["cuentaid"].ToString();
                    txtCuentaname.Text = tmptabla.Rows[0]["cuentaname"].ToString();
                    zhallado = true;
                }
                if (!zhallado & xcodartic.Length > 0)
                {
                    txtCuenta.Text = j_Cuenta;
                }
            }
            sw_novaluechange = false;
        }
        private String CuentaNombre(string perianio, string cuentaid)
        {
            tb_co_plancontableBL BL = new tb_co_plancontableBL();
            tb_co_plancontable BE = new tb_co_plancontable();

            DataTable tablecuenta = new DataTable();

            BE.perianio = perianio;
            BE.cuentaid = cuentaid;
            try
            {
                tablecuenta = BL.GetOne(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return tablecuenta.Rows[0]["cuentaname"].ToString().Trim();
        }
        void llenar_GridExaminar()
        {
            try
            {
                tb_co_plancontableBL BL = new tb_co_plancontableBL();
                tb_co_plancontable BE = new tb_co_plancontable();

                BE.perianio = VariablesPublicas.perianio;

                switch (cboCriterioBusqueda.SelectedItem.ToString())
                {
                    case "Cuenta":
                        BE.cuentaid = txtCadenaBuscar.Text.Trim().ToUpper();
                        break;
                    case "Descripción":
                        BE.cuentaname = txtCadenaBuscar.Text.Trim().ToUpper();
                        break;
                    default:
                        BE.cuentaid = txtCadenaBuscar.Text.Trim().ToUpper();
                        break;
                }
                if (GridExaminar.RowCount > 0)
                {
                    GridExaminar.Focus();
                    GridExaminar.BeginEdit(true);
                }
                U_RefrescaControles();
                GridExaminar.AutoGenerateColumns = false;
                GridExaminar.DataSource = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            pintar();
        }
        private void Frm_AyudaCuentas_Activated(object sender, EventArgs e)
        {
            if (sw_Load)
            {
                sw_Load = false;
                if (_CUENTA_MAYOR.Trim().Length > 0)
                {
                    txtCadenaBuscar.Text = _CUENTA_MAYOR.Trim();
                }
                //chkcuentamayor.Checked = _activaCta & _CUENTA_MAYOR.Trim().Length > 0;
                //if (txtCadenaBuscar.Text.Trim().Length > 0)
                //{
                    tb_co_plancontableBL BL = new tb_co_plancontableBL();
                    tb_co_plancontable BE = new tb_co_plancontable();

                    BE.perianio = VariablesPublicas.perianio;

                    switch (cboCriterioBusqueda.SelectedItem.ToString())
                    {
                        case "Código":
                            BE.cuentaid = txtCadenaBuscar.Text.Trim().ToUpper();
                            break;
                        case "Descripción":
                            BE.cuentaname = txtCadenaBuscar.Text.Trim().ToUpper();
                            break;
                        default:
                            BE.cuentaid = txtCadenaBuscar.Text.Trim().ToUpper();
                            break;
                    }

                    tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];

                    if (tmptabla.Rows.Count > 0)
                    {
                        txtCadenaBuscar.Text = tmptabla.Rows[0]["cuentaid"].ToString().Trim();
                    }
                //}
                U_CargaDatos();
            }
        }
        private void llenar_GridExaminar()
        {
            try
            {
                var BL = new tb_co_plancontableBL();
                var BE = new tb_co_plancontable();

                BE.perianio = VariablesPublicas.perianio;
                if (_cuentaEEFF == "SI")
                {
                }
                else
                {
                    BE.cuentadigito = "2";
                }
                if (txtCadenaBuscar.Text.Length > 0)
                {
                    switch (cboCriterioBusqueda.SelectedItem.ToString())
                    {
                        case "Cuenta":
                            BE.cuentaid = txtCadenaBuscar.Text.Trim().ToUpper();
                            break;
                        case "Descripción":
                            BE.cuentaname = txtCadenaBuscar.Text.Trim().ToUpper();
                            break;
                        default:
                            BE.cuentaid = txtCadenaBuscar.Text.Trim().ToUpper();
                            break;
                    }
                }
                tabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            pintar();
        }