Beispiel #1
0
        private void chkAcumulador_CheckStateChanged(object sender, EventArgs e)
        {
            if ((bool)this.chkAcumulador.EditValue == true)
            {
                //this.slkupCentroAcumulador.Enabled = false;
                if (this.slkupCentroAcumulador.EditValue == null || this.slkupCentroAcumulador.EditValue.ToString() == "")
                {
                    DataView dv = new DataView()
                    {
                        Table = _dtCentro, RowFilter = string.Format("IDCentro='{0}' ", 0)
                    };
                    DataTable dt = dv.ToTable();

                    bool EsAcumulador = Convert.ToBoolean((this.chkAcumulador.EditValue == null) ? false : this.chkAcumulador.EditValue);


                    int iProximoConsecutivo = CentroCostoDAC.GetNextConsecutivo(-1, 0, 0);
                    //iProximoConsecutivo++;

                    this.txtNivel3.Text = "0";
                    this.txtNivel2.Text = "0";
                    this.txtNivel1.Text = iProximoConsecutivo.ToString();



                    //this.txtDescripcion.Text = "";
                }
            }
            //else
            //{
            //    this.slkupCentroAcumulador.Enabled = true;

            //}
        }
Beispiel #2
0
        //private void slkupCentroAnterior_EditValueChanged(object sender, EventArgs e)
        //{

        //    try
        //    {
        //        if (!isEdition)
        //            return;

        //        if (this.slkupCentroAnterior.EditValue != null && this.slkupCentroAnterior.EditValue.ToString() != "")
        //        {
        //            DataView dv = new DataView();
        //            dv.Table = _dtCentro;
        //            dv.RowFilter = "IDCentro='" + this.slkupCentroAnterior.EditValue.ToString() + "'";
        //            this.txtNivel1.Text = dv[0].Row["Nivel1"].ToString();

        //            DataTable dt = dv.ToTable();
        //            int i = -1;
        //            if (dt.Rows[0]["Nivel3"].ToString() != "0")
        //            {
        //                i = Convert.ToInt32(dt.Rows[0]["Nivel3"]);
        //                i++;
        //                this.txtNivel3.Text = i.ToString();
        //                this.txtNivel2.Text = dt.Rows[0]["Nivel2"].ToString();


        //            }
        //            else if (dt.Rows[0]["Nivel2"].ToString() != "0")
        //            {
        //                i = Convert.ToInt32(dt.Rows[0]["Nivel2"]);
        //                i++;
        //                this.txtNivel2.Text = i.ToString();
        //                this.txtNivel3.Text = "0";
        //            }


        //        }

        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message);
        //    }

        //}

        private void slkupCentroAcumulador_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (!isEdition)
                {
                    return;
                }
                if (this.slkupCentroAcumulador.EditValue != null && this.slkupCentroAcumulador.EditValue.ToString() != "")
                {
                    DataView dv = new DataView()
                    {
                        Table = _dtCentro, RowFilter = string.Format("IDCentro='{0}' ", this.slkupCentroAcumulador.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 = CentroCostoDAC.GetNextConsecutivo(Convert.ToInt32(dt.Rows[0]["Nivel1"]), Convert.ToInt32(dt.Rows[0]["Nivel2"]), -1);

                        //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 = CentroCostoDAC.GetNextConsecutivo(Convert.ToInt32(dt.Rows[0]["Nivel1"]), -1, 0);
                        //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.txtDescripcion.Text = "";
                    this.txtDescripcion.Focus();
                }
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
        private void btnAgregar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            isEdition = true;
            HabilitarControles(true);
            ClearControls();
            currentRow = null;

            //Agregar  los consecutivos

            int iProximoConsecutivo = CentroCostoDAC.GetNextConsecutivo(-1, 0, 0);

            //iProximoConsecutivo++;

            this.txtNivel3.Text = "0";
            this.txtNivel2.Text = "0";
            this.txtNivel1.Text = iProximoConsecutivo.ToString();

            this.txtDescripcion.Focus();
        }