164 lines
4.7 KiB
ObjectPascal
164 lines
4.7 KiB
ObjectPascal
unit uEditorContratosClienteBeneficios;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, uEditorGridBase, Menus, JvAppStorage, JvAppRegistryStorage, DB,
|
||
uDAInterfaces, uDADataTable, JvComponentBase, JvFormPlacement, ImgList,
|
||
PngImageList, StdActns, ActnList, ComCtrls, JvExComCtrls, JvStatusBar, TBX,
|
||
TB2ExtItems, TBXExtItems, TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls,
|
||
JvExControls, JvNavigationPane, uIEditorContratosClienteBeneficios, uBizContratosCliente,
|
||
uCustomView, uViewBase, uViewGridBase, uViewGrid,
|
||
uViewContratosClienteBeneficios, uContratosClienteController;
|
||
|
||
type
|
||
TfEditorContratosClienteBeneficios = class(TfEditorGridBase, IEditorContratosClienteBeneficios)
|
||
frViewContratosClienteBeneficios1: TfrViewContratosClienteBeneficios;
|
||
actVerBeneficio: TAction;
|
||
TBItem1: TTBItem;
|
||
procedure FormShow(Sender: TObject);
|
||
procedure actVerBeneficioExecute(Sender: TObject);
|
||
procedure OnListaAnosChange(Sender: TObject; const Text: string);
|
||
|
||
private
|
||
FContratos: IBizContratosClienteBeneficios;
|
||
FController : IContratosClienteController;
|
||
|
||
function GetContratos: IBizContratosClienteBeneficios;
|
||
procedure SetContratos(const Value: IBizContratosClienteBeneficios);
|
||
|
||
function GetController : IContratosClienteController;
|
||
procedure SetController (const Value : IContratosClienteController);
|
||
|
||
|
||
protected
|
||
procedure ImprimirInterno; override;
|
||
procedure PrevisualizarInterno; override;
|
||
procedure RefrescarInterno; override;
|
||
|
||
public
|
||
property Contratos: IBizContratosClienteBeneficios read GetContratos write SetContratos;
|
||
property Controller : IContratosClienteController read GetController write SetController;
|
||
constructor Create(AOwner: TComponent); override;
|
||
destructor Destroy; override;
|
||
end;
|
||
|
||
var
|
||
fEditorContratosClienteBeneficios: TfEditorContratosClienteBeneficios;
|
||
|
||
implementation
|
||
|
||
uses
|
||
cxControls;
|
||
|
||
{$R *.dfm}
|
||
{ TfEditorContratosClienteBeneficios }
|
||
|
||
procedure TfEditorContratosClienteBeneficios.actVerBeneficioExecute(
|
||
Sender: TObject);
|
||
begin
|
||
inherited;
|
||
FController.VerBeneficio(Contratos.ID);
|
||
end;
|
||
|
||
constructor TfEditorContratosClienteBeneficios.Create(AOwner: TComponent);
|
||
begin
|
||
inherited;
|
||
FContratos := NIL;
|
||
end;
|
||
|
||
destructor TfEditorContratosClienteBeneficios.Destroy;
|
||
begin
|
||
FContratos := NIL;
|
||
inherited;
|
||
end;
|
||
|
||
procedure TfEditorContratosClienteBeneficios.FormShow(Sender: TObject);
|
||
begin
|
||
cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES DEL INHERITED
|
||
|
||
inherited;
|
||
ViewGrid := frViewContratosClienteBeneficios1;
|
||
FContratos.Active := True;
|
||
actAnchoAuto.Execute;
|
||
end;
|
||
|
||
function TfEditorContratosClienteBeneficios.GetContratos: IBizContratosClienteBeneficios;
|
||
begin
|
||
Result := FContratos;
|
||
end;
|
||
|
||
function TfEditorContratosClienteBeneficios.GetController: IContratosClienteController;
|
||
begin
|
||
Result := FController;
|
||
end;
|
||
|
||
procedure TfEditorContratosClienteBeneficios.ImprimirInterno;
|
||
begin
|
||
inherited;
|
||
|
||
end;
|
||
|
||
procedure TfEditorContratosClienteBeneficios.OnListaAnosChange(Sender: TObject; const Text: string);
|
||
begin
|
||
Controller.FiltrarAnoBeneficios(Contratos, DynWhereDataTable, Text);
|
||
if Contratos.DataTable.Active then
|
||
RefrescarInterno;
|
||
end;
|
||
|
||
procedure TfEditorContratosClienteBeneficios.PrevisualizarInterno;
|
||
begin
|
||
inherited;
|
||
|
||
end;
|
||
|
||
procedure TfEditorContratosClienteBeneficios.RefrescarInterno;
|
||
begin
|
||
//Volvemos a cargar los a<>os de los Contratos
|
||
if Assigned(FController) then
|
||
ListaAnos := FController.DarListaAnosContratos;
|
||
|
||
//Pasamos del padre ya que refresh da error
|
||
// inherited;
|
||
ShowHourglassCursor;
|
||
ViewGrid.SaveGridStatus;
|
||
ViewGrid._FocusedView.BeginUpdate;
|
||
|
||
try
|
||
Contratos.DataTable.Active := False;
|
||
Contratos.DataTable.Active := True;
|
||
|
||
finally
|
||
ViewGrid._FocusedView.EndUpdate;
|
||
ViewGrid.RestoreGridStatus;
|
||
HideHourglassCursor;
|
||
end;
|
||
|
||
|
||
|
||
end;
|
||
|
||
procedure TfEditorContratosClienteBeneficios.SetContratos(const Value: IBizContratosClienteBeneficios);
|
||
begin
|
||
FContratos := Value;
|
||
|
||
if Assigned(FContratos) then
|
||
begin
|
||
//Se guarda el where de la sentencia origen, por si el editor tiene filtros que
|
||
//afecten a este where y en un futuro se desea volver al where origen (filtro de a<>o))
|
||
DynWhereDataTable := FContratos.DataTable.DynamicWhere.Xml;
|
||
frViewContratosClienteBeneficios1.Contratos := FContratos;
|
||
end;
|
||
end;
|
||
|
||
procedure TfEditorContratosClienteBeneficios.SetController(const Value: IContratosClienteController);
|
||
begin
|
||
FController := Value;
|
||
|
||
if Assigned(FController) then
|
||
ListaAnos := FController.DarListaAnosContratos;
|
||
end;
|
||
|
||
end.
|