Exemplo n.º 1
0
        private void gridView3_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView viewDet = sender as DevExpress.XtraGrid.Views.Grid.GridView;

            //DevExpress.XtraGrid.Views.Grid.GridView viewSub = viewDet.GetDetailView(e.RowHandle, 0) as DevExpress.XtraGrid.Views.Grid.GridView;


            if (e.Column == viewDet.Columns["Cantidad"] || e.Column == viewDet.Columns["Precio"] || e.Column == viewDet.Columns["CantExtra"] || e.Column == viewDet.Columns["aFacturar"])
            {
                DevExpress.XtraGrid.Views.Grid.GridView viewCap = viewDet.ParentView as DevExpress.XtraGrid.Views.Grid.GridView;
                viewCap.SetFocusedRowCellValue("ModifCap", DateTime.Now);
                gridView1.SetFocusedRowCellValue("ModifCab", DateTime.Now);

                try
                {
                    decimal CantidadExtra    = viewDet.GetFocusedRowCellValue("CantExtra") == DBNull.Value ? 0 : (decimal)viewDet.GetFocusedRowCellValue("CantExtra");
                    decimal CntidadAFacturar = viewDet.GetFocusedRowCellValue("aFacturar") == DBNull.Value ? 0 : (decimal)viewDet.GetFocusedRowCellValue("aFacturar");
                    decimal CntidadPendiente = viewDet.GetFocusedRowCellValue("Pendiente") == DBNull.Value ? 0 : (decimal)viewDet.GetFocusedRowCellValue("Pendiente");


                    if (CntidadAFacturar > CntidadPendiente)
                    {
                        if (MessageBox.Show("Cantidad A Facturar superior a lo Pendiente. ¿Desea establecer la diferencia como Extra?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
                        {
                            viewDet.SetFocusedRowCellValue("CantExtra", CantidadExtra + CntidadAFacturar - CntidadPendiente);
                        }
                        else
                        {
                            viewDet.SetFocusedRowCellValue("aFacturar", CntidadPendiente);
                        }
                    }
                }
                catch { }
            }
        }
Exemplo n.º 2
0
        private void gridView3_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView viewDet = sender as DevExpress.XtraGrid.Views.Grid.GridView;

            ////DevExpress.XtraGrid.Views.Grid.GridView viewSub = viewDet.GetDetailView(e.RowHandle, 0) as DevExpress.XtraGrid.Views.Grid.GridView;

            if (e.Column == viewDet.Columns["Cantidad"] || e.Column == viewDet.Columns["Precio"] || e.Column == viewDet.Columns["CantExtra"] || e.Column == viewDet.Columns["aFacturar"])
            {
                int idDetalle = (int)viewDet.GetFocusedRowCellValue("IdPresupDet");
                if (TieneSubdetalle(idDetalle))
                {
                    //////////     //var subValido = false;
                    //////////     //for (int i = 0; i < viewSub1.RowCount; i++)
                    //////////     //{
                    //////////     //    var aaaa = viewSub1.GetDataRow(i);
                    //////////     //    var bbb = viewSub1.GetDataRow(i).Table;



                    //////////     //    viewSub.FocusedRowHandle = i;
                    //////////     //    var cantidad = viewSub1.GetFocusedRowCellValue("Cantidad");
                    //////////     //    var cantExtra = viewSub1.GetFocusedRowCellValue("CantExtra");
                    //////////     //    var precio = viewSub1.GetFocusedRowCellValue("Precio");
                    //////////     //    var aFacturar = viewSub1.GetFocusedRowCellValue("aFacturar");


                    //////////     //    //if ((cantidad+cantExtra)*precio!=0 || aFacturar!=0)
                    //////////     //    //{
                    //////////     //    //    subValido = true;
                    //////////     //    //    break;
                    //////////     //    //}
                    //////////     //}

                    //////////     //if (subValido)
                    //////////     //{

                    MessageBox.Show("No puede haber Cantidad, Precio, Cantidad Extra o A Facturar en un Detalle que contiene Subdetalle", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //var ccc = viewDet.GetFocusedRowCellValue("Cantidad");

                    viewDet.SetFocusedRowCellValue("Cantidad", null);
                    viewDet.SetFocusedRowCellValue("Precio", null);
                    viewDet.SetFocusedRowCellValue("CantExtra", null);
                    viewDet.SetFocusedRowCellValue("aFacturar", null);
                    //////////    /// }
                }
            }
        }
Exemplo n.º 3
0
        private void EliminaFila(GridView GridActiva)
        {
            if (MessageBox.Show("¿Desea Eliminar el elemento Seleccionado?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                //

                // MessageBox.Show(GridActiva.DetailLevel.ToString());

                //GridView GridActiva = (GridView)presupCapGridControl.FocusedView;
                GridActiva.DeleteSelectedRows();

                if (GridActiva.DetailLevel == 0)
                {
                    gridView1.SetFocusedRowCellValue("ModifCab", DateTime.Now);
                }

                if (GridActiva.DetailLevel == 1)
                {
                    DevExpress.XtraGrid.Views.Grid.GridView viewCap = GridActiva.ParentView as DevExpress.XtraGrid.Views.Grid.GridView;
                    viewCap.SetFocusedRowCellValue("ModifCap", DateTime.Now);
                    gridView1.SetFocusedRowCellValue("ModifCab", DateTime.Now);
                }


                if (GridActiva.DetailLevel == 2)
                {
                    DevExpress.XtraGrid.Views.Grid.GridView viewDet = GridActiva.ParentView as DevExpress.XtraGrid.Views.Grid.GridView;
                    DevExpress.XtraGrid.Views.Grid.GridView viewCap = viewDet.ParentView as DevExpress.XtraGrid.Views.Grid.GridView;
                    viewDet.SetFocusedRowCellValue("ModifDet", DateTime.Now);
                    viewCap.SetFocusedRowCellValue("ModifCap", DateTime.Now);
                    gridView1.SetFocusedRowCellValue("ModifCab", DateTime.Now);
                }
            }
        }
Exemplo n.º 4
0
        private void afbGridView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
            int afbID = (int)accountQueriesTableAdapter.GET_PK("ACC");

            view.SetFocusedRowCellValue(colAFBID, afbID);
            view.SetFocusedRowCellValue(colDRM, "A");               // Acik
            view.SetFocusedRowCellValue(colTUR, "BS");              // Satis
            view.SetFocusedRowCellValue(colTUR2, "I");              // yurtIci
            view.SetFocusedRowCellValue(colTUR3, "G");              // Genel
            view.SetFocusedRowCellValue(colFTRTRH, DateTime.Today); // Null olamaz!
            view.SetFocusedRowCellValue(colBDVZ, "TRL");
            view.SetFocusedRowCellValue(colBKUR, 1.000);

            colTUR3.OptionsColumn.AllowEdit = false;    // Burdan Ops icin Fatura giremez (FaturaLink'den)
        }
Exemplo n.º 5
0
        private void aFacturarSub_ButtonPressed(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            this.Validate();
            this.presupSubBindingSource.EndEdit();
            try
            {
                decimal CantFacturado = viewSub.GetFocusedRowCellValue("CantSubFact") == DBNull.Value ? 0 : (decimal)viewSub.GetFocusedRowCellValue("CantSubFact");

                decimal CantidadAFacturar = viewSub.GetFocusedRowCellValue("aFacturar") == DBNull.Value ? 0 : (decimal)viewSub.GetFocusedRowCellValue("aFacturar");

                decimal Cantidad = viewSub.GetFocusedRowCellValue("Cantidad") == DBNull.Value ? 0 : (decimal)viewSub.GetFocusedRowCellValue("Cantidad");

                viewSub.SetFocusedRowCellValue("CantExtra", CantFacturado + CantidadAFacturar - Cantidad);
            }
            catch { }
        }