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 { } } }
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 { } }
private void avbGridView_ShowingEditor(object sender, CancelEventArgs e) { DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView; e.Cancel = !Program.MF.YetkiCheck(view.GetFocusedRowCellValue(colONYYTK).ToString()); if (avbGridView.GetFocusedRowCellValue(colDRM).ToString() != "A" && view.FocusedRowHandle != DevExpress.XtraGrid.GridControl.NewItemRowHandle && view.GetDataRow(view.FocusedRowHandle).RowState != DataRowState.Added) { e.Cancel = true; } else if (view.FocusedColumn != colTUR && view.FocusedColumn != colACIKLAMA && view.GetFocusedRowCellValue(colREFID) != DBNull.Value && view.GetFocusedRowCellValue(colREFTO).ToString() != "E") // OdemeEmri disindakiler { e.Cancel = true; } }
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); ////////// /// } } } }