This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Noviseda_FactuGES2/Source/Modulos/Recibos de cliente/Views/uEditorElegirRecibosCliente.pas

211 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 uEditorElegirRecibosCliente;
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, SpTBXItem,
TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls, JvExControls, JvComponent,
JvNavigationPane, uViewBarraSeleccion, StdCtrls,
uViewRecibosCliente, uEditorRecibosCliente, uBizRecibosCliente, uIEditorElegirRecibosCliente,
Buttons, cxRadioGroup, cxMaskEdit, cxDropDownEdit, cxCalendar, cxControls,
cxContainer, cxEdit, cxTextEdit, SpTBXDkPanels, JSDialog,
uDAInterfaces, cxGraphics, cxLookAndFeels, cxLookAndFeelPainters, TntStdCtrls,
SpTBXEditors, cxSpinEdit;
type
TfEditorElegirRecibosCliente = class(TfEditorRecibosCliente, IEditorElegirRecibosCliente)
frViewBarraSeleccion1: TfrViewBarraSeleccion;
lblTitle: TLabel;
lblComments: TLabel;
EditorSeleccionActionList: TActionList;
actBuscar2: TAction;
actQuitarFiltro2: TAction;
actAnchoAuto2: TAction;
pnlFiltrar: TPanel;
Label1: TLabel;
txtFiltroTodo: TcxTextEdit;
edtFechaFiltro1: TcxDateEdit;
edtFechaFiltro2: TcxDateEdit;
Button1: TBitBtn;
pnlHeader: TPanel;
edtImporteFiltro1: TcxSpinEdit;
edtImporteFiltro2: TcxSpinEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
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 OnParametrosFiltroChange(Sender: TObject);
protected
procedure SetMultiSelect (AValue : Boolean);
function GetMultiSelect : Boolean;
function GetRecibosClienteSeleccionados: IBizRecibosCliente;
procedure SetViewGrid(const Value: IViewGridBase); override;
procedure SetMensaje (const AValue: String);
function GetMensaje: String;
public
property Mensaje : String read GetMensaje write SetMensaje;
property RecibosClienteSeleccionados: IBizRecibosCliente read GetRecibosClienteSeleccionados;
property MultiSelect : Boolean read GetMultiSelect write SetMultiSelect;
end;
implementation
uses
uEditorGridBase, cxGridCustomTableView, uIntegerListUtils, uDBSelectionListUtils,
uGridStatusUtils, uDialogUtils, uEditorBase, uRecibosClienteController;
{$R *.dfm}
{ TfEditorElegirRecibosCliente }
procedure TfEditorElegirRecibosCliente.actAnchoAuto2Execute(Sender: TObject);
begin
inherited;
actAnchoAuto.Execute;
end;
procedure TfEditorElegirRecibosCliente.actQuitarFiltro2Execute(Sender: TObject);
begin
// inherited;
if Assigned(ViewGrid) then
begin
txtFiltroTodo.Clear;
edtFechaFiltro1.Clear;
edtFechaFiltro2.Clear;
edtImporteFiltro1.Clear;
edtImporteFiltro2.Clear;
// (ViewGrid as IViewRecibosCliente).FiltrarPorFechas(null, null);
inherited;
end;
// actQuitarFiltro.Execute;
end;
procedure TfEditorElegirRecibosCliente.FormShow(Sender: TObject);
begin
inherited;
EditorActionList.State := asSuspended;
frViewRecibosCliente1.cxViewGridPopupMenu.PopupMenus.Items[0].HitTypes := [];
end;
procedure TfEditorElegirRecibosCliente.frViewBarraSeleccion1actCancelarExecute(
Sender: TObject);
begin
inherited;
Close;
end;
procedure TfEditorElegirRecibosCliente.frViewBarraSeleccion1actSeleccionarExecute(
Sender: TObject);
begin
inherited;
ModalResult := mrOk;
end;
procedure TfEditorElegirRecibosCliente.frViewBarraSeleccion1actSeleccionarUpdate(
Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled := (ViewGrid._FocusedView.Controller.SelectedRowCount > 0)
end;
function TfEditorElegirRecibosCliente.GetRecibosClienteSeleccionados: IBizRecibosCliente;
begin
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (RecibosCliente as ISeleccionable).SelectedRecords);
// En SelectedRecords tengo los ID de las filas seleccionadas del grid
Result := (Controller as IRecibosClienteController).ExtraerSeleccionados(RecibosCliente) as IBizRecibosCliente;
end;
function TfEditorElegirRecibosCliente.GetMensaje: String;
begin
Result := lblComments.Caption;
end;
function TfEditorElegirRecibosCliente.GetMultiSelect: Boolean;
begin
Result := ViewGrid.MultiSelect;
end;
procedure TfEditorElegirRecibosCliente.SetMensaje(const AValue: String);
begin
lblComments.Caption := AValue;
end;
procedure TfEditorElegirRecibosCliente.SetMultiSelect(AValue: Boolean);
begin
ViewGrid.MultiSelect := AValue;
end;
procedure TfEditorElegirRecibosCliente.SetViewGrid(const Value: IViewGridBase);
begin
inherited;
ViewGrid.OnDblClick := frViewBarraSeleccion1.actSeleccionar.OnExecute;
end;
procedure TfEditorElegirRecibosCliente.OnParametrosFiltroChange(Sender: TObject);
begin
if Assigned(ViewGrid) then
ViewGrid.Filter := txtFiltroTodo.Text;
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 IViewRecibosCliente).FiltrarPorFechas(edtFechaFiltro1.EditValue, edtFechaFiltro2.EditValue);
end;
if (edtImporteFiltro1.EditValue <> 0) and (edtImporteFiltro2.EditValue <> 0) then
begin
if (edtImporteFiltro1.EditValue > edtImporteFiltro2.EditValue) then
begin
ShowWarningMessage('El importe de inicial debe ser menor que el importe final');
edtImporteFiltro1.SetFocus;
end
else
(ViewGrid as IViewRecibosCliente).FiltrarPorImportes(edtImporteFiltro1.EditValue, edtImporteFiltro2.EditValue);
end;
end;
end.