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:
parent
548d88424c
commit
8c427f8792
@ -46,6 +46,7 @@ type
|
|||||||
function GetAppSplashForm : IAppSplashForm;
|
function GetAppSplashForm : IAppSplashForm;
|
||||||
procedure SetAppSplashForm (AAppSplashForm : IAppSplashForm);
|
procedure SetAppSplashForm (AAppSplashForm : IAppSplashForm);
|
||||||
|
|
||||||
|
procedure SeleccionarEmpresa;
|
||||||
procedure CambiarEmpresa(const AIDEmpresa : Integer);
|
procedure CambiarEmpresa(const AIDEmpresa : Integer);
|
||||||
procedure CambiarEmpresaPorDefecto;
|
procedure CambiarEmpresaPorDefecto;
|
||||||
procedure CambiarEjercicio(const AIDEmpresa : Integer);
|
procedure CambiarEjercicio(const AIDEmpresa : Integer);
|
||||||
@ -138,6 +139,7 @@ type
|
|||||||
|
|
||||||
procedure Configurar;
|
procedure Configurar;
|
||||||
|
|
||||||
|
procedure SeleccionarEmpresa;
|
||||||
procedure CambiarEmpresa(const AIDEmpresa : Integer);
|
procedure CambiarEmpresa(const AIDEmpresa : Integer);
|
||||||
procedure CambiarEmpresaPorDefecto;
|
procedure CambiarEmpresaPorDefecto;
|
||||||
procedure CambiarEjercicio(const AIDEmpresa : Integer);
|
procedure CambiarEjercicio(const AIDEmpresa : Integer);
|
||||||
@ -168,7 +170,7 @@ var
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Dialogs, uDialogUtils, cxControls, uUsuariosViewRegister, uDMBase,
|
Windows, Dialogs, JSDialog, JSDialogs, uDialogUtils, cxControls, uUsuariosViewRegister, uDMBase,
|
||||||
uEmpresasViewRegister, uEjerciciosController, uAppInfoUtils;
|
uEmpresasViewRegister, uEjerciciosController, uAppInfoUtils;
|
||||||
|
|
||||||
procedure TAppFactuGES.CambiarEjercicio(const AIDEmpresa: Integer);
|
procedure TAppFactuGES.CambiarEjercicio(const AIDEmpresa: Integer);
|
||||||
@ -429,6 +431,49 @@ begin
|
|||||||
FDoMainFormEvent := AMainFormEvent;
|
FDoMainFormEvent := AMainFormEvent;
|
||||||
end;
|
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);
|
procedure TAppFactuGES.SetAppSplashForm(AAppSplashForm: IAppSplashForm);
|
||||||
begin
|
begin
|
||||||
FAppSplashForm := AAppSplashForm;
|
FAppSplashForm := AAppSplashForm;
|
||||||
|
|||||||
@ -310,7 +310,6 @@ object fPantallaPrincipal: TfPantallaPrincipal
|
|||||||
Category = 'Menus'
|
Category = 'Menus'
|
||||||
Caption = 'Empresa'
|
Caption = 'Empresa'
|
||||||
OnExecute = actMenuEmpresaExecute
|
OnExecute = actMenuEmpresaExecute
|
||||||
OnUpdate = actMenuComprasUpdate
|
|
||||||
end
|
end
|
||||||
object actMenuInformes: TAction
|
object actMenuInformes: TAction
|
||||||
Category = 'Menus'
|
Category = 'Menus'
|
||||||
@ -644,8 +643,8 @@ object fPantallaPrincipal: TfPantallaPrincipal
|
|||||||
Tag = 1000
|
Tag = 1000
|
||||||
Action = actMenuEmpresa
|
Action = actMenuEmpresa
|
||||||
object Listadeempresas1_OLD: TMenuItem
|
object Listadeempresas1_OLD: TMenuItem
|
||||||
Caption = 'Lista de empresas'
|
Caption = 'Selecci'#243'n de empresas'
|
||||||
Visible = False
|
OnClick = Listadeempresas1_OLDClick
|
||||||
end
|
end
|
||||||
object N1_OLD: TMenuItem
|
object N1_OLD: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
|
|||||||
@ -123,6 +123,7 @@ type
|
|||||||
procedure actMenuContabilidadExecute(Sender: TObject);
|
procedure actMenuContabilidadExecute(Sender: TObject);
|
||||||
procedure actMenuEmpresaExecute(Sender: TObject);
|
procedure actMenuEmpresaExecute(Sender: TObject);
|
||||||
procedure actMenuInformesExecute(Sender: TObject);
|
procedure actMenuInformesExecute(Sender: TObject);
|
||||||
|
procedure Listadeempresas1_OLDClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
FContenido : TCustomEditor;
|
FContenido : TCustomEditor;
|
||||||
procedure ShowEmbedded(AEditor : ICustomEditor);
|
procedure ShowEmbedded(AEditor : ICustomEditor);
|
||||||
@ -198,6 +199,9 @@ begin
|
|||||||
ClientWidth := Screen.Width ;
|
ClientWidth := Screen.Width ;
|
||||||
ClientHeight := Screen.Height;
|
ClientHeight := Screen.Height;
|
||||||
Refresh;
|
Refresh;
|
||||||
|
|
||||||
|
//Sacamos la lista de empresas para que el usuario elija con la que va a trabajar
|
||||||
|
AppFactuGES.SeleccionarEmpresa;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfPantallaPrincipal.RefrescarUI;
|
procedure TfPantallaPrincipal.RefrescarUI;
|
||||||
@ -314,7 +318,8 @@ end;
|
|||||||
|
|
||||||
procedure TfPantallaPrincipal.Informacindeempresa1Click(Sender: TObject);
|
procedure TfPantallaPrincipal.Informacindeempresa1Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
AppFactuGES.EmpresasController.Ver(AppFactuGES.EmpresaActiva);
|
if Assigned(AppFactuGES.EmpresaActiva) then
|
||||||
|
AppFactuGES.EmpresasController.Ver(AppFactuGES.EmpresaActiva);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfPantallaPrincipal.InicializarUI;
|
procedure TfPantallaPrincipal.InicializarUI;
|
||||||
@ -597,6 +602,11 @@ begin
|
|||||||
RefrescarUI;
|
RefrescarUI;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfPantallaPrincipal.Listadeempresas1_OLDClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
AppFactuGES.SeleccionarEmpresa;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfPantallaPrincipal.actConexionExecute(Sender: TObject);
|
procedure TfPantallaPrincipal.actConexionExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
dmConexion.ConfigurarConexion;
|
dmConexion.ConfigurarConexion;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user