git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@8 0c75b7a4-871f-7646-8a2f-f78d34cc349f
103 lines
2.5 KiB
ObjectPascal
103 lines
2.5 KiB
ObjectPascal
unit uFichasEmpleadoReportController;
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, uDADataTable, uControllerBase, uIDataModuleFichasEmpleadoReport,
|
|
uEmpleadosController;
|
|
|
|
type
|
|
IFichasEmpleadoReportController = interface
|
|
['{8E43F55F-7D5A-4778-8523-7C105EAEB1AB}']
|
|
procedure Preview(const AFichaID : String);
|
|
procedure Print(const AFichaID : String);
|
|
end;
|
|
|
|
TFichasEmpleadoReportController = class(TInterfacedObject, IFichasEmpleadoReportController)
|
|
private
|
|
FDataModule : IDataModuleFichasEmpleadoReport;
|
|
function CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean;
|
|
public
|
|
constructor Create;
|
|
destructor Destroy; override;
|
|
|
|
procedure Preview(const AFichaID : String);
|
|
procedure Print(const AFichaID : String);
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
uses
|
|
uROTypes, uEditorRegistryUtils, uIEditorFichasEmpleadoPreview,
|
|
uEditorPreview, uDataModuleEmpleados, uEditorBase, cxControls;
|
|
|
|
{ TFichasEmpleadoReportController }
|
|
|
|
constructor TFichasEmpleadoReportController.Create;
|
|
begin
|
|
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;
|
|
|
|
procedure TFichasEmpleadoReportController.Preview(const AFichaID : String);
|
|
var
|
|
AStream: Binary;
|
|
AEditor : IEditorFichasEmpleadoPreview;
|
|
begin
|
|
AEditor := NIL;
|
|
|
|
ShowHourglassCursor;
|
|
try
|
|
AStream := FDataModule.GetReport(AFichaID);
|
|
try
|
|
CreateEditor('EditorFichasEmpleadoPreview', IEditorFichasEmpleadoPreview, AEditor);
|
|
AEditor.LoadFromStream(AStream);
|
|
finally
|
|
AStream.Free;
|
|
end;
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
|
|
if Assigned(AEditor) then
|
|
AEditor.Preview;
|
|
end;
|
|
|
|
procedure TFichasEmpleadoReportController.Print(const AFichaID : String);
|
|
var
|
|
AStream: Binary;
|
|
AEditor : IEditorFichasEmpleadoPreview;
|
|
begin
|
|
AEditor := NIL;
|
|
|
|
ShowHourglassCursor;
|
|
try
|
|
AStream := FDataModule.GetReport(AFichaID);
|
|
try
|
|
CreateEditor('EditorFichasEmpleadoPreview', IEditorFichasEmpleadoPreview, AEditor);
|
|
AEditor.LoadFromStream(AStream);
|
|
finally
|
|
AStream.Free;
|
|
end;
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
|
|
if Assigned(AEditor) then
|
|
AEditor.Print
|
|
end;
|
|
|
|
end.
|