Tecsitel_FactuGES2/Source/Modulos/Recibos de proveedor/Views/uEditorElegirRecibosProveedor.pas
2009-07-09 11:21:22 +00:00

213 lines
7.2 KiB
ObjectPascal

{
===============================================================================
Copyright (©) 2007. Rodax Software.
===============================================================================
Los contenidos de este fichero son propiedad de Rodax Software titular del
copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado,
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
acuerdo con los términos y condiciones establecidas en el acuerdo/contrato
bajo el que se suministra.
-----------------------------------------------------------------------------
Web: www.rodax-software.com
===============================================================================
Fecha primera versión:
Versión actual: 1.0.0
Fecha versión actual:
===============================================================================
Modificaciones:
Fecha Comentarios
---------------------------------------------------------------------------
===============================================================================
}
unit uEditorElegirRecibosProveedor;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, uDADataTable, Menus, JvAppStorage, JvAppRegistryStorage,
JvComponentBase, JvFormPlacement, ImgList, PngImageList, StdActns,
ActnList, uCustomView, uViewBase, uViewGridBase, uViewGrid,
JvExComCtrls, JvStatusBar,
ComCtrls, TB2ExtItems, TBXExtItems, TBX,
TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls, JvExControls, JvComponent,
JvNavigationPane, uViewBarraSeleccion, StdCtrls,
uViewRecibosProveedor, uEditorRecibosProveedor, uBizRecibosProveedor, uIEditorElegirRecibosProveedor,
Buttons, cxRadioGroup, cxMaskEdit, cxDropDownEdit, cxCalendar, cxControls,
cxContainer, cxEdit, cxTextEdit, TBXDkPanels, JSDialog, uDAInterfaces;
type
TfEditorElegirRecibosProveedor = class(TfEditorRecibosProveedor, IEditorElegirRecibosProveedor)
frViewBarraSeleccion1: TfrViewBarraSeleccion;
lblTitle: TLabel;
lblComments: TLabel;
EditorSeleccionActionList: TActionList;
actBuscar2: TAction;
actQuitarFiltro2: TAction;
actAnchoAuto2: TAction;
pnlFiltrar: TTBXDockablePanel;
Label1: TLabel;
txtFiltroTodo: TcxTextEdit;
edtFechaFiltro1: TcxDateEdit;
edtFechaFiltro2: TcxDateEdit;
rbTodo: TcxRadioButton;
rbFechas: TcxRadioButton;
Button1: TBitBtn;
procedure frViewBarraSeleccion1actSeleccionarUpdate(Sender: TObject);
procedure frViewBarraSeleccion1actCancelarExecute(Sender: TObject);
procedure frViewBarraSeleccion1actSeleccionarExecute(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure actAnchoAuto2Execute(Sender: TObject);
procedure actQuitarFiltro2Execute(Sender: TObject);
procedure txtFiltroTodoPropertiesChange(Sender: TObject);
procedure edtFechaFiltro1PropertiesEditValueChanged(Sender: TObject);
procedure rbTodoClick(Sender: TObject);
protected
procedure SetMultiSelect (AValue : Boolean);
function GetMultiSelect : Boolean;
function GetRecibosProveedorSeleccionados: IBizRecibosProveedor;
procedure SetViewGrid(const Value: IViewGridBase); override;
procedure SetMensaje (const AValue: String);
function GetMensaje: String;
public
property Mensaje : String read GetMensaje write SetMensaje;
property RecibosProveedorSeleccionados: IBizRecibosProveedor read GetRecibosProveedorSeleccionados;
property MultiSelect : Boolean read GetMultiSelect write SetMultiSelect;
end;
implementation
uses
uEditorGridBase, cxGridCustomTableView, uIntegerListUtils, uDBSelectionListUtils,
uGridStatusUtils, uDialogUtils, uEditorBase, uRecibosProveedorController;
{$R *.dfm}
{ TfEditorElegirRecibosProveedor }
procedure TfEditorElegirRecibosProveedor.actAnchoAuto2Execute(Sender: TObject);
begin
inherited;
actAnchoAuto.Execute;
end;
procedure TfEditorElegirRecibosProveedor.actQuitarFiltro2Execute(Sender: TObject);
begin
// inherited;
if Assigned(ViewGrid) then
begin
txtFiltroTodo.Clear;
edtFechaFiltro1.Clear;
edtFechaFiltro2.Clear;
(ViewGrid as IViewRecibosProveedor).FiltrarPorFechas(null, null);
inherited;
end;
// actQuitarFiltro.Execute;
end;
procedure TfEditorElegirRecibosProveedor.edtFechaFiltro1PropertiesEditValueChanged(Sender: TObject);
begin
if not VarIsNull(edtFechaFiltro1.EditValue) and not VarIsNull(edtFechaFiltro2.EditValue) then
begin
if (edtFechaFiltro1.EditValue > edtFechaFiltro2.EditValue) then
begin
ShowWarningMessage('La fecha de inicio debe ser anterior a la fecha final');
edtFechaFiltro1.SetFocus;
end
else
(ViewGrid as IViewRecibosProveedor).FiltrarPorFechas(edtFechaFiltro1.EditValue, edtFechaFiltro2.EditValue);
end;
end;
procedure TfEditorElegirRecibosProveedor.FormShow(Sender: TObject);
begin
inherited;
EditorActionList.State := asSuspended;
frViewRecibosProveedor1.cxViewGridPopupMenu.PopupMenus.Items[0].HitTypes := [];
end;
procedure TfEditorElegirRecibosProveedor.frViewBarraSeleccion1actCancelarExecute(
Sender: TObject);
begin
inherited;
Close;
end;
procedure TfEditorElegirRecibosProveedor.frViewBarraSeleccion1actSeleccionarExecute(
Sender: TObject);
begin
inherited;
ModalResult := mrOk;
end;
procedure TfEditorElegirRecibosProveedor.frViewBarraSeleccion1actSeleccionarUpdate(
Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled := (ViewGrid._FocusedView.Controller.SelectedRowCount > 0)
end;
function TfEditorElegirRecibosProveedor.GetRecibosProveedorSeleccionados: IBizRecibosProveedor;
begin
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (RecibosProveedor as ISeleccionable).SelectedRecords);
// En SelectedRecords tengo los ID de las filas seleccionadas del grid
Result := (Controller as IRecibosProveedorController).ExtraerSeleccionados(RecibosProveedor) as IBizRecibosProveedor;
end;
procedure TfEditorElegirRecibosProveedor.rbTodoClick(Sender: TObject);
begin
actQuitarFiltro.Execute;
if rbTodo.Checked then
begin
edtFechaFiltro1.Enabled := False;
edtFechaFiltro2.Enabled := False;
txtFiltroTodo.Enabled := True;
end
else begin
edtFechaFiltro1.Enabled := True;
edtFechaFiltro2.Enabled := True;
txtFiltroTodo.Enabled := False;
end;
end;
function TfEditorElegirRecibosProveedor.GetMensaje: String;
begin
Result := lblComments.Caption;
end;
function TfEditorElegirRecibosProveedor.GetMultiSelect: Boolean;
begin
Result := ViewGrid.MultiSelect;
end;
procedure TfEditorElegirRecibosProveedor.SetMensaje(const AValue: String);
begin
lblComments.Caption := AValue;
end;
procedure TfEditorElegirRecibosProveedor.SetMultiSelect(AValue: Boolean);
begin
ViewGrid.MultiSelect := AValue;
end;
procedure TfEditorElegirRecibosProveedor.SetViewGrid(const Value: IViewGridBase);
begin
inherited;
ViewGrid.OnDblClick := frViewBarraSeleccion1.actSeleccionar.OnExecute;
end;
procedure TfEditorElegirRecibosProveedor.txtFiltroTodoPropertiesChange(Sender: TObject);
begin
if Assigned(ViewGrid) then
ViewGrid.Filter := txtFiltroTodo.Text;
end;
end.