uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Db, dbf,
StdCtrls, Buttons, DBGrids, ComCtrls;
type
{ TFrmPMSSetup }
TFrmPMSSetup = class(TForm)
DSInvoices: TDataSource;
DbfInvoices: TDbf;
DSPhotos: TDataSource;
DbfPhotos: TDbf;
DSPhotographers: TDataSource;
DbfPhotographers: TDbf;
DSSalesOrders: TDataSource;
DbfSalesOrders: TDbf;
DSProposals: TDataSource;
DbfProposals: TDbf;
DSReferences: TDataSource;
DbfReferences: TDbf;
DSContacts: TDataSource;
DbfContacts: TDbf;
DSClients: TDataSource;
DbfClients: TDbf;
DSAppointments: TDataSource;
DbfAppointments: TDbf;
LblWarning2: TLabel;
LblPrgrsBar: TLabel;
LblStartNotation: TLabel;
LblWarning: TLabel;
LblWarning1: TLabel;
LblWarning3: TLabel;
PnlPMSSetupTop: TPanel;
PrgrsBarTableRebld: TProgressBar;
SpdBtnPMSDataRebuild: TSpeedButton;
SpdBtnSetUpClose: TSpeedButton;
TimerRebld: TTimer;
procedure FormCreate(Sender: TObject);
procedure SpdBtnPMSDataRebuildClick(Sender: TObject);
procedure SpdBtnSetUpCloseClick(Sender: TObject);
procedure TimerRebldTimer(Sender: TObject);
private
public
function TFieldDefs.Add(const AName: string; ADataType: TFieldType;
ASize: Integer; APrecision: Integer; ARequired: Boolean):TFieldDef;
overload; { Error here beginning of function: Syntax error, ":"
expected but "." found }
end;
var
FrmPMSSetup: TFrmPMSSetup;
implementation
{$R *.lfm}
{ TFrmPMSSetup }
procedure TFrmPMSSetup.SpdBtnPMSDataRebuildClick(Sender: TObject);
{ Create the Appointments, Clients, Contacts, Invoices, Photographers,
Photos, Proposals, References and SalesOrders tables plus associated
indexes for each table. }
var
Appointments: TDbf;
Clients: TDbf;
Contacts: TDbf;
Photographers: TDbf;
Photos: TDbf;
Proposals: TDbf;
References: TDbf;
SalesOrders: TDbf;
Invoices: TDbf;
begin
PrgrsBarTableRebld.Step:= 10;
PrgrsBarTableRebld.Position:= 10;
ForceDirectories('PMS Data'); //-> Note: PMS Database Directory = PMS Data
//-> Build Appointments.dbf and indices
if FileExists('Appointments.dbf') then
DeleteFile('Appointments.dbf');
Appointments := TDbf.Create(nil); // APPOINTMENTS TABLE
try
//-> Use the relative path to the "PMS Data" directory
Appointments.FilePath := 'PMS Data' + DirectorySeparator;
//-> Use Visual dBase VII compatible tables for Lazarus (Table Level 7)
Appointments.TableLevel:= 7;
Appointments.Exclusive:= True;
Appointments.TableName:= 'Appointments.dbf';
with Appointments.FieldDefs do begin //-> 17 fields
PrgrsBarTableRebld.Step:= 20;
PrgrsBarTableRebld.Position:= 20;
...