git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES/trunk@4 b68bf8ae-e977-074f-a058-3cfd71dd8f45
321 lines
9.4 KiB
ObjectPascal
321 lines
9.4 KiB
ObjectPascal
{
|
|
===============================================================================
|
|
Copyright (©) 2001. Rodax Software.
|
|
===============================================================================
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|
copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado,
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|
acuerdo con los términos y condiciones establecidas en el acuerdo/contrato
|
|
bajo el que se suministra.
|
|
-----------------------------------------------------------------------------
|
|
Web: www.rodax-software.com
|
|
===============================================================================
|
|
Fecha primera versión: 01-10-2001
|
|
Versión actual: 1.0.4
|
|
Fecha versión actual: 12-10-2004
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
29-10-2001 En la barra de estado aparece el nombre de la base de datos.
|
|
|
|
21-09-2002 Solo se permite el acceso al administrador del sistema en
|
|
contadores.
|
|
|
|
06-03-2004 Se ha eliminado el tratamiento de perfiles de usuario.
|
|
|
|
12-10-2004 p289, p290. Cambio de apartados
|
|
===============================================================================
|
|
}
|
|
|
|
unit Principal;
|
|
|
|
interface
|
|
|
|
uses
|
|
Forms, Sysutils, ComCtrls, ToolWin, RdxBotones, RdxPaneles, Graphics, Controls,
|
|
RdxFrame, Menus, am2000menuitem, am2000utils, am2000popupmenu, am2000,
|
|
StdCtrls, ExtCtrls, pngimage, FthImage, Classes, Buttons, ActnList,
|
|
am2000options, am2000skin;
|
|
|
|
type
|
|
TfrPrincipal = class(TRdxFrame)
|
|
BarraEstado: TStatusBar;
|
|
menuCartas: TPopupMenu2000;
|
|
Cliente: TMenuItem2000;
|
|
N1: TMenuItem2000;
|
|
Proveedor: TMenuItem2000;
|
|
MenuOpciones: TPopupMenu2000;
|
|
Contadores: TMenuItem2000;
|
|
pnlBarraSuperior: TRdxGradientePanel;
|
|
bEmpresas: TFourthImage;
|
|
JzLabel1: TLabel;
|
|
JzLabel4: TLabel;
|
|
bProveedores: TFourthImage;
|
|
bClientes: TFourthImage;
|
|
bCartas: TFourthImage;
|
|
bDatos: TFourthImage;
|
|
bOpciones: TFourthImage;
|
|
JzLabel7: TLabel;
|
|
JzLabel8: TLabel;
|
|
JzLabel9: TLabel;
|
|
JzLabel10: TLabel;
|
|
JzLabel11: TLabel;
|
|
JzLabel12: TLabel;
|
|
bInformes: TFourthImage;
|
|
Shape1: TShape;
|
|
bAlmacen: TFourthImage;
|
|
imgFondo: TImage;
|
|
actPrincipal: TActionList;
|
|
actAlmacen: TAction;
|
|
actDatos: TAction;
|
|
actCompras: TAction;
|
|
actVentas: TAction;
|
|
actEmpresas: TAction;
|
|
eNombreEmpresa: TLabel;
|
|
bObras: TFourthImage;
|
|
Label1: TLabel;
|
|
actObras: TAction;
|
|
actInformes: TAction;
|
|
Label2: TLabel;
|
|
bSincronizacion: TFourthImage;
|
|
actSincronizacion: TAction;
|
|
procedure LogotipoClick(Sender: TObject);
|
|
procedure bSalirClick(Sender: TObject);
|
|
procedure ProveedorClick(Sender: TObject);
|
|
procedure ClienteClick(Sender: TObject);
|
|
procedure ContadoresClick(Sender: TObject);
|
|
procedure bCartasClick(Sender: TObject);
|
|
procedure bOpcionesClick(Sender: TObject);
|
|
procedure JvImage6Click(Sender: TObject);
|
|
procedure actAlmacenExecute(Sender: TObject);
|
|
procedure actAlmacenUpdate(Sender: TObject);
|
|
procedure actDatosExecute(Sender: TObject);
|
|
procedure actComprasExecute(Sender: TObject);
|
|
procedure actVentasExecute(Sender: TObject);
|
|
procedure actDatosUpdate(Sender: TObject);
|
|
procedure actEmpresasExecute(Sender: TObject);
|
|
procedure RdxFrameResize(Sender: TObject);
|
|
procedure actObrasExecute(Sender: TObject);
|
|
procedure actInformesExecute(Sender: TObject);
|
|
procedure actSincronizacionExecute(Sender: TObject);
|
|
public
|
|
Version : String;
|
|
constructor Create(AOwner : TComponent); override;
|
|
procedure ManejadorExcepciones(Sender: TObject; E: Exception);
|
|
published
|
|
procedure OnCloseApp (Sender: TObject; var Action: TCloseAction);
|
|
end;
|
|
|
|
var
|
|
frPrincipal: TfrPrincipal;
|
|
|
|
implementation
|
|
|
|
{$R *.DFM}
|
|
|
|
uses
|
|
BarraAlmacenes, Windows, BarraDatos, BarraProveedores, BarraClientes,
|
|
ContenidoPrincipal, Mensajes, Excepciones, Tipos, EditorCartas, StrFunc,
|
|
BaseDatos, Literales, Configuracion, ElegirEmpresa, RdxEmpresaActiva,
|
|
BarraInformes, BarraObras, DatosContadores, Sincronizacion;
|
|
|
|
{ TfrPrincipal }
|
|
|
|
constructor TfrPrincipal.Create(AOwner: TComponent);
|
|
begin
|
|
inherited;
|
|
ConfigurarVentanaPrincipal(Self);
|
|
{eVersion.Caption := 'versión ' + Copy(DarVersionFichero(Application.ExeName), 0, 3);}
|
|
if PuedeSincronizar then
|
|
actSincronizacion.OnUpdate := actDatosUpdate
|
|
else begin
|
|
actSincronizacion.Enabled := False;
|
|
actSincronizacion.OnUpdate := NIL;
|
|
end;
|
|
|
|
Contenido := TfrContenidoPrincipal.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.LogotipoClick(Sender: TObject);
|
|
begin
|
|
Contenido := TfrContenidoPrincipal.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.bSalirClick(Sender: TObject);
|
|
begin
|
|
if VerMensajePregunta(msgDeseaSalir) = mrYES then
|
|
begin
|
|
if CloseFrame then
|
|
Application.Terminate;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrPrincipal.OnCloseApp(Sender: TObject;
|
|
var Action: TCloseAction);
|
|
begin
|
|
Action := caNone;
|
|
if VerMensajePregunta(msgDeseaSalir) = mrYES then
|
|
if CloseFrame then Action := caFree;
|
|
end;
|
|
|
|
procedure TfrPrincipal.ManejadorExcepciones(Sender: TObject; E: Exception);
|
|
begin
|
|
TratarExcepcion(E);
|
|
end;
|
|
|
|
procedure TfrPrincipal.ProveedorClick(Sender: TObject);
|
|
begin
|
|
CaptionModal := 'Carta a un proveedor';
|
|
WidthModal := 710;
|
|
HeightModal := 570;
|
|
ModoModal := Listar;
|
|
EntidadModal := entProveedor;
|
|
ContenidoModal := TfrEditorCartas.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.ClienteClick(Sender: TObject);
|
|
begin
|
|
CaptionModal := 'Carta a un cliente';
|
|
WidthModal := 710;
|
|
HeightModal := 570;
|
|
ModoModal := Listar;
|
|
EntidadModal := entCliente;
|
|
ContenidoModal := TfrEditorCartas.Create(Self);
|
|
end;
|
|
|
|
|
|
procedure TfrPrincipal.ContadoresClick(Sender: TObject);
|
|
begin
|
|
HeightModal := 500;
|
|
WidthModal := 370;
|
|
EntidadModal := entOpciones;
|
|
ModoModal := Anadir;
|
|
ContenidoModal := TfrDatosContadores.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.bCartasClick(Sender: TObject);
|
|
var
|
|
P : TPoint;
|
|
begin
|
|
if (Sender as TImage).PopupMenu <> NIL then
|
|
begin
|
|
P.X := (Sender as TImage).Left;
|
|
P.Y := pnlBarraSuperior.Top + pnlBarraSuperior.Height;
|
|
P := ClientToScreen(P);
|
|
(Sender as TImage).PopupMenu.Popup(P.X, P.Y);
|
|
end;
|
|
end;
|
|
|
|
procedure TfrPrincipal.bOpcionesClick(Sender: TObject);
|
|
var
|
|
P : TPoint;
|
|
begin
|
|
if (Sender as TImage).PopupMenu <> NIL then
|
|
begin
|
|
P.X := (Sender as TImage).Left;
|
|
P.Y := pnlBarraSuperior.Top + pnlBarraSuperior.Height;
|
|
P := ClientToScreen(P);
|
|
(Sender as TImage).PopupMenu.Popup(P.X, P.Y);
|
|
end;
|
|
end;
|
|
|
|
procedure TfrPrincipal.JvImage6Click(Sender: TObject);
|
|
var
|
|
P : TPoint;
|
|
begin
|
|
if (Sender as TImage).PopupMenu <> NIL then
|
|
begin
|
|
P.X := (Sender as TImage).Left;
|
|
P.Y := pnlBarraSuperior.Top + pnlBarraSuperior.Height;
|
|
P := ClientToScreen(P);
|
|
(Sender as TImage).PopupMenu.Popup(P.X, P.Y);
|
|
end;
|
|
end;
|
|
|
|
procedure TfrPrincipal.actAlmacenExecute(Sender: TObject);
|
|
begin
|
|
Contenido := TfrBarraAlmacenes.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.actAlmacenUpdate(Sender: TObject);
|
|
begin
|
|
(Sender as TAction).Enabled := (EmpresaActiva.Codigo <> NULL);
|
|
end;
|
|
|
|
procedure TfrPrincipal.actDatosExecute(Sender: TObject);
|
|
begin
|
|
Contenido := TfrBarraDatos.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.actComprasExecute(Sender: TObject);
|
|
begin
|
|
Contenido := TfrBarraProveedores.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.actVentasExecute(Sender: TObject);
|
|
begin
|
|
Contenido := TfrBarraClientes.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.actDatosUpdate(Sender: TObject);
|
|
begin
|
|
(Sender as TAction).Enabled := (EmpresaActiva.Codigo <> NULL);
|
|
bCartas.Enabled := (EmpresaActiva.Codigo <> NULL);
|
|
bInformes.Enabled := (EmpresaActiva.Codigo <> NULL);
|
|
bOpciones.Enabled := (EmpresaActiva.Codigo <> NULL);
|
|
end;
|
|
|
|
procedure TfrPrincipal.actEmpresasExecute(Sender: TObject);
|
|
var
|
|
EmpresaAnterior : Variant;
|
|
begin
|
|
if (Contenido <> NIL) then
|
|
Contenido := TfrContenidoPrincipal.Create(Self);
|
|
|
|
if (Contenido is TfrContenidoPrincipal) then
|
|
begin
|
|
EmpresaAnterior := EmpresaActiva.Codigo;
|
|
HeightModal := 370;
|
|
WidthModal := 594;
|
|
ContenidoModal := TfrElegirEmpresa.Create(Self);
|
|
if (EmpresaAnterior <> EmpresaActiva.Codigo) then
|
|
begin
|
|
eNombreEmpresa.Caption := EmpresaActiva.Nombre;
|
|
BarraEstado.Panels[0].Text := 'Empresa: ' + EmpresaActiva.Nombre;
|
|
Application.MainForm.Caption := 'FactuGES v' + Version + ' - ' + EmpresaActiva.Nombre;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrPrincipal.RdxFrameResize(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
eNombreEmpresa.Left := pnlBarraSuperior.Width - eNombreEmpresa.Width - 10;
|
|
end;
|
|
|
|
procedure TfrPrincipal.actObrasExecute(Sender: TObject);
|
|
begin
|
|
Contenido := TfrBarraObras.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.actInformesExecute(Sender: TObject);
|
|
begin
|
|
Contenido := TfrBarraInformes.Create(Self);
|
|
end;
|
|
|
|
procedure TfrPrincipal.actSincronizacionExecute(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
Contenido := TfrContenidoPrincipal.Create(Self);
|
|
fSincronizacion := TfSincronizacion.Create(Self);
|
|
try
|
|
fSincronizacion.ShowModal;
|
|
finally
|
|
fSincronizacion.Free;
|
|
end;
|
|
end;
|
|
|
|
end.
|