git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@63 f4e31baf-9722-1c47-927c-6f952f962d4b
150 lines
4.6 KiB
ObjectPascal
150 lines
4.6 KiB
ObjectPascal
unit uViewSubCuentaContacto;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, uViewBase, ExtCtrls, StdCtrls, Buttons, DB, uDADataTable,
|
|
DBCtrls, Grids, DBGrids, uBizContactos, Mask, ComCtrls, uCustomView,
|
|
JvComponent, JvFormAutoSize, cxControls, cxContainer, cxEdit, cxTextEdit,
|
|
cxDBEdit, dxLayoutControl, uDAInterfaces, cxGraphics, cxDropDownEdit,
|
|
cxImageComboBox, cxMaskEdit, cxCalendar, ImgList, PngImageList, ActnList,
|
|
cxCurrencyEdit, uSubCuentasController;
|
|
|
|
type
|
|
IViewSubCuenta = interface(IViewBase)
|
|
['{F01E0772-4D72-41DD-AFEF-4BA6548A1FC6}']
|
|
function GetContacto: IBizContacto;
|
|
procedure SetContacto(const Value: IBizContacto);
|
|
property Contacto: IBizContacto read GetContacto write SetContacto;
|
|
end;
|
|
|
|
TfrViewSubCuentaContacto = class(TfrViewBase, IViewSubCuenta)
|
|
DADataSource: TDADataSource;
|
|
layoutApunteGroup_Root: TdxLayoutGroup;
|
|
layoutApunte: TdxLayoutControl;
|
|
layoutApunteGroup1: TdxLayoutGroup;
|
|
layoutApunteItem2: TdxLayoutItem;
|
|
eRefSubCuenta: TcxDBTextEdit;
|
|
layoutApunteItem4: TdxLayoutItem;
|
|
BitBtn3: TBitBtn;
|
|
png: TActionList;
|
|
actElegirSubCuenta: TAction;
|
|
LargeImages: TPngImageList;
|
|
layoutApunteItem5: TdxLayoutItem;
|
|
eSubCuenta: TcxDBTextEdit;
|
|
layoutApunteGroup3: TdxLayoutGroup;
|
|
actVerSubcuenta: TAction;
|
|
actAnadirSubcuenta: TAction;
|
|
layoutApunteItem1: TdxLayoutItem;
|
|
BitBtn1: TBitBtn;
|
|
layoutApunteItem3: TdxLayoutItem;
|
|
BitBtn2: TBitBtn;
|
|
procedure CustomViewCreate(Sender: TObject);
|
|
procedure CustomViewDestroy(Sender: TObject);
|
|
procedure actElegirSubCuentaExecute(Sender: TObject);
|
|
procedure actAnadirSubcuentaExecute(Sender: TObject);
|
|
procedure actVerSubcuentaExecute(Sender: TObject);
|
|
procedure actVerSubcuentaUpdate(Sender: TObject);
|
|
|
|
protected
|
|
FController : ISubcuentasController;
|
|
FContacto: IBizContacto;
|
|
function GetContacto: IBizContacto;
|
|
procedure SetContacto(const Value: IBizContacto);
|
|
public
|
|
property Contacto: IBizContacto read GetContacto write SetContacto;
|
|
end;
|
|
|
|
implementation
|
|
{$R *.dfm}
|
|
|
|
|
|
{ TfrViewSubCuenta }
|
|
|
|
{
|
|
******************************* TfrViewSubCuenta ********************************
|
|
}
|
|
|
|
procedure TfrViewSubCuentaContacto.actAnadirSubcuentaExecute(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
{ if Supports(IBizCliente, FContacto) then
|
|
FController.VerSubCuentaContacto((Contacto as IBizCliente).SubCuentas)
|
|
else if Supports(IBizProveedor, FContacto) then
|
|
FController.VerSubCuentaContacto((Contacto as IBizProveedor).SubCuentas);
|
|
}
|
|
end;
|
|
|
|
procedure TfrViewSubCuentaContacto.actElegirSubCuentaExecute(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
if Supports(FContacto, IBizCliente) then
|
|
FController.ElegirSubCuentaContacto((Contacto as IBizCliente).SubCuentas, CTE_CUENTASCLIENTE)
|
|
else if Supports(FContacto, IBizProveedor) then
|
|
FController.ElegirSubCuentaContacto((Contacto as IBizProveedor).SubCuentas, CTE_CUENTASPROVEEDOR);
|
|
end;
|
|
|
|
procedure TfrViewSubCuentaContacto.actVerSubcuentaExecute(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
if Supports(FContacto, IBizCliente) then
|
|
FController.VerSubCuentaContacto((Contacto as IBizCliente).SubCuentas)
|
|
else if Supports(FContacto, IBizProveedor) then
|
|
FController.VerSubCuentaContacto((Contacto as IBizProveedor).SubCuentas);
|
|
end;
|
|
|
|
procedure TfrViewSubCuentaContacto.actVerSubcuentaUpdate(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
(Sender as TAction).Enabled := not eRefSubCuenta.DataBinding.Field.IsNull;
|
|
end;
|
|
|
|
{
|
|
function TfrViewApunte.GetController: IApuntesController;
|
|
begin
|
|
Result := FController;
|
|
end;
|
|
}
|
|
|
|
procedure TfrViewSubCuentaContacto.CustomViewCreate(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
FController := TSubcuentasController.Create;
|
|
end;
|
|
|
|
procedure TfrViewSubCuentaContacto.CustomViewDestroy(Sender: TObject);
|
|
begin
|
|
FController := Nil;
|
|
inherited;
|
|
end;
|
|
|
|
function TfrViewSubCuentaContacto.GetContacto: IBizContacto;
|
|
begin
|
|
Result := FContacto;
|
|
end;
|
|
|
|
{
|
|
procedure TfrViewApunte.SetController(const Value: IApuntesController);
|
|
begin
|
|
FController := Value;
|
|
end;
|
|
}
|
|
|
|
procedure TfrViewSubCuentaContacto.SetContacto(const Value: IBizContacto);
|
|
begin
|
|
FContacto := Value;
|
|
if Assigned(FContacto) then
|
|
begin
|
|
if Supports(FContacto, IBizCliente) then
|
|
DADataSource.DataTable := (FContacto as IBizCliente).SubCuentas.DataTable
|
|
else if Supports(FContacto, IBizProveedor) then
|
|
DADataSource.DataTable := (FContacto as IBizProveedor).SubCuentas.DataTable;
|
|
end
|
|
else
|
|
DADataSource.DataTable := NIL;
|
|
end;
|
|
|
|
end.
|
|
|