unit uEditorAlbaranesDevCliente;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uEditorAlbaranesCliente, JSDialog, Menus, DB, uDADataTable,
  JvAppStorage, JvAppRegistryStorage, JvComponentBase, JvFormPlacement, ImgList,
  PngImageList, StdActns, ActnList, ComCtrls, JvExComCtrls, JvStatusBar, TBX,
  TB2ExtItems, TBXExtItems, TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls,
  JvExControls, JvComponent, JvNavigationPane, uIEditorAlbaranesDevCliente,
  uDAInterfaces, dxGDIPlusClasses;

type
  TfEditorAlbaranesDevCliente = class(TfEditorAlbaranesCliente, IEditorAlbaranesDevCliente)
    procedure actEliminarUpdate(Sender: TObject);
  protected
    procedure AsignarVista; override;
    procedure NuevoInterno; override;
  public
    procedure PonerTitulos(const ATitulo: string = ''); override;
		constructor Create(AOwner: TComponent); override;    
  end;

implementation
{$R *.dfm}

uses
  uDataModuleUsuarios, uViewAlbaranesDevCliente, uFactuGES_App;

{ TfEditorAlbaranesDevCliente }

procedure TfEditorAlbaranesDevCliente.actEliminarUpdate(Sender: TObject);
begin
  inherited;
  if (Sender as TAction).Enabled then
     (Sender as TAction).Enabled := not (FAlbaranes.ID_FACTURA > 0);
end;

procedure TfEditorAlbaranesDevCliente.AsignarVista;
begin
  ViewGrid := CreateView(TfrViewAlbaranesDevCliente) as IViewAlbaranesDevCliente;
end;

constructor TfEditorAlbaranesDevCliente.Create(AOwner: TComponent);
begin
	inherited;

  FHeaderText := 'Lista de órdenes de devolución a cliente';
  FWindowCaption := FHeaderText;	
end;

procedure TfEditorAlbaranesDevCliente.NuevoInterno;
begin
//  inherited;
  if FController.AnadirAlbaranDev(Albaranes) then
     FController.Ver(Albaranes);
end;

procedure TfEditorAlbaranesDevCliente.PonerTitulos(const ATitulo: string);
var
  FTitulo : String;
begin
  FTitulo := FWindowCaption + ' - ' + AppFactuGES.EmpresaActiva.NOMBRE;
  inherited PonerTitulos(FTitulo);
end;

end.
