-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathudSMSLinks.pas
1989 lines (1836 loc) · 82.9 KB
/
udSMSLinks.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit udSMSLinks;
{
Nov 2014 Code By: Daniel Campbell
HOW TO ADD A NEW TABLE TO AN EXISTING MASTER TAB
*DFM*
1. Right click the sub TPageControl and create a new page
2. Copy another SMDBGrid into the new tab
3. Name the SMDBGrid dbgSomething and the tab tsSomething and give the tab a caption
*PAS*
4. Copy and paste 2 lines of code, something like this
lSQL := 'select * from something where something_code = :something_code';
tab[1][2] := TTab.Create(dbgSomething, 0, 'something', lSQL, False);
5. Depending on the table, may need to do extra work in the Search button for the master
tab and also linking from/to to other tables
HOW TO ADD A NEW MASTER TAB
*DFM*
1. Right click the Master TPageControl and create a new page
2. Copy the controls and the TPageControl from the last tab and rename everything
with the same convention
*PAS*
1. Search all files in this project for '//new master tab' to get the idea
}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, ExtCtrls, Grids, DBGrids, SMDBGrid, DB, DBTables,
nxdb, Buttons, udRecordView, kbmMemTable, Menus, uuTab, DBCtrls,
uuGlobals, ufISQLDataBase, ufISQLQuery;
type
//This helps make the link from button automatic
TMasterCode = record
edt : TLabeledEdit;
code : String;
btnS : tSpeedButton;
end;
TMasterTab = record
pc : TPageControl;
dn : TDBNavigator;
end;
THackDBGrid = class(TSMDBGrid);
TdSMSLinks = class(TForm)
pgEnquiry: TPageControl;
tsSale: TTabSheet;
tsItem: TTabSheet;
tsGRN: TTabSheet;
tsLocMove: TTabSheet;
tsStockTake: TTabSheet;
pgSale: TPageControl;
tsSaleSale: TTabSheet;
tsSaleLine: TTabSheet;
tsSaleBenefit: TTabSheet;
tsSaleBenefitLine: TTabSheet;
edtSaleCode: TLabeledEdit;
edtReceiptNbr: TLabeledEdit;
btnLastSale: TButton;
pgItem: TPageControl;
tsItemItem: TTabSheet;
tsItemColour: TTabSheet;
tsItemColourSize: TTabSheet;
edtItemColourSize: TLabeledEdit;
pgGRN: TPageControl;
edtGRNCode: TLabeledEdit;
tsGRNGRN: TTabSheet;
tsGrnLine: TTabSheet;
tsGrnCarton: TTabSheet;
tsGrnSize: TTabSheet;
dbgSale: TSMDBGrid;
dbgSaleLine: TSMDBGrid;
dbgSaleBenefit: TSMDBGrid;
dbgSaleLineBenefit: TSMDBGrid;
dbgItem: TSMDBGrid;
dbgItemColour: TSMDBGrid;
dbgItemColourSize: TSMDBGrid;
dbgGrn: TSMDBGrid;
dbgGrnLine: TSMDBGrid;
dbgGrnCarton: TSMDBGrid;
dbgGrnSize: TSMDBGrid;
btnLastGRN: TButton;
edtStockTakeCode: TLabeledEdit;
pgStockTake: TPageControl;
tsStockTakeStockTake: TTabSheet;
tsStockTakeCount: TTabSheet;
tsStockTakeCountLine: TTabSheet;
dbgStockTake: TSMDBGrid;
dbgStockTakeCount: TSMDBGrid;
dbgStockTakeCountLine: TSMDBGrid;
tsTenderLine: TTabSheet;
dbgTenderLine: TSMDBGrid;
btnLastStockTake: TButton;
TabSheet8: TTabSheet;
dbgSaleLineReturn: TSMDBGrid;
edtLocMoveCode: TLabeledEdit;
pgLocMove: TPageControl;
btnLastLocMove: TButton;
tsLocMoveLocMove: TTabSheet;
tsLocMoveLine: TTabSheet;
tsLocMoveCarton: TTabSheet;
tsLocMoveSize: TTabSheet;
tsLocMoveComment: TTabSheet;
dbgLocMove: TSMDBGrid;
dbgLocMoveLine: TSMDBGrid;
dbgLocMoveCarton: TSMDBGrid;
dbgLocMoveSize: TSMDBGrid;
dbgLocMoveComment: TSMDBGrid;
btnRecordView: TSpeedButton;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
mtbRecord: TkbmMemTable;
mtbRecordField: TStringField;
mtbRecordValue: TStringField;
mtbRecordType: TStringField;
mtbRecordIsNull: TBooleanField;
btnSearchStockTake: TSpeedButton;
btnSearchLocMove: TSpeedButton;
btnGRNSearch: TSpeedButton;
btnItemSearch: TSpeedButton;
btnSaleSearch: TSpeedButton;
btnItemLink: TButton;
btnLocMoveLinkFrom: TButton;
tsStoreICS: TTabSheet;
dbgStoreICS: TSMDBGrid;
tsVirtualDrawer: TTabSheet;
SpeedButton5: TSpeedButton;
edtVirtualDrawerCode: TLabeledEdit;
btnSearchVirtualDrawer: TSpeedButton;
pgVirtualDrawer: TPageControl;
tsVirtualDrawerVirtualDrawer: TTabSheet;
dbgVirtualDrawer: TSMDBGrid;
tsVirtualDrawerTender: TTabSheet;
dbgVirtualDrawerTender: TSMDBGrid;
tsVirtualDrawerTransfer: TTabSheet;
dbgVirtualDrawerTransfer: TSMDBGrid;
btnVirtualDrawerLinkFrom: TButton;
btnInfo: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
pnlInfo: TPanel;
mmoTableHint: TRichEdit;
dnSale: TDBNavigator;
dnItem: TDBNavigator;
dnGrn: TDBNavigator;
dnLocMove: TDBNavigator;
dnStockTake: TDBNavigator;
dnVirtualDrawer: TDBNavigator;
poColumns: TPopupMenu;
SortAscending: TMenuItem;
SortDescending: TMenuItem;
SetValueTo: TMenuItem;
Hint: TMenuItem;
edtColumnValue: TEdit;
tsPromotion: TTabSheet;
dnPromotion: TDBNavigator;
SpeedButton11: TSpeedButton;
edtPromotionCode: TLabeledEdit;
btnSearchPromotion: TSpeedButton;
btnPromotionLinkFrom: TButton;
SpeedButton13: TSpeedButton;
pgPromotion: TPageControl;
tsPromotionPromotion: TTabSheet;
dbgPromotion: TSMDBGrid;
tsPromotionItem: TTabSheet;
dbgPromotionItem: TSMDBGrid;
tsPromotionTier: TTabSheet;
dbgPromotionTier: TSMDBGrid;
tsStore: TTabSheet;
dnStore: TDBNavigator;
SpeedButton12: TSpeedButton;
edtStoreCode: TLabeledEdit;
btnSearchStore: TSpeedButton;
btnStoreLinkFrom: TButton;
SpeedButton15: TSpeedButton;
pgStore: TPageControl;
tsStoreStore: TTabSheet;
dbgStore: TSMDBGrid;
tsStoreNeighbour: TTabSheet;
dbgStoreNeighbour: TSMDBGrid;
tsSaleDelivery: TTabSheet;
dbgSaleDelivery: TSMDBGrid;
tsTransCustomer: TTabSheet;
dbgTransCustomer: TSMDBGrid;
tsSaleGiftVoucher: TTabSheet;
dbgSaleGiftVoucher: TSMDBGrid;
tsGiftCardTransaction: TTabSheet;
dbgGiftCardTransaction: TSMDBGrid;
btnRefreshAll: TButton;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
tsGrnComment: TTabSheet;
dbgGrnComment: TSMDBGrid;
mtbRecordHint: TStringField;
edtItemColour: TLabeledEdit;
edtItem: TLabeledEdit;
tsPrice: TTabSheet;
tsSellCode: TTabSheet;
dbgPrice: TSMDBGrid;
dbgSellCode: TSMDBGrid;
tsStoreICSTran: TTabSheet;
tsStoreIC: TTabSheet;
dbgStoreICSTran: TSMDBGrid;
dbgStoreIC: TSMDBGrid;
tsLocation: TTabSheet;
dbgLocation: TSMDBGrid;
tsDataCentre: TTabSheet;
dbgDataCentre: TSMDBGrid;
tsItemColourSupplier: TTabSheet;
dbgItemColourSupplier: TSMDBGrid;
tsRetailChain: TTabSheet;
dbgRetailChain: TSMDBGrid;
tsCompany: TTabSheet;
dbgCompany: TSMDBGrid;
tsCountry: TTabSheet;
dbgCountry: TSMDBGrid;
tsTimeZone: TTabSheet;
dbgTimeZone: TSMDBGrid;
tsUser: TTabSheet;
dnUser: TDBNavigator;
SpeedButton14: TSpeedButton;
edtUserCode: TLabeledEdit;
btnSearchUser: TSpeedButton;
btnUserLinkFrom: TButton;
Button9: TButton;
SpeedButton17: TSpeedButton;
pgUser: TPageControl;
tsRemediUser: TTabSheet;
dbgRemediUser: TSMDBGrid;
tsRemediUserKey: TTabSheet;
edtEmployeeID: TLabeledEdit;
dbgRemediUserKey: TSMDBGrid;
tsEmployee: TTabSheet;
dbgEmployee: TSMDBGrid;
tsEmployeeStore: TTabSheet;
dbgEmployeeStore: TSMDBGrid;
tsStocktakeInit: TTabSheet;
dbgStocktakeInit: TSMDBGrid;
tsStocktakeAdjustment: TTabSheet;
dbgStocktakeAdjustment: TSMDBGrid;
tsStocktakeOmit: TTabSheet;
dbgStocktakeOmit: TSMDBGrid;
tsStocktakeLocation: TTabSheet;
dbgStocktakeLocation: TSMDBGrid;
tsStocktakeCategory: TTabSheet;
dbgStocktakeCategory: TSMDBGrid;
tsStocktakeError: TTabSheet;
dbgStocktakeError: TSMDBGrid;
tsDivision: TTabSheet;
dbgDivision: TSMDBGrid;
tsCategory: TTabSheet;
dbgCategory: TSMDBGrid;
tsDepartment: TTabSheet;
dbgDepartment: TSMDBGrid;
tsColour: TTabSheet;
dbgColour: TSMDBGrid;
tsSize: TTabSheet;
dbgSize: TSMDBGrid;
tsRegister: TTabSheet;
dbgRegister: TSMDBGrid;
tsRemediPc: TTabSheet;
dbgRemediPc: TSMDBGrid;
poLinkFrom: TPopupMenu;
tsEmployeeStoreDisc: TTabSheet;
dbgEmployeeStoreDisc: TSMDBGrid;
tsSaleSignature: TTabSheet;
tsSaleNote: TTabSheet;
dbgSaleSignature: TSMDBGrid;
dbgSaleNote: TSMDBGrid;
tsCustomer: TTabSheet;
dnCustomer: TDBNavigator;
SpeedButton16: TSpeedButton;
edtCustomerId: TLabeledEdit;
btnSearchCustomer: TSpeedButton;
btnCustomerLinkFrom: TButton;
Button10: TButton;
SpeedButton19: TSpeedButton;
pgCustomer: TPageControl;
tsCustomerCustomer: TTabSheet;
dbgCustomer: TSMDBGrid;
tsLoyaltyCustomer: TTabSheet;
dbgLoyaltyCustomer: TSMDBGrid;
tsLoyaltyCustMember: TTabSheet;
dbgLoyaltyCustMember: TSMDBGrid;
tsLoyaltyCustTran: TTabSheet;
dbgLoyaltyCustTran: TSMDBGrid;
tsLoyaltyCustPeriod: TTabSheet;
dbgLoyaltyCustPeriod: TSMDBGrid;
tsLoyalty: TTabSheet;
tsLoyaltyProgram: TTabSheet;
dbgLoyalty: TSMDBGrid;
dbgLoyaltyProgram: TSMDBGrid;
tsCustomerType: TTabSheet;
dbgCustomerType: TSMDBGrid;
tsCustomerPoints: TTabSheet;
dbgCustomerPoints: TSMDBGrid;
tsLayby: TTabSheet;
tsBankDeposit: TTabSheet;
dnLayby: TDBNavigator;
SpeedButton18: TSpeedButton;
edtLaybyId: TLabeledEdit;
btnSearchLayby: TSpeedButton;
btnLaybyLinkFrom: TButton;
Button11: TButton;
SpeedButton21: TSpeedButton;
dnBankDeposit: TDBNavigator;
SpeedButton22: TSpeedButton;
edtBankDepositCode: TLabeledEdit;
btnSearchBankDeposit: TSpeedButton;
btnBankDepositLinkFrom: TButton;
Button13: TButton;
SpeedButton24: TSpeedButton;
pgLayby: TPageControl;
tsLaybyLayby: TTabSheet;
dbgLayby: TSMDBGrid;
pgBankDeposit: TPageControl;
tsBankDepositBankDeposit: TTabSheet;
dbgBankDeposit: TSMDBGrid;
btnLastBankDeposit: TButton;
tsLaybyLine: TTabSheet;
tsLaybyTrans: TTabSheet;
tsLaybyNote: TTabSheet;
tsLaybyBalance: TTabSheet;
dbgLaybyLine: TSMDBGrid;
dbgLaybyTrans: TSMDBGrid;
dbgLaybyNote: TSMDBGrid;
dbgLaybyBalance: TSMDBGrid;
tsBankDepositCheque: TTabSheet;
tsBankDepositVoucher: TTabSheet;
tsBankDepositTransfer: TTabSheet;
dbgBankDepositCheque: TSMDBGrid;
dbgBankDepositVoucher: TSMDBGrid;
dbgBankDepositTransfer: TSMDBGrid;
tsBankAccount: TTabSheet;
dbgBankAccount: TSMDBGrid;
tsBankAccountStore: TTabSheet;
dbgBankAccountStore: TSMDBGrid;
tsVdMovement: TTabSheet;
dbgVdMovement: TSMDBGrid;
tsvdrawerevent: TTabSheet;
dbgVDrawerEvent: TSMDBGrid;
tsVdrawerrecline: TTabSheet;
dbgVDrawerRecLine: TSMDBGrid;
tsVdrawerrecdenom: TTabSheet;
dbgVDrawerRecDenom: TSMDBGrid;
tsVdrawerrecvoucher: TTabSheet;
dbgVDrawerRecVoucher: TSMDBGrid;
tsPromotionItemGroup: TTabSheet;
dbgPromotionItemGroup: TSMDBGrid;
tsPromotionStore: TTabSheet;
dbgPromotionStore: TSMDBGrid;
tsPromotionCustomer: TTabSheet;
tsPromotionCustomerType: TTabSheet;
dbgPromotionCustomer: TSMDBGrid;
dbgPromotionCustomerType: TSMDBGrid;
tsPromotionLoyaltyGroup: TTabSheet;
dbgPromotionLoyaltyGroup: TSMDBGrid;
tsPromotionBeneficiary: TTabSheet;
dbgPromotionBeneficiary: TSMDBGrid;
tsSaleTaxCustomer: TTabSheet;
tsSaleTaxExempt: TTabSheet;
dbgSaleTaxCustomer: TSMDBGrid;
dbgSaleTaxExempt: TSMDBGrid;
tsDocketMessageLine: TTabSheet;
dbgDocketMessageLine: TSMDBGrid;
tsDataCentreStatus: TTabSheet;
dbgDataCentreStatus: TSMDBGrid;
tsDataCentreLastTask: TTabSheet;
dbgDataCentreLastTask: TSMDBGrid;
tsScript: TTabSheet;
dbgScript: TSMDBGrid;
tsStoreJournal: TTabSheet;
dbgStoreJournal: TSMDBGrid;
tsCustomerPayment: TTabSheet;
dbgCustomerPayment: TSMDBGrid;
tsCustomerPayment1: TTabSheet;
dbgCustomerPayment2: TSMDBGrid;
tstimeattenddayhour: TTabSheet;
dbgTimeAttendDayHour: TSMDBGrid;
tsTimeAttendTrans: TTabSheet;
dbgTimeAttendTrans: TSMDBGrid;
tsPrintRequest: TTabSheet;
dbgPrintRequest: TSMDBGrid;
tsStoreICSTran2: TTabSheet;
dbgStoreICSTran2: TSMDBGrid;
tsStoreICSTran3: TTabSheet;
dbgStoreICSTran3: TSMDBGrid;
tsAdjustment: TTabSheet;
dnAdjustment: TDBNavigator;
btn1: TSpeedButton;
edtAdjustmentCode: TLabeledEdit;
btnSearchAdjustment: TSpeedButton;
btnLastAdjustment: TButton;
btnAdjustmentLinkFrom: TButton;
btn5: TButton;
btn6: TSpeedButton;
pgAdjustment: TPageControl;
tsAdjustmentAdjustment: TTabSheet;
dbgAdjustment: TSMDBGrid;
tsAdjustmentLine: TTabSheet;
dbgAdjustmentLine: TSMDBGrid;
tsAdjustmentSize: TTabSheet;
dbgAdjustmentSize: TSMDBGrid;
tsStoreICSTran4: TTabSheet;
dbgStoreICSTran4: TSMDBGrid;
tsStocktakeSku: TTabSheet;
dbgStocktakeSku: TSMDBGrid;
tsCustIdentification: TTabSheet;
dbgCustIdentification: TSMDBGrid;
tsSalelineReference: TTabSheet;
dbgSalelineReference: TSMDBGrid;
tsUnitload: TTabSheet;
dbgUnitload: TSMDBGrid;
tsUnitloadContent: TTabSheet;
dbgUnitloadcontent: TSMDBGrid;
tsUnitloadcontentlog: TTabSheet;
dbgUnitloadcontentlog: TSMDBGrid;
tsItemColourImage: TTabSheet;
dbgItemColourImage: TSMDBGrid;
tsImage: TTabSheet;
dbgImage: TSMDBGrid;
tsFixedItemColourSize: TTabSheet;
dbgFixedItemColourSize: TSMDBGrid;
tsRemediPwdHist: TTabSheet;
dbgRemediPwdHist: TSMDBGrid;
tsLocationRetailChain: TTabSheet;
dbgLocationRetailChain: TSMDBGrid;
tsRemediEvent: TTabSheet;
dbgRemediEvent: TSMDBGrid;
tsRemediPrinterType: TTabSheet;
dbgRemediPrinterType: TSMDBGrid;
tsCurrencyLocation: TTabSheet;
dbgCurrencyLocation: TSMDBGrid;
tsCurrencyRate: TTabSheet;
dbgCurrencyRate: TSMDBGrid;
tsCurrency: TTabSheet;
dbgCurrency: TSMDBGrid;
tsitemretailchain: TTabSheet;
dbgItemRetailChain: TSMDBGrid;
tsRetailChain2: TTabSheet;
dbgRetailChain2: TSMDBGrid;
tsSaleLine2: TTabSheet;
dbgSaleline2: TSMDBGrid;
tsLaybyTerms: TTabSheet;
dbgLaybyTerms: TSMDBGrid;
tsLaybyTermsLine: TTabSheet;
dbgLaybyTermsLine: TSMDBGrid;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btnSaleSearchClick(Sender: TObject);
procedure btnItemSearcClick(Sender: TObject);
procedure btnGRNSearchClick(Sender: TObject);
procedure btnSearchStockTakeClick(Sender: TObject);
procedure btnLastSaleClick(Sender: TObject);
procedure btnSearchLocMovClick(Sender: TObject);
procedure dbgTableMouseWheelDown(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
procedure dbgTableMouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
procedure btnRecordViewClick(Sender: TObject);
procedure btnItemLinkClick(Sender: TObject);
procedure btnLocMoveLinkFromClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure btnLastGRNClick(Sender: TObject);
procedure btnLastLocMoveClick(Sender: TObject);
procedure btnLastStockTakeClick(Sender: TObject);
procedure btnSearchVirtualDrawerClick(Sender: TObject);
procedure btnVirtualDrawerLinkFromClick(Sender: TObject);
procedure btnInfoClick(Sender: TObject);
procedure pgChange(Sender: TObject);
procedure edtColumnValueKeyPress(Sender: TObject; var Key: Char);
procedure edtColumnValueExit(Sender: TObject);
procedure dbgTableTitleClick(Column: TColumn);
procedure HintClick(Sender: TObject);
procedure SortAscendingClick(Sender: TObject);
procedure SortDescendingClick(Sender: TObject);
procedure SetValueToClick(Sender: TObject);
procedure dbgTableColumnMoved(Sender: TObject; FromIndex, ToIndex: Integer);
procedure btnSearchPromotionClick(Sender: TObject);
procedure btnSearchStoreClick(Sender: TObject);
procedure btnRefreshAllClick(Sender: TObject);
procedure btnPromotionLinkFromClick(Sender: TObject);
procedure dbgTableMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure btnSearchUserClick(Sender: TObject);
procedure btnUserLinkFromClick(Sender: TObject);
procedure pgTableDrawTab(Control: TCustomTabControl; TabIndex: Integer;
const Rect: TRect; Active: Boolean);
procedure LinkFromClick(Sender: TObject);
procedure mtbRecordValueChange(Sender: TField);
procedure btnCustomerLinkFromClick(Sender: TObject);
procedure btnSearchCustomerClick(Sender: TObject);
procedure btnLaybyLinkFromClick(Sender: TObject);
procedure btnBankDepositLinkFromClick(Sender: TObject);
procedure btnSearchBankDepositClick(Sender: TObject);
procedure btnSearchLaybyClick(Sender: TObject);
procedure btnLastBankDepositClick(Sender: TObject);
procedure btnStoreLinkFromClick(Sender: TObject);
procedure btnAdjustmentLinkFromClick(Sender: TObject);
procedure btnSearchAdjustmentClick(Sender: TObject);
procedure btnLastAdjustmentClick(Sender: TObject);
procedure edtSaleCodeKeyPress(Sender: TObject; var Key: Char);
procedure edtItemColourSizeKeyPress(Sender: TObject; var Key: Char);
procedure edtGRNCodeKeyPress(Sender: TObject; var Key: Char);
procedure edtLocMoveCodeKeyPress(Sender: TObject; var Key: Char);
procedure edtStockTakeCodeKeyPress(Sender: TObject; var Key: Char);
procedure edtVirtualDrawerCodeKeyPress(Sender: TObject; var Key: Char);
procedure edtPromotionCodeKeyPress(Sender: TObject; var Key: Char);
procedure edtStoreCodeKeyPress(Sender: TObject; var Key: Char);
procedure edtEmployeeIDKeyPress(Sender: TObject; var Key: Char);
procedure edtCustomerIdKeyPress(Sender: TObject; var Key: Char);
procedure edtLaybyIdKeyPress(Sender: TObject; var Key: Char);
procedure edtBankDepositCodeKeyPress(Sender: TObject; var Key: Char);
procedure edtAdjustmentCodeKeyPress(Sender: TObject; var Key: Char);
procedure edtItemColourSizeChange(Sender: TObject);
procedure edtItemColourChange(Sender: TObject);
procedure edtItemChange(Sender: TObject);
private
{ Private declarations }
tab : array of array of TTab;
mCode : array of TMasterCode;
mTab : array of TMasterTab;
fInfoShowing : Boolean;
fFieldClicked : TField;
fColMoved : Boolean;
fColumnHint : String;
fScrollLeftRight : Boolean;
qryUtil : ISQLQuery;
function SetParamOpenAndDDL(I, J: Integer; ParamName,
ParamValue: String): Boolean;
function GetActiveSubPageIndex: Integer;
function ActiveTab: TTab;
procedure CreateMasterTab(aIndex: Integer);
function OpenEmployeeTables(aEmployeeId: String): String;
procedure OpenUserTables(aUserCode: String);
procedure ShowLinkFrom(aMasterTabIndex: Integer);
procedure SetMasterTabs;
procedure SingleCodeSearch(aCode: String; aMasterCodeIndex,
aTabIndex: Integer);
procedure AdjustTabSQLForICSearch;
procedure AdjustTabSQLForICSSearch;
procedure AdjustTabSQLForItemSearch;
public
{ Public declarations }
procedure SetUp(aUseRegistry : Boolean;
aDefaultCodes : array of String; aFont : Integer);
end;
implementation
uses
TypInfo, Math;
//creating all the tab objects in FormCreate created a delay, so instead
//only creating the tab objects for the active tab in formshow
//then create if neccesary when changing tabs
procedure TdSMSLinks.CreateMasterTab(aIndex : Integer);
var
lSQL : String;
begin
if (aIndex = 0) and (not Assigned(tab[0][0])) then //SALE
begin
lSQL := 'select * from sale where sale_code = :sale_code';
tab[0][0] := TTab.Create(gDataBase, dbgSale, 0, 'sale', lSQL, False);
lSQL := 'select * from saleline where sale_code = :sale_code';
tab[0][1] := TTab.Create(gDataBase, dbgSaleLine, 0, 'saleline', lSQL, False);
lSQL := 'select * from tenderline where source_doc_code = :sale_code';
tab[0][2] := TTab.Create(gDataBase, dbgTenderLine, 0, 'tenderline', lSQL, False);
lSQL := 'select * from storeicstran where (document_type = ' + QuotedStr('S') + ') and document_line_id in (select saleline_id from saleline where sale_code = :sale_code)';
tab[0][3] := TTab.Create(gDataBase, dbgStoreICSTran3, 0, 'storeicstran', lSQL, False);
lSQL := 'select * from salebenefit where sale_code = :sale_code';
tab[0][4] := TTab.Create(gDataBase, dbgSaleBenefit, 0, 'salebenefit', lSQL, False);
lSQL := 'select * from salelinebenefit where saleline_id in (select saleline_id from saleline where sale_code = :sale_code)';
tab[0][5] := TTab.Create(gDataBase, dbgSaleLineBenefit, 0, 'salelinebenefit', lSQL, False);
lSQL := 'select * from salelinereturn where return_saleline_id in (select saleline_id from saleline where sale_code = :sale_code)';
tab[0][6] := TTab.Create(gDataBase, dbgSaleLineReturn, 0, 'salelinereturn', lSQL, False);
lSQL := 'select * from saledelivery where sale_code = :sale_code';
tab[0][7] := TTab.Create(gDataBase, dbgSaleDelivery, 0, 'saledelivery', lSQL, False);
lSQL := 'select * from transcustomer where sale_code = :sale_code';
tab[0][8] := TTab.Create(gDataBase, dbgTransCustomer, 0, 'transcustomer', lSQL, False);
lSQL := 'select * from salegiftvoucher where saleline_id in (select saleline_id from saleline where sale_code = :sale_code)';
tab[0][9] := TTab.Create(gDataBase, dbgSaleGiftVoucher, 0, 'salegiftvoucher', lSQL, False);
lSQL := 'select * from giftcardtransaction where sale_code = :sale_code';
tab[0][10] := TTab.Create(gDataBase, dbgGiftCardTransaction, 0, 'giftcardtransaction', lSQL, False);
lSQL := 'select * from salesignature where sale_code = :sale_code';
tab[0][11] := TTab.Create(gDataBase, dbgSaleSignature, 0, 'salesignature', lSQL, False);
lSQL := 'select * from salenote where sale_code = :sale_code';
tab[0][12] := TTab.Create(gDataBase, dbgSaleNote, 0, 'salenote', lSQL, False);
lSQL := 'select * from saletaxcustomer where sale_code = :sale_code';
tab[0][13] := TTab.Create(gDataBase, dbgSaleTaxCustomer, 0, 'saletaxcustomer', lSQL, False);
lSQL := 'select * from saletaxexempt where sale_code = :sale_code';
tab[0][14] := TTab.Create(gDataBase, dbgSaleTaxExempt, 0, 'saletaxexempt', lSQL, False);
lSQL := 'select * from "script" where sale_code = :sale_code';
tab[0][15] := TTab.Create(gDataBase, dbgScript, 0, 'script', lSQL, False);
lSQL := 'select * from customerpayment where sale_code = :sale_code';
tab[0][16] := TTab.Create(gDataBase, dbgCustomerPayment, 0, 'customerpayment', lSQL, False);
lSQL := 'select * from salelinereference where saleline_id in (select saleline_id from saleline where sale_code = :sale_code)';
tab[0][17] := TTab.Create(gDataBase, dbgSalelineReference, 0, 'salelinereference', lSQL, False);
end
else if (aIndex = 1) and (not Assigned(tab[1][0])) then //ITEM
begin
//The SQL here is determined dynamically when searching
tab[1][0] := TTab.Create(gDataBase, dbgItem, 0, 'item', 'xxx', False);
tab[1][1] := TTab.Create(gDataBase, dbgItemColour, 0, 'itemcolour', 'xxx', False);
tab[1][2] := TTab.Create(gDataBase, dbgItemColourSize, 0, 'itemcoloursize', 'xxx', False);
tab[1][3] := TTab.Create(gDataBase, dbgStoreICS, 0, 'storeics', 'xxx', False);
tab[1][4] := TTab.Create(gDataBase, dbgPrice, 0, 'price', 'xxx', False);
tab[1][5] := TTab.Create(gDataBase, dbgSellCode, 0, 'sellcode', 'xxx', False);
tab[1][6] := TTab.Create(gDataBase, dbgStoreICSTran, 0, 'storeicstran', 'xxx', False);
tab[1][7] := TTab.Create(gDataBase, dbgStoreIC, 0, 'storeic', 'xxx', False);
tab[1][8] := TTab.Create(gDataBase, dbgItemColourSupplier, 0, 'itemcoloursupplier', 'xxx', False);
tab[1][9] := TTab.Create(gDataBase, dbgDivision, 0, 'division', 'xxx', False);
tab[1][10] := TTab.Create(gDataBase, dbgDepartment, 0, 'department', 'xxx', False);
tab[1][11] := TTab.Create(gDataBase, dbgCategory, 0, 'category', 'xxx', False);
tab[1][12] := TTab.Create(gDataBase, dbgColour, 0, 'colour', 'xxx', False);
tab[1][13] := TTab.Create(gDataBase, dbgSize, 0, 'size', 'xxx', False);
tab[1][14] := TTab.Create(gDataBase, dbgItemColourImage, 0, 'itemcoloursize', 'xxx', False);
tab[1][15] := TTab.Create(gDataBase, dbgImage, 0, 'image', 'xxx', False);
tab[1][16] := TTab.Create(gDataBase, dbgFixedItemColourSize, 0, 'fixeditemcoloursize', 'xxx', False);
tab[1][17] := TTab.Create(gDataBase, dbgItemRetailChain, 0, 'itemretailchain', 'xxx', False);
tab[1][18] := TTab.Create(gDataBase, dbgRetailChain2, 0, 'retailchain', 'xxx', False);
end
else if (aIndex = 2) and (not Assigned(tab[2][0])) then //GRN
begin
lSQL := 'select * from grn where grn_code = :grn_code';
tab[2][0] := TTab.Create(gDataBase, dbgGrn, 0, 'grn', lSQL, False);
lSQL := 'select * from grnline where grn_code = :grn_code';
tab[2][1] := TTab.Create(gDataBase, dbgGrnLine, 0, 'grnline', lSQL, False);
lSQL := 'select * from grncarton where grn_code = :grn_code';
tab[2][2] := TTab.Create(gDataBase, dbgGrnCarton, 0, 'grncarton', lSQL, False);
lSQL := 'select * from grnsize where grn_code = :grn_code';
tab[2][3] := TTab.Create(gDataBase, dbgGrnSize, 0, 'grnsize', lSQL, False);
lSQL := 'select * from grncomment where grn_code = :grn_code';
tab[2][4] := TTab.Create(gDataBase, dbgGrnComment, 0, 'grncomment', lSQL, False);
lSQL := 'select * from storeicstran where (document_type = ' + QuotedStr('G') + ') and document_line_id in (select grnline_id from grnline where grn_code = :grn_code)';
tab[2][5] := TTab.Create(gDataBase, dbgStoreICSTran2, 0, 'storeicstran', lSQL, False);
end
else if (aIndex = 3) and (not Assigned(tab[3][0])) then //LOCMOVE
begin
lSQL := 'select * from locmove where locmove_code = :locmove_code';
tab[3][0] := TTab.Create(gDataBase, dbgLocMove, 0, 'locmove', lSQL, False);
lSQL := 'select * from locmoveline where locmove_code = :locmove_code';
tab[3][1] := TTab.Create(gDataBase, dbgLocMoveLine, 0, 'locmoveline', lSQL, False);
lSQL := 'select * from locmovecarton where locmove_code = :locmove_code';
tab[3][2] := TTab.Create(gDataBase, dbgLocMoveCarton, 0, 'locmovecarton', lSQL, False);
lSQL := 'select * from locmovesize where locmove_code = :locmove_code';
tab[3][3] := TTab.Create(gDataBase, dbgLocMoveSize, 0, 'locmovesize', lSQL, False);
lSQL := 'select * from locmovecomment where locmove_code = :locmove_code';
tab[3][4] := TTab.Create(gDataBase, dbgLocMoveComment, 0, 'locmovecomment', lSQL, False);
lSQL := 'select * from unitload where doc_type_ind = ''D'' and document_code = :locmove_code';
tab[3][5] := TTab.Create(gDataBase, dbgUnitload, 0, 'unitload', lSQL, False);
lSQL := 'select * from unitloadcontent where unitload_id in (select unitload_id from unitload where doc_type_ind = ''D'' and document_code = :locmove_code)';
tab[3][6] := TTab.Create(gDataBase, dbgUnitloadContent, 0, 'unitloadcontent', lSQL, False);
lSQL := 'select * from unitloadcontentlog where unitload_id in (select unitload_id from unitload where doc_type_ind = ''D'' and document_code = :locmove_code)';
tab[3][7] := TTab.Create(gDataBase, dbgUnitloadContentLog, 0, 'unitloadcontentlog', lSQL, False);
end
else if (aIndex = 4) and (not Assigned(tab[4][0])) then //STOCKTAKE
begin
lSQL := 'select * from stocktake where stocktake_code = :stocktake_code';
tab[4][0] := TTab.Create(gDataBase, dbgStocktake, 0, 'stocktake', lSQL, False);
lSQL := 'select * from stocktakecount where stocktake_code = :stocktake_code';
tab[4][1] := TTab.Create(gDataBase, dbgStocktakeCount, 0, 'stocktakecount', lSQL, False);
lSQL := 'select * from stocktakecountline where stocktakecount_code in (select stocktakecount_code from stocktakecount where stocktake_code = :stocktake_code)';
tab[4][2] := TTab.Create(gDataBase, dbgStocktakeCountLine, 0, 'stocktakecountline', lSQL, False);
lSQL := 'select * from stocktakeinit where stocktake_code = :stocktake_code';
tab[4][3] := TTab.Create(gDataBase, dbgStocktakeInit, 0, 'stocktakeinit', lSQL, False);
lSQL := 'select * from stocktakeadjustment where stocktake_code = :stocktake_code';
tab[4][4] := TTab.Create(gDataBase, dbgStocktakeAdjustment, 0, 'stocktakeadjustment', lSQL, False);
lSQL := 'select * from stocktakeomit where stocktake_code = :stocktake_code';
tab[4][5] := TTab.Create(gDataBase, dbgStocktakeOmit, 0, 'stocktakeomit', lSQL, False);
lSQL := 'select * from stocktakelocation where stocktake_code = :stocktake_code';
tab[4][6] := TTab.Create(gDataBase, dbgStocktakeLocation, 0, 'stocktakelocation', lSQL, False);
lSQL := 'select * from stocktakecategory where stocktake_code = :stocktake_code';
tab[4][7] := TTab.Create(gDataBase, dbgStocktakeCategory, 0, 'stocktakecategory', lSQL, False);
lSQL := 'select * from stocktakeerror where stocktake_code = :stocktake_code';
tab[4][8] := TTab.Create(gDataBase, dbgStocktakeError, 0, 'stocktakeerror', lSQL, False);
lSQL := 'select * from stocktakesku where stocktake_code = :stocktake_code';
tab[4][9] := TTab.Create(gDataBase, dbgStocktakeSku, 0, 'stocktakesku', lSQL, False);
end
else if (aIndex = 5) and (not Assigned(tab[5][0])) then //VIRTUALDRAWER
begin
lSQL := 'select * from virtualdrawer where virtualdrawer_code = :virtualdrawer_code';
tab[5][0] := TTab.Create(gDataBase, dbgVirtualDrawer, 0, 'virtualdrawer', lSQL, False);
lSQL := 'select * from virtualdrawertender where virtualdrawer_code = :virtualdrawer_code';
tab[5][1] := TTab.Create(gDataBase, dbgVirtualDrawerTender, 0, 'virtualdrawertender', lSQL, False);
lSQL := 'select * from virtualdrawertransfer where virtualdrawer_code = :virtualdrawer_code';
tab[5][2] := TTab.Create(gDataBase, dbgVirtualDrawerTransfer, 0, 'virtualdrawertransfer', lSQL, False);
lSQL := 'select * from vdmovement where virtualdrawer_code = :virtualdrawer_code';
tab[5][3] := TTab.Create(gDataBase, dbgVdMovement, 0, 'vdmovement', lSQL, False);
lSQL := 'select * from vdrawerevent where virtualdrawer_code = :virtualdrawer_code';
tab[5][4] := TTab.Create(gDataBase, dbgVdrawerEvent, 0, 'vdrawerevent', lSQL, False);
lSQL := 'select * from storejournal where virtualdrawer_code = :virtualdrawer_code';
tab[5][5] := TTab.Create(gDataBase, dbgStoreJournal, 0, 'storejournal', lSQL, False);
lSQL := 'select * from vdrawerrecline where virtualdrawer_code = :virtualdrawer_code';
tab[5][6] := TTab.Create(gDataBase, dbgVdrawerrecline, 0, 'vdrawerrecline', lSQL, False);
lSQL := 'select * from vdrawerrecdenom where vdrawerrecline_id in (select vdrawerrecline_id from vdrawerrecline where virtualdrawer_code = :virtualdrawer_code)';
tab[5][7] := TTab.Create(gDataBase, dbgVdrawerrecdenom, 0, 'vdrawerrecdenom', lSQL, False);
lSQL := 'select * from vdrawerrecvoucher where vdrawerrecline_id in (select vdrawerrecline_id from vdrawerrecline where virtualdrawer_code = :virtualdrawer_code)';
tab[5][8] := TTab.Create(gDataBase, dbgVdrawerrecvoucher, 0, 'vdrawerrecvoucher', lSQL, False);
end
else if (aIndex = 6) and (not Assigned(tab[6][0])) then //PROMOTION
begin
lSQL := 'select * from promotion where promotion_code = :promotion_code';
tab[6][0] := TTab.Create(gDataBase, dbgPromotion, 0, 'promotion', lSQL, False);
lSQL := 'select * from promotiontier where promotion_code = :promotion_code';
tab[6][1] := TTab.Create(gDataBase, dbgPromotionTier, 0, 'promotiontier', lSQL, False);
lSQL := 'select * from promotionitem where promotion_code = :promotion_code';
tab[6][2] := TTab.Create(gDataBase, dbgPromotionItem, 0, 'promotionitem', lSQL, False);
lSQL := 'select * from promotionitemgroup where promotion_code = :promotion_code';
tab[6][3] := TTab.Create(gDataBase, dbgPromotionItemGroup, 0, 'promotionitemgroup', lSQL, False);
lSQL := 'select * from promotionstore where promotion_code = :promotion_code';
tab[6][4] := TTab.Create(gDataBase, dbgPromotionStore, 0, 'promotionstore', lSQL, False);
lSQL := 'select * from promotioncustomer where promotion_code = :promotion_code';
tab[6][5] := TTab.Create(gDataBase, dbgPromotionCustomer, 0, 'promotioncustomer', lSQL, False);
lSQL := 'select * from promotioncustomertype where promotion_code = :promotion_code';
tab[6][6] := TTab.Create(gDataBase, dbgPromotionCustomerType, 0, 'promotioncustomertype', lSQL, False);
lSQL := 'select * from promotionloyaltygroup where promotion_code = :promotion_code';
tab[6][7] := TTab.Create(gDataBase, dbgPromotionLoyaltyGroup, 0, 'promotionloyaltygroup', lSQL, False);
lSQL := 'select * from promotionbeneficiary where promotion_code = :promotion_code';
tab[6][8] := TTab.Create(gDataBase, dbgPromotionBeneficiary, 0, 'promotionbeneficiary', lSQL, False);
end
else if (aIndex = 7) and (not Assigned(tab[7][0])) then //STORE
begin
lSQL := 'select * from store where store_code = :store_code';
tab[7][0] := TTab.Create(gDataBase, dbgStore, 0, 'store', lSQL, False);
lSQL := 'select * from storeneighbour where store_code = :store_code';
tab[7][1] := TTab.Create(gDataBase, dbgStoreNeighbour, 0, 'storeneighbour', lSQL, False);
lSQL := 'select * from location where store_code = :store_code';
tab[7][2] := TTab.Create(gDataBase, dbgLocation, 0, 'location', lSQL, False);
lSQL := 'select * from retailchain where retailchain_code in (select retailchain_code from location where location_code = :store_code)';
tab[7][3] := TTab.Create(gDataBase, dbgRetailChain, 0, 'retailchain', lSQL, False);
lSQL := 'select * from company where company_code in (select company_code from location where location_code = :store_code)';
tab[7][4] := TTab.Create(gDataBase, dbgCompany, 0, 'company', lSQL, False);
lSQL := 'select * from country where country_code in (select country_code from location where location_code = :store_code)';
tab[7][5] := TTab.Create(gDataBase, dbgCountry, 0, 'country', lSQL, False);
lSQL := 'select * from timezone where timezone_code in (select timezone_code from location where location_code = :store_code)';
tab[7][6] := TTab.Create(gDataBase, dbgTimeZone, 0, 'timezone', lSQL, False);
lSQL := 'select * from register where store_code = :store_code';
tab[7][7] := TTab.Create(gDataBase, dbgRegister, 0, 'register', lSQL, False);
lSQL := 'select * from remedipc where location_code = :store_code';
tab[7][8] := TTab.Create(gDataBase, dbgRemediPc, 0, 'remedipc', lSQL, False);
lSQL := 'select * from docketmessageline where store_code = :store_code';
tab[7][9] := TTab.Create(gDataBase, dbgDocketMessageLine, 0, 'docketmessageline', lSQL, False);
lSQL := 'select * from datacentre where location_code = :store_code';
tab[7][10] := TTab.Create(gDataBase, dbgDataCentre, 0, 'datacentre', lSQL, False);
lSQL := 'select * from datacentrestatus where datacentre_code in (select datacentre_code from datacentre where location_code = :store_code)';
tab[7][11] := TTab.Create(gDataBase, dbgDatacentreStatus, 0, 'datacentrestatus', lSQL, False);
lSQL := 'select * from datacentrelasttask where local_datacentre_code in (select datacentre_code from datacentre where location_code = :store_code)';
tab[7][12] := TTab.Create(gDataBase, dbgDatacentreLastTask, 0, 'datacentrelasttask', lSQL, False);
lSQL := 'select * from locationretailchain where location_code = :store_code';
tab[7][13] := TTab.Create(gDataBase, dbgLocationRetailChain, 0, 'locationretailchain', lSQL, False);
lSQL := 'select * from remedievent where location_code = :store_code';
tab[7][14] := TTab.Create(gDataBase, dbgRemediEvent, 0, 'remedievent', lSQL, False);
lSQL := 'select * from remediprintertype where remediprintertype_code in (select remediprintertype_code from register where store_code = :store_code)';
tab[7][15] := TTab.Create(gDataBase, dbgRemediPrinterType, 0, 'remediprintertype', lSQL, False);
lSQL := 'select * from currencylocation where location_code = :store_code';
tab[7][16] := TTab.Create(gDataBase, dbgCurrencyLocation, 0, 'currencylocation', lSQL, False);
lSQL := 'select * from currency where currency_code in (select currency_code from currencylocation where location_code = :store_code)';
tab[7][17] := TTab.Create(gDataBase, dbgCurrency, 0, 'currency', lSQL, False);
lSQL := 'select * from currencyrate where (from_currency_code in (select currency_code from currencylocation where location_code = :store_code)) or (to_currency_code in (select currency_code from currencylocation where location_code = :store_code))';
tab[7][18] := TTab.Create(gDataBase, dbgCurrencyRate, 0, 'currencyrate', lSQL, False);
lSQL := 'select * from laybyterms where (store_code = :store_code) or (store_code is null)';
tab[7][19] := TTab.Create(gDataBase, dbgLaybyTerms, 0, 'laybyterms', lSQL, False);
lSQL := 'select * from laybytermsline where laybyterms_id in (select laybyterms_id from laybyterms where (store_code = :store_code) or (store_code is null))';
tab[7][20] := TTab.Create(gDataBase, dbgLaybyTermsLine, 0, 'laybytermsline', lSQL, False);
end
else if (aIndex = 8) and (not Assigned(tab[8][0])) then //USER/EMPLOYEE
begin
lSQL := 'select * from remediuser where remediuser_code = :remediuser_code';
tab[8][0] := TTab.Create(gDataBase, dbgRemediUser, 0, 'remediuser', lSQL, False);
lSQL := 'select * from remediuserkey where remediuser_code = :remediuser_code';
tab[8][1] := TTab.Create(gDataBase, dbgRemediUserKey, 0, 'remediuserkey', lSQL, False);
lSQL := 'select * from employee where employee_id = :employee_id';
tab[8][2] := TTab.Create(gDataBase, dbgEmployee, 0, 'employee', lSQL, False);
lSQL := 'select * from employeestore where employee_id = :employee_id';
tab[8][3] := TTab.Create(gDataBase, dbgEmployeeStore, 0, 'employeestore', lSQL, False);
lSQL := 'select * from employeestoredisc where employee_id = :employee_id';
tab[8][4] := TTab.Create(gDataBase, dbgEmployeeStoreDisc, 0, 'employeestoredisc', lSQL, False);
lSQL := 'select * from timeattenddayhour where employee_id = :employee_id';
tab[8][5] := TTab.Create(gDataBase, dbgTimeAttendDayHour, 0, 'timeattenddayhour', lSQL, False);
lSQL := 'select * from timeattendtrans where employee_id = :employee_id';
tab[8][6] := TTab.Create(gDataBase, dbgTimeAttendTrans, 0, 'timeattendtrans', lSQL, False);
lSQL := 'select * from printrequest where employee_id = :employee_id';
tab[8][7] := TTab.Create(gDataBase, dbgPrintRequest, 0, 'printrequest', lSQL, False);
lSQL := 'select * from remedipwdhist where remediuser_code = :remediuser_code';
tab[8][8] := TTab.Create(gDataBase, dbgRemedipwdhist, 0, 'remedipwdhist', lSQL, False);
end
else if (aIndex = 9) and (not Assigned(tab[9][0])) then //CUSTOMER
begin
lSQL := 'select * from customer where customer_id = :customer_id';
tab[9][0] := TTab.Create(gDataBase, dbgCustomer, 0, 'customer', lSQL, False);
lSQL := 'select * from customertype where customertype_id in (select customertype_id from customer where customer_id = :customer_id)';
tab[9][1] := TTab.Create(gDataBase, dbgCustomerType, 0, 'customertype', lSQL, False);
lSQL := 'select * from customerpoints where customer_code = :customer_id';
tab[9][2] := TTab.Create(gDataBase, dbgCustomerPoints, 0, 'customerpoints', lSQL, False);
lSQL := 'select * from loyaltycustomer where customer_id = :customer_id';
tab[9][3] := TTab.Create(gDataBase, dbgLoyaltyCustomer, 0, 'loyaltycustomer', lSQL, False);
lSQL := 'select * from loyaltycustmember where loyaltycustomer_id in (select loyaltycustomer_id from loyaltycustomer where customer_id = :customer_id)';
tab[9][4] := TTab.Create(gDataBase, dbgLoyaltyCustMember, 0, 'loyaltycustmember', lSQL, False);
lSQL := 'select * from loyaltycusttran where loyaltycustomer_id in (select loyaltycustomer_id from loyaltycustomer where customer_id = :customer_id)';
tab[9][5] := TTab.Create(gDataBase, dbgLoyaltyCustTran, 0, 'loyaltycusttran', lSQL, False);
lSQL := 'select * from loyaltycustperiod where loyaltycustomer_id in (select loyaltycustomer_id from loyaltycustomer where customer_id = :customer_id)';
tab[9][6] := TTab.Create(gDataBase, dbgLoyaltyCustPeriod, 0, 'loyaltycustperiod', lSQL, False);
lSQL := 'select * from loyalty where loyalty_code in (select loyalty_code from loyaltycustomer where customer_id = :customer_id)';
tab[9][7] := TTab.Create(gDataBase, dbgLoyalty, 0, 'loyalty', lSQL, False);
lSQL := 'select * from loyaltyprogram where loyalty_code in (select loyalty_code from loyaltycustomer where customer_id = :customer_id)';
tab[9][8] := TTab.Create(gDataBase, dbgLoyaltyProgram, 0, 'loyaltyprogram', lSQL, False);
lSQL := 'select * from custidentification where customer_id = :customer_id';
tab[9][9] := TTab.Create(gDataBase, dbgCustIdentification, 0, 'custidentification', lSQL, False);
end
else if (aIndex = 10) and (not Assigned(tab[10][0])) then //LAYBY
begin
lSQL := 'select * from layby where layby_id = :layby_id';
tab[10][0] := TTab.Create(gDataBase, dbgLayby, 0, 'layby', lSQL, False);
lSQL := 'select * from laybyline where layby_code = :layby_id';
tab[10][1] := TTab.Create(gDataBase, dbgLaybyLine, 0, 'laybyline', lSQL, False);
lSQL := 'select * from laybytrans where layby_code = :layby_id';
tab[10][2] := TTab.Create(gDataBase, dbgLaybyTrans, 0, 'laybytrans', lSQL, False);
lSQL := 'select * from laybynote where layby_code = :layby_id';
tab[10][3] := TTab.Create(gDataBase, dbgLaybyNote, 0, 'laybynote', lSQL, False);
lSQL := 'select * from laybybalance where layby_id = :layby_id';
tab[10][4] := TTab.Create(gDataBase, dbgLaybyBalance, 0, 'laybybalance', lSQL, False);
lSQL := 'select * from customerpayment where layby_id = :layby_id';
tab[10][5] := TTab.Create(gDataBase, dbgCustomerPayment2, 0, 'customerpayment', lSQL, False);
lSQL := 'select * from saleline where layby_code = :layby_id';
tab[10][6] := TTab.Create(gDataBase, dbgSaleLine2, 0, 'saleline', lSQL, False);
end
else if (aIndex = 11) and (not Assigned(tab[11][0])) then //BANK DEPOSIT
begin
lSQL := 'select * from bankdeposit where bankdeposit_code = :bankdeposit_code';
tab[11][0] := TTab.Create(gDataBase, dbgBankDeposit, 0, 'bankdeposit', lSQL, False);
lSQL := 'select * from bankdepositcheque where bankdeposit_code = :bankdeposit_code';
tab[11][1] := TTab.Create(gDataBase, dbgBankDepositCheque, 0, 'bankdepositcheque', lSQL, False);
lSQL := 'select * from bankdepositvoucher where bankdeposit_code = :bankdeposit_code';
tab[11][2] := TTab.Create(gDataBase, dbgBankDepositVoucher, 0, 'bankdepositvoucher', lSQL, False);
lSQL := 'select * from bankdeposittransfer where bankdeposit_code = :bankdeposit_code';
tab[11][3] := TTab.Create(gDataBase, dbgBankDepositTransfer, 0, 'bankdeposittransfer', lSQL, False);
lSQL := 'select * from bankaccount where bankaccount_id in (select bankaccount_id from bankdeposit where bankdeposit_code = :bankdeposit_code)';
tab[11][4] := TTab.Create(gDataBase, dbgBankAccount, 0, 'bankaccount', lSQL, False);
lSQL := 'select * from bankaccountstore where bankaccount_id in (select bankaccount_id from bankdeposit where bankdeposit_code = :bankdeposit_code)';
tab[11][5] := TTab.Create(gDataBase, dbgBankAccountStore, 0, 'bankaccountstore', lSQL, False);
end
else if (aIndex = 12) and (not Assigned(tab[12][0])) then //ADJUSTMENT
begin
lSQL := 'select * from adjustment where adjustment_code = :adjustment_code';
tab[12][0] := TTab.Create(gDataBase, dbgAdjustment, 0, 'adjustment', lSQL, False);
lSQL := 'select * from adjustmentline where adjustment_code = :adjustment_code';
tab[12][1] := TTab.Create(gDataBase, dbgAdjustmentLine, 0, 'adjustmentline', lSQL, False);
lSQL := 'select * from adjustmentsize where adjustment_code = :adjustment_code';
tab[12][2] := TTab.Create(gDataBase, dbgAdjustmentSize, 0, 'adjustmentsize', lSQL, False);
lSQL := 'select * from storeicstran where (document_type = ' + QuotedStr('A') + ') and document_line_id in (select adjustmentline_id from adjustmentline where adjustment_code = :adjustment_code)';
tab[12][3] := TTab.Create(gDataBase, dbgStoreICSTran4, 0, 'storeicstran', lSQL, False);
end;
//new master tab
end;
procedure TdSMSLinks.AdjustTabSQLForItemSearch;
begin
tab[1][0].SQL := 'select * from item where item_code = :item_code';
tab[1][1].SQL := 'select * from itemcolour where item_code = :item_code';
tab[1][2].SQL := 'select * from itemcoloursize where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code)';
tab[1][3].SQL := 'select * from storeics where itemcoloursize_id in (select itemcoloursize_id from itemcoloursize where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code))';
tab[1][4].SQL := 'select * from price where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code)';
tab[1][5].SQL := 'select * from sellcode where itemcoloursize_id in (select itemcoloursize_id from itemcoloursize where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code))';
tab[1][6].SQL := 'select * from storeicstran where itemcoloursize_id in (select itemcoloursize_id from itemcoloursize where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code))';
tab[1][7].SQL := 'select * from storeic where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code)';
tab[1][8].SQL := 'select * from itemcoloursupplier where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code)';
tab[1][9].SQL := 'select * from division where division_code in (select division_code from item where item_code = :item_code)';
tab[1][10].SQL := 'select * from department where department_code in (select department_code from item where item_code = :item_code)';
tab[1][11].SQL := 'select * from category where category_code in (select category_code from item where item_code = :item_code)';
tab[1][12].SQL := 'select * from colour where colour_code in (select colour_code from itemcolour where item_code = :item_code)';
tab[1][13].SQL := 'select * from "size" where "size" in (select size from itemcoloursize where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code))';
tab[1][14].SQL := 'select * from itemcolourimage where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code)';
tab[1][15].SQL := 'select * from "image" where image_code in (select image_code from itemcolourimage where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code))';
tab[1][16].SQL := 'select * from fixeditemcoloursize where itemcoloursize_id in (select itemcoloursize_id from itemcoloursize where itemcolour_id in (select itemcolour_id from itemcolour where item_code = :item_code))';
tab[1][17].SQL := 'select * from itemretailchain where item_code = :item_code';
tab[1][18].SQL := 'select * from retailchain where retailchain_code in (select retailchain_code from itemretailchain where item_code = :item_code)';
end;
procedure TdSMSLinks.AdjustTabSQLForICSearch;
begin
tab[1][0].SQL := 'select * from item where item_code = (select item_code from itemcolour where itemcolour_id = :itemcolour_id)';
tab[1][1].SQL := 'select * from itemcolour where itemcolour_id = :itemcolour_id';
tab[1][2].SQL := 'select * from itemcoloursize where itemcolour_id = :itemcolour_id';
tab[1][3].SQL := 'select * from storeics where itemcoloursize_id in (select itemcoloursize_id from itemcoloursize where itemcolour_id = :itemcolour_id)';
tab[1][4].SQL := 'select * from price where itemcolour_id = :itemcolour_id';
tab[1][5].SQL := 'select * from sellcode where itemcoloursize_id in (select itemcoloursize_id from itemcoloursize where itemcolour_id = :itemcolour_id)';
tab[1][6].SQL := 'select * from storeicstran where itemcoloursize_id in (select itemcoloursize_id from itemcoloursize where itemcolour_id = :itemcolour_id)';
tab[1][7].SQL := 'select * from storeic where itemcolour_id = :itemcolour_id';
tab[1][8].SQL := 'select * from itemcoloursupplier where itemcolour_id = :itemcolour_id';
tab[1][9].SQL := 'select * from division where division_code in (select division_code from item where item_code = (select item_code from itemcolour where itemcolour_id = :itemcolour_id))';
tab[1][10].SQL := 'select * from department where department_code in (select department_code from item where item_code = (select item_code from itemcolour where itemcolour_id = :itemcolour_id))';
tab[1][11].SQL := 'select * from category where category_code in (select category_code from item where item_code = (select item_code from itemcolour where itemcolour_id = :itemcolour_id))';
tab[1][12].SQL := 'select * from colour where colour_code in (select colour_code from itemcolour where itemcolour_id = :itemcolour_id)';
tab[1][13].SQL := 'select * from "size" where "size" in (select size from itemcoloursize where itemcolour_id = :itemcolour_id)';
tab[1][14].SQL := 'select * from itemcolourimage where itemcolour_id = :itemcolour_id';
tab[1][15].SQL := 'select * from "image" where image_code in (select image_code from itemcolourimage where itemcolour_id = :itemcolour_id)';
tab[1][16].SQL := 'select * from fixeditemcoloursize where itemcoloursize_id in (select itemcoloursize_id from itemcoloursize where itemcolour_id = :itemcolour_id)';
tab[1][17].SQL := 'select * from itemretailchain where item_code = (select item_code from itemcolour where itemcolour_id = :itemcolour_id)';
//Whoops :( This is longer than 255 chars
//tab[1][18].SQL := 'select * from retailchain where retailchain_code in (select retailchain_code from itemretailchain where item_code = (select item_code from itemcolour where itemcolour_id = :itemcolour_id))';
tab[1][18].SQL := 'select * from retailchain';
end;
procedure TdSMSLinks.AdjustTabSQLForICSSearch;
begin
tab[1][0].SQL := 'select * from item where item_code = (select item_code from itemcolour where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id))';
tab[1][1].SQL := 'select * from itemcolour where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)';
tab[1][2].SQL := 'select * from itemcoloursize where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)';
tab[1][3].SQL := 'select * from storeics where itemcoloursize_id = :itemcoloursize_id';
tab[1][4].SQL := 'select * from price where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)';
tab[1][5].SQL := 'select * from sellcode where itemcoloursize_id = :itemcoloursize_id';
tab[1][6].SQL := 'select * from storeicstran where itemcoloursize_id = :itemcoloursize_id';
tab[1][7].SQL := 'select * from storeic where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)';
tab[1][8].SQL := 'select * from itemcoloursupplier where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)';
tab[1][9].SQL := 'select * from division where division_code in (select division_code from item where item_code = (select item_code from itemcolour where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)))';
tab[1][10].SQL := 'select * from department where department_code in (select department_code from item where item_code = (select item_code from itemcolour where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)))';
tab[1][11].SQL := 'select * from category where category_code in (select category_code from item where item_code = (select item_code from itemcolour where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)))';
tab[1][12].SQL := 'select * from colour where colour_code in (select colour_code from itemcolour where item_code = (select item_code from itemcolour where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)))';
tab[1][13].SQL := 'select * from "size" where "size" in (select size from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)';
tab[1][14].SQL := 'select * from itemcolourimage where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)';
tab[1][15].SQL := 'select * from "image" where image_code in (select image_code from itemcolourimage where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id))';
tab[1][16].SQL := 'select * from fixeditemcoloursize where itemcoloursize_id = :itemcoloursize_id';
tab[1][17].SQL := 'select * from itemretailchain where item_code = (select item_code from itemcolour where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id))';
//Whoops :( This is longer than 255 chars
//tab[1][18].SQL := 'select * from retailchain where retailchain_code in (select retailchain_code from itemretailchain where item_code = (select item_code from itemcolour where itemcolour_id = (select itemcolour_id from itemcoloursize where itemcoloursize_id = :itemcoloursize_id)))';
tab[1][18].SQL := 'select * from retailchain';
end;
procedure TdSMSLinks.SetMasterTabs;
begin
SetLength(mCode, 17); //determined by the number of TEdits for the codes
mCode[0].edt := edtSaleCode;
mCode[0].btnS := btnSaleSearch;
mCode[0].code := 'sale_code';
mCode[1].edt := edtReceiptNbr;
mCode[1].btnS := btnSaleSearch;
mCode[1].code := 'receipt_ref';
mCode[2].edt := edtItemColourSize;
mCode[2].btnS := btnItemSearch;
mCode[2].code := 'itemcoloursize_id';
mCode[3].edt := edtItemColour;
mCode[3].btnS := btnItemSearch;
mCode[3].code := 'itemcolour_id';
mCode[4].edt := edtItem;
mCode[4].btnS := btnItemSearch;
mCode[4].code := 'item_code';
mCode[5].edt := edtGRNCode;
mCode[5].btnS := btnGRNSearch;
mCode[5].code := 'grn_code';
mCode[6].edt := edtLocMoveCode;
mCode[6].btnS := btnSearchLocMove;
mCode[6].code := 'locmove_code';
mCode[7].edt := edtStocktakeCode;
mCode[7].btnS := btnSearchStocktake;
mCode[7].code := 'stocktake_code';
mCode[8].edt := edtVirtualDrawerCode;
mCode[8].btnS := btnSearchVirtualDrawer;
mCode[8].code := 'virtualdrawer_code';
mCode[9].edt := edtPromotionCode;
mCode[9].btnS := btnSearchPromotion;
mCode[9].code := 'promotion_code';
mCode[10].edt := edtStoreCode;
mCode[10].btnS := btnSearchStore;
mCode[10].code := 'store_code';
mCode[11].edt := edtEmployeeId;