-
Notifications
You must be signed in to change notification settings - Fork 0
/
Common Ground Tools.MB
1623 lines (1246 loc) · 61.8 KB
/
Common Ground Tools.MB
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
include "Common Ground.DEF"
'================================================================================
sub EnsureTableIsFormattedForV12 ( byval InputTable as string )
'================================================================================
dim M1TableRequiresFieldReordering as logical
if not FieldExists ( InputTable , "lga_code" ) then
alter table InputTable ( add lga_code Char(5) )
M1TableRequiresFieldReordering = "TRUE"
end if
if not FieldExists ( InputTable , "new_sub" ) then
alter table InputTable ( add new_sub Char(1) )
M1TableRequiresFieldReordering = "TRUE"
end if
if not FieldExists ( InputTable , "address_pfi" ) then
alter table InputTable ( add address_pfi Char(10) )
M1TableRequiresFieldReordering = "TRUE"
end if
if not FieldExists ( InputTable , "SU_HSA_FLAG" ) then
alter table InputTable ( add su_hsa_flag Char(1) )
M1TableRequiresFieldReordering = "TRUE"
end if
if not FieldExists ( InputTable , "SU_HSA_UNIT_ID" ) then
alter table InputTable ( add su_hsa_unit_id Char (10) )
M1TableRequiresFieldReordering = "TRUE"
end if
if not FieldExists ( InputTable , "access_type" ) then
alter table InputTable ( add access_type Char(1) )
M1TableRequiresFieldReordering = "TRUE"
end if
if not FieldExists ( InputTable , "new_road" ) then
alter table InputTable ( add new_road Char(1) )
M1TableRequiresFieldReordering = "TRUE"
end if
if not FieldExists ( InputTable , "M1Version" ) then
alter table InputTable ( add M1Version Char(5) )
M1TableRequiresFieldReordering = "TRUE"
end if
if M1TableRequiresFieldReordering = "TRUE" then
alter table InputTable (
order
lga_code,
new_sub,
property_pfi,
parcel_pfi,
address_pfi,
multi_assess,
retired_propnum,
base_propnum,
propnum,
crefno,
spi,
part_p,
plan_number,
lot_number,
allotment,
section_p,
block_c,
portion,
subdivision,
parish_code,
township_code,
su_hsa_flag,
su_hsa_unit_id,
su_type,
su_prefix_1,
su_no_1,
su_suff_1,
su_prefix_2,
su_no_2,
su_suff_2,
fl_type,
fl_prefix_1,
fl_no_1,
fl_suff_1,
fl_prefix_2,
fl_no_2 ,
fl_suff_2,
pr_name_1,
pr_name_2,
loc_des,
house_prefix_1,
house_number_1 ,
house_suffix_1 ,
house_prefix_2,
house_number_2 ,
house_suffix_2,
display_prefix_1,
display_no_1,
display_suffix_1,
display_prefix_2,
display_no_2 ,
display_suffix_2,
access_type,
new_road )
end if
end sub
'================================================================================
sub AddLayerToMap ( byval TableName as string , byval ViewPreference as smallint )
'================================================================================
dim LayerName as string
if TableName like "%\%" then
open table TableName
LayerName = TableInfo ( 0 , 1 )
else
LayerName = TableName
end if
if IsMapWindowOpen() then
set map redraw off
add map auto layer LayerName
else
map from LayerName
set window CurrentMapWindow
position (0,0)
title "Common Ground Map"
scrollbars on
width WindowInfo ( CurrentMapWindow, WIN_INFO_WIDTH ) * 1.5
height WindowInfo ( CurrentMapWindow, WIN_INFO_HEIGHT ) * 1.5
set map redraw off
end if
do case ViewPreference
case LAYERSHOW
do case LayerName
case VicmapAddressTable
set map Layer LayerName
Display Global
Global Pen (1,2,0) Brush (1,16777215,16777215) Symbol (31,0,12) Line (1,2,0) Font ("Arial",0,8,0)
Zoom (0, 25) Units "km"
Label Position Center Font ("Arial",257,9,255,16777215) Pen (1,2,0)
With Left$(Left$(EZI_ADDRESS, InStr(1, EZI_ADDRESS, " ")-1), 99*Int(Str$(HOUSE_NUMBER_1) <> all("", "0")))
Auto On Overlap On Duplicates On PartialSegments On Max 96 Visibility Zoom (0, 25) Units "km"
Visibility On
case VicmapPropertyTable
Set Map Layer LayerName
Display Global
Global Pen (1,2,0) Global Brush (1,16777215,16777215)
Label With PROP_PROPNUM
case VicmapParcelTable
Set Map Layer LayerName
Display Global
Global Pen (1,2,12632256) Global Brush (1,0,16777215)
Label Font ("Arial",257,8,12632256,16777215)
With Left$(PARCEL_SPI, InStr(1, PARCEL_SPI, "\")-1)+Chr$(13)+Mid$(PARCEL_SPI, InStr(1, PARCEL_SPI, "\")+1, 99)
Auto On PartialSegments On Overlap Off Max 64 Visibility Zoom (0, 10) Units "km"
Visibility On
case VicmapParcelTable + "_proposed"
Set Map Layer LayerName
Display Global
Selectable Off
Global Line (1,2,0) Global Pen (2,9,16711935) Global Brush (1,16777215,16777215)
Label Font ("Arial",257,8,16711935,16777215) Pen (1,2,0)
With Left$(PARCEL_SPI, InStr(1, PARCEL_SPI, "\")-1)+Chr$(13)+Mid$(PARCEL_SPI, InStr(1, PARCEL_SPI, "\")+1, 99)
Auto On PartialSegments On Overlap On Max 32 Visibility Zoom (0, 10) Units "km"
Visibility On
case VicmapParcelTable + "_multi_lot"
Set Map Layer LayerName
Display Global
Selectable Off
Global Line (1,2,0) Global Pen (1,1,16744448) Global Brush (6,65280)
case VicmapPropertyTable + "_multi_ass"
Set Map Layer LayerName
Display Global
Selectable Off
Global Line (1,2,0) Global Pen (1,1,16744448) Global Brush (5,16756832)
end case
case LAYERHIDE
set map layer LayerName
Selectable Off
do case LayerName
case VicmapPropertyTable, VicmapParcelTable
Set Map Layer LayerName
Display Global
Global Pen (1,1,0) Global Brush (1,16777215,16777215)
end case
end case
set map redraw on
end sub
'================================================================================
function IsThisWindowOpen ( byval WindowID as integer ) as logical
'================================================================================
dim WindowName as string
onerror goto Err
WindowName = WindowInfo ( WindowID , WIN_INFO_NAME )
IsThisWindowOpen = TRUE
exit function
Err:
end function
'================================================================================
function INIValue ( byval SectionName as string , byval KeyName as string ) as string
'================================================================================
dim ValueReturned as string
dim ReadArgument as smallint
dim INIFile as string
onerror goto HandleError
INIFile = ApplicationDirectory$() & "Common Ground.INI"
ValueReturned = string$(255,"X")
ReadArgument = GetPrivateProfileString32(SectionName, KeyName, "?", ValueReturned, len(ValueReturned), INIFile)
INIValue = ValueReturned
exit sub
HandleError:
print " " + Error$()
resume next
end function
'================================================================================
function AutoSpreadsheetName ( byval FolderName as string , byval CouncilLabel as string , byval UserName as string ) as string
'================================================================================
dim FileList() as string
dim NumFiles as integer
dim i as integer
dim ThisFileNum as integer
dim LatestFileNum as integer
'**** Populate the variable LatestFileNum with the value of the highest number found in any xls file
call GetFiles ( FolderName , "*.xls", FileList )
NumFiles = ubound ( FileList )
for i = 1 to NumFiles
if FileList(i) like "#%" then
ThisFileNum = val ( mid$ ( FileList(i) , 2 , 3 ) )
if ThisFileNum > LatestFileNum then
LatestFileNum = ThisFileNum
end if
end if
next
'**** Populate the variable LatestFileNum with the value of the highest number found in any csv file
call GetFiles ( FolderName , "*.csv", FileList )
NumFiles = ubound ( FileList )
for i = 1 to NumFiles
if FileList(i) like "#%" then
ThisFileNum = val ( mid$ ( FileList(i) , 2 , 3 ) )
if ThisFileNum > LatestFileNum then
LatestFileNum = ThisFileNum
end if
end if
next
if CouncilLabel like "M1%" then
CouncilLabel = ltrim$ ( mid$ ( CouncilLabel , 3 , 99 ) )
end if
if CouncilLabel like "%M1" then
CouncilLabel = rtrim$ ( left$ ( CouncilLabel , len ( CouncilLabel ) - 2 ) )
end if
'find and replace spaces with underscores
CouncilLabel = FindAndReplaceTextRecursive ( CouncilLabel , " " , "_" )
if UserName <> "" then
UserName = UserName + "_"
end if
AutoSpreadsheetName =
"#" + Format$ ( LatestFileNum + 1 , "000" ) + "_" +
CouncilLabel +
"_M1_" +
Year ( CurDate () ) + "-" + Format$ ( Month ( CurDate () ) , "00" ) + "-" + Format$ ( Day ( CurDate () ) , "00" ) + "_" +
UserName +
"v12" +
".csv"
end function
'================================================================================
function AutoEditCode (
byval TargetPropertyMulti as string ,
byval TargetAddressPrimary as string ,
byval TargetAddressDistRel as string ,
byval TargetExtent as integer ,
byval ActionPropNum as integer ,
byval ActionAddress as integer ,
byval ActionCrefNo as integer ) as string
'================================================================================
dim CodeValue as string
'---- EDIT CODE 'A' Add a Multi Assessment property
if ActionPropNum = PROPNUM_ADD then
CodeValue = "A"
goto FinalVerdict
end if
'---- EDIT CODE 'R' Retire a Multi Assessment property
if TargetPropertyMulti = "Y" and ActionPropNum = PROPNUM_REMOVE then
CodeValue = "R"
goto FinalVerdict
end if
'---- EDIT CODE 'T' Transfer a parcel out of a multi-parcel property
'if TargetExtent = EXTENT_THIS_PARCEL and ActionPropNum = PROPNUM_MODIFY then
' if TargetExtent = EXTENT_THIS_PARCEL and ActionPropNum in ( PROPNUM_MODIFY , PROPNUM_REMOVE ) then
' CodeValue = "T"
' goto FinalVerdict
' end if
'---- EDIT CODE 'E' Update Everything
if ActionAddress = ADDRESS_MODIFY and ( ActionPropNum = PROPNUM_MODIFY or ActionCrefNo = CREFNO_MODIFY ) then
CodeValue = "E"
goto FinalVerdict
end if
'---- EDIT CODE 'C'
if ActionPropNum = PROPNUM_NO_ACTION and ActionAddress = ADDRESS_NO_ACTION and ActionCrefNo in ( CREFNO_MODIFY , CREFNO_REMOVE ) then
CodeValue = "C"
goto FinalVerdict
end if
'---- EDIT CODE 'P' Update Council Property and Parcel Details
if ActionAddress = ADDRESS_NO_ACTION and ( ActionPropNum = PROPNUM_MODIFY or ActionPropNum = PROPNUM_REMOVE or ActionCrefNo in ( CREFNO_MODIFY , CREFNO_REMOVE ) ) then
CodeValue = "P"
goto FinalVerdict
end if
'---- EDIT CODE 'Z' Retire a Secondary Address
'if ActionAddress = ADDRESS_REMOVE and ( TargetAddressDistRel = "Y" or TargetAddressPrimary = "N" ) then
if ActionAddress = ADDRESS_REMOVE and TargetAddressPrimary = "N" then
CodeValue = "Z"
goto FinalVerdict
end if
'---- EDIT CODE 'S' Update Address Details
'if ( ActionAddress = ADDRESS_MODIFY and ( ActionPropNum = PROPNUM_NO_ACTION or TargetAddressDistRel = "Y" or TargetAddressPrimary = "N" ) ) or
if ( ActionAddress in (ADDRESS_MODIFY,ADDRESS_ADD) and ( ActionPropNum = PROPNUM_NO_ACTION or TargetAddressDistRel = "Y" or TargetAddressPrimary = "N" ) ) or
( ActionPropNum = PROPNUM_ADD ) or
( ActionAddress = ADDRESS_REMOVE and TargetAddressPrimary = "Y" ) then
CodeValue = "S"
goto FinalVerdict
end if
FinalVerdict:
AutoEditCode = CodeValue
end function
' '================================================================================
' function IsAdditionalZapRecordRequired (
' byval CurrentEditCode as string ,
' byval TargetParcelPFI as string ,
' byval TargetAddressPFI as string ,
' byval TargetAddressPrimary as string ,
' byval TargetAddressDistRel as string ,
' byval ActionAddress as integer ) as logical
' '================================================================================
' dim Check1 as logical
' dim Check2 as logical
' dim ParcelObject as alias
' dim AddressObject as alias
' if ActionAddress = ADDRESS_MODIFY and ( TargetAddressPrimary = "N" or TargetAddressDistRel = "Y" ) then
' Check1 = TRUE
' if CurrentEditCode = "T" then
' ParcelObject = VicmapParcelTable + ".obj"
' AddressObject = VicmapAddressTable + ".obj"
' select *
' from VicmapParcelTable, VicmapAddressTable
' where PARCEL_PFI = TargetParcelPFI and
' ParcelObject contains AddressObject and
' PFI = TargetAddressPFI
' into TempSelection noselect
' if TableInfo ( TempSelection , TAB_INFO_NROWS ) > 0 then
' Check2 = TRUE
' end if
' close table TempSelection
' else
' Check2 = TRUE
' end if
' end if
' if Check1 and Check2 then
' IsAdditionalZapRecordRequired = TRUE
' end if
' end function
'================================================================================
sub PopulateExtentArray ( byval NumParcels as integer )
'================================================================================
do case NumParcels
case 1
redim ExtentPicklistArray ( 1 )
ExtentPicklistArray ( 1 ) = "this parcel/property"
ExtentMode = 1
case else
redim ExtentPicklistArray ( 2 )
ExtentPicklistArray ( 1 ) = "whole property (" + NumParcels + " parcels)"
ExtentPicklistArray ( 2 ) = "this parcel"
ExtentMode = 2
end case
end sub
'================================================================================
sub UpdateRecordFromAddressArray ( byval TableName as string , byval RowNum as integer , AddressArray ( ) as AddressCaptureForm )
'================================================================================
update TableName set SU_HSA_FLAG = ucase$ ( AddressArray ( ) . SU_HSA_FLAG ) where RowID = RowNum
update TableName set SU_HSA_UNIT_ID = ucase$ ( AddressArray ( ) . SU_HSA_UNIT_ID ) where RowID = RowNum
update TableName set SU_TYPE = ucase$ ( AddressArray ( ) . SU_TYPE ) where RowID = RowNum
update TableName set SU_PREFIX_1 = ucase$ ( AddressArray ( ) . SU_PREFIX_1 ) where RowID = RowNum
update TableName set SU_NO_1 = ucase$ ( AddressArray ( ) . SU_NO_1 ) where RowID = RowNum
update TableName set SU_SUFF_1 = ucase$ ( AddressArray ( ) . SU_SUFF_1 ) where RowID = RowNum
update TableName set SU_PREFIX_2 = ucase$ ( AddressArray ( ) . SU_PREFIX_2 ) where RowID = RowNum
update TableName set SU_NO_2 = ucase$ ( AddressArray ( ) . SU_NO_2 ) where RowID = RowNum
update TableName set SU_SUFF_2 = ucase$ ( AddressArray ( ) . SU_SUFF_2 ) where RowID = RowNum
update TableName set FL_TYPE = ucase$ ( AddressArray ( ) . FL_TYPE ) where RowID = RowNum
update TableName set FL_PREFIX_1 = ucase$ ( AddressArray ( ) . FL_PREFIX_1 ) where RowID = RowNum
update TableName set FL_NO_1 = ucase$ ( AddressArray ( ) . FL_NO_1 ) where RowID = RowNum
update TableName set FL_SUFF_1 = ucase$ ( AddressArray ( ) . FL_SUFF_1 ) where RowID = RowNum
update TableName set FL_PREFIX_2 = ucase$ ( AddressArray ( ) . FL_PREFIX_2 ) where RowID = RowNum
update TableName set FL_NO_2 = ucase$ ( AddressArray ( ) . FL_NO_2 ) where RowID = RowNum
update TableName set FL_SUFF_2 = ucase$ ( AddressArray ( ) . FL_SUFF_2 ) where RowID = RowNum
update TableName set PR_NAME_1 = ucase$ ( AddressArray ( ) . PR_NAME_1 ) where RowID = RowNum
update TableName set PR_NAME_2 = ucase$ ( AddressArray ( ) . PR_NAME_2 ) where RowID = RowNum
update TableName set LOC_DES = ucase$ ( AddressArray ( ) . LOC_DES ) where RowID = RowNum
update TableName set HOUSE_PREFIX_1 = ucase$ ( AddressArray ( ) . HOUSE_PREFIX_1 ) where RowID = RowNum
update TableName set HOUSE_NUMBER_1 = ucase$ ( AddressArray ( ) . HOUSE_NUMBER_1 ) where RowID = RowNum
update TableName set HOUSE_SUFFIX_1 = ucase$ ( AddressArray ( ) . HOUSE_SUFFIX_1 ) where RowID = RowNum
update TableName set HOUSE_PREFIX_2 = ucase$ ( AddressArray ( ) . HOUSE_PREFIX_2 ) where RowID = RowNum
update TableName set HOUSE_NUMBER_2 = ucase$ ( AddressArray ( ) . HOUSE_NUMBER_2 ) where RowID = RowNum
update TableName set HOUSE_SUFFIX_2 = ucase$ ( AddressArray ( ) . HOUSE_SUFFIX_2 ) where RowID = RowNum
update TableName set STREET_NAME = ucase$ ( AddressArray ( ) . STREET_NAME ) where RowID = RowNum
update TableName set STREET_TYPE = ucase$ ( AddressArray ( ) . STREET_TYPE ) where RowID = RowNum
update TableName set STREET_SUFFIX = ucase$ ( AddressArray ( ) . STREET_SUFFIX ) where RowID = RowNum
update TableName set LOCALITY = ucase$ ( AddressArray ( ) . LOCALITY ) where RowID = RowNum
update TableName set DIST_RELATED_FLAG = ucase$ ( AddressArray ( ) . DIST_RELATED_FLAG ) where RowID = RowNum
update TableName set PRIMARY = ucase$ ( AddressArray ( ) . PRIMARY ) where RowID = RowNum
update TableName set EASTING = ucase$ ( AddressArray ( ) . EASTING ) where RowID = RowNum
update TableName set NORTHING = ucase$ ( AddressArray ( ) . NORTHING ) where RowID = RowNum
update TableName set DATUM_PROJ = ucase$ ( AddressArray ( ) . DATUM_PROJ ) where RowID = RowNum
update TableName set OUTSIDE_PROPERTY = ucase$ ( AddressArray ( ) . OUTSIDE_PROPERTY ) where RowID = RowNum
end sub
'================================================================================
sub UpdateAddressArrayFromRecord ( AddressArray () as AddressCaptureForm , byval TableName as string , byval RowNum as integer )
'================================================================================
dim FieldAlias as alias
onerror goto Err
fetch rec RowNum from TableName
do case TableName
case RatesAddressQuery
FieldAlias = TableName + ".SU_HSA_FLAG"
AddressArray ( ) . SU_HSA_FLAG = FieldAlias
FieldAlias = TableName + ".SU_HSA_UNIT_ID"
AddressArray ( ) . SU_HSA_UNIT_ID = FieldAlias
FieldAlias = TableName + ".SU_TYPE"
AddressArray ( ) . SU_TYPE = FieldAlias
FieldAlias = TableName + ".SU_PREFIX_1"
AddressArray ( ) . SU_PREFIX_1 = FieldAlias
FieldAlias = TableName + ".SU_NO_1"
AddressArray ( ) . SU_NO_1 = FieldAlias
FieldAlias = TableName + ".SU_SUFF_1"
AddressArray ( ) . SU_SUFF_1 = FieldAlias
FieldAlias = TableName + ".SU_PREFIX_2"
AddressArray ( ) . SU_PREFIX_2 = FieldAlias
FieldAlias = TableName + ".SU_NO_2"
AddressArray ( ) . SU_NO_2 = FieldAlias
FieldAlias = TableName + ".SU_SUFF_2"
AddressArray ( ) . SU_SUFF_2 = FieldAlias
FieldAlias = TableName + ".FL_TYPE"
AddressArray ( ) . FL_TYPE = FieldAlias
FieldAlias = TableName + ".FL_PREFIX_1"
AddressArray ( ) . FL_PREFIX_1 = FieldAlias
FieldAlias = TableName + ".FL_NO_1"
AddressArray ( ) . FL_NO_1 = FieldAlias
FieldAlias = TableName + ".FL_SUFF_1"
AddressArray ( ) . FL_SUFF_1 = FieldAlias
FieldAlias = TableName + ".FL_PREFIX_2"
AddressArray ( ) . FL_PREFIX_2 = FieldAlias
FieldAlias = TableName + ".FL_NO_2"
AddressArray ( ) . FL_NO_2 = FieldAlias
FieldAlias = TableName + ".FL_SUFF_2"
AddressArray ( ) . FL_SUFF_2 = FieldAlias
FieldAlias = TableName + ".PR_NAME_1"
AddressArray ( ) . PR_NAME_1 = FieldAlias
FieldAlias = TableName + ".PR_NAME_2"
AddressArray ( ) . PR_NAME_2 = FieldAlias
FieldAlias = TableName + ".LOC_DES"
AddressArray ( ) . LOC_DES = FieldAlias
FieldAlias = TableName + ".HOUSE_PREFIX_1"
AddressArray ( ) . HOUSE_PREFIX_1 = FieldAlias
FieldAlias = TableName + ".HOUSE_NUMBER_1"
AddressArray ( ) . HOUSE_NUMBER_1 = FieldAlias
FieldAlias = TableName + ".HOUSE_SUFFIX_1"
AddressArray ( ) . HOUSE_SUFFIX_1 = FieldAlias
FieldAlias = TableName + ".HOUSE_PREFIX_2"
AddressArray ( ) . HOUSE_PREFIX_2 = FieldAlias
FieldAlias = TableName + ".HOUSE_NUMBER_2"
AddressArray ( ) . HOUSE_NUMBER_2 = FieldAlias
FieldAlias = TableName + ".HOUSE_SUFFIX_2"
AddressArray ( ) . HOUSE_SUFFIX_2 = FieldAlias
FieldAlias = TableName + ".STREET_NAME"
AddressArray ( ) . STREET_NAME = FieldAlias
FieldAlias = TableName + ".STREET_TYPE"
AddressArray ( ) . STREET_TYPE = FieldAlias
FieldAlias = TableName + ".STREET_SUFFIX"
AddressArray ( ) . STREET_SUFFIX = FieldAlias
FieldAlias = TableName + ".LOCALITY"
AddressArray ( ) . LOCALITY = FieldAlias
FieldAlias = TableName + ".PRIMARY"
AddressArray ( ) . PRIMARY = FieldAlias
FieldAlias = TableName + ".DIST_RELATED_FLAG"
AddressArray ( ) . DIST_RELATED_FLAG = FieldAlias
FieldAlias = TableName + ".OUTSIDE_PROPERTY"
AddressArray ( ) . OUTSIDE_PROPERTY = FieldAlias
case VicmapAddressQuery
FieldAlias = TableName + ".SU_HSA_FLAG"
AddressArray ( ) . SU_HSA_FLAG = FieldAlias
FieldAlias = TableName + ".SU_HSA_UNIT_ID"
AddressArray ( ) . SU_HSA_UNIT_ID = FieldAlias
FieldAlias = TableName + ".BLG_UNIT_TYPE"
AddressArray ( ) . SU_TYPE = FieldAlias
FieldAlias = TableName + ".BLG_UNIT_PREFIX_1"
AddressArray ( ) . SU_PREFIX_1 = FieldAlias
FieldAlias = TableName + ".BLG_UNIT_ID_1"
AddressArray ( ) . SU_NO_1 = FieldAlias
FieldAlias = TableName + ".BLG_UNIT_SUFFIX_1"
AddressArray ( ) . SU_SUFF_1 = FieldAlias
FieldAlias = TableName + ".BLG_UNIT_PREFIX_2"
AddressArray ( ) . SU_PREFIX_2 = FieldAlias
FieldAlias = TableName + ".BLG_UNIT_ID_2"
AddressArray ( ) . SU_NO_2 = FieldAlias
FieldAlias = TableName + ".BLG_UNIT_SUFFIX_2"
AddressArray ( ) . SU_SUFF_2 = FieldAlias
FieldAlias = TableName + ".FLOOR_TYPE"
AddressArray ( ) . FL_TYPE = FieldAlias
FieldAlias = TableName + ".FLOOR_PREFIX_1"
AddressArray ( ) . FL_PREFIX_1 = FieldAlias
FieldAlias = TableName + ".FLOOR_NO_1"
AddressArray ( ) . FL_NO_1 = FieldAlias
FieldAlias = TableName + ".FLOOR_SUFFIX_1"
AddressArray ( ) . FL_SUFF_1 = FieldAlias
FieldAlias = TableName + ".FLOOR_PREFIX_2"
AddressArray ( ) . FL_PREFIX_2 = FieldAlias
FieldAlias = TableName + ".FLOOR_NO_2"
AddressArray ( ) . FL_NO_2 = FieldAlias
FieldAlias = TableName + ".FLOOR_SUFFIX_2"
AddressArray ( ) . FL_SUFF_2 = FieldAlias
FieldAlias = TableName + ".BUILDING_NAME"
AddressArray ( ) . PR_NAME_1 = FieldAlias
FieldAlias = TableName + ".COMPLEX_NAME"
AddressArray ( ) . PR_NAME_2 = FieldAlias
FieldAlias = TableName + ".LOCATION_DESCRIPTOR"
AddressArray ( ) . LOC_DES = FieldAlias
FieldAlias = TableName + ".HOUSE_PREFIX_1"
AddressArray ( ) . HOUSE_PREFIX_1 = FieldAlias
FieldAlias = TableName + ".HOUSE_NUMBER_1"
AddressArray ( ) . HOUSE_NUMBER_1 = FieldAlias
FieldAlias = TableName + ".HOUSE_SUFFIX_1"
AddressArray ( ) . HOUSE_SUFFIX_1 = FieldAlias
FieldAlias = TableName + ".HOUSE_PREFIX_2"
AddressArray ( ) . HOUSE_PREFIX_2 = FieldAlias
FieldAlias = TableName + ".HOUSE_NUMBER_2"
AddressArray ( ) . HOUSE_NUMBER_2 = FieldAlias
FieldAlias = TableName + ".HOUSE_SUFFIX_2"
AddressArray ( ) . HOUSE_SUFFIX_2 = FieldAlias
FieldAlias = TableName + ".STREET_NAME"
AddressArray ( ) . STREET_NAME = FieldAlias
FieldAlias = TableName + ".STREET_TYPE"
AddressArray ( ) . STREET_TYPE = FieldAlias
FieldAlias = TableName + ".STREET_SUFFIX"
AddressArray ( ) . STREET_SUFFIX = FieldAlias
FieldAlias = TableName + ".LOCALITY_NAME"
AddressArray ( ) . LOCALITY = FieldAlias
FieldAlias = TableName + ".IS_PRIMARY"
AddressArray ( ) . PRIMARY = FieldAlias
FieldAlias = TableName + ".DISTANCE_RELATED_FLAG"
AddressArray ( ) . DIST_RELATED_FLAG = FieldAlias
FieldAlias = TableName + ".OUTSIDE_PROPERTY"
AddressArray ( ) . OUTSIDE_PROPERTY = FieldAlias
end case
exit sub
Err:
resume next
end sub
'================================================================================
function AddressMatch ( InputAddress1 () as AddressCaptureForm , InputAddress2 () as AddressCaptureForm ) as logical
'================================================================================
dim MatchStatus as logical
MatchStatus = TRUE
'**** disabling this because I thinnk it would have flagged a mismatch seeing as the Rates value would be blank and the Vicmap value would be 'N'
'if InputAddress1().SU_HSA_FLAG <> InputAddress2().SU_HSA_FLAG then MatchStatus = FALSE end if
if InputAddress1().SU_HSA_UNIT_ID <> InputAddress2().SU_HSA_UNIT_ID then MatchStatus = FALSE end if
if left$(InputAddress1().SU_TYPE,1) <> left$(InputAddress2().SU_TYPE,1) then MatchStatus = FALSE end if
if InputAddress1().SU_PREFIX_1 <> InputAddress2().SU_PREFIX_1 then MatchStatus = FALSE end if
if InputAddress1().SU_NO_1 <> InputAddress2().SU_NO_1 then MatchStatus = FALSE end if
if InputAddress1().SU_SUFF_1 <> InputAddress2().SU_SUFF_1 then MatchStatus = FALSE end if
if InputAddress1().SU_PREFIX_2 <> InputAddress2().SU_PREFIX_2 then MatchStatus = FALSE end if
if InputAddress1().SU_NO_2 <> InputAddress2().SU_NO_2 then MatchStatus = FALSE end if
if InputAddress1().SU_SUFF_2 <> InputAddress2().SU_SUFF_2 then MatchStatus = FALSE end if
if left$(InputAddress1().FL_TYPE,1) <> left$(InputAddress2().FL_TYPE,1) then MatchStatus = FALSE end if
if InputAddress1().FL_PREFIX_1 <> InputAddress2().FL_PREFIX_1 then MatchStatus = FALSE end if
if InputAddress1().FL_NO_1 <> InputAddress2().FL_NO_1 then MatchStatus = FALSE end if
if InputAddress1().FL_SUFF_1 <> InputAddress2().FL_SUFF_1 then MatchStatus = FALSE end if
if InputAddress1().FL_PREFIX_2 <> InputAddress2().FL_PREFIX_2 then MatchStatus = FALSE end if
if InputAddress1().FL_NO_2 <> InputAddress2().FL_NO_2 then MatchStatus = FALSE end if
if InputAddress1().FL_SUFF_2 <> InputAddress2().FL_SUFF_2 then MatchStatus = FALSE end if
if InputAddress1().PR_NAME_1 <> InputAddress2().PR_NAME_1 then MatchStatus = FALSE end if
if InputAddress1().PR_NAME_2 <> InputAddress2().PR_NAME_2 then MatchStatus = FALSE end if
if InputAddress1().LOC_DES <> InputAddress2().LOC_DES then MatchStatus = FALSE end if
if InputAddress1().HOUSE_PREFIX_1 <> InputAddress2().HOUSE_PREFIX_1 then MatchStatus = FALSE end if
if InputAddress1().HOUSE_NUMBER_1 <> InputAddress2().HOUSE_NUMBER_1 then MatchStatus = FALSE end if
if InputAddress1().HOUSE_SUFFIX_1 <> InputAddress2().HOUSE_SUFFIX_1 then MatchStatus = FALSE end if
if InputAddress1().HOUSE_PREFIX_2 <> InputAddress2().HOUSE_PREFIX_2 then MatchStatus = FALSE end if
if InputAddress1().HOUSE_NUMBER_2 <> InputAddress2().HOUSE_NUMBER_2 then MatchStatus = FALSE end if
if InputAddress1().HOUSE_SUFFIX_2 <> InputAddress2().HOUSE_SUFFIX_2 then MatchStatus = FALSE end if
' if InputAddress1().DISPLAY_PREFIX_1 <> InputAddress2().DISPLAY_PREFIX_1 then MatchStatus = FALSE end if
' if InputAddress1().DISPLAY_NO_1 <> InputAddress2().DISPLAY_NO_1 then MatchStatus = FALSE end if
' if InputAddress1().DISPLAY_SUFFIX_1 <> InputAddress2().DISPLAY_SUFFIX_1 then MatchStatus = FALSE end if
' if InputAddress1().DISPLAY_PREFIX_2 <> InputAddress2().DISPLAY_PREFIX_2 then MatchStatus = FALSE end if
' if InputAddress1().DISPLAY_NO_2 <> InputAddress2().DISPLAY_NO_2 then MatchStatus = FALSE end if
' if InputAddress1().DISPLAY_SUFFIX_2 <> InputAddress2().DISPLAY_SUFFIX_2 then MatchStatus = FALSE end if
if InputAddress1().STREET_NAME <> InputAddress2().STREET_NAME then MatchStatus = FALSE end if
if InputAddress1().STREET_TYPE <> InputAddress2().STREET_TYPE then MatchStatus = FALSE end if
if InputAddress1().STREET_SUFFIX <> InputAddress2().STREET_SUFFIX then MatchStatus = FALSE end if
if InputAddress1().LOCALITY <> InputAddress2().LOCALITY and InputAddress2().LOCALITY <> "" then MatchStatus = FALSE end if
'PRIMARY
'if InputAddress1().PRIMARY = "Y" and not InputAddress2().PRIMARY = "Y" then MatchStatus = FALSE end if
'if not InputAddress1().PRIMARY = "Y" and InputAddress2().PRIMARY = "Y" then MatchStatus = FALSE end if
AddressMatch = MatchStatus
end function
'================================================================================
sub DisplayRecordSummary ( byval TableName as string , byval RowNum as integer )
'================================================================================
' this sub assumes that there are no number fields - only character and date
dim i as smallint
dim CurrentField as alias
Dim QueryStatement as string
onerror goto Err
QueryStatement = "select "
fetch rec RowNum from TableName
for i = 1 to TableInfo ( TableName , TAB_INFO_NCOLS )
CurrentField = TableName + ".COL" + i
if str$(CurrentField) not in ( "" ) or ColumnInfo ( TableName , "COL" + i , COL_INFO_NAME ) = "Comments" then
QueryStatement = QueryStatement + "COL" + i + ","
end if
next
if QueryStatement = "select " then
QueryStatement = "select * "
end if
QueryStatement = left$ ( QueryStatement , len ( QueryStatement ) - 1 ) + " from " + TableName + " where rowid = " + RowNum + " into EditSummary noselect"
run command QueryStatement
set window WIN_INFO
table EditSummary
rec 1
exit sub
Err:
note "Unable to display edit summary." + chr$(13) + "Please contact Groundtruth Mapping Systems."
end sub
'================================================================================
sub SearchMap
'================================================================================
'onerror goto Err
dim UserSelectedSearchMode as smallint
dim InitialOperator as string
dim UserEnteredSearchParameter as string
do case LastUserSelectedSearchMode
case 0,1,3,4,7 InitialOperator = " = "
case 2,5,6 InitialOperator = " like "
end case
StartSearch:
dialog
title "Search"
control PopUpMenu
ID 9876
title "Property Number;Property Address;Property PFI;Parcel CrefNo;Parcel Plan Number;Parcel SPI;Parcel PFI"
value LastUserSelectedSearchMode
into UserSelectedSearchMode
calling SearchMapInteractionHandler
control StaticText
ID 8765
title InitialOperator
control EditText
ID 9991
value LastUserEnteredSearchParameter
into UserEnteredSearchParameter
control OKButton
control CancelButton
if not CommandInfo ( CMD_INFO_DLG_OK ) then exit sub end if
LastUserSelectedSearchMode = UserSelectedSearchMode
LastUserEnteredSearchParameter = UserEnteredSearchParameter
if not TablesOpened then
call OpenTables
end if
do case UserSelectedSearchMode
case 1
select * from VicmapPropertyTable where PROP_PROPNUM = UserEnteredSearchParameter and PROP_LGA_CODE = LGACode into CommonGroundSearchQuery
case 2
select PROP_PFI, PROP_PROPNUM, EZI_ADDRESS, IS_PRIMARY, ADDRESS_CLASS, DISTANCE_RELATED_FLAG, OUTSIDE_PROPERTY, LOCATION_DESCRIPTOR, val(HOUSE_NUMBER_1) "HOUSE_NUM"
from VicmapPropertyTable, VicmapAddressTable
where EZI_ADDRESS like "%" + UserEnteredSearchParameter + "%" and
UserEnteredSearchParameter <> "" and
PROP_PFI = PROPERTY_PFI
into CommonGroundSearchQuery
order by HOUSE_NUM
case 3
select * from VicmapPropertyTable where PROP_PFI = UserEnteredSearchParameter into CommonGroundSearchQuery
case 4
select * from VicmapParcelTable where PARCEL_CREFNO = UserEnteredSearchParameter into CommonGroundSearchQuery
case 5
'select * from VicmapParcelTable where PARCEL_PLAN_NUMBER like "%" + UserEnteredSearchParameter + "%" and UserEnteredSearchParameter <> "" order by PARCEL_PLAN_NUMBER, into CommonGroundSearchQuery
select PARCEL_PFI, PARCEL_SPI, PARCEL_CREFNO, PARCEL_STATUS, PARCEL_PLAN_NUMBER, PARCEL_LOT_NUMBER, PARCEL_SEC, PARCEL_CROWN_STATUS, PARCEL_P_NUMBER, PARCEL_FURTHER_DESCRIPTION, PARCEL_PART, PARCEL_PFI_CREATED, PARCEL_UFI_CREATED, val(PARCEL_LOT_NUMBER) "Lot_Num_Value"
from VicmapParcelTable
where UserEnteredSearchParameter <> "" and
( PARCEL_PLAN_NUMBER like "%" + UserEnteredSearchParameter + "%" or PARCEL_FURTHER_DESCRIPTION like "%" + UserEnteredSearchParameter + "%" )
order by PARCEL_PLAN_NUMBER, Lot_Num_Value
into CommonGroundSearchQuery
case 6
select * from VicmapParcelTable where PARCEL_SPI like "%" + UserEnteredSearchParameter + "%" and UserEnteredSearchParameter <> "" into CommonGroundSearchQuery
case 7
select * from VicmapParcelTable where PARCEL_PFI = UserEnteredSearchParameter into CommonGroundSearchQuery
end case
do case SelectionInfo ( SEL_INFO_NROWS )
case 0
'note "No records were selected."
'if Ask ( "No records were selected." + chr$(13) + chr$(13) + "Do you wish to search again?" , "Yes" , "No" ) then
if Ask ( "No records were selected." , "Search Again" , "Cancel" ) then
goto StartSearch
end if
case 1
'---- Try to prevent MI 7.5 from crashing at Glen Eira
if SystemInfo ( SYS_INFO_MIVERSION ) = 750 then
run menu command M_QUERY_FIND_SELECTION
exit sub
end if
call WinFocusChangedHandler
call ZoomToSelection ( CurrentMapWindow , 4 )
case else
'---- Try to prevent MI 7.5 from crashing at Glen Eira
if SystemInfo ( SYS_INFO_MIVERSION ) = 750 then
run menu command M_QUERY_FIND_SELECTION
exit sub
end if
call WinFocusChangedHandler
call ZoomToSelection ( CurrentMapWindow , 4 )
browse * from Selection
if CurrentMapWindow <> 0 then
call TileWindowsForAudit ( CurrentMapWindow , FrontWindow() , 6 )
end if
end case
exit sub
'Err:
' call LogEvent ( Error$() )
end sub
'================================================================================
sub SearchMapInteractionHandler
'================================================================================
alter control 9991 active
do case ReadControlValue ( 9876 )
case 1,3,4,7 alter control 8765 title " = "
case 2,5,6 alter control 8765 title " like "
end case
end sub
'================================================================================
function DoesMapContainLayer ( byval WindowNum as integer , byval LayerName as string ) as logical
'================================================================================
dim i as smallint
if WindowNum = 0 then
exit function
end if
if WindowInfo ( WindowNum , WIN_INFO_TYPE ) <> WIN_MAPPER then
exit function
end if
for i = 1 to MapperInfo ( WindowNum , MAPPER_INFO_LAYERS )
if LayerInfo ( WindowNum , i , LAYER_INFO_NAME ) = LayerName then
DoesMapContainLayer = TRUE
exit function
end if
next
end function
'=================================================================================
function TableEditedDate ( byval TableName as string ) as date
'=================================================================================
dim DATFileDate as date
dim MAPFileDate as date
if TableName not like "%\%" then
if IsTableOpen(TableName) then
TableName = TableInfo(TableName,19) ' (19 = TAB_INFO_TABFILE)
end if
else
if not FileExists(TableName) then
exit function
end if
end if
TableName = left$(TableName,len(TableName)-4)
DATFileDate = FileModifiedDate(TableName & ".DAT")
MAPFileDate = FileModifiedDate(TableName & ".MAP")
TableEditedDate = maximum(DATFileDate,MAPFileDate)
end function
'=================================================================================
function FileModifiedDate ( byval Filepath as string ) as date
'=================================================================================
dim hFile as integer ' handle to the opened file
dim ctime as FILETIME ' receives time of creation
dim atime as FILETIME ' receives time of last access
dim mtime as FILETIME ' receives time of last modification
dim thetime as SYSTEMTIME ' used to manipulate the time
dim retval as integer ' return value
dim a_sec as Security_Attributes 'required for the CreateFile function
if Filepath = "" then exit sub end if
hFile = CreateFile(Filepath, &H80000000, &H1, a_sec, 3, &H20, 0)
if hFile = -1 then exit sub end if
retval = GetFileTime(hFile, ctime, atime, mtime)
retval = FileTimeToLocalFileTime (mtime, mtime)
retval = FileTimeToSystemTime (mtime, thetime)
'**** Close the file to free up resources.
retval = CloseHandle(hFile)
FileModifiedDate = thetime.wYear &
string$(2 - len(str$(thetime.wMonth)),"0") & thetime.wMonth &
string$(2 - len(str$(thetime.wDay)),"0") & thetime.wDay
end function
'===========================================================================
function IsOBDCConnectionStillOpen ( byval ServerConnectionNumber as integer ) as logical
'===========================================================================
dim SomeString as string
onerror goto Err
'**** this statement will fail (and go to Err) if ServerConnectionNumber is not valid
SomeString = Server_ConnectInfo ( ServerConnectionNumber , SRV_CONNECT_INFO_DRIVER_NAME )
IsOBDCConnectionStillOpen = TRUE
exit sub
Err:
end function
'===========================================================================
function IsMapWindowOpen () as logical
'===========================================================================
dim i as smallint
for i = 1 to NumWindows()
if WindowInfo ( i, WIN_INFO_TYPE ) = WIN_MAPPER then
IsMapWindowOpen = TRUE
exit for
end if
next
end function
'===========================================================================
sub CloseNamedWindow ( byval WindowName as string)
'===========================================================================
dim i as smallint