2007-09-04 17:44:53 +00:00
|
|
|
unit uFichasEmpleadoReportController;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Classes, SysUtils, uDADataTable, uControllerBase, uIDataModuleFichasEmpleadoReport,
|
2008-08-22 14:52:35 +00:00
|
|
|
uEmpleadosController, uIntegerListUtils;
|
2007-09-04 17:44:53 +00:00
|
|
|
|
|
|
|
|
type
|
2008-02-21 10:06:02 +00:00
|
|
|
IFichasEmpleadoReportController = interface(IControllerBase)
|
2007-09-04 17:44:53 +00:00
|
|
|
['{8E43F55F-7D5A-4778-8523-7C105EAEB1AB}']
|
2008-08-22 14:52:35 +00:00
|
|
|
procedure Preview(const ListaID : TIntegerList);
|
|
|
|
|
procedure Print(const ListaID : TIntegerList);
|
2007-09-04 17:44:53 +00:00
|
|
|
end;
|
|
|
|
|
|
2008-02-21 10:06:02 +00:00
|
|
|
TFichasEmpleadoReportController = class(TControllerBase, IFichasEmpleadoReportController)
|
2007-09-04 17:44:53 +00:00
|
|
|
private
|
|
|
|
|
FDataModule : IDataModuleFichasEmpleadoReport;
|
|
|
|
|
function CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean;
|
|
|
|
|
public
|
2008-05-20 18:50:02 +00:00
|
|
|
constructor Create; override;
|
2007-09-04 17:44:53 +00:00
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
2008-08-22 14:52:35 +00:00
|
|
|
procedure Preview(const ListaID : TIntegerList);
|
|
|
|
|
procedure Print(const ListaID : TIntegerList);
|
2007-09-04 17:44:53 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
uROTypes, uEditorRegistryUtils, uIEditorFichasEmpleadoPreview,
|
|
|
|
|
uEditorPreview, uDataModuleEmpleados, uEditorBase, cxControls;
|
|
|
|
|
|
|
|
|
|
{ TFichasEmpleadoReportController }
|
|
|
|
|
|
|
|
|
|
constructor TFichasEmpleadoReportController.Create;
|
|
|
|
|
begin
|
2008-11-10 19:38:27 +00:00
|
|
|
inherited;
|
2007-09-04 17:44:53 +00:00
|
|
|
FDataModule := TDataModuleEmpleados.Create(Nil);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TFichasEmpleadoReportController.CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
destructor TFichasEmpleadoReportController.Destroy;
|
|
|
|
|
begin
|
|
|
|
|
FDataModule := NIL;
|
|
|
|
|
inherited;
|
|
|
|
|
end;
|
|
|
|
|
|
2008-08-22 14:52:35 +00:00
|
|
|
procedure TFichasEmpleadoReportController.Preview(const ListaID : TIntegerList);
|
2007-09-04 17:44:53 +00:00
|
|
|
var
|
|
|
|
|
AStream: Binary;
|
|
|
|
|
AEditor : IEditorFichasEmpleadoPreview;
|
|
|
|
|
begin
|
|
|
|
|
AEditor := NIL;
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
try
|
2008-08-22 14:52:35 +00:00
|
|
|
AStream := FDataModule.GetReport(ListaID);
|
2007-09-04 17:44:53 +00:00
|
|
|
try
|
|
|
|
|
CreateEditor('EditorFichasEmpleadoPreview', IEditorFichasEmpleadoPreview, AEditor);
|
2007-11-18 20:08:55 +00:00
|
|
|
if Assigned(AEditor) then
|
|
|
|
|
begin
|
2008-08-22 14:52:35 +00:00
|
|
|
try
|
|
|
|
|
AEditor.Controller := Self;
|
|
|
|
|
AEditor.ListaID := ListaID;
|
|
|
|
|
AEditor.LoadFromStream(AStream);
|
|
|
|
|
AEditor.Preview;
|
|
|
|
|
finally
|
|
|
|
|
AEditor.Release;
|
|
|
|
|
end;
|
2007-11-18 20:08:55 +00:00
|
|
|
end;
|
2007-09-04 17:44:53 +00:00
|
|
|
finally
|
2007-11-18 20:08:55 +00:00
|
|
|
FreeAndNil(AStream);
|
|
|
|
|
AEditor := Nil;
|
2007-09-04 17:44:53 +00:00
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2008-08-22 14:52:35 +00:00
|
|
|
procedure TFichasEmpleadoReportController.Print(const ListaID : TIntegerList);
|
2007-09-04 17:44:53 +00:00
|
|
|
var
|
|
|
|
|
AStream: Binary;
|
|
|
|
|
AEditor : IEditorFichasEmpleadoPreview;
|
|
|
|
|
begin
|
|
|
|
|
AEditor := NIL;
|
|
|
|
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
try
|
2008-08-22 14:52:35 +00:00
|
|
|
AStream := FDataModule.GetReport(ListaID);
|
2007-09-04 17:44:53 +00:00
|
|
|
try
|
|
|
|
|
CreateEditor('EditorFichasEmpleadoPreview', IEditorFichasEmpleadoPreview, AEditor);
|
2007-11-18 20:08:55 +00:00
|
|
|
if Assigned(AEditor) then
|
|
|
|
|
begin
|
2008-08-22 14:52:35 +00:00
|
|
|
try
|
|
|
|
|
AEditor.Controller := Self;
|
|
|
|
|
AEditor.ListaID := ListaID;
|
|
|
|
|
AEditor.LoadFromStream(AStream);
|
|
|
|
|
AEditor.Print;
|
|
|
|
|
finally
|
|
|
|
|
AEditor.Release;
|
|
|
|
|
end;
|
2007-11-18 20:08:55 +00:00
|
|
|
end;
|
2007-09-04 17:44:53 +00:00
|
|
|
finally
|
2007-11-18 20:08:55 +00:00
|
|
|
FreeAndNil(AStream);
|
|
|
|
|
AEditor := Nil;
|
2007-09-04 17:44:53 +00:00
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|