Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2008.01.27;
Скачать: CL | DM;

Вниз

Добавление функции преобразования суммы прописью в FastReport 4   Найти похожие ветки 

 
RUYurik   (2007-12-18 12:23) [0]

Здравствуйте! У меня есть невизуальный компонент для преобразования суммы в пропись. Как мне его подключить к FastReport"у чтобы там при суммировании постранично сумм выводить на каждой сумму прописью?


 
Andrey ©   (2007-12-18 13:49) [1]

И каким боком это к IB/FB относится?
goto http://fast-report.com/ru/forum/


 
RUYurik   (2007-12-19 06:02) [2]

IB/FB в вопросе не указывается. А на форуме фастрепорта я не нашел все таки как подключить его.


 
atruhin ©   (2007-12-19 06:42) [3]

> А на форуме фастрепорта я не нашел все таки как подключить
> его.

Плохо искал. Вообще в Фастрепорт есть стандартная функция преобразования суммы в строку,
ищи в документации.
Ну и вот пример подключения своих функций:

unit fs_MyFunc_rtti;

interface
{$i fs.inc}

uses fs_iinterpreter, fs_ievents, Classes,
DateUtils, SysUtils, Math, Types, StringConv;

type
TfsDateUtilsRTTI = class(TComponent);

implementation

type
TFunctions = class(TfsRTTIModule)
private
  function CallMethod(Instance: TObject; ClassType: TClass;
                const MethodName: String; Caller: TfsMethodHelper): Variant;
public
  constructor Create(AScript: TfsScript); override;
  destructor Destroy; override;
end;

//var
// Functions: TFunctions;

function GetWord(Str : string; Index : integer): string;
var
 S : string;
begin
 Result := "";
 while (Index > 0)and(Str <> "") do begin
   S := scQStrSplit(Str,"|");
   dec(Index);
   if Index = 0
     then Result := S;
 end;
end;

constructor TFunctions.Create;
begin
inherited Create(AScript);
with AScript do begin
  AddMethod("function ObjToInt(const Obj : TObject): integer", CallMethod,"MyFunction","");
  AddMethod("function GetWord(Str : string; Index : integer): string", CallMethod,"MyFunction","");
  AddMethod("function ExtractFilePath(const FileName: string): string", CallMethod,"MyFunction","");
  AddMethod("function ParamStr(Index: Integer): string", CallMethod,"MyFunction","");
end;
end;

destructor TFunctions.Destroy;
begin
if fsGlobalUnit <> nil then
  fsGlobalUnit.RemoveItems(Self);
inherited;
end;

function TFunctions.CallMethod(Instance: TObject; ClassType: TClass;
               const MethodName: String; Caller: TfsMethodHelper): Variant;
begin
 Result := 0;
 if MethodName = "OBJTOINT" then
   result := integer(Caller.Params[0])
 else
 if MethodName = "GETWORD" then begin
   result := GetWord(Caller.Params[0], Caller.Params[1]);
 end else
 if MethodName = "EXTRACTFILEPATH" then
   result := ExtractFilePath(Caller.Params[0])
 else
 if MethodName = "PARAMSTR" then
   result := ParamStr(Caller.Params[0])
 else;
end;

initialization
fsRTTIModules.Add(TFunctions);
end.



Страницы: 1 вся ветка

Текущий архив: 2008.01.27;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.012 c
2-1198403590
mfender
2007-12-23 12:53
2008.01.27
Перебрать все запущенные приложения из сервиса


15-1198132418
Pazitron_Brain
2007-12-20 09:33
2008.01.27
SIP провайдер


2-1198861624
Kuvalda
2007-12-28 20:07
2008.01.27
Webbrowser


15-1198229544
boriskb
2007-12-21 12:32
2008.01.27
Опять офтоп


2-1198472251
mikola
2007-12-24 07:57
2008.01.27
индикатор загрузки отправки