unit uEditorAlbaranDevCliente;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uEditorAlbaranCliente, dxLayoutLookAndFeels, DB, uDADataTable,
  JvAppStorage, JvAppRegistryStorage, JvComponentBase, JvFormPlacement, ImgList,
  PngImageList, StdActns, ActnList, uViewTotales, ComCtrls, JvExComCtrls,
  JvStatusBar, uViewIncidencias, uCustomView, uViewBase, uViewDetallesBase,
  uViewDetallesDTO, uViewDetallesArticulos, uViewDetallesAlbaranCliente, TBX,
  TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls, JvExControls, JvComponent,
  JvNavigationPane, uIEditorAlbaranDevCliente, uDAInterfaces, dxGDIPlusClasses,
  uViewDetallesArticulosParaVenta, cxControls, cxContainer, cxEdit, cxLabel;

type
  TfEditorAlbaranDevCliente = class(TfEditorAlbaranCliente, IEditorAlbaranDevCliente)
    procedure actEliminarUpdate(Sender: TObject);
  protected
    //Si queremos crear otra vista para el editor heredado solo tendriamos que
    //sobreescribir este metodo
    procedure AsignarVista; override;

  public
    procedure PonerTitulos(const ATitulo: string = ''); override;
  end;

implementation
{$R *.dfm}

uses
  uViewAlbaranDevCliente, schAlbaranesClienteClient_Intf;

{ TfEditorAlbaranDevCliente }

procedure TfEditorAlbaranDevCliente.actEliminarUpdate(Sender: TObject);
begin
	inherited;
	if (Sender as TAction).Enabled then
		(Sender as TAction).Enabled := (FAlbaran.REF_FACTURA = '');
end;

procedure TfEditorAlbaranDevCliente.AsignarVista;
var
  AViewAlbaranDevCliente: TfrViewAlbaranDevCliente;

begin
  AViewAlbaranDevCliente := TfrViewAlbaranDevCliente.create(Self);
  with AViewAlbaranDevCliente do
  begin
    Parent := pagGeneral;
    Align := alClient;
    dxLayoutControl1.LookAndFeel := dxLayoutOfficeLookAndFeel1;
  end;
  ViewAlbaran := AViewAlbaranDevCliente;
end;

procedure TfEditorAlbaranDevCliente.PonerTitulos(const ATitulo: string);
var
  FTitulo : String;
begin
  FTitulo := ATitulo;
  if (FTitulo = '') and Assigned(FAlbaran) then
  begin
      if FAlbaran.EsNuevo then
         FTitulo := 'Nueva orden de devolución de cliente'
      else
         FTitulo := 'Orden de devolución de cliente'  + ' - ' + FAlbaran.Cliente.Nombre;
  end;

  inherited PonerTitulos(FTitulo);
end;

end.
