unit uViewDetallesAlbaranCliente; 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 TfrViewDetallesAlbaranCliente = 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); procedure cxGridViewVALORADOStylesGetContentStyle( Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); end; implementation uses Variants, uBizImportesDetalleBase, SysUtils; {$R *.dfm} procedure TfrViewDetallesAlbaranCliente.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 TfrViewDetallesAlbaranCliente.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 TfrViewDetallesAlbaranCliente.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; procedure TfrViewDetallesAlbaranCliente.cxGridViewVALORADOStylesGetContentStyle( 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.