unit uEditorDBItem;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uEditorItem, ImgList, PngImageList, StdActns, ActnList, TBX,
  TB2Item, TB2Dock, TB2Toolbar, ComCtrls, JvExControls, JvComponent,
  JvNavigationPane, DB, uDADataTable, uEditorDBBase, JvFormAutoSize,
  StdCtrls, uDAScriptingProvider, uDACDSDataTable, AppEvnts, uCustomView,
  uViewBase, JvAppStorage, JvAppRegistryStorage,
  JvFormPlacement, pngimage, ExtCtrls, JvComponentBase;

type
  IEditorDBItem = interface(IEditorDBBase)
  ['{497AE4CE-D061-4F75-A29A-320F8565FF54}']
  end;

  TfEditorDBItem = class(TfEditorDBBase, IEditorDBItem)
    procedure actEliminarExecute(Sender: TObject);
    procedure actPrevisualizarExecute(Sender: TObject);
    procedure actImprimirExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fEditorDBItem: TfEditorDBItem;

implementation

uses
  uBizInformesBase;

{$R *.dfm}

procedure TfEditorDBItem.actEliminarExecute(Sender: TObject);
begin
  inherited;
  actCerrar.Execute;
end;

procedure TfEditorDBItem.actPrevisualizarExecute(Sender: TObject);
var
  Respuesta: Integer;
  aInf : IBizInformesAware;
begin
  inherited;
{  if Modified then
  begin
    if (Application.MessageBox('Se han producido cambios y no se puede previsualizar hasta que no se guarden.' + #10#13 +
      '¿Desea guardarlos ahora?', 'Atención', MB_YESNO) = IDYES) then
      actGuardar.Execute
    else begin
      Application.MessageBox('Recuerde guardar los cambios si quiere previsualizar o imprimir.', 'Información', MB_OK);
      Exit;
    end;
  end;}

  if Assigned(dsDataTable.DataTable) and
    Supports(dsDataTable.DataTable, IBizInformesAware, aInf) then
    aInf.Preview;
end;

procedure TfEditorDBItem.actImprimirExecute(Sender: TObject);
var
  Respuesta: Integer;
  aInf : IBizInformesAware;
begin
  inherited;
{  if Modified then
  begin
    if (Application.MessageBox('Se han producido cambios y no se puede imprimir hasta que no se guarden.' + #10#13 +
      '¿Desea guardarlos ahora?', 'Atención', MB_YESNO) = IDYES) then
      actGuardar.Execute
    else begin
      Application.MessageBox('Recuerde guardar los cambios si quiere previsualizar o imprimir.', 'Información', MB_OK);
      Exit;
    end;
  end;}

  if Assigned(dsDataTable.DataTable) and
    Supports(dsDataTable.DataTable, IBizInformesAware, aInf) then
    aInf.Print;
end;

end.
