2007-09-12 14:11:44 +00:00
|
|
|
|
unit uPantallaPrincipal;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2007-09-19 16:38:24 +00:00
|
|
|
|
Windows, Forms, SysUtils, Messages, JvMenus, Menus, Graphics, AppEvnts,
|
|
|
|
|
|
JvAppStorage, JvAppRegistryStorage, JvFormPlacement, JvComponentBase,
|
|
|
|
|
|
JvNavigationPane, ImgList, Controls, PngImageList, Classes, ActnList, XPMan,
|
|
|
|
|
|
TBXStatusBars, JvXPCore, JvXPContainer, pngimage, ExtCtrls, StdCtrls,
|
|
|
|
|
|
JvPageList, JvExControls, JvExExtCtrls, JvSplitter, JvSyncSplitter,
|
2007-10-08 07:58:40 +00:00
|
|
|
|
TBXDkPanels, uCustomEditor, uHostManager, uGUIBase,
|
2007-09-19 16:38:24 +00:00
|
|
|
|
Dialogs;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
|
2007-09-19 16:38:24 +00:00
|
|
|
|
type
|
2007-09-12 14:11:44 +00:00
|
|
|
|
IMainForm = interface(IHostForm)
|
2007-10-08 07:58:40 +00:00
|
|
|
|
['{7F6F5574-5E5C-486C-AA24-D3AEAA52D243}']
|
2007-09-12 14:11:44 +00:00
|
|
|
|
procedure ReleaseEmbedded;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TfPantallaPrincipal = class(TForm, IHostForm, IMainForm)
|
|
|
|
|
|
GeneralActionList: TActionList;
|
|
|
|
|
|
ModulesSmallImageList: TPngImageList;
|
|
|
|
|
|
XPManifest1: TXPManifest;
|
|
|
|
|
|
actSalir: TAction;
|
|
|
|
|
|
ModulesActionList: TActionList;
|
|
|
|
|
|
ModulesLargeImageList: TPngImageList;
|
|
|
|
|
|
pnlContenido: TTBXAlignmentPanel;
|
|
|
|
|
|
JvNavigationPane: TJvNavigationPane;
|
|
|
|
|
|
pnlMain: TTBXAlignmentPanel;
|
|
|
|
|
|
JvSyncSplitter1: TJvSyncSplitter;
|
|
|
|
|
|
HostManager: THostManager;
|
|
|
|
|
|
actLogin: TAction;
|
|
|
|
|
|
StyleManagerButtons: TJvNavPaneStyleManager;
|
|
|
|
|
|
JvFormStorage: TJvFormStorage;
|
|
|
|
|
|
JvAppRegistryStorage: TJvAppRegistryStorage;
|
|
|
|
|
|
actAdministracion: TAction;
|
|
|
|
|
|
ApplicationEvents: TApplicationEvents;
|
|
|
|
|
|
actCambiarPass: TAction;
|
|
|
|
|
|
actConexion: TAction;
|
|
|
|
|
|
actAcerca: TAction;
|
|
|
|
|
|
pnlBorde: TJvXPContainer;
|
|
|
|
|
|
HostMenu: TJvMainMenu;
|
|
|
|
|
|
JvXPMenuItemPainter1: TJvXPMenuItemPainter;
|
|
|
|
|
|
Archivo2_OLD: TMenuItem;
|
|
|
|
|
|
Ayuda2_OLD: TMenuItem;
|
|
|
|
|
|
Cambiarmicontrasea2_OLD: TMenuItem;
|
|
|
|
|
|
N3_OLD: TMenuItem;
|
|
|
|
|
|
Configurarconexin2_OLD: TMenuItem;
|
|
|
|
|
|
Paneldeadministracin2_OLD: TMenuItem;
|
|
|
|
|
|
N4_OLD: TMenuItem;
|
|
|
|
|
|
Salir2_OLD: TMenuItem;
|
|
|
|
|
|
Acercade2_OLD: TMenuItem;
|
|
|
|
|
|
lblBienvenido: TLabel;
|
|
|
|
|
|
Label22: TLabel;
|
|
|
|
|
|
TBXStatusBar1: TTBXStatusBar;
|
|
|
|
|
|
StatusPanelImageList: TPngImageList;
|
|
|
|
|
|
Empresa1_OLD: TMenuItem;
|
|
|
|
|
|
Listadeempresas1_OLD: TMenuItem;
|
|
|
|
|
|
N1_OLD: TMenuItem;
|
|
|
|
|
|
Opciones1_OLD: TMenuItem;
|
|
|
|
|
|
Edicin1_OLD: TMenuItem;
|
|
|
|
|
|
N1: TMenuItem;
|
|
|
|
|
|
Compras1: TMenuItem;
|
|
|
|
|
|
Ventas1: TMenuItem;
|
|
|
|
|
|
actMenuCompras: TAction;
|
|
|
|
|
|
actLogisticaMenu: TAction;
|
|
|
|
|
|
actVentasMenu: TAction;
|
|
|
|
|
|
Logstica1: TMenuItem;
|
|
|
|
|
|
pagInicio: TJvNavPanelPage;
|
|
|
|
|
|
Panel1: TPanel;
|
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
|
Image1: TImage;
|
|
|
|
|
|
actActualizaciones: TAction;
|
|
|
|
|
|
Configuraractualizaciones1: TMenuItem;
|
|
|
|
|
|
actVerPanel: TAction;
|
|
|
|
|
|
actVerBarraEstado: TAction;
|
|
|
|
|
|
Paneldeexploracin1: TMenuItem;
|
|
|
|
|
|
Paneldeexploracin2: TMenuItem;
|
2007-10-09 07:47:51 +00:00
|
|
|
|
Informacindeempresa1: TMenuItem;
|
|
|
|
|
|
Administracin1: TMenuItem;
|
|
|
|
|
|
N2: TMenuItem;
|
|
|
|
|
|
Usuarios1: TMenuItem;
|
|
|
|
|
|
Perfiles1: TMenuItem;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
|
|
procedure FormDestroy(Sender: TObject);
|
|
|
|
|
|
procedure HostManagerAfterLoad(Sender: TObject; AModuleInfo: TModuleInfo);
|
|
|
|
|
|
procedure Salir1Click(Sender: TObject);
|
|
|
|
|
|
procedure actSalirExecute(Sender: TObject);
|
|
|
|
|
|
procedure actLoginExecute(Sender: TObject);
|
|
|
|
|
|
procedure actCambiarPassExecute(Sender: TObject);
|
|
|
|
|
|
procedure actAcercaExecute(Sender: TObject);
|
|
|
|
|
|
procedure actConexionExecute(Sender: TObject);
|
|
|
|
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
|
|
|
|
procedure JvNavigationPaneChange(Sender: TObject);
|
|
|
|
|
|
procedure ApplicationEventsException(Sender: TObject; E: Exception);
|
|
|
|
|
|
procedure actMenuComprasExecute(Sender: TObject);
|
|
|
|
|
|
procedure actMenuComprasUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actLogisticaMenuExecute(Sender: TObject);
|
|
|
|
|
|
procedure actVentasMenuExecute(Sender: TObject);
|
|
|
|
|
|
procedure actActualizacionesExecute(Sender: TObject);
|
|
|
|
|
|
procedure actVerPanelUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actVerPanelExecute(Sender: TObject);
|
|
|
|
|
|
procedure actVerBarraEstadoUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actVerBarraEstadoExecute(Sender: TObject);
|
2007-10-08 07:58:40 +00:00
|
|
|
|
procedure Acercade1Click(Sender: TObject);
|
2007-10-09 07:47:51 +00:00
|
|
|
|
procedure Informacindeempresa1Click(Sender: TObject);
|
|
|
|
|
|
procedure Usuarios1Click(Sender: TObject);
|
|
|
|
|
|
procedure Perfiles1Click(Sender: TObject);
|
2007-09-12 14:11:44 +00:00
|
|
|
|
private
|
|
|
|
|
|
FContenido : TCustomEditor;
|
|
|
|
|
|
procedure ShowEmbedded(AEditor : ICustomEditor);
|
|
|
|
|
|
procedure ReleaseEmbedded;
|
|
|
|
|
|
procedure AplicarPerfil;
|
|
|
|
|
|
procedure RefrescarUI;
|
|
|
|
|
|
procedure InicializarUI;
|
|
|
|
|
|
procedure CargarModulos;
|
|
|
|
|
|
procedure OnThemeChange(Sender: TObject);
|
|
|
|
|
|
procedure RegisterModule(AModuleInfo : TModuleInfo);
|
|
|
|
|
|
procedure ExecuteActionMenu(Sender : TObject);
|
2007-10-03 10:27:58 +00:00
|
|
|
|
procedure WMSysCommand(var Msg: TMessage); message WM_SYSCOMMAND;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
protected
|
|
|
|
|
|
function GetWorkPanel : TWinControl;
|
2007-10-03 10:27:58 +00:00
|
|
|
|
procedure CreateParams(var Params: TCreateParams); override;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
public
|
|
|
|
|
|
function IsShortcut(var Message: TWMKey): Boolean; override;
|
|
|
|
|
|
procedure OnWorkPanelChanged(AEditor : ICustomEditor);
|
|
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
|
|
property WorkPanel : TWinControl read GetWorkPanel;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
fPantallaPrincipal: TfPantallaPrincipal;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2007-10-09 07:47:51 +00:00
|
|
|
|
uSplash, uAcercaDe, UxTheme, Themes, uMenuUtils, uBizEmpresas,
|
2007-10-08 07:58:40 +00:00
|
|
|
|
uFactuGES_App, uDataModuleBase, uDataModuleConexion,
|
|
|
|
|
|
uModuleController, uMainMenuController, uNavPaneController,
|
|
|
|
|
|
uDialogUtils, cxControls;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
***************************** TfPantallaPrincipal ******************************
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.FormCloseQuery(Sender: TObject;
|
|
|
|
|
|
var CanClose: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
CanClose := True;
|
|
|
|
|
|
if Assigned(FContenido) then
|
|
|
|
|
|
CanClose := FContenido.CloseQuery;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.FormCreate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ApplicationEvents.Activate;
|
2007-10-09 07:47:51 +00:00
|
|
|
|
Caption := AppFactuGES.AppName + ' ' + AppFactuGES.AppVersion;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
SplashScreen := TSplashScreen.Create(Application) ;
|
|
|
|
|
|
SplashScreen.Show;
|
|
|
|
|
|
|
|
|
|
|
|
JvNavigationPane.StyleManager := dmBase.StyleManager;
|
|
|
|
|
|
dmBase.OnThemeChange := Self.OnThemeChange;
|
|
|
|
|
|
Self.OnThemeChange(Self); // Forzar el refresco de los colores del tema activo
|
|
|
|
|
|
|
|
|
|
|
|
with HostManager do
|
|
|
|
|
|
begin
|
|
|
|
|
|
BPLPath := ExtractFilePath(Application.ExeName) + '\';
|
|
|
|
|
|
MainMenu := Self.Menu;
|
|
|
|
|
|
MainForm := Self;
|
|
|
|
|
|
OnAfterLoad := HostManagerAfterLoad;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
actLogin.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.FormDestroy(Sender: TObject);
|
|
|
|
|
|
begin
|
2007-10-03 10:27:58 +00:00
|
|
|
|
// ReleaseEmbedded;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
HostManager.UnloadModules;
|
|
|
|
|
|
ApplicationEvents.CancelDispatch;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.HostManagerAfterLoad(Sender: TObject;
|
|
|
|
|
|
AModuleInfo: TModuleInfo);
|
|
|
|
|
|
begin
|
|
|
|
|
|
RegisterModule(AModuleInfo);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.RefrescarUI;
|
|
|
|
|
|
var
|
|
|
|
|
|
ATitulo : String;
|
|
|
|
|
|
begin
|
2007-10-09 07:47:51 +00:00
|
|
|
|
ATitulo := AppFactuGES.AppName + ' ' + AppFactuGES.AppVersion;
|
2007-10-03 10:27:58 +00:00
|
|
|
|
|
2007-10-09 07:47:51 +00:00
|
|
|
|
if Assigned(AppFactuGES.EmpresaActiva) then
|
|
|
|
|
|
ATitulo := AppFactuGES.EmpresaActiva.NOMBRE + ' - ' + ATitulo;
|
2007-10-03 10:27:58 +00:00
|
|
|
|
|
2007-09-12 14:11:44 +00:00
|
|
|
|
Caption := ATitulo;
|
|
|
|
|
|
|
|
|
|
|
|
if dmConexion.HayConexion then
|
|
|
|
|
|
TBXStatusBar1.Panels[0].Caption := 'Conectado a: ' + dmConexion.TargetURL
|
|
|
|
|
|
else
|
|
|
|
|
|
TBXStatusBar1.Panels[0].Caption := 'Desconectado';
|
|
|
|
|
|
|
2007-10-09 07:47:51 +00:00
|
|
|
|
if Assigned(AppFactuGES.UsuarioActivo) then
|
|
|
|
|
|
TBXStatusBar1.Panels[1].Caption := AppFactuGES.UsuarioActivo.UserName
|
|
|
|
|
|
else
|
2007-09-12 14:11:44 +00:00
|
|
|
|
TBXStatusBar1.Panels[1].Caption := '';
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.RegisterModule(AModuleInfo : TModuleInfo);
|
|
|
|
|
|
var
|
|
|
|
|
|
AModule: TModuleController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AModule := AModuleInfo.Module;
|
|
|
|
|
|
|
|
|
|
|
|
SplashScreen.Texto := 'Cargando ''' + AModule.ModuleName + '''...';
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.ReleaseEmbedded;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Assigned(FContenido) then
|
|
|
|
|
|
FContenido.Release;
|
|
|
|
|
|
FContenido := Nil;
|
|
|
|
|
|
Application.ProcessMessages;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.Salir1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actSalirExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actVentasMenuExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actVerBarraEstadoExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
TBXStatusBar1.Visible := not TBXStatusBar1.Visible;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actVerBarraEstadoUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
(Sender as TAction).Checked := TBXStatusBar1.Visible;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actVerPanelExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
JvNavigationPane.Visible := not JvNavigationPane.Visible;
|
|
|
|
|
|
if (JvNavigationPane.Visible) and (JvNavigationPane.Width = 0) then
|
|
|
|
|
|
JvNavigationPane.Width := 210;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actVerPanelUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
(Sender as TAction).Checked := JvNavigationPane.Visible and (JvNavigationPane.Width > 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.OnThemeChange(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
LockWindowUpdate(Handle);
|
|
|
|
|
|
try
|
|
|
|
|
|
Color := dmBase.StyleManager.Colors.DividerColorTo;
|
|
|
|
|
|
//pnlBorde.Color := dmBase.StyleManager.Colors.FrameColor;
|
|
|
|
|
|
pnlBorde.BoundColor := dmBase.StyleManager.Colors.FrameColor;
|
|
|
|
|
|
with StyleManagerButtons do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Colors.ButtonColorFrom := clWindow;
|
|
|
|
|
|
Colors.ButtonColorTo := clWindow;
|
|
|
|
|
|
Colors.ButtonSeparatorColor := clWindow;
|
|
|
|
|
|
Colors.SplitterColorFrom := clWindow;
|
|
|
|
|
|
Colors.SplitterColorTo := clWindow;
|
|
|
|
|
|
Colors.DividerColorFrom := clWindow;
|
|
|
|
|
|
Colors.DividerColorTo := clWindow;
|
|
|
|
|
|
Colors.HeaderColorFrom := clWindow;
|
|
|
|
|
|
Colors.HeaderColorTo := clWindow;
|
|
|
|
|
|
Colors.FrameColor := clWindow;
|
|
|
|
|
|
Colors.ToolPanelHeaderColorFrom := clWindow;
|
|
|
|
|
|
Colors.ToolPanelHeaderColorTo := clWindow;
|
|
|
|
|
|
|
|
|
|
|
|
Colors.ButtonHotColorFrom := dmBase.StyleManager.Colors.ButtonHotColorFrom;
|
|
|
|
|
|
Colors.ButtonHotColorTo := dmBase.StyleManager.Colors.ButtonHotColorTo;
|
|
|
|
|
|
|
|
|
|
|
|
Colors.ButtonSelectedColorFrom := dmBase.StyleManager.Colors.ButtonSelectedColorFrom;
|
|
|
|
|
|
Colors.ButtonSelectedColorTo := dmBase.StyleManager.Colors.ButtonSelectedColorTo;
|
|
|
|
|
|
end;
|
|
|
|
|
|
lblBienvenido.Font.Color := JvNavigationPane.Colors.ButtonColorTo;
|
|
|
|
|
|
{ JvGradient1.StartColor := JvNavigationPane.Colors.ButtonColorFrom;
|
|
|
|
|
|
JvGradient1.EndColor := JvNavigationPane.Colors.ButtonColorTo;}
|
|
|
|
|
|
finally
|
|
|
|
|
|
LockWindowUpdate(0);
|
|
|
|
|
|
Refresh;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfPantallaPrincipal.GetWorkPanel: TWinControl;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := pnlMain;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-10-09 07:47:51 +00:00
|
|
|
|
procedure TfPantallaPrincipal.Informacindeempresa1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//
|
|
|
|
|
|
AppFactuGES.EmpresasController.Ver(AppFactuGES.EmpresaActiva);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-12 14:11:44 +00:00
|
|
|
|
procedure TfPantallaPrincipal.InicializarUI;
|
|
|
|
|
|
var
|
2007-10-09 07:47:51 +00:00
|
|
|
|
AListaEmpresas : IBizEmpresa;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
i : Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
for i := 0 to HostManager.ModulesCount - 1 do
|
|
|
|
|
|
MainMenuController.RegisterModule(HostManager.Modules[i]);
|
|
|
|
|
|
|
|
|
|
|
|
MainMenuController.SortMenuByTag;
|
|
|
|
|
|
MainMenuController.InitMainMenu;
|
|
|
|
|
|
|
|
|
|
|
|
for i := 0 to HostManager.ModulesCount - 1 do
|
|
|
|
|
|
NavPaneController.RegisterModule(HostManager.Modules[i]);
|
|
|
|
|
|
|
|
|
|
|
|
NavPaneController.InitNavPane;
|
|
|
|
|
|
|
2007-10-09 07:47:51 +00:00
|
|
|
|
AListaEmpresas := AppFactuGES.EmpresasController.BuscarTodos;
|
|
|
|
|
|
if Assigned(AListaEmpresas) then
|
2007-09-12 14:11:44 +00:00
|
|
|
|
begin
|
2007-10-09 07:47:51 +00:00
|
|
|
|
AListaEmpresas.Active := True;
|
|
|
|
|
|
if AListaEmpresas.RecordCount = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
// Oculto la p<>gina de inicio para que no parezca
|
|
|
|
|
|
// que se pueden manejar varias empresas.
|
|
|
|
|
|
JvNavigationPane.ActivePageIndex := 1;
|
|
|
|
|
|
pagInicio.PageList := NIL;
|
|
|
|
|
|
pagInicio.Visible := False;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
|
|
|
|
|
|
RefrescarUI;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actLoginExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
HostManager.UnloadModules;
|
|
|
|
|
|
|
2007-10-08 07:58:40 +00:00
|
|
|
|
if AppFactuGES.UsuariosController.StartLogin then
|
2007-09-12 14:11:44 +00:00
|
|
|
|
begin
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
SplashScreen.Update;
|
|
|
|
|
|
Application.ProcessMessages;
|
|
|
|
|
|
CargarModulos;
|
|
|
|
|
|
try
|
|
|
|
|
|
InicializarUI;
|
|
|
|
|
|
Application.ProcessMessages;
|
|
|
|
|
|
Visible := True;
|
|
|
|
|
|
AplicarPerfil;
|
|
|
|
|
|
finally
|
|
|
|
|
|
SplashScreen.Update;
|
|
|
|
|
|
SplashScreen.Hide;
|
|
|
|
|
|
FreeAndNIL(SplashScreen);
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
2007-10-08 07:58:40 +00:00
|
|
|
|
Application.Terminate;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actMenuComprasExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actMenuComprasUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
2007-10-09 07:47:51 +00:00
|
|
|
|
(Sender as TAction).Enabled := Assigned(AppFactuGES.EmpresaActiva);
|
2007-09-12 14:11:44 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actLogisticaMenuExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.ExecuteActionMenu(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
i : integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
for i := 0 to JvNavigationPane.PageCount - 1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if JvNavigationPane.NavPages[i].Caption = (Sender as TAction).Caption then
|
|
|
|
|
|
begin
|
|
|
|
|
|
JvNavigationPane.ActivePageIndex := i;
|
|
|
|
|
|
Break;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.AplicarPerfil;
|
|
|
|
|
|
begin
|
|
|
|
|
|
//
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.ApplicationEventsException(Sender: TObject;
|
|
|
|
|
|
E: Exception);
|
|
|
|
|
|
begin
|
2007-10-08 07:58:40 +00:00
|
|
|
|
{ if E is EROSessionNotFound then
|
2007-09-12 14:11:44 +00:00
|
|
|
|
begin
|
2007-10-03 10:27:58 +00:00
|
|
|
|
// OJOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
|
2007-10-08 07:58:40 +00:00
|
|
|
|
if not dmUsuarios.Login then
|
|
|
|
|
|
ShowMessage(E.Message);
|
2007-09-12 14:11:44 +00:00
|
|
|
|
end
|
2007-10-08 07:58:40 +00:00
|
|
|
|
else}
|
2007-09-12 14:11:44 +00:00
|
|
|
|
ShowMessage(E.Message);
|
|
|
|
|
|
//ShowErrorMessage('Se ha producido un error', '', E);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.OnWorkPanelChanged(AEditor: ICustomEditor);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-10-09 07:47:51 +00:00
|
|
|
|
procedure TfPantallaPrincipal.Perfiles1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
AppFactuGES.UsuariosController.ShowProfileManager;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-12 14:11:44 +00:00
|
|
|
|
procedure TfPantallaPrincipal.ShowEmbedded(AEditor: ICustomEditor);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Assigned(FContenido) and not FContenido.CloseQuery then
|
|
|
|
|
|
begin
|
|
|
|
|
|
AEditor.Release;
|
|
|
|
|
|
AEditor := NIL;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
LockWindowUpdate(Handle);
|
|
|
|
|
|
ReleaseEmbedded;
|
|
|
|
|
|
try
|
|
|
|
|
|
FContenido := TCustomEditor(AEditor.GetInstance);
|
|
|
|
|
|
with (FContenido) do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Visible := False;
|
|
|
|
|
|
BorderIcons := [];
|
|
|
|
|
|
BorderStyle := bsNone;
|
|
|
|
|
|
Parent := WorkPanel;
|
|
|
|
|
|
FContenido.Show;
|
|
|
|
|
|
Align := alClient;
|
|
|
|
|
|
FContenido.SetFocus;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
Application.ProcessMessages;
|
|
|
|
|
|
LockWindowUpdate(0);
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
OnWorkPanelChanged(FContenido);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-10-09 07:47:51 +00:00
|
|
|
|
procedure TfPantallaPrincipal.Usuarios1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
AppFactuGES.UsuariosController.ShowUserManager;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-10-03 10:27:58 +00:00
|
|
|
|
procedure TfPantallaPrincipal.WMSysCommand(var Msg: TMessage);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//No tocar, sirve para recuperar el foco el formulario principal cuando
|
|
|
|
|
|
// tenemos varios formularios hijos abiertos a la vez.
|
|
|
|
|
|
DefaultHandler(Msg);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-12 14:11:44 +00:00
|
|
|
|
procedure TfPantallaPrincipal.CargarModulos;
|
|
|
|
|
|
begin
|
2007-10-08 07:58:40 +00:00
|
|
|
|
//HostManager.LoadModule('Empresas_plugin.bpl');
|
|
|
|
|
|
//HostManager.LoadModule('FormasPago_plugin.bpl');
|
|
|
|
|
|
//HostManager.LoadModule('TiposIVA_plugin.bpl');
|
2007-09-12 14:11:44 +00:00
|
|
|
|
// HostManager.LoadModule('Almacenes_plugin.bpl');
|
|
|
|
|
|
// HostManager.LoadModule('Familias_plugin.bpl');
|
|
|
|
|
|
// HostManager.LoadModule('Articulos_plugin.bpl');
|
|
|
|
|
|
// HostManager.LoadModule('Inventario_plugin.bpl');
|
2007-10-03 10:27:58 +00:00
|
|
|
|
|
|
|
|
|
|
//HostManager.LoadModule('Contactos_plugin.bpl');
|
|
|
|
|
|
|
|
|
|
|
|
// HostManager.LoadModule('RecibosCliente_plugin.bpl');
|
2007-09-12 14:11:44 +00:00
|
|
|
|
// HostManager.LoadModule('RemesasCliente_plugin.bpl');
|
|
|
|
|
|
// HostManager.LoadModule('FacturasCliente_plugin.bpl');
|
|
|
|
|
|
// HostManager.LoadModule('RecibosProveedor_plugin.bpl');
|
|
|
|
|
|
// HostManager.LoadModule('FacturasProveedor_plugin.bpl');
|
|
|
|
|
|
{
|
|
|
|
|
|
HostManager.LoadModule('Presupuestos_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('Montajes_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('PedidosProveedor_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('PedidosCliente_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('AlbaranesProveedor_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('AlbaranesCliente_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('BancaElectronica_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('Comisiones_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('TiendaWeb_plugin.bpl');
|
|
|
|
|
|
|
|
|
|
|
|
HostManager.LoadModule('HistoricoMovimientos_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('RemesasProveedor_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('Referencias_plugin.bpl');
|
|
|
|
|
|
|
|
|
|
|
|
HostManager.LoadModule('Informes_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('InfVentasArticulo_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('InfMargenArticulo_plugin.bpl');
|
|
|
|
|
|
|
|
|
|
|
|
HostManager.LoadModule('PedidosMontaje_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('CobrosMontaje_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('MontajesDetalle_plugin.bpl');
|
|
|
|
|
|
HostManager.LoadModule('MontajesCompleto_plugin.bpl');
|
|
|
|
|
|
}
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
constructor TfPantallaPrincipal.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FContenido := NIL;
|
|
|
|
|
|
|
|
|
|
|
|
with NavPaneController do
|
|
|
|
|
|
begin
|
|
|
|
|
|
SmallImages := ModulesSmallImageList;
|
|
|
|
|
|
LargeImages := ModulesLargeImageList;
|
|
|
|
|
|
NavigationPane := JvNavigationPane;
|
|
|
|
|
|
MainForm := Self;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with MainMenuController do
|
|
|
|
|
|
begin
|
|
|
|
|
|
SmallImages := ModulesSmallImageList;
|
|
|
|
|
|
LargeImages := ModulesLargeImageList;
|
|
|
|
|
|
MainMenu := HostMenu;
|
|
|
|
|
|
MainForm := Self;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-10-03 10:27:58 +00:00
|
|
|
|
procedure TfPantallaPrincipal.CreateParams(var Params: TCreateParams);
|
|
|
|
|
|
begin
|
|
|
|
|
|
// <20><><EFBFBD>Fallo en Delphi 2007!!!
|
|
|
|
|
|
// Cambio los param<61>tros para obligar a que aparezca el icono en la barra de tareas.
|
|
|
|
|
|
inherited CreateParams(Params);
|
|
|
|
|
|
with Params do begin
|
|
|
|
|
|
ExStyle := ExStyle or WS_EX_APPWINDOW;
|
|
|
|
|
|
WndParent := GetDesktopwindow;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-12 14:11:44 +00:00
|
|
|
|
procedure TfPantallaPrincipal.actActualizacionesExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
2007-10-08 07:58:40 +00:00
|
|
|
|
{ fActualizacion := TfActualizacion.Create(Self);
|
2007-09-12 14:11:44 +00:00
|
|
|
|
try
|
|
|
|
|
|
fActualizacion.ShowModal;
|
|
|
|
|
|
finally
|
|
|
|
|
|
FreeAndNil(fActualizacion);
|
2007-10-08 07:58:40 +00:00
|
|
|
|
end;}
|
2007-09-12 14:11:44 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actCambiarPassExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
2007-10-09 07:47:51 +00:00
|
|
|
|
AppFactuGES.UsuariosController.ShowChangePassword;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
RefrescarUI;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-10-08 07:58:40 +00:00
|
|
|
|
procedure TfPantallaPrincipal.Acercade1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
AppFactuGES.UsuariosController.StartLogin;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-12 14:11:44 +00:00
|
|
|
|
procedure TfPantallaPrincipal.actAcercaExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
with TfAcercaDe.Create(NIL) do
|
|
|
|
|
|
try
|
|
|
|
|
|
HostManager := Self.HostManager;
|
|
|
|
|
|
ShowModal;
|
|
|
|
|
|
finally
|
|
|
|
|
|
Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfPantallaPrincipal.IsShortcut(var Message: TWMKey): Boolean;
|
|
|
|
|
|
Var
|
|
|
|
|
|
ctrl: TWinControl;
|
|
|
|
|
|
comp: TComponent;
|
|
|
|
|
|
i: Integer;
|
|
|
|
|
|
Begin
|
|
|
|
|
|
ctrl := ActiveControl;
|
|
|
|
|
|
If ctrl <> Nil Then Begin
|
|
|
|
|
|
Repeat
|
|
|
|
|
|
ctrl := ctrl.Parent
|
|
|
|
|
|
Until (ctrl = nil) or (ctrl Is TCustomForm);
|
|
|
|
|
|
// Note: replace TCustomFrame with TForm, check if the found form is
|
|
|
|
|
|
// self, if not, execute the following block of code.
|
|
|
|
|
|
If ctrl <> nil Then Begin
|
|
|
|
|
|
For i:= 0 To ctrl.componentcount-1 Do Begin
|
|
|
|
|
|
comp:= ctrl.Components[i];
|
|
|
|
|
|
If comp Is TCustomActionList Then Begin
|
|
|
|
|
|
result := TCustomActionList(comp).IsShortcut( message );
|
|
|
|
|
|
If result Then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
End;
|
|
|
|
|
|
End;
|
|
|
|
|
|
End;
|
|
|
|
|
|
End;
|
|
|
|
|
|
//Result := inherited IsShortCut(Message);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.JvNavigationPaneChange(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
{ Cuando se destruye el formulario este evento salta pero no
|
|
|
|
|
|
hay que cambiar de empresa }
|
|
|
|
|
|
if (csDestroying in ComponentState) then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
|
|
|
|
|
|
//Se libera el contenido que tenga ya que cambiamos de empresa;
|
|
|
|
|
|
ReleaseEmbedded;
|
|
|
|
|
|
|
2007-10-09 07:47:51 +00:00
|
|
|
|
AppFactuGES.CambarEmpresa(JvNavigationPane.ActivePage.Tag);
|
2007-09-12 14:11:44 +00:00
|
|
|
|
RefrescarUI;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfPantallaPrincipal.actConexionExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
dmConexion.ConfigurarConexion;
|
|
|
|
|
|
RefrescarUI;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end.
|