FactuGES2/Source/Modulos/Contabilidad/Views/uEditorCuentaEspecial.pas

179 lines
5.6 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 uEditorCuentaEspecial;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Grids, DBGrids, StdCtrls, Mask, DBCtrls, DB,
uBizCuentasEspeciales, uCuentasEspecialesController,
uDADataTable, uIEditorCuentaEspecial, ActnList, ExtCtrls, JvExControls,
JvComponent, JvEnterTab, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, cxDBData, cxSpinEdit, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls,
cxGridCustomView, cxGrid, uDAInterfaces;
type
TfEditorCuentaEspecial = class(TForm, IEditorCuentaEspecial)
ActionList1: TActionList;
actAnadir: TAction;
actEliminar: TAction;
actAceptar: TAction;
actCancelar: TAction;
bAceptar: TButton;
bCancelar: TButton;
actCerrar: TAction;
actModificar: TAction;
eReferencia: TDBEdit;
eDescripcion: TDBEdit;
dsCuentasEspeciales: TDADataSource;
Label1: TLabel;
Bevel1: TBevel;
Label2: TLabel;
Label3: TLabel;
Bevel4: TBevel;
JvEnterAsTab1: TJvEnterAsTab;
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);
protected
FCuentaEspecial: IBizCuentaEspecial;
FController : ICuentasEspecialesController;
function GetCuentaEspecial: IBizCuentaEspecial;
procedure SetCuentaEspecial(const Value: IBizCuentaEspecial);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property CuentaEspecial: IBizCuentaEspecial read GetCuentaEspecial write SetCuentaEspecial;
end;
implementation
{$R *.dfm}
{ TfEditorCuentasEspeciales }
uses
Dialogs, uDialogUtils;
function TfEditorCuentaEspecial.GetCuentaEspecial: IBizCuentaEspecial;
begin
Result := FCuentaEspecial;
end;
procedure TfEditorCuentaEspecial.SetCuentaEspecial(const Value: IBizCuentaEspecial);
begin
FCuentaEspecial := Value;
if Assigned(FCuentaEspecial) then
begin
dsCuentasEspeciales.DataTable := FCuentaEspecial.DataTable;
dsCuentasEspeciales.DataTable.Open;
end
else begin
dsCuentasEspeciales.DataTable := NIL;
end;
end;
procedure TfEditorCuentaEspecial.actAnadirExecute(Sender: TObject);
begin
// FPlazos.Append;
end;
procedure TfEditorCuentaEspecial.actEliminarExecute(Sender: TObject);
begin
// FPlazos.Delete;
end;
procedure TfEditorCuentaEspecial.actEliminarUpdate(Sender: TObject);
begin
{
(Sender as TAction).Enabled := Assigned(FPlazos) and
FPlazos.DataTable.Active and
(FPlazos.DataTable.RecordCount > 0);
}
end;
constructor TfEditorCuentaEspecial.Create(AOwner: TComponent);
begin
inherited;
FController := TCuentasEspecialesController.Create;
end;
destructor TfEditorCuentaEspecial.Destroy;
begin
FCuentaEspecial := NIL;
FController := NIL;
inherited;
end;
procedure TfEditorCuentaEspecial.actAceptarExecute(Sender: TObject);
begin
{
if (ListaCuentasEspeciales.ActiveView.DataController.RecordCount = 0) then
if (ShowConfirmMessage('Forma de pago sin plazos', 'No ha indicado plazos de pago para esta forma de pago por lo tanto no se podrán generarar los recibos correspondientes.' + #10#13 + '¿Desea continuar guardando la forma de pago?') = IDNO) then
Exit;
}
if FController.Guardar(FCuentaEspecial) then
actCerrar.Execute;
end;
procedure TfEditorCuentaEspecial.actCancelarExecute(Sender: TObject);
begin
FController.DescartarCambios(FCuentaEspecial);
actCerrar.Execute;
end;
procedure TfEditorCuentaEspecial.actCerrarExecute(Sender: TObject);
begin
Close;
end;
procedure TfEditorCuentaEspecial.actAnadirUpdate(Sender: TObject);
begin
{
(Sender as TAction).Enabled := Assigned(FPlazos) and
FPlazos.DataTable.Active;
}
end;
procedure TfEditorCuentaEspecial.FormShow(Sender: TObject);
begin
if not FCuentaEspecial.DataTable.Active then
FCuentaEspecial.DataTable.Active := True;
if FCuentaEspecial.EsNuevo then
Self.Caption := 'Nueva forma de pago'
else
Self.Caption := 'Modificar forma de pago';
end;
end.