Se adapta para poder elegir la empresa nada mas arrancar la aplicación, ademas de poder cambiar de emrpesa en los menus superiores

git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@375 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
David Arranz 2008-12-19 17:13:36 +00:00
parent 548d88424c
commit 8c427f8792
3 changed files with 59 additions and 5 deletions

View File

@ -46,6 +46,7 @@ type
function GetAppSplashForm : IAppSplashForm;
procedure SetAppSplashForm (AAppSplashForm : IAppSplashForm);
procedure SeleccionarEmpresa;
procedure CambiarEmpresa(const AIDEmpresa : Integer);
procedure CambiarEmpresaPorDefecto;
procedure CambiarEjercicio(const AIDEmpresa : Integer);
@ -138,6 +139,7 @@ type
procedure Configurar;
procedure SeleccionarEmpresa;
procedure CambiarEmpresa(const AIDEmpresa : Integer);
procedure CambiarEmpresaPorDefecto;
procedure CambiarEjercicio(const AIDEmpresa : Integer);
@ -168,7 +170,7 @@ var
implementation
uses
Dialogs, uDialogUtils, cxControls, uUsuariosViewRegister, uDMBase,
Windows, Dialogs, JSDialog, JSDialogs, uDialogUtils, cxControls, uUsuariosViewRegister, uDMBase,
uEmpresasViewRegister, uEjerciciosController, uAppInfoUtils;
procedure TAppFactuGES.CambiarEjercicio(const AIDEmpresa: Integer);
@ -429,6 +431,49 @@ begin
FDoMainFormEvent := AMainFormEvent;
end;
procedure TAppFactuGES.SeleccionarEmpresa;
var
JsDialog: TJSDialog;
AEmpresas: IBizEmpresa;
AEmpresasController: IEmpresasController;
begin
JsDialog := TJSDialog.Create(nil);
try
JsDialog.Content.Add('Selección de empresa');
JsDialog.Instruction.Text := 'Elija la empresa con la que desea trabajar.';
JsDialog.DialogOptions := [doCommandLinks, doModal];
JsDialog.ButtonBar.Buttons := [cbOk];
JsDialog.Width := 600;
//Añadimos las diferentes empresas que existan
AEmpresasController := TEmpresasController.Create;
AEmpresas := AEmpresasController.BuscarTodos;
AEmpresas.DataTable.Active := True;
AEmpresas.Datatable.First;
while not AEmpresas.Datatable.eof do
begin
with JsDialog.CustomButtons.Add do
begin
Caption := AEmpresas.NIF_CIF + ' - ' + AEmpresas.NOMBRE;
Value := AEmpresas.ID;
end;
AEmpresas.DataTable.Next;
end;
AEmpresas.DataTable.First;
if JsDialog.Execute <> IDCANCEL then
if JsDialog.CustomButtonResult > 0 then
CambiarEmpresa(JsDialog.CustomButtonResult);
finally
FreeAndNIL(JsDialog);
AEmpresasController:= NIL;
AEmpresas := NIL;
end;
end;
procedure TAppFactuGES.SetAppSplashForm(AAppSplashForm: IAppSplashForm);
begin
FAppSplashForm := AAppSplashForm;

View File

@ -310,7 +310,6 @@ object fPantallaPrincipal: TfPantallaPrincipal
Category = 'Menus'
Caption = 'Empresa'
OnExecute = actMenuEmpresaExecute
OnUpdate = actMenuComprasUpdate
end
object actMenuInformes: TAction
Category = 'Menus'
@ -644,8 +643,8 @@ object fPantallaPrincipal: TfPantallaPrincipal
Tag = 1000
Action = actMenuEmpresa
object Listadeempresas1_OLD: TMenuItem
Caption = 'Lista de empresas'
Visible = False
Caption = 'Selecci'#243'n de empresas'
OnClick = Listadeempresas1_OLDClick
end
object N1_OLD: TMenuItem
Caption = '-'

View File

@ -123,6 +123,7 @@ type
procedure actMenuContabilidadExecute(Sender: TObject);
procedure actMenuEmpresaExecute(Sender: TObject);
procedure actMenuInformesExecute(Sender: TObject);
procedure Listadeempresas1_OLDClick(Sender: TObject);
private
FContenido : TCustomEditor;
procedure ShowEmbedded(AEditor : ICustomEditor);
@ -198,6 +199,9 @@ begin
ClientWidth := Screen.Width ;
ClientHeight := Screen.Height;
Refresh;
//Sacamos la lista de empresas para que el usuario elija con la que va a trabajar
AppFactuGES.SeleccionarEmpresa;
end;
procedure TfPantallaPrincipal.RefrescarUI;
@ -314,7 +318,8 @@ end;
procedure TfPantallaPrincipal.Informacindeempresa1Click(Sender: TObject);
begin
AppFactuGES.EmpresasController.Ver(AppFactuGES.EmpresaActiva);
if Assigned(AppFactuGES.EmpresaActiva) then
AppFactuGES.EmpresasController.Ver(AppFactuGES.EmpresaActiva);
end;
procedure TfPantallaPrincipal.InicializarUI;
@ -597,6 +602,11 @@ begin
RefrescarUI;
end;
procedure TfPantallaPrincipal.Listadeempresas1_OLDClick(Sender: TObject);
begin
AppFactuGES.SeleccionarEmpresa;
end;
procedure TfPantallaPrincipal.actConexionExecute(Sender: TObject);
begin
dmConexion.ConfigurarConexion;