git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES2/trunk@205 b2cfbe5a-eba1-4a0c-8b32-7feea0a119f2
171 lines
4.8 KiB
ObjectPascal
171 lines
4.8 KiB
ObjectPascal
unit uEditorDatosBancariosEmpresa;
|
||
|
||
interface
|
||
|
||
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
|
||
Buttons, ExtCtrls, Mask, DBCtrls, DB, uDADataTable, PngSpeedButton,
|
||
cxControls, cxContainer, cxEdit, cxTextEdit, cxHyperLinkEdit, cxDBEdit,
|
||
uIEditorDatosBancarioEmpresa, uDatosBancariosEmpresaController, uBizEmpresasDatosBancarios,
|
||
cxCurrencyEdit, uDAInterfaces;
|
||
|
||
type
|
||
TfEditorDatosBancariosEmpresa = class(TForm, IEditorDatosBancariosEmpresa)
|
||
OKBtn: TButton;
|
||
CancelBtn: TButton;
|
||
dsDatosBancarios: TDADataSource;
|
||
GroupBox1: TGroupBox;
|
||
Label5: TLabel;
|
||
eNombre: TDBEdit;
|
||
Label2: TLabel;
|
||
eCodEntidad: TDBEdit;
|
||
Label3: TLabel;
|
||
eCodSucursal: TDBEdit;
|
||
Label4: TLabel;
|
||
eDC: TDBEdit;
|
||
Label6: TLabel;
|
||
eCuenta: TDBEdit;
|
||
eIBAN: TDBEdit;
|
||
Label8: TLabel;
|
||
eSWIFT: TDBEdit;
|
||
Label9: TLabel;
|
||
GroupBox3: TGroupBox;
|
||
Label10: TLabel;
|
||
eSufijoAcreedor: TDBEdit;
|
||
Bevel4: TBevel;
|
||
Label12: TLabel;
|
||
Label13: TLabel;
|
||
Label11: TLabel;
|
||
eNIFCIFPresentador: TDBEdit;
|
||
Label14: TLabel;
|
||
eSufijoPresentador: TDBEdit;
|
||
Label15: TLabel;
|
||
Label16: TLabel;
|
||
eNombrePresentador: TDBEdit;
|
||
Label17: TLabel;
|
||
eCodEntidadPresentador: TDBEdit;
|
||
Label18: TLabel;
|
||
eCodSucursalPresentador: TDBEdit;
|
||
procedure eCodEntidadExit(Sender: TObject);
|
||
procedure eCodSucursalExit(Sender: TObject);
|
||
procedure eDCExit(Sender: TObject);
|
||
procedure eCuentaExit(Sender: TObject);
|
||
procedure eIBANExit(Sender: TObject);
|
||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||
protected
|
||
FController : IDatosBancariosEmpresaController;
|
||
FDatosBancarios: IBizEmpresasDatosBancarios;
|
||
|
||
function GetController : IDatosBancariosEmpresaController;
|
||
procedure SetController (const Value : IDatosBancariosEmpresaController);
|
||
|
||
function GetDatosBancarios: IBizEmpresasDatosBancarios;
|
||
procedure SetDatosBancarios(const Value: IBizEmpresasDatosBancarios);
|
||
|
||
procedure CalcularCodigoIBAN();
|
||
public
|
||
constructor Create(AOwner: TComponent); override;
|
||
destructor Destroy; override;
|
||
property DatosBancarios: IBizEmpresasDatosBancarios read GetDatosBancarios write SetDatosBancarios;
|
||
property Controller : IDatosBancariosEmpresaController read GetController
|
||
write SetController;
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
Variants, uStringsUtils;
|
||
|
||
{$R *.dfm}
|
||
|
||
{ TfEditorDireccion }
|
||
|
||
procedure TfEditorDatosBancariosEmpresa.CalcularCodigoIBAN;
|
||
begin
|
||
if not EsCadenaVacia(FDatosBancarios.ENTIDAD) and
|
||
not EsCadenaVacia(FDatosBancarios.SUCURSAL) and
|
||
not EsCadenaVacia(FDatosBancarios.DC) and
|
||
not EsCadenaVacia(FDatosBancarios.CUENTA) then
|
||
begin
|
||
FDatosBancarios.Edit;
|
||
FDatosBancarios.IBAN := FController.GenerarCodigoIBAN(FDatosBancarios);
|
||
end;
|
||
end;
|
||
|
||
constructor TfEditorDatosBancariosEmpresa.Create(AOwner: TComponent);
|
||
begin
|
||
inherited;
|
||
FController := NIL;
|
||
end;
|
||
|
||
destructor TfEditorDatosBancariosEmpresa.Destroy;
|
||
begin
|
||
FController := NIL;
|
||
inherited;
|
||
end;
|
||
|
||
procedure TfEditorDatosBancariosEmpresa.eCodEntidadExit(Sender: TObject);
|
||
begin
|
||
CalcularCodigoIBAN();
|
||
end;
|
||
|
||
procedure TfEditorDatosBancariosEmpresa.eCodSucursalExit(Sender: TObject);
|
||
begin
|
||
CalcularCodigoIBAN();
|
||
end;
|
||
|
||
procedure TfEditorDatosBancariosEmpresa.eCuentaExit(Sender: TObject);
|
||
begin
|
||
CalcularCodigoIBAN();
|
||
end;
|
||
|
||
procedure TfEditorDatosBancariosEmpresa.eDCExit(Sender: TObject);
|
||
begin
|
||
CalcularCodigoIBAN();
|
||
end;
|
||
|
||
procedure TfEditorDatosBancariosEmpresa.eIBANExit(Sender: TObject);
|
||
begin
|
||
if not EsCadenaVacia(eIBAN.Text) and not FController.ValidarCodigoIBAN(eIBAN.Text) then
|
||
begin
|
||
raise Exception.Create('Compruebe que el c<>digo IBAN indicado es correcto.');
|
||
end;
|
||
end;
|
||
|
||
procedure TfEditorDatosBancariosEmpresa.FormCloseQuery(Sender: TObject;
|
||
var CanClose: Boolean);
|
||
begin
|
||
if not EsCadenaVacia(eIBAN.Text) and not FController.ValidarCodigoIBAN(eIBAN.Text) then
|
||
begin
|
||
raise Exception.Create('Compruebe que el c<>digo IBAN indicado es correcto.');
|
||
end;
|
||
end;
|
||
|
||
function TfEditorDatosBancariosEmpresa.GetController: IDatosBancariosEmpresaController;
|
||
begin
|
||
Result := FController;
|
||
end;
|
||
|
||
function TfEditorDatosBancariosEmpresa.GetDatosBancarios: IBizEmpresasDatosBancarios;
|
||
begin
|
||
Result := FDatosBancarios;
|
||
end;
|
||
|
||
procedure TfEditorDatosBancariosEmpresa.SetController(
|
||
const Value: IDatosBancariosEmpresaController);
|
||
begin
|
||
FController := Value;
|
||
end;
|
||
|
||
procedure TfEditorDatosBancariosEmpresa.SetDatosBancarios(
|
||
const Value: IBizEmpresasDatosBancarios);
|
||
begin
|
||
FDatosBancarios := Value;
|
||
if Assigned(FDatosBancarios) then
|
||
dsDatosBancarios.DataTable := FDatosBancarios.DataTable
|
||
else
|
||
dsDatosBancarios.DataTable := NIL;
|
||
end;
|
||
|
||
|
||
end.
|