private void gridViewIntDet_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { MDataSet.inventoryDetailsRow det = this.gridViewIntDet.GetDataRow(e.RowHandle) as MDataSet.inventoryDetailsRow; if (det == null) { return; } if (det.Quantity == det.QuantityFact) { e.Appearance.Font = e.Cache.GetFont(e.Appearance.Font, FontStyle.Italic); e.Appearance.ForeColor = Color.Gray; } if (det.Quantity < det.QuantityFact) { e.Appearance.Font = e.Cache.GetFont(e.Appearance.Font, FontStyle.Bold); } if (det.UseByDate.AddMonths(-6) < DateTime.Today) { e.Appearance.ForeColor = Color.Pink; } if (det.UseByDate.AddMonths(-2) < DateTime.Today) { e.Appearance.ForeColor = Color.Red; } }
private void quantityFactEdit_Validating(object sender, CancelEventArgs e) { MDataSet.inventoryDetailsRow det = this.gridViewIntDet.GetDataRow(this.gridViewIntDet.FocusedRowHandle) as MDataSet.inventoryDetailsRow; if (det == null) { return; } double proposedV = Convert.ToDouble(this.gridViewIntDet.ActiveEditor.Text); if (proposedV < 0) { this.gridViewIntDet.SetColumnError(this.colQuantityFact, "Неверное значение после запятой!"); e.Cancel = true; } if (det.MinDivisor != 1) { double ed = (1.000 / det.MinDivisor); double proposed = Convert.ToDouble(this.gridViewIntDet.ActiveEditor.Text); if (Convert.ToInt32((proposed / ed) * 1000) != Convert.ToInt32(proposed / ed) * 1000) { this.gridViewIntDet.SetColumnError(this.colQuantityFact, "Неверное значение после запятой!"); e.Cancel = true; } else { this.gridViewIntDet.SetColumnError(this.colQuantityFact, ""); } } }
private void btProdReport_Click(object sender, EventArgs e) { MDataSet.inventoryDetailsRow _row = (this.gridViewIntDet.GetDataRow(this.gridViewIntDet.FocusedRowHandle) as MDataSet.inventoryDetailsRow); if (_row == null) { return; } (this.ParentForm as MainForm).ProductReport(_row.ProductRef); }
private void gridViewIntDet_ShownEditor(object sender, EventArgs e) { MDataSet.inventoryDetailsRow det = this.gridViewIntDet.GetDataRow(this.gridViewIntDet.FocusedRowHandle) as MDataSet.inventoryDetailsRow; if (det == null) { return; } if (det.MinDivisor == 1) { this.quantityFactEdit.IsFloatValue = false; } else { this.quantityFactEdit.IsFloatValue = true; this.quantityFactEdit.Increment = Convert.ToDecimal(1.000 / det.MinDivisor); } }