unit uPluginControllerObrasFinal;

interface

uses Menus, Classes, ActnList, ImgList, Controls, PngImageList,
     uModuleController, uInterfaces, uHostManager;

type
  IMCObrasFinal = interface(IInterface)
  ['{42B684D0-112F-4B96-8FEF-957DE55AC8A1}']
  end;

  TModuleObrasFinal = class(TModuleController, IMCObrasFinal)
    actObras: TAction;
    Obras: TMenuItem;
    LargeImages: TPngImageList;
    MainMenu: TMainMenu;
    ModuleActionList: TActionList;
    Obras1: TMenuItem;
    SmallImages: TPngImageList;
    actFacturas: TAction;
    Facturas1: TMenuItem;
    procedure actObrasExecute(Sender: TObject);
    procedure actFacturasExecute(Sender: TObject);
  end;

implementation
{$R *.dfm}

uses Forms, uBizObraFinal, uDataModuleObrasFinal, uEditorFacturasObras,
  uEditorFacturasCliente, uEditorObrasFinal;

function GetModule : TModuleController;
begin
  Result := TModuleObrasFinal.Create(NIL);
end;

exports
  GetModule name GET_MODULE_FUNC;

{
******************************* TModuleObras *******************************
}

procedure TModuleObrasFinal.actObrasExecute(Sender: TObject);
var
  aObj: IEditorObrasFinal;
  aObras: IBizObraFinal;
begin
  aObras := dmObrasFinal.GetObrasItems;
  aObj := TfEditorObrasFinal.Create(Application);
  try
    with aObj do
    begin
      Obras := aObras;
      ShowEmbedded;
    end;
  finally
    aObras := NIL;
    aObj := NIL;
  end;
end;

procedure TModuleObrasFinal.actFacturasExecute(Sender: TObject);
var
  aObj: IEditorFacturasObras;
  aFacturasObras: IBizFacturasObras;
begin
  aFacturasObras := dmObrasFinal.GetFacturasItems;
  aObj := TfEditorFacturasObras.Create(Application);
  try
    with aObj do
    begin
      FacturasCliente := aFacturasObras;
      ShowEmbedded;
    end;
  finally
    aFacturasObras := NIL;
    aObj := NIL;
  end;
end;

initialization
  RegisterModuleClass(TModuleObrasFinal);

finalization
  UnRegisterModuleClass(TModuleObrasFinal);

end.
