2011-11-14 17:40:41 +00:00
|
|
|
unit uRemesasClienteReportController;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Classes, SysUtils, uDADataTable, uControllerBase, uIDataModuleRemesasClienteReport,
|
2013-06-03 16:01:08 +00:00
|
|
|
uBizRemesasCliente, uIntegerListUtils;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
type
|
2013-06-03 16:01:08 +00:00
|
|
|
IRemesasClienteReportController = interface
|
2011-11-14 17:40:41 +00:00
|
|
|
['{EA6EAD10-E07B-45A9-9B5E-0D560E2B92DF}']
|
2013-06-03 16:01:08 +00:00
|
|
|
procedure Preview(const ListaID : TIntegerList);
|
|
|
|
|
function Print(const ListaID : TIntegerList): Boolean;
|
2011-11-14 17:40:41 +00:00
|
|
|
end;
|
|
|
|
|
|
2013-06-03 16:01:08 +00:00
|
|
|
TRemesasClienteReportController = class(TInterfacedObject, IRemesasClienteReportController)
|
2011-11-14 17:40:41 +00:00
|
|
|
private
|
|
|
|
|
FDataModule : IDataModuleRemesasClienteReport;
|
|
|
|
|
function CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean;
|
|
|
|
|
public
|
2013-06-03 16:01:08 +00:00
|
|
|
constructor Create;
|
2011-11-14 17:40:41 +00:00
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
2013-06-03 16:01:08 +00:00
|
|
|
procedure Preview(const ListaID : TIntegerList);
|
|
|
|
|
function Print(const ListaID : TIntegerList): Boolean;
|
2011-11-14 17:40:41 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
uROTypes, uEditorRegistryUtils, uIEditorRemesasClientePreview,
|
2013-06-03 16:01:08 +00:00
|
|
|
uEditorPreview, uDataModuleRemesasCliente, uEditorBase, cxControls, schRemesasClienteClient_Intf;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
{ TRemesasClienteReportController }
|
|
|
|
|
|
|
|
|
|
constructor TRemesasClienteReportController.Create;
|
|
|
|
|
begin
|
|
|
|
|
FDataModule := TDataModuleRemesasCliente.Create(Nil);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TRemesasClienteReportController.CreateEditor(const AName: String;
|
|
|
|
|
const IID: TGUID; out Intf): Boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
destructor TRemesasClienteReportController.Destroy;
|
|
|
|
|
begin
|
|
|
|
|
FDataModule := NIL;
|
|
|
|
|
inherited;
|
|
|
|
|
end;
|
|
|
|
|
|
2013-06-03 16:01:08 +00:00
|
|
|
procedure TRemesasClienteReportController.Preview(const ListaID : TIntegerList);
|
2011-11-14 17:40:41 +00:00
|
|
|
var
|
|
|
|
|
AStream: Binary;
|
|
|
|
|
AEditor : IEditorRemesasClientePreview;
|
|
|
|
|
begin
|
|
|
|
|
AEditor := NIL;
|
|
|
|
|
|
2013-06-03 16:01:08 +00:00
|
|
|
ShowHourglassCursor;
|
2011-11-14 17:40:41 +00:00
|
|
|
try
|
2013-06-03 16:01:08 +00:00
|
|
|
AStream := FDataModule.GetReport(ListaID);
|
|
|
|
|
try
|
|
|
|
|
CreateEditor('EditorRemesasClientePreview', IEditorRemesasClientePreview, AEditor);
|
|
|
|
|
if Assigned(AEditor) then
|
|
|
|
|
try
|
|
|
|
|
AEditor.LoadFromStream(AStream);
|
|
|
|
|
AEditor.Preview;
|
|
|
|
|
finally
|
|
|
|
|
AEditor.Release;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(AStream);
|
|
|
|
|
AEditor := Nil;
|
|
|
|
|
end;
|
2011-11-14 17:40:41 +00:00
|
|
|
finally
|
2013-06-03 16:01:08 +00:00
|
|
|
HideHourglassCursor;
|
2011-11-14 17:40:41 +00:00
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2013-06-03 16:01:08 +00:00
|
|
|
function TRemesasClienteReportController.Print(const ListaID : TIntegerList): Boolean;
|
2011-11-14 17:40:41 +00:00
|
|
|
var
|
|
|
|
|
AStream: Binary;
|
|
|
|
|
AEditor : IEditorRemesasClientePreview;
|
|
|
|
|
begin
|
2013-06-03 16:01:08 +00:00
|
|
|
Result := False;
|
2011-11-14 17:40:41 +00:00
|
|
|
AEditor := NIL;
|
|
|
|
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
try
|
2013-06-03 16:01:08 +00:00
|
|
|
AStream := FDataModule.GetReport(ListaID);
|
2011-11-14 17:40:41 +00:00
|
|
|
try
|
|
|
|
|
CreateEditor('EditorRemesasClientePreview', IEditorRemesasClientePreview, AEditor);
|
|
|
|
|
if Assigned(AEditor) then
|
|
|
|
|
try
|
|
|
|
|
AEditor.LoadFromStream(AStream);
|
|
|
|
|
AEditor.Print;
|
2013-06-03 16:01:08 +00:00
|
|
|
Result := True;
|
2011-11-14 17:40:41 +00:00
|
|
|
finally
|
|
|
|
|
AEditor.Release;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(AStream);
|
2013-06-03 16:01:08 +00:00
|
|
|
AEditor := Nil;
|
2011-11-14 17:40:41 +00:00
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|