2012-01-27 16:11:39 +00:00
|
|
|
unit uViewFiltroAgentes;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, uViewBase, cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit,
|
|
|
|
|
StdCtrls, Buttons, TBXDkPanels, uViewParametrosInforme, uBizContactos,
|
|
|
|
|
uAgentesController;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
IViewFiltroAgentes = interface(IViewParametrosInforme)
|
|
|
|
|
['{95ACBD97-13A4-4360-A2F7-EC3B0905BB94}']
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
TfrViewFiltroAgentes = class(TfrViewParametrosInforme, IViewFiltroAgentes)
|
|
|
|
|
TBXLabel2: TTBXLabel;
|
|
|
|
|
rbTodosAgentes: TRadioButton;
|
|
|
|
|
rbUnAgente: TRadioButton;
|
|
|
|
|
cbxDesglosado: TCheckBox;
|
|
|
|
|
bElegirAgente: TBitBtn;
|
|
|
|
|
edtAgente: TcxTextEdit;
|
2013-02-13 11:18:17 +00:00
|
|
|
rbAgentesActivos: TRadioButton;
|
2015-10-07 16:23:12 +00:00
|
|
|
cbxPaginado: TCheckBox;
|
2012-01-27 16:11:39 +00:00
|
|
|
procedure rbTodosAgentesClick(Sender: TObject);
|
|
|
|
|
procedure rbUnAgenteClick(Sender: TObject);
|
|
|
|
|
procedure CustomViewCreate(Sender: TObject);
|
|
|
|
|
procedure bElegirAgenteClick(Sender: TObject);
|
|
|
|
|
procedure CustomViewDestroy(Sender: TObject);
|
|
|
|
|
private
|
|
|
|
|
FAgente : IBizAgente;
|
|
|
|
|
FAgentesController : IAgentesController;
|
|
|
|
|
public
|
|
|
|
|
property Agente : IBizAgente read FAgente;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFiltroAgentes.bElegirAgenteClick(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
AAgente : IBizAgente;
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
AAgente := IBizAgente(FAgentesController.BuscarTodos);
|
|
|
|
|
try
|
|
|
|
|
FAgente := IBizAgente(FAgentesController.ElegirContacto(AAgente, '', False));
|
|
|
|
|
if Assigned(FAgente) then
|
|
|
|
|
begin
|
|
|
|
|
FAgente.Open;
|
|
|
|
|
edtAgente.Text := FAgente.NOMBRE;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
AAgente := NIL;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFiltroAgentes.CustomViewCreate(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
FAgente := NIL;
|
|
|
|
|
FAgentesController := NIL;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFiltroAgentes.CustomViewDestroy(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
inherited;
|
|
|
|
|
FAgente := NIL;
|
|
|
|
|
FAgentesController := NIL;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFiltroAgentes.rbTodosAgentesClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if rbTodosAgentes.Checked then
|
|
|
|
|
begin
|
|
|
|
|
cbxDesglosado.Enabled := True;
|
|
|
|
|
FAgente := NIL;
|
|
|
|
|
bElegirAgente.Enabled := False;
|
|
|
|
|
edtAgente.Clear;
|
|
|
|
|
edtAgente.Enabled := False;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFiltroAgentes.rbUnAgenteClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if rbUnAgente.Checked then
|
|
|
|
|
begin
|
|
|
|
|
cbxDesglosado.Enabled := False;
|
|
|
|
|
bElegirAgente.Enabled := True;
|
|
|
|
|
edtAgente.Enabled := True;
|
|
|
|
|
if not Assigned(FAgentesController) then
|
|
|
|
|
FAgentesController := TAgentesController.Create;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|