Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Прикладное программирование » Использование DevExpress (часть 4)

Модерирует : ShIvADeSt

 Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

Открыть новую тему     Написать ответ в эту тему

vladman

Advanced Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

unit Unit12;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, dxmdaset, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxStyles, dxSkinsCore,
  dxSkinMcSkin, dxSkinscxPCPainter, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
  cxCustomPivotGrid, cxDBPivotGrid;
 
type
  TForm12 = class(TForm)
    dxMemData1: TdxMemData;
    DataSource1: TDataSource;
    dxMemData1Employee: TStringField;
    dxMemData1Region: TIntegerField;
    dxMemData1Date: TDateField;
    dxMemData1Clients: TIntegerField;
    dxMemData1AcceptedClients: TIntegerField;
    cxDBPivotGrid1: TcxDBPivotGrid;
    procedure FormCreate(Sender: TObject);
    procedure DoCalculateQuality(Sender: TcxPivotGridField; ASummary: TcxPivotGridCrossCellSummary);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form12: TForm12;
 
implementation
 
{$R *.dfm}
 
function VarToInteger(const AValue: Variant): Integer;
begin
  Result := 0;
  if not VarIsNull(AValue) then
    Result := AValue;
end;
 
procedure TForm12.FormCreate(Sender: TObject);
begin
  dxMemData1.LoadFromTextFile('Data.txt');
  dxMemData1.Active := True;
  cxDBPivotGrid1.CreateAllFields;
  cxDBPivotGrid1.Fields[1].Area := faRow;
  cxDBPivotGrid1.Fields[2].Area := faRow;
  cxDBPivotGrid1.Fields[4].Area := faData;
  cxDBPivotGrid1.Fields[5].Area := faData;
  with cxDBPivotGrid1.CreateField do
    begin
      Area := faData;
      Caption := 'Quality';
      Visible := True;
      SummaryType := stCustom;
      OnCalculateCustomSummary := DoCalculateQuality;
    end;
  dxMemData1.Refresh;
end;
 
procedure TForm12.DoCalculateQuality(Sender: TcxPivotGridField; ASummary: TcxPivotGridCrossCellSummary);
var
  vAcceptedClients: Integer;
  vClients: Integer;
begin
  vClients := VarToInteger(ASummary.Owner.GetSummaryByField( cxDBPivotGrid1.Fields[4], stSum));
  vAcceptedClients := VarToInteger(ASummary.Owner.GetSummaryByField( cxDBPivotGrid1.Fields[5], stSum));
 
  if vClients <> 0 then
    ASummary.Custom := vAcceptedClients / vClients * 100;
end;
 
end.

Всего записей: 708 | Зарегистр. 13-11-2002 | Отправлено: 17:28 28-06-2010 | Исправлено: vladman, 17:29 28-06-2010
Открыть новую тему     Написать ответ в эту тему

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Прикладное программирование » Использование DevExpress (часть 4)


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru