AbetoDesign_FactuGES2/Source/Modulos/Contabilidad/Views/uViewCajasBancos.pas

122 lines
3.2 KiB
ObjectPascal

unit uViewCajasBancos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewBase, ExtCtrls, StdCtrls, DB, uDADataTable, cxGraphics,
dxLayoutControl, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit,
cxControls, cxCheckBox;
type
IViewCajasBancos = interface(IViewBase)
['{5266EE90-D715-462A-9720-FF0D4078A496}']
end;
TfrViewCajasBancos = class(TfrViewBase, IViewCajasBancos)
cbCajasBancos: TcxComboBox;
dxLayoutControl1Group_Root: TdxLayoutGroup;
dxLayoutControl1: TdxLayoutControl;
dxLayoutControl1Item1: TdxLayoutItem;
dxLayoutControl1Item2: TdxLayoutItem;
eContabilizar: TcxCheckBox;
procedure CustomViewCreate(Sender: TObject);
procedure CustomViewDestroy(Sender: TObject);
procedure cbCajaBancoPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
procedure eContabilizarPropertiesEditValueChanged(Sender: TObject);
private
FIdSubCuenta : Integer;
FListaCajasBancos : TStringList;
function getIDCajaBanco: Integer;
public
property IdSubCuenta: Integer read getIDCajaBanco;
procedure ElegirCajaBanco(const AIdSubCuenta : Integer);
end;
implementation
{$R *.dfm}
{$INCLUDE ..\..\..\FactuGES.inc}
uses
uFactuGES_App, uSubCuentasController;
procedure TfrViewCajasBancos.cbCajaBancoPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
begin
inherited;
FIdSubCuenta := StrToInt(FListaCajasBancos.Values[DisplayValue]);
end;
procedure TfrViewCajasBancos.CustomViewCreate(Sender: TObject);
var
i : integer;
begin
inherited;
with TSubCuentasController.create do
begin
FListaCajasBancos := DarListaCajasBancos;
with cbCajasBancos.Properties.Items do
begin
BeginUpdate;
try
Clear;
for i := 0 to FListaCajasBancos.Count - 1 do
Add(FListaCajasBancos.Names[i]);
finally
EndUpdate;
end;
end;
Free;
end;
{$IFDEF CONTABILIDAD}
eContabilizar.Checked := false;
{$ELSE}
eContabilizar.Checked := true;
{$ENDIF}
end;
procedure TfrViewCajasBancos.CustomViewDestroy(Sender: TObject);
begin
inherited;
FreeAndNIL(FListaCajasBancos);
end;
procedure TfrViewCajasBancos.eContabilizarPropertiesEditValueChanged(Sender: TObject);
begin
inherited;
if not eContabilizar.Checked then
begin
cbCajasBancos.ItemIndex := 0;
cbCajasBancos.Enabled := True;
FIdSubCuenta := StrToInt(FListaCajasBancos.Values[cbCajasBancos.Text]); //Refrescamos el valor
end
else
begin
cbCajasBancos.ItemIndex := -1;
cbCajasBancos.Enabled := False;
end;
end;
procedure TfrViewCajasBancos.ElegirCajaBanco(const AIdSubCuenta: Integer);
var
i : integer;
begin
for i := 0 to FListaCajasBancos.Count-1 do
begin
if FListaCajasBancos.ValueFromIndex[i] = IntToStr(AIdSubCuenta) then
begin
cbCajasBancos.Text := FListaCajasBancos.Names[i];
Break;
end;
end;
end;
function TfrViewCajasBancos.getIDCajaBanco: Integer;
begin
Result := FIdSubCuenta;
end;
end.