FactuGES2/Source/Modulos/Contabilidad/Views/uEditorSubCuentas.pas

157 lines
4.4 KiB
ObjectPascal
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit uEditorSubCuentas;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uEditorBase, ToolWin, ComCtrls, JvExControls, JvComponent,
JvNavigationPane, uViewSubCuentas, uBizSubCuentas, 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, uIEditorSubCuentas, uEditorGridBase,
JvComponentBase, uViewGridBase, uSubCuentasController, JvExComCtrls,
JvStatusBar, uDAInterfaces, uViewEpigrafes, dxGDIPlusClasses;
type
TfEditorSubCuentas = class(TfEditorGridBase, IEditorSubCuentas)
frViewSubCuentas1: TfrViewSubCuentas;
procedure FormShow(Sender: TObject);
private
FSubCuentas: IBizSubCuenta;
FController : ISubCuentasController;
protected
function GetSubCuentas: IBizSubCuenta;
procedure SetSubCuentas(const Value: IBizSubCuenta);
function GetController : ISubCuentasController; virtual;
procedure SetController (const Value : ISubCuentasController); virtual;
procedure NuevoInterno; override;
procedure EliminarInterno; override;
procedure ModificarInterno; override;
procedure DuplicarInterno; override;
public
procedure PonerTitulos(const ATitulo: string = ''); override;
property SubCuentas: IBizSubCuenta read GetSubCuentas write SetSubCuentas;
property Controller : ISubCuentasController read GetController write SetController;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
implementation
uses
uCustomEditor, uDataModuleUsuarios,
// uEditorEpigrafe,
uEditorDBBase, uFactuGES_App,
cxGrid, cxGridCustomTableView; //, uListaSubCuentas;
{$R *.dfm}
{
****************************** TfEditorSubCuentas *******************************
}
procedure TfEditorSubCuentas.FormShow(Sender: TObject);
begin
inherited;
if not Assigned(ViewGrid) then
raise Exception.Create('No hay ninguna vista asignada');
if not Assigned(SubCuentas) then
raise Exception.Create('No hay ningún Epigrafe asignado');
SubCuentas.DataTable.Active := True;
ViewGrid.GotoFirst;
end;
function TfEditorSubCuentas.GetSubCuentas: IBizSubCuenta;
begin
Result := FSubCuentas;
end;
function TfEditorSubCuentas.GetController: ISubCuentasController;
begin
Result := FController;
end;
procedure TfEditorSubCuentas.ModificarInterno;
begin
inherited;
FController.Ver(SubCuentas);
end;
procedure TfEditorSubCuentas.NuevoInterno;
begin
inherited;
FController.Anadir(SubCuentas);
FController.Ver(SubCuentas);
end;
procedure TfEditorSubCuentas.PonerTitulos(const ATitulo: string);
var
FTitulo : String;
begin
FTitulo := 'Lista de SubCuentas - ' + AppFactuGES.EmpresaActiva.NOMBRE + ' - ' + AppFactuGES.EjercicioActivo.NOMBRE;
inherited PonerTitulos(FTitulo);
end;
procedure TfEditorSubCuentas.SetSubCuentas(const Value: IBizSubCuenta);
begin
FSubCuentas := Value;
dsDataTable.DataTable := FSubCuentas.DataTable;
if Assigned(ViewGrid) then
(ViewGrid as IViewSubCuentas).SubCuentas := SubCuentas;
end;
procedure TfEditorSubCuentas.SetController(const Value: ISubCuentasController);
begin
FController := Value;
end;
destructor TfEditorSubCuentas.Destroy;
begin
FSubCuentas := NIL;
inherited;
end;
procedure TfEditorSubCuentas.DuplicarInterno;
var
AEpigrafe : IBizSubCuenta;
begin
AppFactuGES.ShowCapado;
{
inherited;
AEpigrafe := FController.Duplicar(SubCuentas);
try
FController.Ver(AEpigrafe);
finally
actRefrescar.Execute;
end;
}
end;
procedure TfEditorSubCuentas.EliminarInterno;
begin
if (Application.MessageBox('¿Desea borrar esta subcuenta?', 'Atención', MB_YESNO) = IDYES) then
begin
inherited;
//Para que en el caso de no poderse realizar la operación se refresquen
//los datos y no nos permita eliminar un registro a la segunda
if not FController.Eliminar(SubCuentas) then
actRefrescar.Execute;
end;
end;
constructor TfEditorSubCuentas.Create(AOwner: TComponent);
begin
inherited;
ViewGrid := frViewSubCuentas1; //CreateView(TfrViewSubCuentas) as IViewSubCuentas;
end;
end.