2010-08-11 10:53:06 +00:00
|
|
|
|
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;
|
2013-12-13 09:42:56 +00:00
|
|
|
|
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;
|
2013-12-13 13:07:39 +00:00
|
|
|
|
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);
|
2010-08-11 10:53:06 +00:00
|
|
|
|
protected
|
|
|
|
|
|
FController : IDatosBancariosEmpresaController;
|
|
|
|
|
|
FDatosBancarios: IBizEmpresasDatosBancarios;
|
|
|
|
|
|
|
|
|
|
|
|
function GetController : IDatosBancariosEmpresaController;
|
|
|
|
|
|
procedure SetController (const Value : IDatosBancariosEmpresaController);
|
|
|
|
|
|
|
|
|
|
|
|
function GetDatosBancarios: IBizEmpresasDatosBancarios;
|
|
|
|
|
|
procedure SetDatosBancarios(const Value: IBizEmpresasDatosBancarios);
|
2013-12-13 13:07:39 +00:00
|
|
|
|
|
|
|
|
|
|
procedure CalcularCodigoIBAN();
|
2010-08-11 10:53:06 +00:00
|
|
|
|
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
|
2013-12-13 13:07:39 +00:00
|
|
|
|
Variants, uStringsUtils;
|
2010-08-11 10:53:06 +00:00
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{ TfEditorDireccion }
|
|
|
|
|
|
|
2013-12-13 13:07:39 +00:00
|
|
|
|
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;
|
|
|
|
|
|
|
2010-08-11 10:53:06 +00:00
|
|
|
|
constructor TfEditorDatosBancariosEmpresa.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FController := NIL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
destructor TfEditorDatosBancariosEmpresa.Destroy;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := NIL;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2013-12-13 13:07:39 +00:00
|
|
|
|
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;
|
|
|
|
|
|
|
2010-08-11 10:53:06 +00:00
|
|
|
|
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.
|