This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
LuisLeon_FactuGES/Source/Modulos/Formas de pago/Views/uEditorFormaPago.pas

202 lines
6.0 KiB
ObjectPascal
Raw Normal View History

{
===============================================================================
Copyright (<EFBFBD>) 2006. 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: 22-05-2006
Versi<EFBFBD>n actual: 1.0.0
Fecha versi<EFBFBD>n actual: 22-05-2006
===============================================================================
Modificaciones:
Fecha Comentarios
---------------------------------------------------------------------------
===============================================================================
}
unit uEditorFormaPago;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Grids, DBGrids, StdCtrls, Mask, DBCtrls, DB,
uBizFormasPago, uBizFormasPagoPlazos,
uFormasPagoController, uFormasPagoPlazosController,
uDADataTable, uIEditorFormaPago, ActnList, ExtCtrls, JvExControls,
JvComponent, JvEnterTab, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, cxDBData, cxSpinEdit, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls,
cxGridCustomView, cxGrid;
type
TfEditorFormaPago = class(TForm, IEditorFormaPago)
ActionList1: TActionList;
dsFormaPago: TDADataSource;
actAnadir: TAction;
actEliminar: TAction;
actAceptar: TAction;
actCancelar: TAction;
bAceptar: TButton;
bCancelar: TButton;
actCerrar: TAction;
actModificar: TAction;
eReferencia: TDBEdit;
eDescripcion: TDBEdit;
eTitular: TDBEdit;
eCuenta: TDBEdit;
dsPlazos: TDADataSource;
Label1: TLabel;
Bevel1: TBevel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Bevel2: TBevel;
Label6: TLabel;
eCodEntidad: TDBEdit;
Label7: TLabel;
eCodSucursal: TDBEdit;
Label8: TLabel;
eDC: TDBEdit;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Bevel3: TBevel;
Bevel4: TBevel;
bAnadir: TButton;
bEliminar: TButton;
JvEnterAsTab1: TJvEnterAsTab;
ListaFormasPagoDBTableView1: TcxGridDBTableView;
ListaFormasPagoLevel1: TcxGridLevel;
ListaFormasPago: TcxGrid;
ListaFormasPagoDBTableView1NUM_DIAS: TcxGridDBColumn;
ListaFormasPagoDBTableView1PORCENTAJE: TcxGridDBColumn;
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
FFormaPago: IBizFormaPago;
FPlazos : IBizFormaPagoPlazos;
FController : IFormasPagoController;
FPlazosController: IFormasPagoPlazosController;
function GetFormaPago: IBizFormaPago;
procedure SetFormaPago(const Value: IBizFormaPago);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property FormaPago: IBizFormaPago read GetFormaPago write SetFormaPago;
end;
implementation
{$R *.dfm}
{ TfEditorFormasPago }
uses
uDialogUtils, uDataModuleFormasPago;
function TfEditorFormaPago.GetFormaPago: IBizFormaPago;
begin
Result := FFormaPago;
end;
procedure TfEditorFormaPago.SetFormaPago(const Value: IBizFormaPago);
begin
FFormaPago := Value;
if Assigned(FFormaPago) then
begin
FPlazos := FFormaPago.Plazos;
dsFormaPago.DataTable := FFormaPago.DataTable;
dsPlazos.DataTable := FPlazos.DataTable;
dsFormaPago.DataTable.Open;
dsPlazos.DataTable.Open;
end
else begin
dsFormaPago.DataTable := NIL;
dsPlazos.DataTable := NIL;
end;
end;
procedure TfEditorFormaPago.actAnadirExecute(Sender: TObject);
begin
FPlazos.Append;
end;
procedure TfEditorFormaPago.actEliminarExecute(Sender: TObject);
begin
FPlazos.Delete;
end;
procedure TfEditorFormaPago.actEliminarUpdate(Sender: TObject);
begin
(Sender as TAction).Enabled := Assigned(FPlazos) and
FPlazos.DataTable.Active and
(FPlazos.DataTable.RecordCount > 0);
end;
constructor TfEditorFormaPago.Create(AOwner: TComponent);
begin
inherited;
FController := TFormasPagoController.Create;
FPlazosController := TFormasPagoPlazosController.Create;
end;
destructor TfEditorFormaPago.Destroy;
begin
FFormaPago := NIL;
FPlazosController := NIL;
FController := NIL;
inherited;
end;
procedure TfEditorFormaPago.actAceptarExecute(Sender: TObject);
begin
if FController.Guardar(FFormaPago) then
actCerrar.Execute;
end;
procedure TfEditorFormaPago.actCancelarExecute(Sender: TObject);
begin
FController.DescartarCambios(FFormaPago);
actCerrar.Execute;
end;
procedure TfEditorFormaPago.actCerrarExecute(Sender: TObject);
begin
Close;
end;
procedure TfEditorFormaPago.actAnadirUpdate(Sender: TObject);
begin
(Sender as TAction).Enabled := Assigned(FPlazos) and
FPlazos.DataTable.Active;
end;
procedure TfEditorFormaPago.FormShow(Sender: TObject);
begin
if not FFormaPago.DataTable.Active then
FFormaPago.DataTable.Active := True;
if FFormaPago.EsNuevo then
Self.Caption := 'Nueva forma de pago'
else
Self.Caption := 'Modificar forma de pago';
end;
end.