unit U_RPFun;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ToolWin, StdCtrls, BtnEdit, cxStyles, cxCustomData,
  cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DBGrids, DB, cxDBData,
  cxGridLevel, cxClasses, cxControls, cxGridCustomView, ADODB, StrUtils, Midas,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxTimeEdit,
  cxTreeView, cxGrid, cxDBLookupComboBox, cxCalendar, cxCurrencyEdit,
  cxGridExportLink, ExtCtrls, Buttons, DBClient, RTComboBox, cxDropDownEdit,
  cxGridBandedTableView, cxGridDBBandedTableView, cxRichEdit, cxButtonEdit,
  IniFiles, WinSock, IdHTTP, dxcore, cxTextEdit, FireDAC.Comp.Client, cxCheckBox,
  Vcl.Clipbrd, cxMemo, dxLayoutControl;

function FromPrintFr3(App: Tapplication; DataBaseStr: PChar; JsonArgs: PChar): PChar;

function FunPrintFr3(App: Tapplication; DataBaseStr: PChar; JsonArgs: PChar): PChar;

implementation

function FromPrintFr3(App: Tapplication; DataBaseStr: PChar; JsonArgs: PChar): PChar;
type
  TMyFunc = function(App: Tapplication; FormID: integer; Title: PChar; DataBaseStr: PChar; JsonArgs: PChar): PChar; stdcall;
var
  Tf: TMyFunc;
  Tp: TFarProc;
  Th: Thandle;
  JsonResult: PChar;
begin
  Th := LoadLibrary('ReportPrint.dll');
  if Th > 0 then
  begin
    Tp := GetProcAddress(Th, 'GetDllForm');
    if Tp <> nil then
    begin
      Tf := TMyFunc(Tp);
      JsonResult := Tf(Application, 11, 'FR3报表', DataBaseStr, JsonArgs);
    end
    else
    begin
      JsonResult := '{"succsee":false,"message": "读取调用号异常"}';
    end;
  end
  else
  begin
    JsonResult := '{"succsee":false,"message": "找不到ReportPrint.dll"}';
  end;
  Result := JsonResult;
end;

function FunPrintFr3(App: Tapplication; DataBaseStr: PChar; JsonArgs: PChar): PChar;
type
  TMyFunc = function(App: Tapplication; FormID: integer; Title: PChar; DataBaseStr: PChar; JsonArgs: PChar): PChar; stdcall;
var
  Tf: TMyFunc;
  Tp: TFarProc;
  Th: Thandle;
  JsonResult: PChar;
begin
  Th := LoadLibrary('ReportPrint.dll');
  if Th > 0 then
  begin
    Tp := GetProcAddress(Th, 'GetDllForm');
    if Tp <> nil then
    begin
      Tf := TMyFunc(Tp);
      JsonResult := Tf(Application, 12, 'FR3报表', DataBaseStr, JsonArgs);
    end
    else
    begin
      JsonResult := '{"succsee":false,"message": "读取调用号异常"}';
    end;
  end
  else
  begin
    JsonResult := '{"succsee":false,"message": "找不到ReportPrint.dll"}';
  end;
  Result := JsonResult;
end;

end.

