This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
AlonsoYSal_FactuGES/Modulos/Pagos/Cliente/uEditorPagos.pas
2007-06-21 16:02:50 +00:00

109 lines
2.9 KiB
ObjectPascal

unit uEditorPagos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uEditorBase, uEditorGrid, ToolWin, ComCtrls, JvExControls, JvComponent,
JvNavigationPane, uViewPagos, uBizPagos, ActnList, DBActns, uViewGrid,
Menus, uDataModuleBase, ImgList, PngImageList, TB2Dock, TB2Toolbar, TBX,
TB2Item, StdActns, TB2ExtItems, TBXExtItems, TB2MRU, DB, uDADataTable,
JvFormAutoSize, uDAScriptingProvider, uDACDSDataTable, JvAppStorage,
JvAppRegistryStorage, JvFormPlacement, ExtCtrls, uCustomView, uViewBase,
uViewBarraSeleccion, pngimage, JvComponentBase;
type
IEditorPagos = interface(IEditorGrid)
['{0BCA3B66-90C6-4BD6-8436-EC80462E9A9B}']
function GetPagos: IBizPagos;
procedure SetPagos(const Value: IBizPagos);
property Pagos: IBizPagos read GetPagos write SetPagos;
end;
TfEditorPagos = class(TfEditorGrid, IEditorPagos)
procedure FormShow(Sender: TObject);
procedure actNuevoExecute(Sender: TObject);
procedure actModificarExecute(Sender: TObject);
private
FPagos: IBizPagos;
protected
function GetPagos: IBizPagos; virtual;
procedure SetPagos(const Value: IBizPagos); virtual;
procedure SetViewGrid(const Value: IViewGrid); override;
public
property Pagos: IBizPagos read GetPagos write SetPagos;
destructor Destroy; override;
end;
implementation
uses
uCustomEditor, uDataModulePagos, uEditorDBBase, uEditorUtils,
cxGrid, cxGridCustomTableView, uDBSelectionList;
//, uListaPagos;
// uEditorAlmacen;
{$R *.dfm}
{
****************************** TfEditorPagos *******************************
}
procedure TfEditorPagos.FormShow(Sender: TObject);
begin
inherited;
if not Assigned(ViewGrid) then
raise Exception.Create('No hay ninguna vista asignada');
if not Assigned(Pagos) then
raise Exception.Create('No hay ningún Pago asignado');
Pagos.DataTable.Active := True;
end;
function TfEditorPagos.GetPagos: IBizPagos;
begin
Result := FPagos;
end;
procedure TfEditorPagos.SetPagos(const Value: IBizPagos);
begin
FPagos := Value;
dsDataTable.DataTable := FPagos.DataTable;
if Assigned(ViewGrid) then
(ViewGrid as IViewPagos).Pagos := Pagos;
end;
procedure TfEditorPagos.actNuevoExecute(Sender: TObject);
begin
inherited;
Pagos.Insert;
Pagos.Show;
ViewGrid.RefreshGrid;
ViewGrid.SyncFocusedRecordsFromDataSet;
end;
procedure TfEditorPagos.actModificarExecute(Sender: TObject);
begin
inherited;
Pagos.Show;
ViewGrid.RefreshGrid;
ViewGrid.SyncFocusedRecordsFromDataSet;
end;
procedure TfEditorPagos.SetViewGrid(const Value: IViewGrid);
begin
inherited;
if Assigned(ViewGrid) and Assigned(Pagos) then
(ViewGrid as IViewPagos).Pagos := Pagos;
end;
destructor TfEditorPagos.Destroy;
begin
FPagos := NIL;
inherited;
end;
end.