Sign in Join
Wiki copytemporary

TSqlite3 Master Detail Example: what changed

Revision 3 to 4. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-TSqlite3 Master Detail Example
1+TSqlite3 Master Detail Example
22
33## About Demo
44
5-This demo is a working example of how to use the [[SQLite]] TSqlite3 dataset component in a master detail relationship.
5+This demo is a working example of how to use the [[SQLite]] TSqlite3 dataset component in a master detail relationship.
66
7-> **Note:** this component is not part of the general SQLDB database components. SQLDB provides TSQLite3Connection that match other databases connectors. You are strongly recommended to look into using TSQLite3Connection because of the ease of switching to other databases; only use TSQlite3 if it is really needed.
7+\--- sorry, it is NOT working, try to compile it with the latest version! ---
88
9-See [[MasterDetail]] for instructions on how to implement master/detail relationships using standard sqldb (e.g. sqlite3) components.
9+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** this component is not part of the general SQLDB database components. SQLDB provides TSQLite3Connection that match other databases connectors. You are strongly recommended to look into using TSQLite3Connection because of the ease of switching to other databases; only use TSQlite3 if it is really needed.
1010
11+See [[MasterDetail]] for instructions on how to implement master/detail relationships using standard sqldb (e.g. sqlite3) components.
12+
1113## Author
1214
13-David Stewart .. davesimplewear at yahoo dot com
15+[David Stewart](</User:Davesimplewear> "User:Davesimplewear") .. davesimplewear at yahoo dot com
1416
17+
18+
1519## Components Used
1620
17-- TSqlite3
18-- Standard Lazarus database components
21+ * TSqlite3
22+ * Standard Lazarus database components
1923
2024## Licence
2125
22-- Free to use as you will
26+ * Free to use as you will
2327
28+
29+
2430## Download
2531
26-The TSQLite3 example can be downloaded from [The Lazarus -ccr sf download location](http://sourceforge.net/projects/lazarus-ccr/files/Demos%20and%20examples/). Also from [David's Freeware](http://www.users.on.net/~dave.stewart/index.html).
32+The TSQLite3 example can be downloaded from [The Lazarus -ccr sf download location](<http://sourceforge.net/projects/lazarus-ccr/files/Demos%20and%20examples/>). Also from [David's Freeware](<http://www.users.on.net/~dave.stewart/index.html>).
2733
34+ 1. 1. 1. 1. these examples are written with LCL 0.9.27 and do NOT compile with modern Lazarus Versions i.e. 3.4 ####
35+
2836### Screen shots
2937
30-![](/wiki-images/b/b8/Screenshot-Master_Detail_Example_-_SQLLite3.png)
38+[![Screenshot-Master Detail Example - SQLLite3.png](/wiki-images/b/b8/Screenshot-Master_Detail_Example_-_SQLLite3.png)](</File:Screenshot-Master_Detail_Example_-_SQLLite3.png>)
3139
32-![](/wiki-images/8/82/Screenshot-Master_Detail_Example_-_SQLLite3-1.png)
40+[![Screenshot-Master Detail Example - SQLLite3-1.png](/wiki-images/8/82/Screenshot-Master_Detail_Example_-_SQLLite3-1.png)](</File:Screenshot-Master_Detail_Example_-_SQLLite3-1.png>)
3341
34-![](/wiki-images/7/71/Screenshot-Master_Detail_Example_-_SQLLite3-2.png)
42+[![Screenshot-Master Detail Example - SQLLite3-2.png](/wiki-images/7/71/Screenshot-Master_Detail_Example_-_SQLLite3-2.png)](</File:Screenshot-Master_Detail_Example_-_SQLLite3-2.png>)
3543
36-![](/wiki-images/1/14/Screenshot-Select_Customer_Name.png)
44+[![Screenshot-Select Customer Name.png](/wiki-images/1/14/Screenshot-Select_Customer_Name.png)](</File:Screenshot-Select_Customer_Name.png>)
3745
38-![](/wiki-images/2/2e/Screenshot-Select_Item_Number.png)
46+[![Screenshot-Select Item Number.png](/wiki-images/2/2e/Screenshot-Select_Item_Number.png)](</File:Screenshot-Select_Item_Number.png>)
3947
40-This screenshot shows the table setting for master detail
48+This screenshot shows the table setting for master detail
4149
42-![](/wiki-images/e/e6/Screenshot.png)
50+[![Screenshot.png](/wiki-images/e/e6/Screenshot.png)](</File:Screenshot.png>)
4351
4452### Example program code
45-
46-``` pascal
53+```
4754unit uMain;
48-
49-{$mode objfpc}{$H+}
50-
51-interface
52-
53-uses
54- Classes, SysUtils, db, sqlite3ds, FileUtil, LResources, Forms, Controls,
55- Graphics, Dialogs, ComCtrls, ExtCtrls, Menus, DbCtrls, StdCtrls, DBGrids;
56-
57-type
58-
59- { TfMain }
60-
61- TfMain = class(TForm)
62- btnSelCust: TButton;
63- btnAddSale: TButton;
64- btnSaveEntry: TButton;
65- btnDelEntry: TButton;
66- DBNavigator3: TDBNavigator;
67- dsCust: TDatasource;
68- dsSales: TDatasource;
69- dsStock: TDatasource;
70- DBEdit1: TDBEdit;
71- DBEdit10: TDBEdit;
72- DBEdit12: TDBEdit;
73- DBEdit13: TDBEdit;
74- DBEdit14: TDBEdit;
75- DBEdit15: TDBEdit;
76- DBEdit3: TDBEdit;
77- DBEdit4: TDBEdit;
78- DBEdit5: TDBEdit;
79- DBEdit6: TDBEdit;
80- DBEdit7: TDBEdit;
81- DBEdit8: TDBEdit;
82- DBEdit9: TDBEdit;
83- dgSales: TDBGrid;
84- DBNavigator1: TDBNavigator;
85- DBNavigator2: TDBNavigator;
86- Label1: TLabel;
87- Label10: TLabel;
88- Label11: TLabel;
89- Label2: TLabel;
90- Label3: TLabel;
91- Label4: TLabel;
92- Label5: TLabel;
93- Label7: TLabel;
94- Label8: TLabel;
95- Label9: TLabel;
96- miClose: TMenuItem;
97- miFile: TMenuItem;
98- mmMain: TMainMenu;
99- nbMain: TNotebook;
100- Panel1: TPanel;
101- pnlSales: TPanel;
102- pnlStock: TPanel;
103- pnlCustomer: TPanel;
104- pnlSelectCust: TPanel;
105- pStock: TPage;
106- pCustomer: TPage;
107- pSales: TPage;
108- sbMain: TStatusBar;
109- TCustAddr: TStringField;
110- TCustCustName: TStringField;
111- TCustcustState: TStringField;
112- TCustID: TAutoIncField;
113- TCustpostCode: TStringField;
114- TCustSuburb: TStringField;
115- TSalescustID: TLongintField;
116- TSalesID: TAutoIncField;
117- TSalesitem: TStringField;
118- TSalesitemNum: TStringField;
119- TSalesprice: TFloatField;
120- TSalessaleDate: TDateField;
121- TSalesshipDate: TDateField;
122- TStock: TSqlite3Dataset;
123- TSales: TSqlite3Dataset;
124- TCust: TSqlite3Dataset;
125- TStockID: TAutoIncField;
126- TStockitem: TStringField;
127- TStockitemNum: TStringField;
128- TStockprice: TFloatField;
129- procedure btnAddSaleClick(Sender: TObject);
130- procedure btnDelEntryClick(Sender: TObject);
131- procedure btnSaveEntryClick(Sender: TObject);
132- procedure btnSelCustClick(Sender: TObject);
133- procedure dgSalesEditButtonClick(Sender: TObject);
134- procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
135- procedure FormCreate(Sender: TObject);
136- procedure FormDestroy(Sender: TObject);
137- procedure FormShow(Sender: TObject);
138- procedure miCloseClick(Sender: TObject);
139- private
140- { private declarations }
141- public
142- { public declarations }
143- end;
144-
145-var
146- fMain: TfMain;
147-
148-implementation
149-uses uCust, uSales;
150-{ TfMain }
151-
152-procedure TfMain.miCloseClick(Sender: TObject);
153-begin
154- Close;
155-end;
156-
157-procedure TfMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
158-begin
159- CanClose := MessageDlg('Are You Sure ?',mtConfirmation,[mbYes,mbNo],0)=mrYes;
160-end;
161-
162-procedure TfMain.FormCreate(Sender: TObject);
163-var
164-n:integer;
165-c:TComponent;
166-FName:string;
167-begin
168- fName := ExtractFilePath(ParamStr(0)) +'data/md.db3';
169-for n := 0 to ComponentCount -1 do
55+
56+ {$mode objfpc}{$H+}
57+
58+ interface
59+
60+ uses
61+ Classes, SysUtils, db, sqlite3ds, FileUtil, LResources, Forms, Controls,
62+ Graphics, Dialogs, ComCtrls, ExtCtrls, Menus, DbCtrls, StdCtrls, DBGrids;
63+
64+ type
65+
66+ { TfMain }
67+
68+ TfMain = class(TForm)
69+ btnSelCust: TButton;
70+ btnAddSale: TButton;
71+ btnSaveEntry: TButton;
72+ btnDelEntry: TButton;
73+ DBNavigator3: TDBNavigator;
74+ dsCust: TDatasource;
75+ dsSales: TDatasource;
76+ dsStock: TDatasource;
77+ DBEdit1: TDBEdit;
78+ DBEdit10: TDBEdit;
79+ DBEdit12: TDBEdit;
80+ DBEdit13: TDBEdit;
81+ DBEdit14: TDBEdit;
82+ DBEdit15: TDBEdit;
83+ DBEdit3: TDBEdit;
84+ DBEdit4: TDBEdit;
85+ DBEdit5: TDBEdit;
86+ DBEdit6: TDBEdit;
87+ DBEdit7: TDBEdit;
88+ DBEdit8: TDBEdit;
89+ DBEdit9: TDBEdit;
90+ dgSales: TDBGrid;
91+ DBNavigator1: TDBNavigator;
92+ DBNavigator2: TDBNavigator;
93+ Label1: TLabel;
94+ Label10: TLabel;
95+ Label11: TLabel;
96+ Label2: TLabel;
97+ Label3: TLabel;
98+ Label4: TLabel;
99+ Label5: TLabel;
100+ Label7: TLabel;
101+ Label8: TLabel;
102+ Label9: TLabel;
103+ miClose: TMenuItem;
104+ miFile: TMenuItem;
105+ mmMain: TMainMenu;
106+ nbMain: TNotebook;
107+ Panel1: TPanel;
108+ pnlSales: TPanel;
109+ pnlStock: TPanel;
110+ pnlCustomer: TPanel;
111+ pnlSelectCust: TPanel;
112+ pStock: TPage;
113+ pCustomer: TPage;
114+ pSales: TPage;
115+ sbMain: TStatusBar;
116+ TCustAddr: TStringField;
117+ TCustCustName: TStringField;
118+ TCustcustState: TStringField;
119+ TCustID: TAutoIncField;
120+ TCustpostCode: TStringField;
121+ TCustSuburb: TStringField;
122+ TSalescustID: TLongintField;
123+ TSalesID: TAutoIncField;
124+ TSalesitem: TStringField;
125+ TSalesitemNum: TStringField;
126+ TSalesprice: TFloatField;
127+ TSalessaleDate: TDateField;
128+ TSalesshipDate: TDateField;
129+ TStock: TSqlite3Dataset;
130+ TSales: TSqlite3Dataset;
131+ TCust: TSqlite3Dataset;
132+ TStockID: TAutoIncField;
133+ TStockitem: TStringField;
134+ TStockitemNum: TStringField;
135+ TStockprice: TFloatField;
136+ procedure btnAddSaleClick(Sender: TObject);
137+ procedure btnDelEntryClick(Sender: TObject);
138+ procedure btnSaveEntryClick(Sender: TObject);
139+ procedure btnSelCustClick(Sender: TObject);
140+ procedure dgSalesEditButtonClick(Sender: TObject);
141+ procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
142+ procedure FormCreate(Sender: TObject);
143+ procedure FormDestroy(Sender: TObject);
144+ procedure FormShow(Sender: TObject);
145+ procedure miCloseClick(Sender: TObject);
146+ private
147+ { private declarations }
148+ public
149+ { public declarations }
150+ end;
151+
152+ var
153+ fMain: TfMain;
154+
155+ implementation
156+ uses uCust, uSales;
157+ { TfMain }
158+
159+ procedure TfMain.miCloseClick(Sender: TObject);
170160 begin
171- c := Components[n];
172- if c is TSqlite3Dataset then
173- TSqlite3Dataset(c).FileName:= fName;
161+ Close;
174162 end;
175- for n := 0 to ComponentCount -1 do
163+
164+ procedure TfMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
176165 begin
177- c := Components[n];
178- if c is TSqlite3Dataset then
179- TSqlite3Dataset(c).Open;
166+ CanClose := MessageDlg('Are You Sure ?',mtConfirmation,[mbYes,mbNo],0)=mrYes;
180167 end;
181-end;
182-
183-procedure TfMain.FormDestroy(Sender: TObject);
184-var
185-n:integer;
186-c:TComponent;
187-begin
188- for n := 0 to ComponentCount -1 do
168+
169+ procedure TfMain.FormCreate(Sender: TObject);
170+ var
171+ n:integer;
172+ c:TComponent;
173+ FName:string;
189174 begin
190- c := Components[n];
191- if c is TSqlite3Dataset then
192- TSqlite3Dataset(c).Close;
175+ fName := ExtractFilePath(ParamStr(0)) +'data/md.db3';
176+ for n := 0 to ComponentCount -1 do
177+ begin
178+ c := Components[n];
179+ if c is TSqlite3Dataset then
180+ TSqlite3Dataset(c).FileName:= fName;
181+ end;
182+ for n := 0 to ComponentCount -1 do
183+ begin
184+ c := Components[n];
185+ if c is TSqlite3Dataset then
186+ TSqlite3Dataset(c).Open;
187+ end;
193188 end;
194-end;
195-
196-procedure TfMain.FormShow(Sender: TObject);
197-begin
198- nbMain.PageIndex:=0;
199-end;
200-
201-procedure TfMain.dgSalesEditButtonClick(Sender: TObject);
202-begin
203- if SearchDlg.ShowModalParts =mrOk then
204- begin
205- TSales.Edit;
206- TSalesItemNum.Value := SearchDlg.PartNum;
207- TSalesItem.Value := TStockitem.Value;
208- TSalesPRICE.Value:= TStockPrice.Value;
209- end;
210-end;
211-
212-procedure TfMain.btnSelCustClick(Sender: TObject);
213-begin
214- custDlg.CustName := TCustCUSTNAME.Value ;
215- if CustDlg.ShowModalCust =mrOk then
216- begin
217- TCust.Edit;
218- TCustCUSTNAME.Value := custDlg.CustName;
189+
190+ procedure TfMain.FormDestroy(Sender: TObject);
191+ var
192+ n:integer;
193+ c:TComponent;
194+ begin
195+ for n := 0 to ComponentCount -1 do
196+ begin
197+ c := Components[n];
198+ if c is TSqlite3Dataset then
199+ TSqlite3Dataset(c).Close;
200+ end;
219201 end;
220-end;
221-
222-procedure TfMain.btnAddSaleClick(Sender: TObject);
223-begin
224- TSales.Append;
225-end;
226-
227-procedure TfMain.btnDelEntryClick(Sender: TObject);
228-begin
229- TSales.Delete;
230-end;
231-
232-procedure TfMain.btnSaveEntryClick(Sender: TObject);
233-begin
234- TSales.ApplyUpdates;
235-end;
236-
237-initialization
238- {$I uMain.lrs}
239-
240-end.
202+
203+ procedure TfMain.FormShow(Sender: TObject);
204+ begin
205+ nbMain.PageIndex:=0;
206+ end;
207+
208+ procedure TfMain.dgSalesEditButtonClick(Sender: TObject);
209+ begin
210+ if SearchDlg.ShowModalParts =mrOk then
211+ begin
212+ TSales.Edit;
213+ TSalesItemNum.Value := SearchDlg.PartNum;
214+ TSalesItem.Value := TStockitem.Value;
215+ TSalesPRICE.Value:= TStockPrice.Value;
216+ end;
217+ end;
218+
219+ procedure TfMain.btnSelCustClick(Sender: TObject);
220+ begin
221+ custDlg.CustName := TCustCUSTNAME.Value ;
222+ if CustDlg.ShowModalCust =mrOk then
223+ begin
224+ TCust.Edit;
225+ TCustCUSTNAME.Value := custDlg.CustName;
226+ end;
227+ end;
228+
229+ procedure TfMain.btnAddSaleClick(Sender: TObject);
230+ begin
231+ TSales.Append;
232+ end;
233+
234+ procedure TfMain.btnDelEntryClick(Sender: TObject);
235+ begin
236+ TSales.Delete;
237+ end;
238+
239+ procedure TfMain.btnSaveEntryClick(Sender: TObject);
240+ begin
241+ TSales.ApplyUpdates;
242+ end;
243+
244+ initialization
245+ {$I uMain.lrs}
246+
247+ end.
241248```
242249
243-uMain.lfm (edited)
244-
245-```lfm
246-object fMain: TfMain
247- Left = 395
248- Height = 332
249- Top = 218
250- Width = 534
251- ActiveControl = nbMain
252- BorderIcons = [biSystemMenu, biMinimize]
253- BorderStyle = bsSingle
254- Caption = 'Master Detail Example - SQLLite3'
255- ClientHeight = 305
256- ClientWidth = 534
257- Font.Height = -13
258- Font.Name = 'Sans'
259- Menu = mmMain
260- OnCloseQuery = FormCloseQuery
261- OnCreate = FormCreate
262- OnDestroy = FormDestroy
263- OnShow = FormShow
264- Position = poScreenCenter
265- LCLVersion = '0.9.27'
266- object sbMain: TStatusBar
267- Left = 0
268- Height = 19
269- Top = 286
270- Width = 534
271- AutoHint = True
272- Panels = <>
273- end
274- object nbMain: TNotebook
275- Left = 0
276- Height = 286
277- Top = 0
278- Width = 534
279- Align = alClient
280- PageIndex = 0
281- TabOrder = 1
282- object pSales: TPage
283- Caption = 'Sales'
284- ClientWidth = 532
285- ClientHeight = 259
286- object Label3: TLabel
250+uMain.lfm (edited) object fMain: TfMain
251+```
252+Left = 395
253+ Height = 332
254+ Top = 218
255+ Width = 534
256+ ActiveControl = nbMain
257+ BorderIcons = [biSystemMenu, biMinimize]
258+ BorderStyle = bsSingle
259+ Caption = 'Master Detail Example - SQLLite3'
260+ ClientHeight = 305
261+ ClientWidth = 534
262+ Font.Height = -13
263+ Font.Name = 'Sans'
264+ Menu = mmMain
265+ OnCloseQuery = FormCloseQuery
266+ OnCreate = FormCreate
267+ OnDestroy = FormDestroy
268+ OnShow = FormShow
269+ Position = poScreenCenter
270+ LCLVersion = '0.9.27'
271+ object sbMain: TStatusBar
287272 Left = 0
288- Height = 18
289- Top = 241
290- Width = 532
291- Align = alBottom
292- Caption = 'Select Customer First, then click in item number field to select item, then save'
293- ParentColor = False
273+ Height = 19
274+ Top = 286
275+ Width = 534
276+ AutoHint = True
277+ Panels = <>
294278 end
295- object pnlSelectCust: TPanel
296- Left = 15
297- Height = 216
298- Top = 14
299- Width = 232
300- BevelInner = bvLowered
301- BevelWidth = 2
302- ClientHeight = 216
303- ClientWidth = 232
304- TabOrder = 0
305- object Label1: TLabel
306- Left = 4
307- Height = 18
308- Top = 4
309- Width = 224
310- Align = alTop
311- Alignment = taCenter
312- Caption = 'Customer Detail'
313- Font.Height = -13
314- Font.Name = 'Sans'
315- Font.Style = [fsBold, fsItalic]
316- ParentColor = False
317- ParentFont = False
318- end
319- object Label2: TLabel
320- Left = 24
321- Height = 18
322- Top = 31
323- Width = 73
324- Caption = 'First Name'
325- Font.Height = -13
326- Font.Name = 'Sans'
327- Font.Style = [fsItalic]
328- ParentColor = False
329- ParentFont = False
330- end
331- object DBEdit1: TDBEdit
332- Left = 24
333- Height = 23
334- Hint = 'Cust name'
335- Top = 48
336- Width = 184
337- DataField = 'CustName'
338- DataSource = dsCust
339- ReadOnly = True
340- MaxLength = 8192
341- ParentShowHint = False
342- ShowHint = True
343- TabOrder = 0
344- end
345- object DBEdit3: TDBEdit
346- Left = 24
347- Height = 23
348- Hint = 'Address'
349- Top = 72
350- Width = 184
351- DataField = 'Addr'
352- DataSource = dsCust
353- ReadOnly = True
354- MaxLength = 8192
355- ParentShowHint = False
356- ShowHint = True
357- TabOrder = 1
358- end
359- object DBEdit4: TDBEdit
360- Left = 24
361- Height = 23
362- Hint = 'Suburb/Town'
363- Top = 96
364- Width = 184
365- DataField = 'Suburb'
366- DataSource = dsCust
367- ReadOnly = True
368- MaxLength = 8192
369- ParentShowHint = False
370- ShowHint = True
371- TabOrder = 2
372- end
373- object DBEdit5: TDBEdit
374- Left = 24
375- Height = 23
376- Hint = 'Postal Code'
377- Top = 120
378- Width = 80
379- DataField = 'postCode'
380- DataSource = dsCust
381- ReadOnly = True
382- MaxLength = 8192
383- ParentShowHint = False
384- ShowHint = True
385- TabOrder = 3
279+ object nbMain: TNotebook
280+ Left = 0
281+ Height = 286
282+ Top = 0
283+ Width = 534
284+ Align = alClient
285+ PageIndex = 0
286+ TabOrder = 1
287+ object pSales: TPage
288+ Caption = 'Sales'
289+ ClientWidth = 532
290+ ClientHeight = 259
291+ object Label3: TLabel
292+ Left = 0
293+ Height = 18
294+ Top = 241
295+ Width = 532
296+ Align = alBottom
297+ Caption = 'Select Customer First, then click in item number field to select item, then save'
298+ ParentColor = False
299+ end
300+ object pnlSelectCust: TPanel
301+ Left = 15
302+ Height = 216
303+ Top = 14
304+ Width = 232
305+ BevelInner = bvLowered
306+ BevelWidth = 2
307+ ClientHeight = 216
308+ ClientWidth = 232
309+ TabOrder = 0
310+ object Label1: TLabel
311+ Left = 4
312+ Height = 18
313+ Top = 4
314+ Width = 224
315+ Align = alTop
316+ Alignment = taCenter
317+ Caption = 'Customer Detail'
318+ Font.Height = -13
319+ Font.Name = 'Sans'
320+ Font.Style = [fsBold, fsItalic]
321+ ParentColor = False
322+ ParentFont = False
323+ end
324+ object Label2: TLabel
325+ Left = 24
326+ Height = 18
327+ Top = 31
328+ Width = 73
329+ Caption = 'First Name'
330+ Font.Height = -13
331+ Font.Name = 'Sans'
332+ Font.Style = [fsItalic]
333+ ParentColor = False
334+ ParentFont = False
335+ end
336+ object DBEdit1: TDBEdit
337+ Left = 24
338+ Height = 23
339+ Hint = 'Cust name'
340+ Top = 48
341+ Width = 184
342+ DataField = 'CustName'
343+ DataSource = dsCust
344+ ReadOnly = True
345+ MaxLength = 8192
346+ ParentShowHint = False
347+ ShowHint = True
348+ TabOrder = 0
349+ end
350+ object DBEdit3: TDBEdit
351+ Left = 24
352+ Height = 23
353+ Hint = 'Address'
354+ Top = 72
355+ Width = 184
356+ DataField = 'Addr'
357+ DataSource = dsCust
358+ ReadOnly = True
359+ MaxLength = 8192
360+ ParentShowHint = False
361+ ShowHint = True
362+ TabOrder = 1
363+ end
364+ object DBEdit4: TDBEdit
365+ Left = 24
366+ Height = 23
367+ Hint = 'Suburb/Town'
368+ Top = 96
369+ Width = 184
370+ DataField = 'Suburb'
371+ DataSource = dsCust
372+ ReadOnly = True
373+ MaxLength = 8192
374+ ParentShowHint = False
375+ ShowHint = True
376+ TabOrder = 2
377+ end
378+ object DBEdit5: TDBEdit
379+ Left = 24
380+ Height = 23
381+ Hint = 'Postal Code'
382+ Top = 120
383+ Width = 80
384+ DataField = 'postCode'
385+ DataSource = dsCust
386+ ReadOnly = True
387+ MaxLength = 8192
388+ ParentShowHint = False
389+ ShowHint = True
390+ TabOrder = 3
391+ end
392+ object DBEdit6: TDBEdit
393+ Left = 128
394+ Height = 23
395+ Hint = 'State'
396+ Top = 119
397+ Width = 80
398+ DataField = 'custState'
399+ DataSource = dsCust
400+ ReadOnly = True
401+ CharCase = ecUppercase
402+ MaxLength = 8192
403+ ParentShowHint = False
404+ ShowHint = True
405+ TabOrder = 4
406+ end
407+ object btnSelCust: TButton
408+ Left = 24
409+ Height = 25
410+ Hint = 'Click to select a Customer'
411+ Top = 176
412+ Width = 184
413+ Caption = 'Select Customer'
414+ OnClick = btnSelCustClick
415+ ParentShowHint = False
416+ ShowHint = True
417+ TabOrder = 5
418+ end
419+ object DBNavigator3: TDBNavigator
420+ Left = 30
421+ Height = 22
422+ Top = 150
423+ Width = 170
424+ BevelOuter = bvNone
425+ ClientHeight = 22
426+ ClientWidth = 170
427+ DataSource = dsCust
428+ TabOrder = 6
429+ VisibleButtons = [nbFirst, nbPrior, nbNext, nbLast]
430+ end
431+ end
432+ object pnlSales: TPanel
433+ Left = 255
434+ Height = 216
435+ Top = 14
436+ Width = 260
437+ BevelInner = bvLowered
438+ BevelWidth = 2
439+ ClientHeight = 216
440+ ClientWidth = 260
441+ TabOrder = 1
442+ object Label4: TLabel
443+ Left = 4
444+ Height = 18
445+ Top = 4
446+ Width = 252
447+ Align = alTop
448+ Alignment = taCenter
449+ Caption = 'Sales Detail'
450+ Font.Height = -13
451+ Font.Name = 'Sans'
452+ Font.Style = [fsBold, fsItalic]
453+ ParentColor = False
454+ ParentFont = False
455+ end
456+ object btnAddSale: TButton
457+ Left = 16
458+ Height = 25
459+ Hint = 'Add Another Sale'
460+ Top = 176
461+ Width = 72
462+ Caption = 'Add Sale'
463+ OnClick = btnAddSaleClick
464+ ParentShowHint = False
465+ ShowHint = True
466+ TabOrder = 0
467+ end
468+ object Panel1: TPanel
469+ Left = 4
470+ Height = 13
471+ Top = 22
472+ Width = 252
473+ Align = alTop
474+ BevelOuter = bvNone
475+ TabOrder = 1
476+ end
477+ object dgSales: TDBGrid
478+ Left = 4
479+ Height = 125
480+ Hint = 'Click Item Number Button to Select Item'
481+ Top = 35
482+ Width = 252
483+ Align = alTop
484+ Columns = <
485+ item
486+ ButtonStyle = cbsEllipsis
487+ Title.Caption = 'item Number'
488+ Width = 100
489+ FieldName = 'itemNum'
490+ end
491+ item
492+ Width = 150
493+ FieldName = 'item'
494+ end
495+ item
496+ FieldName = 'price'
497+ end
498+ item
499+ Title.Caption = 'sale Date'
500+ FieldName = 'saleDate'
501+ end
502+ item
503+ Title.Caption = 'ship Date'
504+ FieldName = 'shipDate'
505+ end>
506+ DataSource = dsSales
507+ ShowHint = True
508+ TabOrder = 2
509+ TitleFont.Height = -13
510+ TitleFont.Name = 'Sans'
511+ OnEditButtonClick = dgSalesEditButtonClick
512+ end
513+ object btnSaveEntry: TButton
514+ Left = 95
515+ Height = 25
516+ Hint = 'Save Entry'
517+ Top = 176
518+ Width = 51
519+ Caption = 'Save'
520+ OnClick = btnSaveEntryClick
521+ ParentShowHint = False
522+ ShowHint = True
523+ TabOrder = 3
524+ end
525+ object btnDelEntry: TButton
526+ Left = 168
527+ Height = 25
528+ Hint = 'Delete Entry'
529+ Top = 176
530+ Width = 75
531+ Caption = 'Delete'
532+ OnClick = btnDelEntryClick
533+ ParentShowHint = False
534+ ShowHint = True
535+ TabOrder = 4
536+ end
537+ end
386538 end
387- object DBEdit6: TDBEdit
388- Left = 128
389- Height = 23
390- Hint = 'State'
391- Top = 119
392- Width = 80
393- DataField = 'custState'
394- DataSource = dsCust
395- ReadOnly = True
396- CharCase = ecUppercase
397- MaxLength = 8192
398- ParentShowHint = False
399- ShowHint = True
400- TabOrder = 4
539+ object pCustomer: TPage
540+ Caption = 'Customer'
541+ ClientWidth = 532
542+ ClientHeight = 259
543+ object pnlCustomer: TPanel
544+ Left = 95
545+ Height = 194
546+ Top = 30
547+ Width = 339
548+ BevelInner = bvLowered
549+ BevelWidth = 2
550+ ClientHeight = 194
551+ ClientWidth = 339
552+ TabOrder = 0
553+ object Label5: TLabel
554+ Left = 72
555+ Height = 18
556+ Top = 31
557+ Width = 73
558+ Caption = 'First Name'
559+ Font.Height = -13
560+ Font.Name = 'Sans'
561+ Font.Style = [fsItalic]
562+ ParentColor = False
563+ ParentFont = False
564+ end
565+ object Label7: TLabel
566+ Left = 4
567+ Height = 18
568+ Top = 4
569+ Width = 331
570+ Align = alTop
571+ Alignment = taCenter
572+ Caption = 'Customer Entry'
573+ Font.Height = -13
574+ Font.Name = 'Sans'
575+ Font.Style = [fsBold, fsItalic]
576+ ParentColor = False
577+ ParentFont = False
578+ end
579+ object DBEdit10: TDBEdit
580+ Left = 72
581+ Height = 23
582+ Hint = 'Cust name'
583+ Top = 48
584+ Width = 184
585+ DataField = 'CustName'
586+ DataSource = dsCust
587+ MaxLength = 8192
588+ ParentShowHint = False
589+ ShowHint = True
590+ TabOrder = 0
591+ end
592+ object DBEdit12: TDBEdit
593+ Left = 72
594+ Height = 23
595+ Hint = 'Address'
596+ Top = 72
597+ Width = 184
598+ DataField = 'Addr'
599+ DataSource = dsCust
600+ MaxLength = 8192
601+ ParentShowHint = False
602+ ShowHint = True
603+ TabOrder = 1
604+ end
605+ object DBEdit13: TDBEdit
606+ Left = 72
607+ Height = 23
608+ Hint = 'Suburb/Town'
609+ Top = 96
610+ Width = 184
611+ DataField = 'Suburb'
612+ DataSource = dsCust
613+ MaxLength = 8192
614+ ParentShowHint = False
615+ ShowHint = True
616+ TabOrder = 2
617+ end
618+ object DBEdit14: TDBEdit
619+ Left = 72
620+ Height = 23
621+ Hint = 'Postal Code'
622+ Top = 120
623+ Width = 80
624+ DataField = 'postCode'
625+ DataSource = dsCust
626+ MaxLength = 8192
627+ ParentShowHint = False
628+ ShowHint = True
629+ TabOrder = 3
630+ end
631+ object DBEdit15: TDBEdit
632+ Left = 176
633+ Height = 23
634+ Hint = 'State'
635+ Top = 119
636+ Width = 80
637+ DataField = 'custState'
638+ DataSource = dsCust
639+ CharCase = ecUppercase
640+ MaxLength = 8192
641+ ParentShowHint = False
642+ ShowHint = True
643+ TabOrder = 4
644+ end
645+ object DBNavigator2: TDBNavigator
646+ Left = 45
647+ Height = 25
648+ Top = 154
649+ Width = 241
650+ BevelOuter = bvNone
651+ ClientHeight = 25
652+ ClientWidth = 241
653+ DataSource = dsCust
654+ TabOrder = 5
655+ end
656+ end
401657 end
402- object btnSelCust: TButton
403- Left = 24
404- Height = 25
405- Hint = 'Click to select a Customer'
406- Top = 176
407- Width = 184
408- Caption = 'Select Customer'
409- OnClick = btnSelCustClick
410- ParentShowHint = False
411- ShowHint = True
412- TabOrder = 5
658+ object pStock: TPage
659+ Caption = 'Stock'
660+ ClientWidth = 532
661+ ClientHeight = 259
662+ object pnlStock: TPanel
663+ Left = 95
664+ Height = 218
665+ Top = 22
666+ Width = 339
667+ BevelInner = bvLowered
668+ BevelWidth = 2
669+ ClientHeight = 218
670+ ClientWidth = 339
671+ TabOrder = 0
672+ object Label8: TLabel
673+ Left = 4
674+ Height = 18
675+ Top = 4
676+ Width = 331
677+ Align = alTop
678+ Alignment = taCenter
679+ Caption = 'Stock Entry'
680+ Font.Height = -13
681+ Font.Name = 'Sans'
682+ Font.Style = [fsBold, fsItalic]
683+ ParentColor = False
684+ ParentFont = False
685+ end
686+ object Label9: TLabel
687+ Left = 75
688+ Height = 18
689+ Top = 24
690+ Width = 83
691+ Caption = 'Part Number'
692+ Font.Height = -13
693+ Font.Name = 'Sans'
694+ Font.Style = [fsItalic]
695+ ParentColor = False
696+ ParentFont = False
697+ end
698+ object Label10: TLabel
699+ Left = 75
700+ Height = 18
701+ Top = 72
702+ Width = 75
703+ Caption = 'Description'
704+ Font.Height = -13
705+ Font.Name = 'Sans'
706+ Font.Style = [fsItalic]
707+ ParentColor = False
708+ ParentFont = False
709+ end
710+ object Label11: TLabel
711+ Left = 75
712+ Height = 18
713+ Top = 128
714+ Width = 33
715+ Caption = 'Price'
716+ Font.Height = -13
717+ Font.Name = 'Sans'
718+ Font.Style = [fsItalic]
719+ ParentColor = False
720+ ParentFont = False
721+ end
722+ object DBEdit7: TDBEdit
723+ Left = 75
724+ Height = 23
725+ Top = 40
726+ Width = 181
727+ DataField = 'itemNum'
728+ DataSource = dsStock
729+ MaxLength = 8192
730+ ParentShowHint = False
731+ ShowHint = True
732+ TabOrder = 0
733+ end
734+ object DBEdit8: TDBEdit
735+ Left = 75
736+ Height = 23
737+ Top = 89
738+ Width = 181
739+ DataField = 'item'
740+ DataSource = dsStock
741+ MaxLength = 8192
742+ ParentShowHint = False
743+ ShowHint = True
744+ TabOrder = 1
745+ end
746+ object DBEdit9: TDBEdit
747+ Left = 75
748+ Height = 23
749+ Top = 145
750+ Width = 181
751+ DataField = 'price'
752+ DataSource = dsStock
753+ ParentShowHint = False
754+ ShowHint = True
755+ TabOrder = 2
756+ end
757+ object DBNavigator1: TDBNavigator
758+ Left = 48
759+ Height = 25
760+ Top = 183
761+ Width = 241
762+ BevelOuter = bvNone
763+ ClientHeight = 25
764+ ClientWidth = 241
765+ DataSource = dsStock
766+ ParentShowHint = False
767+ ShowHint = True
768+ TabOrder = 3
769+ end
770+ end
413771 end
414- object DBNavigator3: TDBNavigator
415- Left = 30
416- Height = 22
417- Top = 150
418- Width = 170
419- BevelOuter = bvNone
420- ClientHeight = 22
421- ClientWidth = 170
422- DataSource = dsCust
423- TabOrder = 6
424- VisibleButtons = [nbFirst, nbPrior, nbNext, nbLast]
772+ end
773+ object mmMain: TMainMenu
774+ left = 16
775+ top = 277
776+ object miFile: TMenuItem
777+ Caption = '&File'
778+ object miClose: TMenuItem
779+ Caption = '&Close'
780+ GlyphShowMode = gsmAlways
781+ Hint = 'Close Application'
782+ OnClick = miCloseClick
783+ end
425784 end
426785 end
427- object pnlSales: TPanel
428- Left = 255
429- Height = 216
430- Top = 14
431- Width = 260
432- BevelInner = bvLowered
433- BevelWidth = 2
434- ClientHeight = 216
435- ClientWidth = 260
436- TabOrder = 1
437- object Label4: TLabel
438- Left = 4
439- Height = 18
440- Top = 4
441- Width = 252
442- Align = alTop
443- Alignment = taCenter
444- Caption = 'Sales Detail'
445- Font.Height = -13
446- Font.Name = 'Sans'
447- Font.Style = [fsBold, fsItalic]
448- ParentColor = False
449- ParentFont = False
786+ object dsCust: TDatasource
787+ DataSet = TCust
788+ left = 16
789+ top = 53
790+ end
791+ object dsSales: TDatasource
792+ DataSet = TSales
793+ left = 16
794+ top = 141
795+ end
796+ object dsStock: TDatasource
797+ DataSet = TStock
798+ left = 16
799+ top = 214
800+ end
801+ object TCust: TSqlite3Dataset
802+ AutoIncrementKey = True
803+ Options = []
804+ PrimaryKey = 'ID'
805+ SaveOnClose = True
806+ SaveOnRefetch = True
807+ SQL = 'Select * from cust;'
808+ TableName = 'cust'
809+ FieldDefs = <
810+ item
811+ Name = 'ID'
812+ DataType = ftAutoInc
813+ Precision = -1
814+ Size = 0
815+ end
816+ item
817+ Name = 'CustName'
818+ DataType = ftString
819+ Precision = -1
820+ Size = 8192
821+ end
822+ item
823+ Name = 'Addr'
824+ DataType = ftString
825+ Precision = -1
826+ Size = 8192
827+ end
828+ item
829+ Name = 'Suburb'
830+ DataType = ftString
831+ Precision = -1
832+ Size = 8192
833+ end
834+ item
835+ Name = 'postCode'
836+ DataType = ftString
837+ Precision = -1
838+ Size = 8192
839+ end
840+ item
841+ Name = 'custState'
842+ DataType = ftString
843+ Precision = -1
844+ Size = 8192
845+ end>
846+ left = 66
847+ top = 53
848+ object TCustID: TAutoIncField
849+ DisplayWidth = 10
850+ FieldKind = fkData
851+ FieldName = 'ID'
852+ Index = 0
853+ LookupCache = False
854+ ProviderFlags = [pfInUpdate, pfInWhere]
855+ ReadOnly = False
856+ Required = False
450857 end
451- object btnAddSale: TButton
452- Left = 16
453- Height = 25
454- Hint = 'Add Another Sale'
455- Top = 176
456- Width = 72
457- Caption = 'Add Sale'
458- OnClick = btnAddSaleClick
459- ParentShowHint = False
460- ShowHint = True
461- TabOrder = 0
858+ object TCustCustName: TStringField
859+ DisplayWidth = 8192
860+ FieldKind = fkData
861+ FieldName = 'CustName'
862+ Index = 1
863+ LookupCache = False
864+ ProviderFlags = [pfInUpdate, pfInWhere]
865+ ReadOnly = False
866+ Required = False
867+ Size = 8192
462868 end
463- object Panel1: TPanel
464- Left = 4
465- Height = 13
466- Top = 22
467- Width = 252
468- Align = alTop
469- BevelOuter = bvNone
470- TabOrder = 1
869+ object TCustAddr: TStringField
870+ DisplayWidth = 8192
871+ FieldKind = fkData
872+ FieldName = 'Addr'
873+ Index = 2
874+ LookupCache = False
875+ ProviderFlags = [pfInUpdate, pfInWhere]
876+ ReadOnly = False
877+ Required = False
878+ Size = 8192
471879 end
472- object dgSales: TDBGrid
473- Left = 4
474- Height = 125
475- Hint = 'Click Item Number Button to Select Item'
476- Top = 35
477- Width = 252
478- Align = alTop
479- Columns = <
480- item
481- ButtonStyle = cbsEllipsis
482- Title.Caption = 'item Number'
483- Width = 100
484- FieldName = 'itemNum'
485- end
486- item
487- Width = 150
488- FieldName = 'item'
489- end
490- item
491- FieldName = 'price'
492- end
493- item
494- Title.Caption = 'sale Date'
495- FieldName = 'saleDate'
496- end
497- item
498- Title.Caption = 'ship Date'
499- FieldName = 'shipDate'
500- end>
501- DataSource = dsSales
502- ShowHint = True
503- TabOrder = 2
504- TitleFont.Height = -13
505- TitleFont.Name = 'Sans'
506- OnEditButtonClick = dgSalesEditButtonClick
880+ object TCustSuburb: TStringField
881+ DisplayWidth = 8192
882+ FieldKind = fkData
883+ FieldName = 'Suburb'
884+ Index = 3
885+ LookupCache = False
886+ ProviderFlags = [pfInUpdate, pfInWhere]
887+ ReadOnly = False
888+ Required = False
889+ Size = 8192
507890 end
508- object btnSaveEntry: TButton
509- Left = 95
510- Height = 25
511- Hint = 'Save Entry'
512- Top = 176
513- Width = 51
514- Caption = 'Save'
515- OnClick = btnSaveEntryClick
516- ParentShowHint = False
517- ShowHint = True
518- TabOrder = 3
891+ object TCustpostCode: TStringField
892+ DisplayWidth = 8192
893+ FieldKind = fkData
894+ FieldName = 'postCode'
895+ Index = 4
896+ LookupCache = False
897+ ProviderFlags = [pfInUpdate, pfInWhere]
898+ ReadOnly = False
899+ Required = False
900+ Size = 8192
519901 end
520- object btnDelEntry: TButton
521- Left = 168
522- Height = 25
523- Hint = 'Delete Entry'
524- Top = 176
525- Width = 75
526- Caption = 'Delete'
527- OnClick = btnDelEntryClick
528- ParentShowHint = False
529- ShowHint = True
530- TabOrder = 4
902+ object TCustcustState: TStringField
903+ DisplayWidth = 8192
904+ FieldKind = fkData
905+ FieldName = 'custState'
906+ Index = 5
907+ LookupCache = False
908+ ProviderFlags = [pfInUpdate, pfInWhere]
909+ ReadOnly = False
910+ Required = False
911+ Size = 8192
531912 end
532913 end
533- end
534- object pCustomer: TPage
535- Caption = 'Customer'
536- ClientWidth = 532
537- ClientHeight = 259
538- object pnlCustomer: TPanel
539- Left = 95
540- Height = 194
541- Top = 30
542- Width = 339
543- BevelInner = bvLowered
544- BevelWidth = 2
545- ClientHeight = 194
546- ClientWidth = 339
547- TabOrder = 0
548- object Label5: TLabel
549- Left = 72
550- Height = 18
551- Top = 31
552- Width = 73
553- Caption = 'First Name'
554- Font.Height = -13
555- Font.Name = 'Sans'
556- Font.Style = [fsItalic]
557- ParentColor = False
558- ParentFont = False
559- end
560- object Label7: TLabel
561- Left = 4
562- Height = 18
563- Top = 4
564- Width = 331
565- Align = alTop
566- Alignment = taCenter
567- Caption = 'Customer Entry'
568- Font.Height = -13
569- Font.Name = 'Sans'
570- Font.Style = [fsBold, fsItalic]
571- ParentColor = False
572- ParentFont = False
914+ object TSales: TSqlite3Dataset
915+ AutoIncrementKey = True
916+ IndexFieldNames = 'CustID'
917+ Options = []
918+ PrimaryKey = 'ID'
919+ SaveOnClose = True
920+ SaveOnRefetch = True
921+ SQL = 'Select * from sales;'
922+ TableName = 'sales'
923+ MasterSource = dsCust
924+ MasterFields = 'ID'
925+ FieldDefs = <
926+ item
927+ Name = 'itemNum'
928+ DataType = ftString
929+ Precision = -1
930+ Size = 8192
931+ end
932+ item
933+ Name = 'ID'
934+ DataType = ftAutoInc
935+ Precision = -1
936+ Size = 0
937+ end
938+ item
939+ Name = 'custID'
940+ DataType = ftInteger
941+ Precision = -1
942+ Size = 0
943+ end
944+ item
945+ Name = 'saleDate'
946+ DataType = ftDate
947+ Precision = -1
948+ Size = 0
949+ end
950+ item
951+ Name = 'shipDate'
952+ DataType = ftDate
953+ Precision = -1
954+ Size = 0
955+ end
956+ item
957+ Name = 'item'
958+ DataType = ftString
959+ Precision = -1
960+ Size = 8192
961+ end
962+ item
963+ Name = 'price'
964+ DataType = ftFloat
965+ Precision = -1
966+ Size = 0
967+ end>
968+ left = 66
969+ top = 141
970+ object TSalesitemNum: TStringField
971+ DisplayWidth = 8192
972+ FieldKind = fkData
973+ FieldName = 'itemNum'
974+ Index = 0
975+ LookupCache = False
976+ ProviderFlags = [pfInUpdate, pfInWhere]
977+ ReadOnly = False
978+ Required = False
979+ Size = 8192
573980 end
574- object DBEdit10: TDBEdit
575- Left = 72
576- Height = 23
577- Hint = 'Cust name'
578- Top = 48
579- Width = 184
580- DataField = 'CustName'
581- DataSource = dsCust
582- MaxLength = 8192
583- ParentShowHint = False
584- ShowHint = True
585- TabOrder = 0
981+ object TSalesID: TAutoIncField
982+ DisplayWidth = 10
983+ FieldKind = fkData
984+ FieldName = 'ID'
985+ Index = 1
986+ LookupCache = False
987+ ProviderFlags = [pfInUpdate, pfInWhere]
988+ ReadOnly = False
989+ Required = False
586990 end
587- object DBEdit12: TDBEdit
588- Left = 72
589- Height = 23
590- Hint = 'Address'
591- Top = 72
592- Width = 184
593- DataField = 'Addr'
594- DataSource = dsCust
595- MaxLength = 8192
596- ParentShowHint = False
597- ShowHint = True
598- TabOrder = 1
991+ object TSalescustID: TLongintField
992+ DisplayWidth = 10
993+ FieldKind = fkData
994+ FieldName = 'custID'
995+ Index = 2
996+ LookupCache = False
997+ ProviderFlags = [pfInUpdate, pfInWhere]
998+ ReadOnly = False
999+ Required = False
5991000 end
600- object DBEdit13: TDBEdit
601- Left = 72
602- Height = 23
603- Hint = 'Suburb/Town'
604- Top = 96
605- Width = 184
606- DataField = 'Suburb'
607- DataSource = dsCust
608- MaxLength = 8192
609- ParentShowHint = False
610- ShowHint = True
611- TabOrder = 2
1001+ object TSalessaleDate: TDateField
1002+ DisplayWidth = 10
1003+ FieldKind = fkData
1004+ FieldName = 'saleDate'
1005+ Index = 3
1006+ LookupCache = False
1007+ ProviderFlags = [pfInUpdate, pfInWhere]
1008+ ReadOnly = False
1009+ Required = False
6121010 end
613- object DBEdit14: TDBEdit
614- Left = 72
615- Height = 23
616- Hint = 'Postal Code'
617- Top = 120
618- Width = 80
619- DataField = 'postCode'
620- DataSource = dsCust
621- MaxLength = 8192
622- ParentShowHint = False
623- ShowHint = True
624- TabOrder = 3
1011+ object TSalesshipDate: TDateField
1012+ DisplayWidth = 10
1013+ FieldKind = fkData
1014+ FieldName = 'shipDate'
1015+ Index = 4
1016+ LookupCache = False
1017+ ProviderFlags = [pfInUpdate, pfInWhere]
1018+ ReadOnly = False
1019+ Required = False
6251020 end
626- object DBEdit15: TDBEdit
627- Left = 176
628- Height = 23
629- Hint = 'State'
630- Top = 119
631- Width = 80
632- DataField = 'custState'
633- DataSource = dsCust
634- CharCase = ecUppercase
635- MaxLength = 8192
636- ParentShowHint = False
637- ShowHint = True
638- TabOrder = 4
1021+ object TSalesitem: TStringField
1022+ DisplayWidth = 8192
1023+ FieldKind = fkData
1024+ FieldName = 'item'
1025+ Index = 5
1026+ LookupCache = False
1027+ ProviderFlags = [pfInUpdate, pfInWhere]
1028+ ReadOnly = False
1029+ Required = False
1030+ Size = 8192
6391031 end
640- object DBNavigator2: TDBNavigator
641- Left = 45
642- Height = 25
643- Top = 154
644- Width = 241
645- BevelOuter = bvNone
646- ClientHeight = 25
647- ClientWidth = 241
648- DataSource = dsCust
649- TabOrder = 5
1032+ object TSalesprice: TFloatField
1033+ DisplayWidth = 10
1034+ FieldKind = fkData
1035+ FieldName = 'price'
1036+ Index = 6
1037+ LookupCache = False
1038+ ProviderFlags = [pfInUpdate, pfInWhere]
1039+ ReadOnly = False
1040+ Required = False
1041+ Currency = True
1042+ MaxValue = 0
1043+ MinValue = 0
1044+ Precision = -1
6501045 end
6511046 end
652- end
653- object pStock: TPage
654- Caption = 'Stock'
655- ClientWidth = 532
656- ClientHeight = 259
657- object pnlStock: TPanel
658- Left = 95
659- Height = 218
660- Top = 22
661- Width = 339
662- BevelInner = bvLowered
663- BevelWidth = 2
664- ClientHeight = 218
665- ClientWidth = 339
666- TabOrder = 0
667- object Label8: TLabel
668- Left = 4
669- Height = 18
670- Top = 4
671- Width = 331
672- Align = alTop
673- Alignment = taCenter
674- Caption = 'Stock Entry'
675- Font.Height = -13
676- Font.Name = 'Sans'
677- Font.Style = [fsBold, fsItalic]
678- ParentColor = False
679- ParentFont = False
680- end
681- object Label9: TLabel
682- Left = 75
683- Height = 18
684- Top = 24
685- Width = 83
686- Caption = 'Part Number'
687- Font.Height = -13
688- Font.Name = 'Sans'
689- Font.Style = [fsItalic]
690- ParentColor = False
691- ParentFont = False
692- end
693- object Label10: TLabel
694- Left = 75
695- Height = 18
696- Top = 72
697- Width = 75
698- Caption = 'Description'
699- Font.Height = -13
700- Font.Name = 'Sans'
701- Font.Style = [fsItalic]
702- ParentColor = False
703- ParentFont = False
704- end
705- object Label11: TLabel
706- Left = 75
707- Height = 18
708- Top = 128
709- Width = 33
710- Caption = 'Price'
711- Font.Height = -13
712- Font.Name = 'Sans'
713- Font.Style = [fsItalic]
714- ParentColor = False
715- ParentFont = False
716- end
717- object DBEdit7: TDBEdit
718- Left = 75
719- Height = 23
720- Top = 40
721- Width = 181
722- DataField = 'itemNum'
723- DataSource = dsStock
724- MaxLength = 8192
725- ParentShowHint = False
726- ShowHint = True
727- TabOrder = 0
1047+ object TStock: TSqlite3Dataset
1048+ AutoIncrementKey = True
1049+ Options = []
1050+ PrimaryKey = 'ID'
1051+ SaveOnClose = True
1052+ SaveOnRefetch = True
1053+ SQL = 'Select * from stock;'
1054+ TableName = 'stock'
1055+ FieldDefs = <
1056+ item
1057+ Name = 'ID'
1058+ DataType = ftAutoInc
1059+ Precision = -1
1060+ Size = 0
1061+ end
1062+ item
1063+ Name = 'item'
1064+ DataType = ftString
1065+ Precision = -1
1066+ Size = 8192
1067+ end
1068+ item
1069+ Name = 'price'
1070+ DataType = ftFloat
1071+ Precision = -1
1072+ Size = 0
1073+ end
1074+ item
1075+ Name = 'itemNum'
1076+ DataType = ftString
1077+ Precision = -1
1078+ Size = 8192
1079+ end>
1080+ left = 66
1081+ top = 214
1082+ object TStockID: TAutoIncField
1083+ DisplayWidth = 10
1084+ FieldKind = fkData
1085+ FieldName = 'ID'
1086+ Index = 0
1087+ LookupCache = False
1088+ ProviderFlags = [pfInUpdate, pfInWhere]
1089+ ReadOnly = False
1090+ Required = False
7281091 end
729- object DBEdit8: TDBEdit
730- Left = 75
731- Height = 23
732- Top = 89
733- Width = 181
734- DataField = 'item'
735- DataSource = dsStock
736- MaxLength = 8192
737- ParentShowHint = False
738- ShowHint = True
739- TabOrder = 1
1092+ object TStockitem: TStringField
1093+ DisplayWidth = 8192
1094+ FieldKind = fkData
1095+ FieldName = 'item'
1096+ Index = 1
1097+ LookupCache = False
1098+ ProviderFlags = [pfInUpdate, pfInWhere]
1099+ ReadOnly = False
1100+ Required = False
1101+ Size = 8192
7401102 end
741- object DBEdit9: TDBEdit
742- Left = 75
743- Height = 23
744- Top = 145
745- Width = 181
746- DataField = 'price'
747- DataSource = dsStock
748- ParentShowHint = False
749- ShowHint = True
750- TabOrder = 2
1103+ object TStockprice: TFloatField
1104+ DisplayWidth = 10
1105+ FieldKind = fkData
1106+ FieldName = 'price'
1107+ Index = 2
1108+ LookupCache = False
1109+ ProviderFlags = [pfInUpdate, pfInWhere]
1110+ ReadOnly = False
1111+ Required = False
1112+ Currency = True
1113+ MaxValue = 0
1114+ MinValue = 0
1115+ Precision = -1
7511116 end
752- object DBNavigator1: TDBNavigator
753- Left = 48
754- Height = 25
755- Top = 183
756- Width = 241
757- BevelOuter = bvNone
758- ClientHeight = 25
759- ClientWidth = 241
760- DataSource = dsStock
761- ParentShowHint = False
762- ShowHint = True
763- TabOrder = 3
1117+ object TStockitemNum: TStringField
1118+ DisplayWidth = 8192
1119+ FieldKind = fkData
1120+ FieldName = 'itemNum'
1121+ Index = 3
1122+ LookupCache = False
1123+ ProviderFlags = [pfInUpdate, pfInWhere]
1124+ ReadOnly = False
1125+ Required = False
1126+ Size = 8192
7641127 end
7651128 end
766- end
767- end
768- object mmMain: TMainMenu
769- left = 16
770- top = 277
771- object miFile: TMenuItem
772- Caption = '&File'
773- object miClose: TMenuItem
774- Caption = '&Close'
775- GlyphShowMode = gsmAlways
776- Hint = 'Close Application'
777- OnClick = miCloseClick
778- end
779- end
780- end
781- object dsCust: TDatasource
782- DataSet = TCust
783- left = 16
784- top = 53
785- end
786- object dsSales: TDatasource
787- DataSet = TSales
788- left = 16
789- top = 141
790- end
791- object dsStock: TDatasource
792- DataSet = TStock
793- left = 16
794- top = 214
795- end
796- object TCust: TSqlite3Dataset
797- AutoIncrementKey = True
798- Options = []
799- PrimaryKey = 'ID'
800- SaveOnClose = True
801- SaveOnRefetch = True
802- SQL = 'Select * from cust;'
803- TableName = 'cust'
804- FieldDefs = <
805- item
806- Name = 'ID'
807- DataType = ftAutoInc
808- Precision = -1
809- Size = 0
810- end
811- item
812- Name = 'CustName'
813- DataType = ftString
814- Precision = -1
815- Size = 8192
816- end
817- item
818- Name = 'Addr'
819- DataType = ftString
820- Precision = -1
821- Size = 8192
822- end
823- item
824- Name = 'Suburb'
825- DataType = ftString
826- Precision = -1
827- Size = 8192
828- end
829- item
830- Name = 'postCode'
831- DataType = ftString
832- Precision = -1
833- Size = 8192
834- end
835- item
836- Name = 'custState'
837- DataType = ftString
838- Precision = -1
839- Size = 8192
840- end>
841- left = 66
842- top = 53
843- object TCustID: TAutoIncField
844- DisplayWidth = 10
845- FieldKind = fkData
846- FieldName = 'ID'
847- Index = 0
848- LookupCache = False
849- ProviderFlags = [pfInUpdate, pfInWhere]
850- ReadOnly = False
851- Required = False
852- end
853- object TCustCustName: TStringField
854- DisplayWidth = 8192
855- FieldKind = fkData
856- FieldName = 'CustName'
857- Index = 1
858- LookupCache = False
859- ProviderFlags = [pfInUpdate, pfInWhere]
860- ReadOnly = False
861- Required = False
862- Size = 8192
863- end
864- object TCustAddr: TStringField
865- DisplayWidth = 8192
866- FieldKind = fkData
867- FieldName = 'Addr'
868- Index = 2
869- LookupCache = False
870- ProviderFlags = [pfInUpdate, pfInWhere]
871- ReadOnly = False
872- Required = False
873- Size = 8192
874- end
875- object TCustSuburb: TStringField
876- DisplayWidth = 8192
877- FieldKind = fkData
878- FieldName = 'Suburb'
879- Index = 3
880- LookupCache = False
881- ProviderFlags = [pfInUpdate, pfInWhere]
882- ReadOnly = False
883- Required = False
884- Size = 8192
885- end
886- object TCustpostCode: TStringField
887- DisplayWidth = 8192
888- FieldKind = fkData
889- FieldName = 'postCode'
890- Index = 4
891- LookupCache = False
892- ProviderFlags = [pfInUpdate, pfInWhere]
893- ReadOnly = False
894- Required = False
895- Size = 8192
896- end
897- object TCustcustState: TStringField
898- DisplayWidth = 8192
899- FieldKind = fkData
900- FieldName = 'custState'
901- Index = 5
902- LookupCache = False
903- ProviderFlags = [pfInUpdate, pfInWhere]
904- ReadOnly = False
905- Required = False
906- Size = 8192
907- end
908- end
909- object TSales: TSqlite3Dataset
910- AutoIncrementKey = True
911- IndexFieldNames = 'CustID'
912- Options = []
913- PrimaryKey = 'ID'
914- SaveOnClose = True
915- SaveOnRefetch = True
916- SQL = 'Select * from sales;'
917- TableName = 'sales'
918- MasterSource = dsCust
919- MasterFields = 'ID'
920- FieldDefs = <
921- item
922- Name = 'itemNum'
923- DataType = ftString
924- Precision = -1
925- Size = 8192
926- end
927- item
928- Name = 'ID'
929- DataType = ftAutoInc
930- Precision = -1
931- Size = 0
932- end
933- item
934- Name = 'custID'
935- DataType = ftInteger
936- Precision = -1
937- Size = 0
938- end
939- item
940- Name = 'saleDate'
941- DataType = ftDate
942- Precision = -1
943- Size = 0
944- end
945- item
946- Name = 'shipDate'
947- DataType = ftDate
948- Precision = -1
949- Size = 0
950- end
951- item
952- Name = 'item'
953- DataType = ftString
954- Precision = -1
955- Size = 8192
956- end
957- item
958- Name = 'price'
959- DataType = ftFloat
960- Precision = -1
961- Size = 0
962- end>
963- left = 66
964- top = 141
965- object TSalesitemNum: TStringField
966- DisplayWidth = 8192
967- FieldKind = fkData
968- FieldName = 'itemNum'
969- Index = 0
970- LookupCache = False
971- ProviderFlags = [pfInUpdate, pfInWhere]
972- ReadOnly = False
973- Required = False
974- Size = 8192
975- end
976- object TSalesID: TAutoIncField
977- DisplayWidth = 10
978- FieldKind = fkData
979- FieldName = 'ID'
980- Index = 1
981- LookupCache = False
982- ProviderFlags = [pfInUpdate, pfInWhere]
983- ReadOnly = False
984- Required = False
985- end
986- object TSalescustID: TLongintField
987- DisplayWidth = 10
988- FieldKind = fkData
989- FieldName = 'custID'
990- Index = 2
991- LookupCache = False
992- ProviderFlags = [pfInUpdate, pfInWhere]
993- ReadOnly = False
994- Required = False
995- end
996- object TSalessaleDate: TDateField
997- DisplayWidth = 10
998- FieldKind = fkData
999- FieldName = 'saleDate'
1000- Index = 3
1001- LookupCache = False
1002- ProviderFlags = [pfInUpdate, pfInWhere]
1003- ReadOnly = False
1004- Required = False
1005- end
1006- object TSalesshipDate: TDateField
1007- DisplayWidth = 10
1008- FieldKind = fkData
1009- FieldName = 'shipDate'
1010- Index = 4
1011- LookupCache = False
1012- ProviderFlags = [pfInUpdate, pfInWhere]
1013- ReadOnly = False
1014- Required = False
1015- end
1016- object TSalesitem: TStringField
1017- DisplayWidth = 8192
1018- FieldKind = fkData
1019- FieldName = 'item'
1020- Index = 5
1021- LookupCache = False
1022- ProviderFlags = [pfInUpdate, pfInWhere]
1023- ReadOnly = False
1024- Required = False
1025- Size = 8192
1026- end
1027- object TSalesprice: TFloatField
1028- DisplayWidth = 10
1029- FieldKind = fkData
1030- FieldName = 'price'
1031- Index = 6
1032- LookupCache = False
1033- ProviderFlags = [pfInUpdate, pfInWhere]
1034- ReadOnly = False
1035- Required = False
1036- Currency = True
1037- MaxValue = 0
1038- MinValue = 0
1039- Precision = -1
1040- end
1041- end
1042- object TStock: TSqlite3Dataset
1043- AutoIncrementKey = True
1044- Options = []
1045- PrimaryKey = 'ID'
1046- SaveOnClose = True
1047- SaveOnRefetch = True
1048- SQL = 'Select * from stock;'
1049- TableName = 'stock'
1050- FieldDefs = <
1051- item
1052- Name = 'ID'
1053- DataType = ftAutoInc
1054- Precision = -1
1055- Size = 0
1056- end
1057- item
1058- Name = 'item'
1059- DataType = ftString
1060- Precision = -1
1061- Size = 8192
1062- end
1063- item
1064- Name = 'price'
1065- DataType = ftFloat
1066- Precision = -1
1067- Size = 0
1068- end
1069- item
1070- Name = 'itemNum'
1071- DataType = ftString
1072- Precision = -1
1073- Size = 8192
1074- end>
1075- left = 66
1076- top = 214
1077- object TStockID: TAutoIncField
1078- DisplayWidth = 10
1079- FieldKind = fkData
1080- FieldName = 'ID'
1081- Index = 0
1082- LookupCache = False
1083- ProviderFlags = [pfInUpdate, pfInWhere]
1084- ReadOnly = False
1085- Required = False
1086- end
1087- object TStockitem: TStringField
1088- DisplayWidth = 8192
1089- FieldKind = fkData
1090- FieldName = 'item'
1091- Index = 1
1092- LookupCache = False
1093- ProviderFlags = [pfInUpdate, pfInWhere]
1094- ReadOnly = False
1095- Required = False
1096- Size = 8192
1097- end
1098- object TStockprice: TFloatField
1099- DisplayWidth = 10
1100- FieldKind = fkData
1101- FieldName = 'price'
1102- Index = 2
1103- LookupCache = False
1104- ProviderFlags = [pfInUpdate, pfInWhere]
1105- ReadOnly = False
1106- Required = False
1107- Currency = True
1108- MaxValue = 0
1109- MinValue = 0
1110- Precision = -1
1111- end
1112- object TStockitemNum: TStringField
1113- DisplayWidth = 8192
1114- FieldKind = fkData
1115- FieldName = 'itemNum'
1116- Index = 3
1117- LookupCache = False
1118- ProviderFlags = [pfInUpdate, pfInWhere]
1119- ReadOnly = False
1120- Required = False
1121- Size = 8192
1122- end
1123- end
1124-end
11251129```
11261130
1127-``` pascal
1131+end
1132+```
11281133unit uCust;
1129-
1130-{$mode objfpc}{$H+}
1131-
1132-interface
1133-
1134-uses
1135- Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
1136- StdCtrls, ExtCtrls, Buttons, DBGrids,DB;
1137-
1138-type
1139-
1140- { TcustDlg }
1141-
1142- TcustDlg = class(TForm)
1143- cancelBtn: TButton;
1144- dgCust: TDBGrid;
1145- edSearch: TEdit;
1146- Label1: TLabel;
1147- okBtn: TButton;
1148- pnlCust: TPanel;
1149- sbSearch: TSpeedButton;
1150- procedure dgCustDblClick(Sender: TObject);
1151- procedure edSearchChange(Sender: TObject);
1152- procedure sbSearchClick(Sender: TObject);
1153- private
1154- function GetCust: String;
1155- procedure SetCust(const AValue: String);
1156- { private declarations }
1157- public
1158- { public declarations }
1159- property CustName: String Read GetCust Write SetCust;
1160- function ShowModalCust:integer;
1161- end;
1162-
1163-var
1164- custDlg: TcustDlg;
1165-
1166-implementation
1167-uses uMain;
1168-{ TcustDlg }
1169-
1170-procedure TcustDlg.edSearchChange(Sender: TObject);
1171-begin
1172- sbSearch.Enabled:=edSearch.Text<>'';
1173-end;
1174-
1175-procedure TcustDlg.dgCustDblClick(Sender: TObject);
1176-begin
1177- ModalResult := mrOk;
1178-end;
1179-
1180-procedure TcustDlg.sbSearchClick(Sender: TObject);
1181-begin
1182- if not fMain.TCust.Locate('CustName', edSearch.Text,[loCaseInsensitive, loPartialKey])
1183- then
1184- MessageDlg('No matching record found.', mtInformation, [mbOK], 0);
1185- edSearch.Color:=clRed;
1186-end;
1187-
1188-function TcustDlg.GetCust: String;
1189-begin
1190- Result := fMain.TCustCustName.Value;
1191-end;
1192-
1193-procedure TcustDlg.SetCust(const AValue: String);
1194-begin
1195- fMain.TCust.Locate('CustName',AValue,[loPartialKey,loCaseInsensitive]);
1196-end;
1197-
1198-function TcustDlg.ShowModalCust: integer;
1199-begin
1200- Caption:='Select Customer Name';
1201- Result := ShowModal;
1202-end;
1203-
1204-initialization
1205- {$I uCust.lrs}
1206-
1207-end.
1134+
1135+ {$mode objfpc}{$H+}
1136+
1137+ interface
1138+
1139+ uses
1140+ Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
1141+ StdCtrls, ExtCtrls, Buttons, DBGrids,DB;
1142+
1143+ type
1144+
1145+ { TcustDlg }
1146+
1147+ TcustDlg = class(TForm)
1148+ cancelBtn: TButton;
1149+ dgCust: TDBGrid;
1150+ edSearch: TEdit;
1151+ Label1: TLabel;
1152+ okBtn: TButton;
1153+ pnlCust: TPanel;
1154+ sbSearch: TSpeedButton;
1155+ procedure dgCustDblClick(Sender: TObject);
1156+ procedure edSearchChange(Sender: TObject);
1157+ procedure sbSearchClick(Sender: TObject);
1158+ private
1159+ function GetCust: String;
1160+ procedure SetCust(const AValue: String);
1161+ { private declarations }
1162+ public
1163+ { public declarations }
1164+ property CustName: String Read GetCust Write SetCust;
1165+ function ShowModalCust:integer;
1166+ end;
1167+
1168+ var
1169+ custDlg: TcustDlg;
1170+
1171+ implementation
1172+ uses uMain;
1173+ { TcustDlg }
1174+
1175+ procedure TcustDlg.edSearchChange(Sender: TObject);
1176+ begin
1177+ sbSearch.Enabled:=edSearch.Text<>'';
1178+ end;
1179+
1180+ procedure TcustDlg.dgCustDblClick(Sender: TObject);
1181+ begin
1182+ ModalResult := mrOk;
1183+ end;
1184+
1185+ procedure TcustDlg.sbSearchClick(Sender: TObject);
1186+ begin
1187+ if not fMain.TCust.Locate('CustName', edSearch.Text,[loCaseInsensitive, loPartialKey])
1188+ then
1189+ MessageDlg('No matching record found.', mtInformation, [mbOK], 0);
1190+ edSearch.Color:=clRed;
1191+ end;
1192+
1193+ function TcustDlg.GetCust: String;
1194+ begin
1195+ Result := fMain.TCustCustName.Value;
1196+ end;
1197+
1198+ procedure TcustDlg.SetCust(const AValue: String);
1199+ begin
1200+ fMain.TCust.Locate('CustName',AValue,[loPartialKey,loCaseInsensitive]);
1201+ end;
1202+
1203+ function TcustDlg.ShowModalCust: integer;
1204+ begin
1205+ Caption:='Select Customer Name';
1206+ Result := ShowModal;
1207+ end;
1208+
1209+ initialization
1210+ {$I uCust.lrs}
1211+
1212+ end.
12081213```
1209-
1210-``` pascal
1214+```
12111215unit uSales;
1212-
1213-{$mode objfpc}{$H+}
1214-
1215-interface
1216-
1217-uses
1218- Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
1219- StdCtrls, ExtCtrls, Buttons, DBGrids, DB;
1220-
1221-type
1222-
1223- { TsearchDlg }
1224-
1225- TsearchDlg = class(TForm)
1226- cancelBtn: TButton;
1227- dgParts: TDBGrid;
1228- edSearch: TEdit;
1229- Label1: TLabel;
1230- okBtn: TButton;
1231- pnlParts: TPanel;
1232- sbSearch: TSpeedButton;
1233- procedure dgPartsDblClick(Sender: TObject);
1234- procedure edSearchChange(Sender: TObject);
1235- procedure sbSearchClick(Sender: TObject);
1236- private
1237- function GetPartNum: String;
1238- procedure SetPartNum(const AValue: String);
1239- { private declarations }
1240- public
1241- { public declarations }
1242- property PartNum:String Read GetPartNum Write SetPartNum;
1243- function ShowModalParts: Integer;
1244- end;
1245-
1246-var
1247- searchDlg: TsearchDlg;
1248-
1249-implementation
1250-uses uMain;
1251-{ TsearchDlg }
1252-
1253-procedure TsearchDlg.edSearchChange(Sender: TObject);
1254-begin
1255- sbSearch.Enabled:=edSearch.Text<>'';
1256-end;
1257-
1258-procedure TsearchDlg.dgPartsDblClick(Sender: TObject);
1259-begin
1260- ModalResult := mrOk;
1261-end;
1262-
1263-procedure TsearchDlg.sbSearchClick(Sender: TObject);
1264-begin
1265- if not fMain.TStock.Locate('itemNum', edSearch.Text,[loCaseInsensitive, loPartialKey])
1266- then
1267- MessageDlg('No matching record found.', mtInformation, [mbOK], 0);
1268- edSearch.Color:=clRed;
1269-end;
1270-
1271-function TsearchDlg.GetPartNum: String;
1272-begin
1273- Result := fMain.TStockitemNum.Value;
1274-end;
1275-
1276-procedure TsearchDlg.SetPartNum(const AValue: String);
1277-begin
1278- fMain.TStock.Locate('itemNum',AValue,[loPartialKey,loCaseInsensitive]);
1279-end;
1280-
1281-function TsearchDlg.ShowModalParts: Integer;
1282-begin
1283- Caption:='Select Item Number';
1284- Result := ShowModal;
1285-end;
1286-
1287-initialization
1288- {$I uSales.lrs}
1289-
1290-end.
1216+
1217+ {$mode objfpc}{$H+}
1218+
1219+ interface
1220+
1221+ uses
1222+ Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
1223+ StdCtrls, ExtCtrls, Buttons, DBGrids, DB;
1224+
1225+ type
1226+
1227+ { TsearchDlg }
1228+
1229+ TsearchDlg = class(TForm)
1230+ cancelBtn: TButton;
1231+ dgParts: TDBGrid;
1232+ edSearch: TEdit;
1233+ Label1: TLabel;
1234+ okBtn: TButton;
1235+ pnlParts: TPanel;
1236+ sbSearch: TSpeedButton;
1237+ procedure dgPartsDblClick(Sender: TObject);
1238+ procedure edSearchChange(Sender: TObject);
1239+ procedure sbSearchClick(Sender: TObject);
1240+ private
1241+ function GetPartNum: String;
1242+ procedure SetPartNum(const AValue: String);
1243+ { private declarations }
1244+ public
1245+ { public declarations }
1246+ property PartNum:String Read GetPartNum Write SetPartNum;
1247+ function ShowModalParts: Integer;
1248+ end;
1249+
1250+ var
1251+ searchDlg: TsearchDlg;
1252+
1253+ implementation
1254+ uses uMain;
1255+ { TsearchDlg }
1256+
1257+ procedure TsearchDlg.edSearchChange(Sender: TObject);
1258+ begin
1259+ sbSearch.Enabled:=edSearch.Text<>'';
1260+ end;
1261+
1262+ procedure TsearchDlg.dgPartsDblClick(Sender: TObject);
1263+ begin
1264+ ModalResult := mrOk;
1265+ end;
1266+
1267+ procedure TsearchDlg.sbSearchClick(Sender: TObject);
1268+ begin
1269+ if not fMain.TStock.Locate('itemNum', edSearch.Text,[loCaseInsensitive, loPartialKey])
1270+ then
1271+ MessageDlg('No matching record found.', mtInformation, [mbOK], 0);
1272+ edSearch.Color:=clRed;
1273+ end;
1274+
1275+ function TsearchDlg.GetPartNum: String;
1276+ begin
1277+ Result := fMain.TStockitemNum.Value;
1278+ end;
1279+
1280+ procedure TsearchDlg.SetPartNum(const AValue: String);
1281+ begin
1282+ fMain.TStock.Locate('itemNum',AValue,[loPartialKey,loCaseInsensitive]);
1283+ end;
1284+
1285+ function TsearchDlg.ShowModalParts: Integer;
1286+ begin
1287+ Caption:='Select Item Number';
1288+ Result := ShowModal;
1289+ end;
1290+
1291+ initialization
1292+ {$I uSales.lrs}
1293+
1294+ end.
12911295```
12921296
12931297---
1294-*From the Free Pascal wiki, page "TSqlite3 Master Detail Example", as it stood on 2020-02-10 after a change by Andry, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
1298+*From the Free Pascal wiki, page "TSqlite3 Master Detail Example", as the Internet Archive kept it on 2024-09-20, last changed on 2024-08-08. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history