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/Facturas de proveedor/Cliente/uEditorFacturasProveedor.pas
2007-06-21 16:02:50 +00:00

147 lines
4.4 KiB
ObjectPascal
Raw Blame History

unit uEditorFacturasProveedor;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uEditorGrid, Menus, DB, uDADataTable, JvAppStorage,
JvAppRegistryStorage, JvComponent, JvFormPlacement, ImgList,
PngImageList, StdActns, ActnList, ComCtrls, TB2ExtItems, TBXExtItems,
TBX, TB2Item, TB2Dock, TB2Toolbar, ExtCtrls, JvExControls,
JvNavigationPane, uViewGrid, pngimage, uBizFacturasProveedor,
JvComponentBase;
type
IEditorFacturasProveedor = interface(IEditorGrid)
['{B055B7F3-5A99-4BAC-8D70-A954A6BC288D}']
function GetFacturasProveedor: IBizFacturasProveedor;
procedure SetFacturasProveedor(const Value: IBizFacturasProveedor);
property FacturasProveedor: IBizFacturasProveedor read GetFacturasProveedor
write SetFacturasProveedor;
end;
TfEditorFacturasProveedor = class(TfEditorGrid, IEditorFacturasProveedor)
procedure actEliminarExecute(Sender: TObject);
procedure actModificarExecute(Sender: TObject);
procedure actNuevoExecute(Sender: TObject);
private
FFacturasProveedor: IBizFacturasProveedor;
protected
function GetFacturasProveedor: IBizFacturasProveedor;
procedure SetFacturasProveedor(const Value: IBizFacturasProveedor);
procedure SetViewGrid(const Value: IViewGrid); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property FacturasProveedor: IBizFacturasProveedor read GetFacturasProveedor
write SetFacturasProveedor;
end;
var
fEditorFacturasProveedor: TfEditorFacturasProveedor;
implementation
uses
uDataModuleFacturasProveedor, uViewFacturasProveedor,
uEditorUtils;
{$R *.dfm}
function ShowEditorFacturasProveedor (ABizObject : TDADataTableRules) : TModalResult;
var
AEditor: TfEditorFacturasProveedor;
begin
AEditor := TfEditorFacturasProveedor.Create(Application);
try
AEditor.FacturasProveedor := (ABizObject as IBizFacturasProveedor);
Result := AEditor.ShowModal;
finally
AEditor.Release;
end;
end;
function ShowSelectEditorFacturasProveedor (ABizObject : TDADataTableRules) : TModalResult;
var
AEditor: TfEditorFacturasProveedor;
begin
AEditor := TfEditorFacturasProveedor.Create(Application);
try
AEditor.FacturasProveedor := (ABizObject as IBizFacturasProveedor);
// AEditor.SelectionBarVisible := True;
Result := AEditor.ShowModal;
finally
AEditor.Release;
end;
end;
{
*************************** TfEditorFacturasProveedor ***************************
}
constructor TfEditorFacturasProveedor.Create(AOwner: TComponent);
begin
inherited;
ViewGrid := CreateView(TfrViewFacturasProveedor) as IViewFacturasProveedor;
end;
destructor TfEditorFacturasProveedor.Destroy;
begin
FFacturasProveedor := NIL;
inherited;
end;
procedure TfEditorFacturasProveedor.actEliminarExecute(Sender: TObject);
begin
if (Application.MessageBox('<27>Desea borrar esta factura de proveedor?', 'Atenci<63>n', MB_YESNO) = IDYES) then
begin
inherited;
ViewGrid.RefreshGrid;
end;
end;
procedure TfEditorFacturasProveedor.actModificarExecute(Sender: TObject);
begin
inherited;
FacturasProveedor.Show;
ViewGrid.RefreshGrid;
ViewGrid.SyncFocusedRecordsFromDataSet;
end;
procedure TfEditorFacturasProveedor.actNuevoExecute(Sender: TObject);
begin
inherited;
FacturasProveedor.Insert;
FacturasProveedor.Show;
ViewGrid.RefreshGrid;
ViewGrid.SyncFocusedRecordsFromDataSet;
end;
function TfEditorFacturasProveedor.GetFacturasProveedor: IBizFacturasProveedor;
begin
Result := FFacturasProveedor;
end;
procedure TfEditorFacturasProveedor.SetFacturasProveedor(const Value:
IBizFacturasProveedor);
begin
FFacturasProveedor := Value;
dsDataTable.DataTable := FFacturasProveedor.DataTable;
if Assigned(ViewGrid) then
(ViewGrid as IViewFacturasProveedor).FacturasProveedor := FacturasProveedor;
end;
procedure TfEditorFacturasProveedor.SetViewGrid(const Value: IViewGrid);
begin
inherited;
if Assigned(ViewGrid) and Assigned(FacturasProveedor) then
(ViewGrid as IViewFacturasProveedor).FacturasProveedor := FFacturasProveedor;
end;
initialization
RegisterEditor(IBizFacturasProveedor, ShowEditorFacturasProveedor, etItems);
RegisterEditor(IBizFacturasProveedor, ShowSelectEditorFacturasProveedor, etSelectItems);
finalization
end.