unit uViewDetallesMedicacion;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter,
  cxData, cxDataStorage, cxEdit, DB, cxDBData, ImgList, PngImageList,
  uDADataTable, ActnList, ComCtrls, ToolWin, cxGridLevel, cxClasses, cxControls,
  cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
  cxGrid, cxImageComboBox, cxTextEdit, cxMaskEdit, cxCheckBox, cxCurrencyEdit,
  Grids, DBGrids, StdCtrls, ExtCtrls, cxRichEdit, ExtActns, StdActns,
  JvExStdCtrls, JvCombobox, JvColorCombo, TB2Item, TBX, TB2Dock, TB2Toolbar,
  uArticulosController, uBizMedicaciones, cxDropDownEdit,
  cxCalendar, cxDBEdit, dxLayoutControl, cxContainer, cxLookupEdit,
  cxDBLookupEdit, cxDBLookupComboBox, uDAInterfaces, cxButtonEdit,
  uViewDetallesArticulos, Menus, cxGridCustomPopupMenu, cxGridPopupMenu, 
  cxEditRepositoryItems;

type
  IViewDetallesMedicacion = interface(IViewDetallesArticulos)
  ['{E880166F-89E8-4D0D-96FA-FF3770F6DCDB}']
    function GetMedicacion: IBizMedicacion;
    procedure SetMedicacion(const Value: IBizMedicacion);
    property Medicacion: IBizMedicacion read GetMedicacion write SetMedicacion;
  end;

  TfrViewDetallesMedicacion = class(TfrViewDetallesArticulos, IViewDetallesMedicacion)
    N2: TMenuItem;
    Aadirartculos1: TMenuItem;
    TBXItem18: TTBXItem;
  protected
    FMedicacion: IBizMedicacion;
    function GetMedicacion: IBizMedicacion;
    procedure SetMedicacion(const Value: IBizMedicacion);

    procedure AnadirArticulosInterno; override;
    procedure RellenarArticulosInterno; override;
    function AnadirArticulo(pReferencia: String): Boolean;

  public
    property Medicacion: IBizMedicacion read GetMedicacion write SetMedicacion;
  end;

implementation
{$R *.dfm}

uses
  uDetallesMedicacionController, uViewDetallesBase;

{ TfrViewDetallesMedicacion }

function TfrViewDetallesMedicacion.AnadirArticulo(pReferencia: String): Boolean;
begin
  Result := (Controller as IDetallesMedicacionController).AnadirArticulo(Detalles, pReferencia);
end;

procedure TfrViewDetallesMedicacion.AnadirArticulosInterno;
begin
  (Controller as IDetallesMedicacionController).AnadirArticulos(Detalles);
end;

function TfrViewDetallesMedicacion.GetMedicacion: IBizMedicacion;
begin
  Result := FMedicacion;
end;

procedure TfrViewDetallesMedicacion.RellenarArticulosInterno;
begin
  (Controller as IDetallesMedicacionController).AnadirArticulos(Detalles, False);
end;

procedure TfrViewDetallesMedicacion.SetMedicacion(const Value: IBizMedicacion);
begin
  FMedicacion := Value;
end;

end.
