unit uViewDetallesFacturaCliente; interface uses Windows, Messages, cxImageComboBox, cxTextEdit, cxSpinEdit, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ImgList, Controls, PngImageList, uDADataTable, Classes, ActnList, ComCtrls, ToolWin, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, uViewDetallesFamilias, cxCheckBox, cxMaskEdit, cxCurrencyEdit; type TfrViewDetallesFacturaCliente = class(TfrViewDetallesFamilias) cxGridViewPUNTOS: TcxGridDBColumn; cxGridViewIMPORTEPUNTOS: TcxGridDBColumn; cxStyle_PUNTOS: TcxStyle; procedure cxGridViewPUNTOSStylesGetContentStyle( Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); procedure cxGridViewEditing(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; var AAllow: Boolean); procedure cxGridViewVISIBLEStylesGetContentStyle( Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); end; implementation uses Variants, uBizImportesDetalleBase, SysUtils; {$R *.dfm} procedure TfrViewDetallesFacturaCliente.cxGridViewPUNTOSStylesGetContentStyle( Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); var IndiceCol : Integer; ATipo : String; begin if Assigned(ARecord) then begin IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_TIPODETALLE).Index; ATipo := VarToStr(ARecord.Values[IndiceCol]); if ATipo = TIPODETALLE_CONCEPTO then AStyle := cxStyle_PUNTOS; if ATipo = TIPODETALLE_SUBTOTAL then AStyle := cxStyle_SUBTOTAL; if ATipo = TIPODETALLE_TITULO then AStyle := cxStyle_TITULO; end; end; procedure TfrViewDetallesFacturaCliente.cxGridViewEditing( Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; var AAllow: Boolean); var IndiceCol : Integer; begin IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_IMPORTEPUNTOS).Index; if AItem.Index = IndiceCol then begin IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_TIPODETALLE).Index; if (UpperCase(AItem.GridView.Items[IndiceCol].EditValue) = TIPODETALLE_SUBTOTAL) then AAllow := False else AAllow := True end else inherited; end; procedure TfrViewDetallesFacturaCliente.cxGridViewVISIBLEStylesGetContentStyle( Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); var IndiceCol : Integer; ATipo : String; begin if Assigned(ARecord) then begin IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_TIPODETALLE).Index; ATipo := VarToStr(ARecord.Values[IndiceCol]); if ATipo = TIPODETALLE_SUBTOTAL then AStyle := cxStyle_SUBTOTAL; if ATipo = TIPODETALLE_TITULO then AStyle := cxStyle_TITULO; end; end; end.