2011-11-14 17:40:41 +00:00
{
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Copyright ( <EFBFBD> ) 2 0 0 6 . Rodax Software.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Los contenidos de este fichero son propiedad de Rodax Software titular del
copyright. Este fichero s<EFBFBD> lo podr<EFBFBD> ser copiado, distribuido y utilizado,
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
acuerdo con los t<EFBFBD> rminos y condiciones establecidas en el acuerdo/ contrato
bajo el que se suministra.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Web: www. rodax- software. com
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Fecha primera versi<EFBFBD> n: 2 2 - 0 5 - 2 0 0 6
Versi<EFBFBD> n actual: 1.0 . 0
Fecha versi<EFBFBD> n actual: 2 2 - 0 5 - 2 0 0 6
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
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;
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
2013-10-24 15:51:37 +00:00
if ( ShowConfirmMessage( 'Borrar forma de pago, esta forma de pago puede estar asociada a presupuestos, contratos y facturas.' , '<27> Est<73> seguro que desea borrar esta forma de pago?' ) = IDYES) then
2011-11-14 17:40:41 +00:00
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 ) ;
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 ) ;
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 .