git-svn-id: https://192.168.0.254/svn/Proyectos.AlonsoYSal_FactuGES2/trunk@6 40301925-124e-1c4e-b97d-170ad7a8785b
187 lines
5.8 KiB
ObjectPascal
187 lines
5.8 KiB
ObjectPascal
{
|
|
===============================================================================
|
|
Copyright (©) 2006. Rodax Software.
|
|
===============================================================================
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|
copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado,
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|
acuerdo con los términos y condiciones establecidas en el acuerdo/contrato
|
|
bajo el que se suministra.
|
|
-----------------------------------------------------------------------------
|
|
Web: www.rodax-software.com
|
|
===============================================================================
|
|
Fecha primera versión: 22-05-2006
|
|
Versión actual: 1.0.0
|
|
Fecha versión actual: 22-05-2006
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
===============================================================================
|
|
}
|
|
|
|
unit uEditorFormasPago;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
uIEditorFormasPago, uBizFormasPago, uFormasPagoController, DB, uDADataTable,
|
|
ActnList, Grids, DBGrids, StdCtrls, ComCtrls, uDAInterfaces, Mask, DBCtrls;
|
|
|
|
type
|
|
TfEditorFormasPago = class(TForm, IEditorFormasPago)
|
|
ActionList1: TActionList;
|
|
dsFormasPago: TDADataSource;
|
|
actAnadir: TAction;
|
|
actEliminar: TAction;
|
|
bEliminar: TButton;
|
|
actAceptar: TAction;
|
|
actCancelar: TAction;
|
|
bAceptar: TButton;
|
|
bCancelar: TButton;
|
|
actCerrar: TAction;
|
|
PageControl1: TPageControl;
|
|
TabSheet1: TTabSheet;
|
|
Label1: TLabel;
|
|
bAnadir: TButton;
|
|
actModificar: TAction;
|
|
Button1: TButton;
|
|
ListaFormasPago: TDBGrid;
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
procedure actAnadirExecute(Sender: TObject);
|
|
procedure actEliminarExecute(Sender: TObject);
|
|
procedure actAceptarExecute(Sender: TObject);
|
|
procedure actCancelarExecute(Sender: TObject);
|
|
procedure actCerrarExecute(Sender: TObject);
|
|
procedure actAnadirUpdate(Sender: TObject);
|
|
procedure actEliminarUpdate(Sender: TObject);
|
|
procedure actModificarExecute(Sender: TObject);
|
|
procedure ListaFormasPagoDblClick(Sender: TObject);
|
|
procedure actModificarUpdate(Sender: TObject);
|
|
protected
|
|
FFormasPago: IBizFormaPago;
|
|
FController: IFormasPagoController;
|
|
function GetFormasPago: IBizFormaPago;
|
|
procedure SetFormasPago(const Value: IBizFormaPago);
|
|
public
|
|
constructor Create(AOwner: TComponent); override;
|
|
destructor Destroy; override;
|
|
property FormasPago: IBizFormaPago read GetFormasPago write SetFormasPago;
|
|
end;
|
|
|
|
|
|
implementation
|
|
{$R *.dfm}
|
|
|
|
{ TfEditorFormasPago }
|
|
|
|
uses
|
|
uDialogUtils, uFactuGES_App;
|
|
|
|
function TfEditorFormasPago.GetFormasPago: IBizFormaPago;
|
|
begin
|
|
Result := FFormasPago;
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.ListaFormasPagoDblClick(Sender: TObject);
|
|
begin
|
|
// ListaFormasPago.SelectedIndex
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.SetFormasPago(const Value: IBizFormaPago);
|
|
begin
|
|
FFormasPago := Value;
|
|
dsFormasPago.DataTable := (FFormasPago as IBizFormaPago).DataTable;
|
|
dsFormasPago.DataTable.Open;
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.actAnadirExecute(Sender: TObject);
|
|
begin
|
|
FController.Anadir(FormasPago);
|
|
FController.Ver(FormasPago);
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.actEliminarExecute(Sender: TObject);
|
|
begin
|
|
if (ShowConfirmMessage('Borrar forma de pago', '¿Está seguro que desea borrar esta forma de pago?') = IDYES) then
|
|
FController.Eliminar(FFormasPago)
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.actEliminarUpdate(Sender: TObject);
|
|
begin
|
|
(Sender as TAction).Enabled := Assigned(FFormasPago) and
|
|
FFormasPago.DataTable.Active and
|
|
(FFormasPago.DataTable.RecordCount > 0) and
|
|
(AppFactuGES.UsuarioActivo.ID_PERFIL = CTE_PERFIL_ADMINISTRADOR);
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.actModificarExecute(Sender: TObject);
|
|
begin
|
|
FController.Ver(FormasPago);
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.actModificarUpdate(Sender: TObject);
|
|
begin
|
|
(Sender as TAction).Enabled := Assigned(FFormasPago) and
|
|
FFormasPago.DataTable.Active and
|
|
(FFormasPago.DataTable.RecordCount > 0) and
|
|
(AppFactuGES.UsuarioActivo.ID_PERFIL = CTE_PERFIL_ADMINISTRADOR);
|
|
end;
|
|
|
|
constructor TfEditorFormasPago.Create(AOwner: TComponent);
|
|
begin
|
|
inherited;
|
|
FController := TFormasPagoController.Create;
|
|
end;
|
|
|
|
destructor TfEditorFormasPago.Destroy;
|
|
begin
|
|
FFormasPago := NIL;
|
|
FController := NIL;
|
|
inherited;
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.actAceptarExecute(Sender: TObject);
|
|
begin
|
|
try
|
|
FormasPago.DataTable.ApplyUpdates;
|
|
except
|
|
on E : Exception do begin
|
|
FormasPago.DataTable.CancelUpdates;
|
|
ShowErrorMessage('Error al guardar cambios', 'Se ha producido un error grave', E);
|
|
Exit;
|
|
end;
|
|
end;
|
|
actCerrar.Execute;
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.actCancelarExecute(Sender: TObject);
|
|
begin
|
|
FormasPago.DataTable.CancelUpdates;
|
|
actCerrar.Execute;
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.actCerrarExecute(Sender: TObject);
|
|
begin
|
|
Close;
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.actAnadirUpdate(Sender: TObject);
|
|
begin
|
|
(Sender as TAction).Enabled := Assigned(FFormasPago) and
|
|
FFormasPago.DataTable.Active;
|
|
end;
|
|
|
|
procedure TfEditorFormasPago.FormShow(Sender: TObject);
|
|
begin
|
|
if not FFormasPago.DataTable.Active then
|
|
FFormasPago.DataTable.Active := true;
|
|
|
|
ListaFormasPago.SetFocus;
|
|
end;
|
|
|
|
end.
|