unit inicio;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Spin, Buttons,checa;

type
  TFormaParametros = class(TForm)
    Label1: TLabel;
    Empresa: TSpinEdit;
    Label2: TLabel;
    RutaInicio: TEdit;
    Aceptar: TBitBtn;
    NombreEmpresa: TLabel;
    Label3: TLabel;
    Clave: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure AceptarClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure EmpresaChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormaParametros: TFormaParametros;

implementation

uses Principa;

{$R *.DFM}

{function ruta(linea:integer):String;
var
arch:TextFile;
aux:string;
i:integer;

begin
if FileExists('c:\Proyecto\Sistema\Gener'+FormaParametros.Empresa.Text+'.cnf') then
begin
AssignFile(arch,'c:\Proyecto\Sistema\Gener'+FormaParametros.Empresa.Text+'.cnf');
Reset(arch);
for i:=1 to linea do
Readln(arch,aux);
CloseFile(arch);
ruta:=aux;
end
else
ShowMessage('La Empresa No Existe'+ '  '+'c:\Proyecto\Sistema\Gener'+FormaParametros.Empresa.Text+'.cnf');

end;}



procedure TFormaParametros.FormCreate(Sender: TObject);
begin
RutaInicio.Text:=ruta(8);
end;

procedure TFormaParametros.AceptarClick(Sender: TObject);
begin
if Clave.Text=ruta(11) then
begin
FormaPrincipal.Enabled:=True;
FormaPrincipal.Caption:='Sistema de Facturación Integral     '+ruta(9);
FormaParametros.Close;
end
else
begin
ShowMessage('Clave Incorrecta');
Empresa.SetFocus;
end;
end;

procedure TFormaParametros.FormActivate(Sender: TObject);
begin
FormaParametros.Tag:=1;
end;

procedure TFormaParametros.EmpresaChange(Sender: TObject);
var
F:longbool;
begin
if FileExists('c:\Proyecto\Sistema\Gener'+FormaParametros.Empresa.Text+'.cnf') then
begin
if FileExists('c:\Proyecto\Sistema\general.cnf') then
DeleteFile('c:\Proyecto\Sistema\general.cnf');
CopyFile(Pchar('c:\Proyecto\Sistema\Gener'+FormaParametros.Empresa.Text+'.cnf'),'c:\Proyecto\Sistema\general.cnf',F);
RutaInicio.Text:=ruta(8);
NombreEmpresa.Caption:=ruta(9);
end
else
begin
ShowMessage('La Empresa No Existe');
RutaInicio.Text:='';
end;

end;

end.
